Crate apisdk

Source
Expand description

A highlevel API client framework for Rust.

Re-exports§

pub use serde_json;
pub use quick_xml;

Modules§

digest
dns
DNS resolution
header
HTTP header types
multipart
multipart/form-data

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§

AccessTokenAuth
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 around reqwest::Client which runs middleware on every request.
ClientBuilder
A ClientBuilder can be used to create a Client with custom configuration.
CodeDataMessage
This struct is used to parse {code, data, message} payload.
DynamicForm
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.
HashedTokenAuth
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)
MockServer
This middleware is used to mock the response
MultipartForm
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 with run.
ParsedHashedToken
This struct is used to parse token
Request
A request which can be executed with Client::execute().
RequestBuilder
This is a wrapper around reqwest::RequestBuilder exposing the same API.
RequestId
This extension will set the X-Request-ID header
Response
A Response to a submitted Request.
SocketAddrs
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/or X-Span-ID header
Url
A parsed URL record.
Xml
This struct is used to parse response body to xml

Enums§

AccessToken
This enum holds access_token, which used to sign request
ApiError
Api Error
Carrier
This enum represents the position of request to carry token.
HashAlgorithm
Hash algorithm
LevelFilter
Re-export log::LevelFilter An enum representing the available verbosity level filters of the logger.
MiddlewareError
MimeType
MimeType (aka. ContentType)
ResponseBody
This enum represents the payload of respones
TokenError
Token Error

Traits§

ApiAuthenticator
This trait is used to authenticate request
DnsResolver
This trait is used to performing DNS queries
FormLike
This trait provides form related functions
Initialiser
When attached to a ClientWithMiddleware (generally using with_init), it is run whenever the client starts building a request, in the order it was attached.
IntoFilter
This trait is used to create LevelFilter
IntoUrl
A trait to try to convert some type into a Url.
JsonExtractor
This trait is used to extract result from response.
Middleware
When attached to a ClientWithMiddleware (generally using with), middleware is run whenever the client issues a request, in the order it was attached.
MultipartFormOps
Provides functions to update multipart form
Responder
Reply a response to request. It should be used with MockServer.
TokenGenerator
This trait is used to generate token
UrlOps
This trait provides URL related functions
UrlRewriter
This trait is used to rewrite base_url
WithCarrier
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
WholePayload
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