# NOTE: This file is auto generated by OpenAPI Generator 6.4.0 (https://openapi-generator.tech). # Do not edit this file manually. defmodule DocuSign.Api.EnvelopeTemplates do @moduledoc """ API calls for all endpoints tagged `EnvelopeTemplates`. """ alias DocuSign.Connection import DocuSign.RequestBuilder @doc """ Deletes a template from a document in an existing envelope. Deletes the specified template from a document in an existing envelope. ### Parameters - `connection` (DocuSign.Connection): Connection to server - `account_id` (String.t): The external account number (int) or account ID GUID. - `document_id` (String.t): The unique ID of the document within the envelope. Unlike other IDs in the eSignature API, you specify the `documentId` yourself. Typically the first document has the ID `1`, the second document `2`, and so on, but you can use any numbering scheme that fits within a 32-bit signed integer (1 through 2147483647). Tab objects have a `documentId` property that specifies the document on which to place the tab. - `envelope_id` (String.t): The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec` - `template_id` (String.t): The ID of the template. - `opts` (keyword): Optional parameters ### Returns - `{:ok, nil}` on success - `{:error, Tesla.Env.t}` on failure """ @spec templates_delete_document_templates( Tesla.Env.client(), String.t(), String.t(), String.t(), String.t(), keyword() ) :: {:ok, nil} | {:ok, DocuSign.Model.ErrorDetails.t()} | {:error, Tesla.Env.t()} def templates_delete_document_templates( connection, account_id, document_id, envelope_id, template_id, _opts \\ [] ) do request = %{} |> method(:delete) |> url( "/v2.1/accounts/#{account_id}/envelopes/#{envelope_id}/documents/#{document_id}/templates/#{template_id}" ) |> Enum.into([]) connection |> Connection.request(request) |> evaluate_response([ {200, false}, {400, %DocuSign.Model.ErrorDetails{}} ]) end @doc """ Gets the templates associated with a document in an existing envelope. Retrieves the templates associated with a document in the specified envelope. ### Parameters - `connection` (DocuSign.Connection): Connection to server - `account_id` (String.t): The external account number (int) or account ID GUID. - `document_id` (String.t): The unique ID of the document within the envelope. Unlike other IDs in the eSignature API, you specify the `documentId` yourself. Typically the first document has the ID `1`, the second document `2`, and so on, but you can use any numbering scheme that fits within a 32-bit signed integer (1 through 2147483647). Tab objects have a `documentId` property that specifies the document on which to place the tab. - `envelope_id` (String.t): The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec` - `opts` (keyword): Optional parameters - `:include` (String.t): A comma-separated list that limits the results. Valid values are: * `applied` * `matched` ### Returns - `{:ok, DocuSign.Model.TemplateInformation.t}` on success - `{:error, Tesla.Env.t}` on failure """ @spec templates_get_document_templates( Tesla.Env.client(), String.t(), String.t(), String.t(), keyword() ) :: {:ok, DocuSign.Model.ErrorDetails.t()} | {:ok, DocuSign.Model.TemplateInformation.t()} | {:error, Tesla.Env.t()} def templates_get_document_templates( connection, account_id, document_id, envelope_id, opts \\ [] ) do optional_params = %{ :include => :query } request = %{} |> method(:get) |> url( "/v2.1/accounts/#{account_id}/envelopes/#{envelope_id}/documents/#{document_id}/templates" ) |> add_optional_params(optional_params, opts) |> Enum.into([]) connection |> Connection.request(request) |> evaluate_response([ {200, %DocuSign.Model.TemplateInformation{}}, {400, %DocuSign.Model.ErrorDetails{}} ]) end @doc """ Get List of Templates used in an Envelope This returns a list of the server-side templates, their name and ID, used in an 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 - `:include` (String.t): The possible value is `matching_applied`, which returns template matching information for the template. ### Returns - `{:ok, DocuSign.Model.TemplateInformation.t}` on success - `{:error, Tesla.Env.t}` on failure """ @spec templates_get_envelope_templates(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, DocuSign.Model.ErrorDetails.t()} | {:ok, DocuSign.Model.TemplateInformation.t()} | {:error, Tesla.Env.t()} def templates_get_envelope_templates(connection, account_id, envelope_id, opts \\ []) do optional_params = %{ :include => :query } request = %{} |> method(:get) |> url("/v2.1/accounts/#{account_id}/envelopes/#{envelope_id}/templates") |> add_optional_params(optional_params, opts) |> Enum.into([]) connection |> Connection.request(request) |> evaluate_response([ {200, %DocuSign.Model.TemplateInformation{}}, {400, %DocuSign.Model.ErrorDetails{}} ]) end @doc """ Adds templates to a document in an envelope. Adds templates to a document in the specified envelope. ### Parameters - `connection` (DocuSign.Connection): Connection to server - `account_id` (String.t): The external account number (int) or account ID GUID. - `document_id` (String.t): The unique ID of the document within the envelope. Unlike other IDs in the eSignature API, you specify the `documentId` yourself. Typically the first document has the ID `1`, the second document `2`, and so on, but you can use any numbering scheme that fits within a 32-bit signed integer (1 through 2147483647). Tab objects have a `documentId` property that specifies the document on which to place the tab. - `envelope_id` (String.t): The envelope's GUID. Example: `93be49ab-xxxx-xxxx-xxxx-f752070d71ec` - `opts` (keyword): Optional parameters - `:preserve_template_recipient` (String.t): If omitted or set to false (the default), envelope recipients _will be removed_ if the template being applied includes only tabs positioned via anchor text for the recipient, and none of the documents include the anchor text. When **true,** the recipients _will be preserved_ after the template is applied. - `:body` (DocumentTemplateList): ### Returns - `{:ok, DocuSign.Model.DocumentTemplateList.t}` on success - `{:error, Tesla.Env.t}` on failure """ @spec templates_post_document_templates( Tesla.Env.client(), String.t(), String.t(), String.t(), keyword() ) :: {:ok, DocuSign.Model.DocumentTemplateList.t()} | {:ok, DocuSign.Model.ErrorDetails.t()} | {:error, Tesla.Env.t()} def templates_post_document_templates( connection, account_id, document_id, envelope_id, opts \\ [] ) do optional_params = %{ :preserve_template_recipient => :query, :body => :body } request = %{} |> method(:post) |> url( "/v2.1/accounts/#{account_id}/envelopes/#{envelope_id}/documents/#{document_id}/templates" ) |> add_optional_params(optional_params, opts) |> ensure_body() |> Enum.into([]) connection |> Connection.request(request) |> evaluate_response([ {201, %DocuSign.Model.DocumentTemplateList{}}, {400, %DocuSign.Model.ErrorDetails{}} ]) end @doc """ Adds templates to an envelope. Adds templates to the 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 - `:preserve_template_recipient` (String.t): If omitted or set to false (the default), envelope recipients _will be removed_ if the template being applied includes only tabs positioned via anchor text for the recipient, and none of the documents include the anchor text. When **true,** the recipients _will be preserved_ after the template is applied. - `:body` (DocumentTemplateList): ### Returns - `{:ok, DocuSign.Model.DocumentTemplateList.t}` on success - `{:error, Tesla.Env.t}` on failure """ @spec templates_post_envelope_templates(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, DocuSign.Model.DocumentTemplateList.t()} | {:ok, DocuSign.Model.ErrorDetails.t()} | {:error, Tesla.Env.t()} def templates_post_envelope_templates(connection, account_id, envelope_id, opts \\ []) do optional_params = %{ :preserve_template_recipient => :query, :body => :body } request = %{} |> method(:post) |> url("/v2.1/accounts/#{account_id}/envelopes/#{envelope_id}/templates") |> add_optional_params(optional_params, opts) |> ensure_body() |> Enum.into([]) connection |> Connection.request(request) |> evaluate_response([ {201, %DocuSign.Model.DocumentTemplateList{}}, {400, %DocuSign.Model.ErrorDetails{}} ]) end end