Bingex.HTTP.Request (Bingex v0.1.7)

Constructs and signs HTTP requests for the BingX API.

This module provides utilities for creating HTTP requests, adding authentication headers, and signing parameters when required. It also supports URL building with query parameters and timestamping to ensure request validity.

Summary

Types

body()

@type body() :: nil | binary()

headers()

@type headers() :: [{binary(), binary()}]

method()

@type method() :: :get | :put | :post | :delete

options()

@type options() :: [{:sign, nil | binary()}]

params()

@type params() :: [{binary(), term()}]

path()

@type path() :: binary()

t()

@type t() :: %Bingex.HTTP.Request{
  body: nil | binary(),
  headers: [{binary(), binary()}],
  method: method(),
  url: binary()
}

url()

@type url() :: binary()

Functions

auth_headers(headers \\ [], api_key)

@spec auth_headers(headers(), api_key :: binary()) :: headers()

build_url(path \\ "/", params \\ [], options \\ [])

@spec build_url(path(), params(), options()) :: url :: binary()

new(method, url, headers, body)

@spec new(method(), url(), headers(), body()) :: t()

set_recv_window(params, value \\ 5000)

@spec set_recv_window(params(), value :: non_neg_integer()) :: params()

set_signature(params, secret_key)

@spec set_signature(params(), secret_key :: binary()) :: params()

set_timestamp(params)

@spec set_timestamp(params()) :: params()