pub struct TorboxClient {
pub client: Client,
pub base_url: String,
/* private fields */
}Fields§
§client: ClientClient 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: StringImplementations§
Source§impl TorboxClient
impl TorboxClient
pub fn new(token: String) -> Self
pub fn with_base_url(&self, new_base: impl Into<String>) -> Self
pub fn token(&self) -> &str
pub async fn request_multipart<T: DeserializeOwned>( &self, method: Method, endpoint: &str, form: Form, ) -> Result<T, ApiError>
pub async fn request<T: DeserializeOwned + FromBytes>( &self, method: Method, endpoint: &str, ) -> Result<T, ApiError>
pub async fn request_with_json<T: DeserializeOwned, B: Serialize>( &self, method: Method, endpoint: &str, body: B, ) -> Result<T, ApiError>
pub async fn request_with_query<T: DeserializeOwned, Q: Serialize>( &self, method: Method, endpoint: &str, query: &Q, ) -> Result<T, ApiError>
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 moreAuto 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