DocuSign.RequestBuilder (DocuSign v3.2.0)
View SourceHelper functions for building Req requests
Summary
Functions
Add optional parameters to a request
Add non-optional parameters to a request
This function ensures that the body parameter is always set.
Handle the response for a Req request.
Specify the request method when building a request.
Specify the request url when building a request.
Functions
Add optional parameters to a request
Parameters
request(Map) - Collected request optionsdefinitions(Map) - Map of parameter name to parameter location.options(KeywordList) - The provided optional parameters
Special Parameters
:headers- A map of custom headers to add to the request. These will be merged with the default headers. This is useful for DocuSign-specific headers likeX-DocuSign-Editwhich are required for certain operations on locked envelopes.
Returns
Map
Examples
# Add custom headers for locked envelope operations
optional_params = %{body: :body}
opts = [
body: envelope_data,
headers: %{"X-DocuSign-Edit" => ~s({"LockToken": "abc123", "LockDurationInSeconds": "600"})}
]
add_optional_params(request, optional_params, opts)
Add non-optional parameters to a request
Parameters
request(Map) - Collected request optionslocation(atom) - Where to put the parameterkey(atom) - The name of the parametervalue(any) - The value of the parameter
Returns
Map
This function ensures that the body parameter is always set.
This handles cases where POST, PATCH and PUT requests require a body even when it's empty.
Parameters
request(Map) - Collected request options
Returns
Map
@spec evaluate_response({:ok, Req.Response.t()} | {:error, any()}, [ {integer(), any()} ]) :: {:ok, any()} | {:error, Req.Response.t()}
Handle the response for a Req request.
Parameters
response(Req.Response.t) - The response object
Returns
on success {:error, Req.Response.t} on failure
Specify the request method when building a request.
Does not override the method if one has already been specified.
Parameters
request(Map) - Collected request optionsmethod(atom) - Request method
Returns
Map
Specify the request url when building a request.
Does not override the url if one has already been specified.
Parameters
request(Map) - Collected request optionsurl(String) - Request URL
Returns
Map