pub trait ApiInterface: Send + Sync {
// Required methods
fn get_base_url(&self) -> String;
fn get_auth_info(&self, request: RequestBuilder) -> RequestBuilder;
// Provided methods
fn build_request<E: Display, HK: Into<HeaderName>, HV: Into<HeaderValue>, P: Serialize, B: Serialize>(
&self,
client: ClientWithMiddleware,
endpoint: E,
method: Method,
headers: HashMap<HK, HV>,
params: Option<P>,
body: Option<B>,
) -> Result<Request> { ... }
fn additional_modifications(
&self,
request: RequestBuilder,
) -> RequestBuilder { ... }
}Expand description
The public interface used to access any api. Should be implemented to provide specific details about how to make a given api call.
Required Methods§
Sourcefn get_base_url(&self) -> String
fn get_base_url(&self) -> String
The base url to use
Sourcefn get_auth_info(&self, request: RequestBuilder) -> RequestBuilder
fn get_auth_info(&self, request: RequestBuilder) -> RequestBuilder
How the interface authenticates
Provided Methods§
Sourcefn build_request<E: Display, HK: Into<HeaderName>, HV: Into<HeaderValue>, P: Serialize, B: Serialize>(
&self,
client: ClientWithMiddleware,
endpoint: E,
method: Method,
headers: HashMap<HK, HV>,
params: Option<P>,
body: Option<B>,
) -> Result<Request>
fn build_request<E: Display, HK: Into<HeaderName>, HV: Into<HeaderValue>, P: Serialize, B: Serialize>( &self, client: ClientWithMiddleware, endpoint: E, method: Method, headers: HashMap<HK, HV>, params: Option<P>, body: Option<B>, ) -> Result<Request>
Build a request based on the provided details. Provided, and should not be overridden except in very specific cases.
Sourcefn additional_modifications(&self, request: RequestBuilder) -> RequestBuilder
fn additional_modifications(&self, request: RequestBuilder) -> RequestBuilder
If any additional modifications need to be made to the request, this member can be overridden by impls. Otherwise, it returns the request unmodified
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".