View Source DocuSign.RequestBuilder (DocuSign v1.0.0)

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

Due to a bug in httpc, POST, PATCH and PUT requests will fail, if the body is empty

Specify the request method when building a request

Prune nils from map

Specify the request method when building a request

Link to this section Functions

Link to this function

add_optional_params(request, definitions, values)

View Source
@spec add_optional_params(map(), %{optional(atom()) => atom()}, keyword()) :: map()

Add optional parameters to the request

parameters

Parameters

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

returns

Returns

Map

Link to this function

add_param(request, location, key, value)

View Source
@spec add_param(map(), atom(), atom(), any()) :: map()

Add optional parameters to the request

parameters

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

Returns

Map

@spec decode(Tesla.Env.t() | term(), false | struct() | [struct()]) ::
  {:ok, struct()} | {:ok, Tesla.Env.t()} | {:error, any()}

Handle the response for a Tesla request

parameters

Parameters

  • arg1 (Tesla.Env.t | term) - The response object

  • arg2 (:false | struct | [struct]) - The shape of the struct to deserialize into

returns

Returns

on success {:error, term} on failure

@spec ensure_body(map()) :: map()

Due to a bug in httpc, POST, PATCH and PUT requests will fail, if the body is empty

This function will ensure, that the body param is always set

parameters

Parameters

  • request (Map) - Collected request options

returns

Returns

Map

Link to this function

evaluate_response(env, mapping)

View Source
@spec method(map(), atom()) :: map()

Specify the request method when building a request

parameters

Parameters

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

returns

Returns

Map

@spec prune_nils(map()) :: map()

Prune nils from map

parameters

Parameters

  • map (Map) - Input Map

returns

Returns

Map

Link to this function

resolve_mapping(env, mapping, default \\ nil)

View Source
@spec url(map(), String.t()) :: map()

Specify the request method when building a request

parameters

Parameters

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

returns

Returns

Map