pub struct TorboxClient {
pub client: Client,
pub base_url: String,
/* private fields */
}
Fields§
§client: Client
Client can be specta skipped because TorboxClient should NEVER be used in any frontend, type is only used to be able to derive the APIs built from it.
base_url: String
Implementations§
Source§impl TorboxClient
impl TorboxClient
pub fn new(token: String) -> TorboxClient
pub fn with_base_url(&self, new_base: impl Into<String>) -> TorboxClient
pub fn token(&self) -> &str
pub async fn request_multipart<T>(
&self,
method: Method,
endpoint: &str,
form: Form,
) -> Result<T, ApiError>where
T: DeserializeOwned,
pub async fn request<T>(
&self,
method: Method,
endpoint: &str,
) -> Result<T, ApiError>where
T: DeserializeOwned + FromBytes,
pub async fn request_with_json<T, B>(
&self,
method: Method,
endpoint: &str,
body: B,
) -> Result<T, ApiError>where
T: DeserializeOwned,
B: Serialize,
pub async fn request_with_query<T, Q>(
&self,
method: Method,
endpoint: &str,
query: &Q,
) -> Result<T, ApiError>where
T: DeserializeOwned,
Q: Serialize,
Trait Implementations§
Source§impl Clone for TorboxClient
impl Clone for TorboxClient
Source§fn clone(&self) -> TorboxClient
fn clone(&self) -> TorboxClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl NamedType for TorboxClient
impl NamedType for TorboxClient
fn sid() -> SpectaID
Source§fn named_data_type(
type_map: &mut TypeCollection,
generics: &[DataType],
) -> NamedDataType
fn named_data_type( type_map: &mut TypeCollection, generics: &[DataType], ) -> NamedDataType
this is equivalent to Type::inline but returns a NamedDataType instead.
Source§fn definition_named_data_type(type_map: &mut TypeCollection) -> NamedDataType
fn definition_named_data_type(type_map: &mut TypeCollection) -> NamedDataType
this is equivalent to [Type::definition] but returns a NamedDataType instead.
Source§impl Type for TorboxClient
impl Type for TorboxClient
Source§fn inline(type_map: &mut TypeCollection, generics: Generics<'_>) -> DataType
fn inline(type_map: &mut TypeCollection, generics: Generics<'_>) -> DataType
Returns the definition of a type using the provided generics. Read more
Source§fn reference(type_map: &mut TypeCollection, generics: &[DataType]) -> Reference
fn reference(type_map: &mut TypeCollection, generics: &[DataType]) -> Reference
Generates a datatype corresponding to a reference to this type,
as determined by its category. Getting a reference to a type implies that
it should belong in the type map (since it has to be referenced from somewhere),
so the output of
definition
will be put into the type map.impl Flatten for TorboxClient
Auto Trait Implementations§
impl Freeze for TorboxClient
impl !RefUnwindSafe for TorboxClient
impl Send for TorboxClient
impl Sync for TorboxClient
impl Unpin for TorboxClient
impl !UnwindSafe for TorboxClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more