Thinkific.RequestBuilder (Thinkific API SDK v0.1.3)

Helper functions for building Tesla requests

Link to this section Summary

Functions

Add optional parameters to the request

Add optional parameters to the request

Handle the response for a Tesla request

Specify the request method when building a request

Specify the request method when building a request

Link to this section Functions

Link to this function

add_optional_params(request, definitions, list)

Specs

add_optional_params(map(), %{optional(atom()) => atom()}, keyword()) :: map()

Add optional parameters to the request

Parameters

  • request (Map) - Collected request options
  • definitions (Map) - Map of parameter name to parameter location.
  • options (KeywordList) - The provided optional parameters

Returns

Map

Link to this function

add_param(request, location, key, value)

Specs

add_param(map(), atom(), atom(), any()) :: map()

Add optional parameters to the request

Parameters

  • request (Map) - Collected request options
  • location (atom) - Where to put the parameter
  • key (atom) - The name of the parameter
  • value (any) - The value of the parameter

Returns

Map

Specs

decode({atom(), Tesla.Env.t()} | term()) ::
  {:ok, struct()} | {:error, Tesla.Env.t()} | {:error, term()}

Handle the response for a Tesla request

Parameters

  • arg1 ({atom, Tesla.Env.t} | term) - The :ok or :error atom with response object
  • arg2 (:false | struct | [struct]) - The shape of the struct to deserialize into

Returns

on success {:error, term} on failure

Link to this function

decode(arg, struct)

Specs

decode({atom(), Tesla.Env.t()} | term(), false | struct() | [struct()]) ::
  {:ok, struct()} | {:error, Tesla.Env.t()} | {:error, term()}
Link to this function

method(request, m)

Specs

method(map(), atom()) :: map()

Specify the request method when building a request

Parameters

  • request (Map) - Collected request options
  • m (atom) - Request method

Returns

Map

Link to this function

url(request, u)

Specs

url(map(), String.t()) :: map()

Specify the request method when building a request

Parameters

  • request (Map) - Collected request options
  • u (String) - Request URL

Returns

Map