pub struct Client {
pub auth_key: String,
/* private fields */
}
Fields§
§auth_key: String
Implementations§
Source§impl Client
Represents an HTTP client which holds the user’s API auth key, and is required on every fetch
method for authentication. This is usually the starting point for using this library.
impl Client
Represents an HTTP client which holds the user’s API auth key, and is required on every fetch method for authentication. This is usually the starting point for using this library.
See the Client::new
method to start.
Sourcepub fn new(auth_key: &str) -> Client
pub fn new(auth_key: &str) -> Client
Creates a new Client with a given API auth key.
§Examples
use brawl_api::Client;
let my_client = Client::new("my auth key");
Sourcepub fn inner(&self) -> &ReqClient
pub fn inner(&self) -> &ReqClient
(For sync usage) Provides an immutable reference to the inner
field.
Sourcepub fn inner_mut(&mut self) -> &mut ReqClient
pub fn inner_mut(&mut self) -> &mut ReqClient
(For sync usage) Provides a mutable reference to the inner
field.
Sourcepub fn a_inner(&self) -> &AReqClient
pub fn a_inner(&self) -> &AReqClient
(For async usage) Provides an immutable reference to the a_inner
field.
Sourcepub fn a_inner_mut(&mut self) -> &mut AReqClient
pub fn a_inner_mut(&mut self) -> &mut AReqClient
(For async usage) Provides a mutable reference to the a_inner
field.
Sourcepub fn endpoint_request(&self, endpoint: &str) -> Request<'_>
pub fn endpoint_request(&self, endpoint: &str) -> Request<'_>
Creates a Request instance for one specific endpoint and returns it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FetchFrom<T> for T
impl<T> FetchFrom<T> for T
Source§fn fetch_from(_: &Client, t: &T) -> Result<T, Error>
fn fetch_from(_: &Client, t: &T) -> Result<T, Error>
(Sync) Returns a copy of the current instance when attempting to fetch from itself.
In order to re-fetch, see Refetchable
.
§Errors
Never errors; is only a Result
in order to match the trait signature.
Source§fn a_fetch_from<'life0, 'life1, 'async_trait>(
_: &'life0 Client,
t: &'life1 T,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn a_fetch_from<'life0, 'life1, 'async_trait>(
_: &'life0 Client,
t: &'life1 T,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
(Async) Returns a copy of the current instance when attempting to fetch from itself.
In order to re-fetch, see Refetchable
.
§Errors
Never errors; is only a Result
in order to match the trait signature.