pub struct API { /* private fields */ }
Expand description
Base API definition
Implementations§
source§impl API
impl API
Base API implementation
sourcepub fn with_url_token(url: &str, token: &str) -> API
pub fn with_url_token(url: &str, token: &str) -> API
sourcepub async fn get(&self, method: &str, params: &[(&str, &str)]) -> APIResponse
pub async fn get(&self, method: &str, params: &[(&str, &str)]) -> APIResponse
Executes a GET request. Returns Response.
§Arguments
method
- API methodparams
- List of (name, value) tuples to use as query parameters
sourcepub async fn post(&self, method: &str, json: &Value) -> APIResponse
pub async fn post(&self, method: &str, json: &Value) -> APIResponse
Executes a POST request. Returns Response.
§Arguments
method
- API methodjson
- Value object with post body
sourcepub fn headers(&self, request: RequestBuilder) -> RequestBuilder
pub fn headers(&self, request: RequestBuilder) -> RequestBuilder
Sets headers on a request.
§Arguments
Auto Trait Implementations§
impl Freeze for API
impl RefUnwindSafe for API
impl Send for API
impl Sync for API
impl Unpin for API
impl UnwindSafe for API
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