Current section

Files

Jump to
docusign lib docusign api envelope_attachments.ex
Raw

lib/docusign/api/envelope_attachments.ex

# NOTE: This file is auto generated by OpenAPI Generator 6.2.1 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule DocuSign.Api.EnvelopeAttachments do
@moduledoc """
API calls for all endpoints tagged `EnvelopeAttachments`.
"""
alias DocuSign.Connection
import DocuSign.RequestBuilder
@doc """
Deletes one or more attachments from a draft envelope.
Deletes one or more attachments from a draft envelope.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `envelope_id` (String.t): The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec`
- `opts` (keyword): Optional parameters
- `:body` (EnvelopeAttachmentsRequest):
### Returns
- `{:ok, DocuSign.Model.EnvelopeAttachmentsResult.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec attachments_delete_attachments(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
{:ok, DocuSign.Model.EnvelopeAttachmentsResult.t()}
| {:ok, DocuSign.Model.ErrorDetails.t()}
| {:error, Tesla.Env.t()}
def attachments_delete_attachments(connection, account_id, envelope_id, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:delete)
|> url("/v2.1/accounts/#{account_id}/envelopes/#{envelope_id}/attachments")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %DocuSign.Model.EnvelopeAttachmentsResult{}},
{400, %DocuSign.Model.ErrorDetails{}}
])
end
@doc """
Retrieves an attachment from an envelope.
Retrieves an attachment from an envelope.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `attachment_id` (String.t): The unique identifier for the attachment.
- `envelope_id` (String.t): The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec`
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec attachments_get_attachment(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword()
) :: {:ok, nil} | {:ok, DocuSign.Model.ErrorDetails.t()} | {:error, Tesla.Env.t()}
def attachments_get_attachment(connection, account_id, attachment_id, envelope_id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v2.1/accounts/#{account_id}/envelopes/#{envelope_id}/attachments/#{attachment_id}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{400, %DocuSign.Model.ErrorDetails{}}
])
end
@doc """
Returns a list of attachments associated with a specified envelope
Returns a list of attachments associated with a specified envelope.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `envelope_id` (String.t): The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec`
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, DocuSign.Model.EnvelopeAttachmentsResult.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec attachments_get_attachments(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
{:ok, DocuSign.Model.EnvelopeAttachmentsResult.t()}
| {:ok, DocuSign.Model.ErrorDetails.t()}
| {:error, Tesla.Env.t()}
def attachments_get_attachments(connection, account_id, envelope_id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v2.1/accounts/#{account_id}/envelopes/#{envelope_id}/attachments")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %DocuSign.Model.EnvelopeAttachmentsResult{}},
{400, %DocuSign.Model.ErrorDetails{}}
])
end
@doc """
Adds an attachment to a draft or in-process envelope.
Adds an attachment to a draft or in-process envelope.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `attachment_id` (String.t): The unique identifier for the attachment.
- `envelope_id` (String.t): The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec`
- `opts` (keyword): Optional parameters
- `:body` (Attachment):
### Returns
- `{:ok, DocuSign.Model.EnvelopeAttachmentsResult.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec attachments_put_attachment(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword()
) ::
{:ok, DocuSign.Model.EnvelopeAttachmentsResult.t()}
| {:ok, DocuSign.Model.ErrorDetails.t()}
| {:error, Tesla.Env.t()}
def attachments_put_attachment(connection, account_id, attachment_id, envelope_id, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:put)
|> url("/v2.1/accounts/#{account_id}/envelopes/#{envelope_id}/attachments/#{attachment_id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %DocuSign.Model.EnvelopeAttachmentsResult{}},
{400, %DocuSign.Model.ErrorDetails{}}
])
end
@doc """
Adds one or more attachments to a draft or in-process envelope.
Adds one or more attachments to a draft or in-process envelope. Envelope attachments are files that an application can include in an envelope. They are not converted to PDF. Envelope attachments are available only through the API. There is no user interface in the DocuSign web application for them. For a list of supported file formats, see [Supported File Formats](https://support.docusign.com/guides/ndse-user-guide-supported-file-formats).
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `envelope_id` (String.t): The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec`
- `opts` (keyword): Optional parameters
- `:body` (EnvelopeAttachmentsRequest):
### Returns
- `{:ok, DocuSign.Model.EnvelopeAttachmentsResult.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec attachments_put_attachments(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
{:ok, DocuSign.Model.EnvelopeAttachmentsResult.t()}
| {:ok, DocuSign.Model.ErrorDetails.t()}
| {:error, Tesla.Env.t()}
def attachments_put_attachments(connection, account_id, envelope_id, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:put)
|> url("/v2.1/accounts/#{account_id}/envelopes/#{envelope_id}/attachments")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %DocuSign.Model.EnvelopeAttachmentsResult{}},
{400, %DocuSign.Model.ErrorDetails{}}
])
end
end