View Source CozyAliyunOpenAPI.HTTPClient behaviour (cozy_aliyun_open_api v0.2.0)
The specification for a HTTP client.
It can be set to a client provided by CozyAliyunOpenAPI
, such as:
config :cozy_aliyun_open_api,
http_client: CozyAliyunOpenAPI.HTTPClient.Finch
Or, set it to your own API client, such as:
config :cozy_aliyun_open_api,
http_client: MyHTTPClient
Summary
Functions
Issues an HTTP request by the given HTTP client.
Types
Callbacks
@callback init() :: :ok
Callback to initialize the given API client.
@callback request(CozyAliyunOpenAPI.HTTPRequest.t()) :: response()
Callback to send a request.
Functions
@spec request(CozyAliyunOpenAPI.HTTPRequest.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.