Expand description
A highlevel API client framework for Rust.
Re-exports§
pub use serde_json;
pub use quick_xml;
Modules§
Macros§
- send
- Send request
- send_
form - Send the payload as form
- send_
json - Send the payload as JSON
- send_
multipart - Send the payload as multipart form
- send_
raw - Send and get raw response
- send_
xml - Send the payload as XML, which will be serialized by quick_xml
Structs§
- Access
Token Auth - This struct is used to sign request by using
access_token
- ApiBuilder
- This struct is used to build an instance of ApiCore
- ApiCore
- This struct is used to create HTTP request
- Auto
- This struct is used to parse response body to json or xml
- Body
- This struct is used to parse response body to xml
- Client
ClientWithMiddleware
is a wrapper aroundreqwest::Client
which runs middleware on every request.- Client
Builder - A
ClientBuilder
can be used to create aClient
with custom configuration. - Code
Data Message - This struct is used to parse
{code, data, message}
payload. - Dynamic
Form - The DynamicForm is mixin of urlencoded form and multipart form
- Extension
- A middleware that inserts the value into the
Extensions
during the call. - Extensions
- A type map of protocol extensions.
- Hashed
Token Auth - This struct is used to sign request by hashed token.
- Json
- This struct is used to parse response body to json
- LogConfig
- This struct is used to control how to log. It could be injected into request as an extension.
- Method
- The Request Method (VERB)
- Mock
Server - This middleware is used to mock the response
- Multipart
Form - This struct wraps
reqwest::multipart::Form
- Next
- Next encapsulates the remaining middleware chain to run in
Middleware::handle
. You can forward the request down the chain withrun
. - Parsed
Hashed Token - This struct is used to parse token
- Request
- A request which can be executed with
Client::execute()
. - Request
Builder - This is a wrapper around
reqwest::RequestBuilder
exposing the same API. - Request
Id - This extension will set the
X-Request-ID
header - Response
- A Response to a submitted
Request
. - Socket
Addrs - This struct is used to provides many SocketAddrs
- Text
- This struct is used to parse response body to text
- TraceId
- This extension will set the
X-Trace-ID
and/orX-Span-ID
header - Url
- A parsed URL record.
- Xml
- This struct is used to parse response body to xml
Enums§
- Access
Token - This enum holds
access_token
, which used to sign request - ApiError
- Api Error
- Carrier
- This enum represents the position of request to carry token.
- Hash
Algorithm - Hash algorithm
- Level
Filter - Re-export log::LevelFilter An enum representing the available verbosity level filters of the logger.
- Middleware
Error - Mime
Type - MimeType (aka. ContentType)
- Response
Body - This enum represents the payload of respones
- Token
Error - Token Error
Traits§
- ApiAuthenticator
- This trait is used to authenticate request
- DnsResolver
- This trait is used to performing DNS queries
- Form
Like - This trait provides form related functions
- Initialiser
- When attached to a
ClientWithMiddleware
(generally usingwith_init
), it is run whenever the client starts building a request, in the order it was attached. - Into
Filter - This trait is used to create
LevelFilter
- IntoUrl
- A trait to try to convert some type into a
Url
. - Json
Extractor - This trait is used to extract result from response.
- Middleware
- When attached to a
ClientWithMiddleware
(generally usingwith
), middleware is run whenever the client issues a request, in the order it was attached. - Multipart
Form Ops - Provides functions to update multipart form
- Responder
- Reply a response to request. It should be used with MockServer.
- Token
Generator - This trait is used to generate token
- UrlOps
- This trait provides URL related functions
- UrlRewriter
- This trait is used to rewrite base_url
- With
Carrier - This trait is used to update carrier
Functions§
- init_
default_ log_ level - Set the log level as global default
Type Aliases§
- ApiResult
- An alias of Result<T, ApiError
- Whole
Payload - This extractor will treat whole payload as result
Attribute Macros§
- api_
method - Refine a method of HTTP api
- async_
trait - http_
api - Declare a HTTP api with base_url