Mercadopago.HTTP (mercadopago_sdk_elixir v0.2.0)

Copy Markdown View Source

Req-based HTTP transport. Retries GET on transient errors; no retry for mutating verbs.

All functions accept per-call opts overriding the client configuration:

  • :access_token - token for this request only
  • :custom_headers - headers merged over the client's custom_headers, overriding generated headers case-insensitively
  • :timeout - receive timeout in milliseconds for this request only
  • :max_retries - GET retry budget for this request only

Summary

Types

Result of an API call. {:ok, ...} carries the HTTP status and the parsed JSON body (a map, a list, or nil for empty bodies). {:error, reason} is returned for transport-level failures (timeouts, connection errors).

Functions

GET request with optional query params and per-call opts.

POST request. Omit body or pass nil to send no body.

Types

response()

@type response() ::
  {:ok, %{status: non_neg_integer(), response: map() | list() | nil}}
  | {:error, term()}

Result of an API call. {:ok, ...} carries the HTTP status and the parsed JSON body (a map, a list, or nil for empty bodies). {:error, reason} is returned for transport-level failures (timeouts, connection errors).

Functions

delete(client, uri, opts \\ [])

@spec delete(Mercadopago.Client.t(), String.t(), keyword()) :: response()

DELETE request.

get(client, uri, params \\ nil, opts \\ [])

@spec get(Mercadopago.Client.t(), String.t(), map() | nil, keyword()) :: response()

GET request with optional query params and per-call opts.

post(client, uri, body, opts \\ [])

@spec post(Mercadopago.Client.t(), String.t(), map() | nil, keyword()) :: response()

POST request. Omit body or pass nil to send no body.

put(client, uri, body, opts \\ [])

@spec put(Mercadopago.Client.t(), String.t(), map() | nil, keyword()) :: response()

PUT request.