View Source CozyOSS.ApiClient behaviour (cozy_oss v0.2.0)
Specification for a CozyOSS API client.
It can be set to a client provided by CozyOSS, such as:
config :cozy_oss, :api_client, CozyOSS.ApiClient.Finch
Or, set it to your own API client, such as:
config :cozy_oss, :api_client, MyApiClient
Link to this section Summary
Functions
Send a struct %CozyOSS.ApiRequest{}
as an HTTP request by the given API client.
Link to this section Types
Link to this section Callbacks
@callback init() :: :ok
Callback to initialize the given API client.
@callback request(CozyOSS.ApiRequest.t()) :: response()
Callback to send a request.
Link to this section Functions
@spec request(CozyOSS.ApiRequest.t()) :: response()
Send a struct %CozyOSS.ApiRequest{}
as an HTTP request by the given API client.
When the Content-Type
header of the response is "application/xml"
, this function will try to convert
the XML content to a map with snaked-cased keys.