Shared helpers for dependency-free platform API clients.
Summary
Functions
Decodes a raw HTTP client response, preserving the original response fields.
Sends a request and decodes a JSON response body.
Types
Functions
@spec decode_response(GelotvBot.HTTPClient.response()) :: {:ok, map()} | {:error, term()}
Decodes a raw HTTP client response, preserving the original response fields.
@spec request(atom(), String.t(), keyword()) :: GelotvBot.HTTPClient.response()
Sends a request and decodes a JSON response body.
The returned response keeps the original :body and adds :decoded_body.
Non-2xx HTTP responses are returned as {:error, {:http_error, status, body}}.