pub struct ApiCore { /* private fields */ }
Expand description
This struct is used to create HTTP request
Implementations§
source§impl ApiCore
impl ApiCore
sourcepub fn rebase(&self, base_url: impl IntoUrl) -> ApiResult<Self>
pub fn rebase(&self, base_url: impl IntoUrl) -> ApiResult<Self>
Create a new ApiCore with a different base_url
sourcepub fn with_rewriter<T>(&self, rewriter: T) -> Selfwhere
T: UrlRewriter,
pub fn with_rewriter<T>(&self, rewriter: T) -> Selfwhere
T: UrlRewriter,
Set the UrlRewriter
- resolver: UrlRewriter
sourcepub fn with_resolver<T>(&self, resolver: T) -> Selfwhere
T: DnsResolver,
pub fn with_resolver<T>(&self, resolver: T) -> Selfwhere
T: DnsResolver,
Set the DnsResolver
- resolver: DnsResolver
sourcepub fn with_endpoint<T>(&self, endpoint: T) -> Selfwhere
T: Into<SocketAddr>,
pub fn with_endpoint<T>(&self, endpoint: T) -> Selfwhere
T: Into<SocketAddr>,
Set rewriter to use endpoint
- endpoint: SocketAddr
sourcepub fn with_authenticator<T>(&self, authenticator: T) -> Selfwhere
T: ApiAuthenticator,
pub fn with_authenticator<T>(&self, authenticator: T) -> Selfwhere
T: ApiAuthenticator,
Set the Authenticator
- authenticator: ApiAuthenticator
sourcepub async fn build_url(&self, path: impl AsRef<str>) -> ApiResult<Url>
pub async fn build_url(&self, path: impl AsRef<str>) -> ApiResult<Url>
Build a new request url
- path: relative path to base_url
Return error when failed to retrieve valid endpoint from ApiRouter
sourcepub async fn build_request(
&self,
method: Method,
path: impl AsRef<str>
) -> ApiResult<RequestBuilder>
pub async fn build_request( &self, method: Method, path: impl AsRef<str> ) -> ApiResult<RequestBuilder>
Build a new HTTP request
- method: HTTP method
- path: relative path to base_url
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ApiCore
impl Send for ApiCore
impl Sync for ApiCore
impl Unpin for ApiCore
impl !UnwindSafe for ApiCore
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