View Source AliyunOpenAPI.HTTP.Client behaviour (aliyun_open_api v0.6.0)
The specification for a HTTP client.
It can be set to a client provided by AliyunOpenAPI
, such as:
config :aliyun_open_api,
http_client: AliyunOpenAPI.HTTP.Client.Finch
Or, set it to your own API client, such as:
config :aliyun_open_api,
http_client: MyHTTP.Client
Summary
Functions
Issues an HTTP request by the given HTTP client.
Types
@type body() :: binary()
@type response() :: {:ok, AliyunOpenAPI.HTTP.Response.t()} | {:error, term()}
The response of a request.
@type status() :: pos_integer()
Callbacks
@callback init() :: :ok
Callback to initialize the given API client.
@callback request(AliyunOpenAPI.HTTP.Request.t()) :: response()
Callback to send a request.
Functions
@spec request(AliyunOpenAPI.HTTP.Request.t()) :: response()
Issues an HTTP request by the given HTTP client.
When the content-type
header of the response is "application/xml"
or
"text/xml"
, this function will try to convert the XML body to a map
with snaked-cased keys.
When the content-type
header of the response is "application/json"
,
this function will try to convert the body to a map with snaked-cased
keys.