pub struct Client { /* private fields */ }
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(apikey: impl Into<String>) -> Client
pub fn new(apikey: impl Into<String>) -> Client
Creates a new client pointed to https://api.opennode.co
Sourcepub fn from_url(host: impl Into<String>, apikey: impl Into<String>) -> Client
pub fn from_url(host: impl Into<String>, apikey: impl Into<String>) -> Client
Creates a new client posted to a custom host.
pub fn with_api_key(self, apikey: impl Into<String>) -> Client
pub fn with_host(self, host: impl Into<String>) -> Client
pub async fn get<S, T>(&self, path: &str, params: Option<S>) -> Result<T, Error>
pub async fn post<P, T>(
&self,
path: &str,
payload: Option<P>,
) -> Result<T, Error>where
P: Serialize,
T: DeserializeOwned,
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
Mutably borrows from an owned value. Read more