# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule Docspring.Api.PDF do
@moduledoc """
API calls for all endpoints tagged `PDF`.
"""
alias Docspring.Connection
import Docspring.RequestBuilder
@doc """
Add new fields to a Template
## Parameters
- connection (Docspring.Connection): Connection to server
- template_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :add_fields_data (AddFieldsData):
## Returns
{:ok, %Docspring.Model.AddFieldsTemplateResponse{}} on success
{:error, info} on failure
"""
@spec add_fields_to_template(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.AddFieldsTemplateResponse.t} | {:error, Tesla.Env.t}
def add_fields_to_template(connection, template_id, opts \\ []) do
optional_params = %{
:"AddFieldsData" => :body
}
%{}
|> method(:put)
|> url("/templates/#{template_id}/add_fields")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.AddFieldsTemplateResponse{})
end
@doc """
Generates multiple PDFs
## Parameters
- connection (Docspring.Connection): Connection to server
- template_id (String.t):
- object ([Object]):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, [%CreateSubmissionResponse{}, ...]} on success
{:error, info} on failure
"""
@spec batch_generate_pdf_v1(Tesla.Env.client, String.t, list(Docspring.Model.Object.t), keyword()) :: {:ok, list(Docspring.Model.CreateSubmissionResponse.t)} | {:error, Tesla.Env.t}
def batch_generate_pdf_v1(connection, template_id, object, _opts \\ []) do
%{}
|> method(:post)
|> url("/templates/#{template_id}/submissions/batch")
|> add_param(:body, :"Object", object)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode([%Docspring.Model.CreateSubmissionResponse{}])
end
@doc """
Generates multiple PDFs
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :submission_batch_data (SubmissionBatchData):
## Returns
{:ok, %Docspring.Model.CreateSubmissionBatchResponse{}} on success
{:error, info} on failure
"""
@spec batch_generate_pdfs(Tesla.Env.client, keyword()) :: {:ok, Docspring.Model.CreateSubmissionBatchResponse.t} | {:error, Tesla.Env.t}
def batch_generate_pdfs(connection, opts \\ []) do
optional_params = %{
:"SubmissionBatchData" => :body
}
%{}
|> method(:post)
|> url("/submissions/batches")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.CreateSubmissionBatchResponse{})
end
@doc """
Merge submission PDFs, template PDFs, or custom files
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :combine_pdfs_data (CombinePdfsData):
## Returns
{:ok, %Docspring.Model.CreateCombinedSubmissionResponse{}} on success
{:error, info} on failure
"""
@spec combine_pdfs(Tesla.Env.client, keyword()) :: {:ok, Docspring.Model.CreateCombinedSubmissionResponse.t} | {:error, Tesla.Env.t}
def combine_pdfs(connection, opts \\ []) do
optional_params = %{
:"CombinePdfsData" => :body
}
%{}
|> method(:post)
|> url("/combined_submissions?v=2")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.CreateCombinedSubmissionResponse{})
end
@doc """
Merge generated PDFs together
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :combined_submission_data (CombinedSubmissionData):
## Returns
{:ok, %Docspring.Model.CreateCombinedSubmissionResponse{}} on success
{:error, info} on failure
"""
@spec combine_submissions(Tesla.Env.client, keyword()) :: {:ok, Docspring.Model.CreateCombinedSubmissionResponse.t} | {:error, Tesla.Env.t}
def combine_submissions(connection, opts \\ []) do
optional_params = %{
:"CombinedSubmissionData" => :body
}
%{}
|> method(:post)
|> url("/combined_submissions")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.CreateCombinedSubmissionResponse{})
end
@doc """
Copy a Template
## Parameters
- connection (Docspring.Connection): Connection to server
- template_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :copy_template_data (CopyTemplateData):
## Returns
{:ok, %Docspring.Model.Template{}} on success
{:error, info} on failure
"""
@spec copy_template(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.Template.t} | {:error, Tesla.Env.t}
def copy_template(connection, template_id, opts \\ []) do
optional_params = %{
:"CopyTemplateData" => :body
}
%{}
|> method(:post)
|> url("/templates/#{template_id}/copy")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.Template{})
end
@doc """
Create a new custom file from a cached presign upload
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :create_custom_file_data (CreateCustomFileData):
## Returns
{:ok, %Docspring.Model.CreateCustomFileResponse{}} on success
{:error, info} on failure
"""
@spec create_custom_file_from_upload(Tesla.Env.client, keyword()) :: {:ok, Docspring.Model.CreateCustomFileResponse.t} | {:error, Tesla.Env.t}
def create_custom_file_from_upload(connection, opts \\ []) do
optional_params = %{
:"CreateCustomFileData" => :body
}
%{}
|> method(:post)
|> url("/custom_files")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.CreateCustomFileResponse{})
end
@doc """
Creates a new data request token for form authentication
## Parameters
- connection (Docspring.Connection): Connection to server
- data_request_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Docspring.Model.CreateSubmissionDataRequestTokenResponse{}} on success
{:error, info} on failure
"""
@spec create_data_request_token(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.CreateSubmissionDataRequestTokenResponse.t} | {:error, Tesla.Env.t}
def create_data_request_token(connection, data_request_id, _opts \\ []) do
%{}
|> method(:post)
|> url("/data_requests/#{data_request_id}/tokens")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.CreateSubmissionDataRequestTokenResponse{})
end
@doc """
Create a folder
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :create_folder_data (CreateFolderData):
## Returns
{:ok, %Docspring.Model.Folder{}} on success
{:error, info} on failure
"""
@spec create_folder(Tesla.Env.client, keyword()) :: {:ok, Docspring.Model.Folder.t} | {:error, Tesla.Env.t}
def create_folder(connection, opts \\ []) do
optional_params = %{
:"CreateFolderData" => :body
}
%{}
|> method(:post)
|> url("/folders/")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.Folder{})
end
@doc """
Create a new HTML template
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :create_html_template_data (CreateHtmlTemplateData):
## Returns
{:ok, %Docspring.Model.PendingTemplate{}} on success
{:error, info} on failure
"""
@spec create_html_template(Tesla.Env.client, keyword()) :: {:ok, Docspring.Model.PendingTemplate.t} | {:error, Tesla.Env.t}
def create_html_template(connection, opts \\ []) do
optional_params = %{
:"CreateHtmlTemplateData" => :body
}
%{}
|> method(:post)
|> url("/templates?desc=html")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.PendingTemplate{})
end
@doc """
Create a new PDF template with a form POST file upload
## Parameters
- connection (Docspring.Connection): Connection to server
- template_left_square_bracketdocument_right_square_bracket (String.t):
- template_left_square_bracketname_right_square_bracket (String.t):
- opts (KeywordList): [optional] Optional parameters
- :template_left_square_bracketparent_folder_id_right_square_bracket (String.t):
## Returns
{:ok, %Docspring.Model.PendingTemplate{}} on success
{:error, info} on failure
"""
@spec create_pdf_template(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, Docspring.Model.PendingTemplate.t} | {:error, Tesla.Env.t}
def create_pdf_template(connection, template_left_square_bracketdocument_right_square_bracket, template_left_square_bracketname_right_square_bracket, opts \\ []) do
optional_params = %{
:"template[parent_folder_id]" => :form
}
%{}
|> method(:post)
|> url("/templates")
|> add_param(:file, :"template[document]", template_left_square_bracketdocument_right_square_bracket)
|> add_param(:form, :"template[name]", template_left_square_bracketname_right_square_bracket)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.PendingTemplate{})
end
@doc """
Create a new PDF template from a cached presign upload
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :create_template_from_upload_data (CreateTemplateFromUploadData):
## Returns
{:ok, %Docspring.Model.PendingTemplate{}} on success
{:error, info} on failure
"""
@spec create_pdf_template_from_upload(Tesla.Env.client, keyword()) :: {:ok, Docspring.Model.PendingTemplate.t} | {:error, Tesla.Env.t}
def create_pdf_template_from_upload(connection, opts \\ []) do
optional_params = %{
:"CreateTemplateFromUploadData" => :body
}
%{}
|> method(:post)
|> url("/templates?desc=cached_upload")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.PendingTemplate{})
end
@doc """
Delete a folder
## Parameters
- connection (Docspring.Connection): Connection to server
- folder_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Docspring.Model.Folder{}} on success
{:error, info} on failure
"""
@spec delete_folder(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.Folder.t} | {:error, Tesla.Env.t}
def delete_folder(connection, folder_id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/folders/#{folder_id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.Folder{})
end
@doc """
Expire a combined submission
## Parameters
- connection (Docspring.Connection): Connection to server
- combined_submission_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Docspring.Model.CombinedSubmission{}} on success
{:error, info} on failure
"""
@spec expire_combined_submission(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.CombinedSubmission.t} | {:error, Tesla.Env.t}
def expire_combined_submission(connection, combined_submission_id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/combined_submissions/#{combined_submission_id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.CombinedSubmission{})
end
@doc """
Expire a PDF submission
## Parameters
- connection (Docspring.Connection): Connection to server
- submission_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Docspring.Model.Submission{}} on success
{:error, info} on failure
"""
@spec expire_submission(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.Submission.t} | {:error, Tesla.Env.t}
def expire_submission(connection, submission_id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/submissions/#{submission_id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.Submission{})
end
@doc """
Generates a new PDF
## Parameters
- connection (Docspring.Connection): Connection to server
- template_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :submission_data (SubmissionData):
## Returns
{:ok, %Docspring.Model.CreateSubmissionResponse{}} on success
{:error, info} on failure
"""
@spec generate_pdf(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.CreateSubmissionResponse.t} | {:error, Tesla.Env.t}
def generate_pdf(connection, template_id, opts \\ []) do
optional_params = %{
:"SubmissionData" => :body
}
%{}
|> method(:post)
|> url("/templates/#{template_id}/submissions")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.CreateSubmissionResponse{})
end
@doc """
Check the status of a combined submission (merged PDFs)
## Parameters
- connection (Docspring.Connection): Connection to server
- combined_submission_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Docspring.Model.CombinedSubmission{}} on success
{:error, info} on failure
"""
@spec get_combined_submission(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.CombinedSubmission.t} | {:error, Tesla.Env.t}
def get_combined_submission(connection, combined_submission_id, _opts \\ []) do
%{}
|> method(:get)
|> url("/combined_submissions/#{combined_submission_id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.CombinedSubmission{})
end
@doc """
Look up a submission data request
## Parameters
- connection (Docspring.Connection): Connection to server
- data_request_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Docspring.Model.SubmissionDataRequest{}} on success
{:error, info} on failure
"""
@spec get_data_request(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.SubmissionDataRequest.t} | {:error, Tesla.Env.t}
def get_data_request(connection, data_request_id, _opts \\ []) do
%{}
|> method(:get)
|> url("/data_requests/#{data_request_id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.SubmissionDataRequest{})
end
@doc """
Fetch the full template attributes
## Parameters
- connection (Docspring.Connection): Connection to server
- template_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Docspring.Model.FullTemplate{}} on success
{:error, info} on failure
"""
@spec get_full_template(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.FullTemplate.t} | {:error, Tesla.Env.t}
def get_full_template(connection, template_id, _opts \\ []) do
%{}
|> method(:get)
|> url("/templates/#{template_id}?full=true")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.FullTemplate{})
end
@doc """
Get a presigned URL so that you can upload a file to our AWS S3 bucket
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
@spec get_presign_url(Tesla.Env.client, keyword()) :: {:ok, map()} | {:error, Tesla.Env.t}
def get_presign_url(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/uploads/presign")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode()
end
@doc """
Check the status of a PDF
## Parameters
- connection (Docspring.Connection): Connection to server
- submission_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :include_data (boolean()):
## Returns
{:ok, %Docspring.Model.Submission{}} on success
{:error, info} on failure
"""
@spec get_submission(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.Submission.t} | {:error, Tesla.Env.t}
def get_submission(connection, submission_id, opts \\ []) do
optional_params = %{
:"include_data" => :query
}
%{}
|> method(:get)
|> url("/submissions/#{submission_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.Submission{})
end
@doc """
Check the status of a submission batch job
## Parameters
- connection (Docspring.Connection): Connection to server
- submission_batch_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :include_submissions (boolean()):
## Returns
{:ok, %Docspring.Model.SubmissionBatch{}} on success
{:error, info} on failure
"""
@spec get_submission_batch(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.SubmissionBatch.t} | {:error, Tesla.Env.t}
def get_submission_batch(connection, submission_batch_id, opts \\ []) do
optional_params = %{
:"include_submissions" => :query
}
%{}
|> method(:get)
|> url("/submissions/batches/#{submission_batch_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.SubmissionBatch{})
end
@doc """
Check the status of an uploaded template
## Parameters
- connection (Docspring.Connection): Connection to server
- template_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Docspring.Model.Template{}} on success
{:error, info} on failure
"""
@spec get_template(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.Template.t} | {:error, Tesla.Env.t}
def get_template(connection, template_id, _opts \\ []) do
%{}
|> method(:get)
|> url("/templates/#{template_id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.Template{})
end
@doc """
Fetch the JSON schema for a template
## Parameters
- connection (Docspring.Connection): Connection to server
- template_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
@spec get_template_schema(Tesla.Env.client, String.t, keyword()) :: {:ok, map()} | {:error, Tesla.Env.t}
def get_template_schema(connection, template_id, _opts \\ []) do
%{}
|> method(:get)
|> url("/templates/#{template_id}/schema")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode()
end
@doc """
Get a list of all folders
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :parent_folder_id (String.t): Filter By Folder Id
## Returns
{:ok, [%Folder{}, ...]} on success
{:error, info} on failure
"""
@spec list_folders(Tesla.Env.client, keyword()) :: {:ok, list(Docspring.Model.Folder.t)} | {:error, Tesla.Env.t}
def list_folders(connection, opts \\ []) do
optional_params = %{
:"parent_folder_id" => :query
}
%{}
|> method(:get)
|> url("/folders/")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode([%Docspring.Model.Folder{}])
end
@doc """
List all submissions
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :cursor (String.t):
- :limit (float()):
- :created_after (String.t):
- :created_before (String.t):
- :type (String.t):
- :include_data (boolean()):
## Returns
{:ok, %Docspring.Model.ListSubmissionsResponse{}} on success
{:error, info} on failure
"""
@spec list_submissions(Tesla.Env.client, keyword()) :: {:ok, Docspring.Model.ListSubmissionsResponse.t} | {:error, Tesla.Env.t}
def list_submissions(connection, opts \\ []) do
optional_params = %{
:"cursor" => :query,
:"limit" => :query,
:"created_after" => :query,
:"created_before" => :query,
:"type" => :query,
:"include_data" => :query
}
%{}
|> method(:get)
|> url("/submissions")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.ListSubmissionsResponse{})
end
@doc """
List all submissions for a given template
## Parameters
- connection (Docspring.Connection): Connection to server
- template_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :cursor (String.t):
- :limit (float()):
- :created_after (String.t):
- :created_before (String.t):
- :type (String.t):
- :include_data (boolean()):
## Returns
{:ok, %Docspring.Model.ListSubmissionsResponse{}} on success
{:error, info} on failure
"""
@spec list_submissions_0(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.ListSubmissionsResponse.t} | {:error, Tesla.Env.t}
def list_submissions_0(connection, template_id, opts \\ []) do
optional_params = %{
:"cursor" => :query,
:"limit" => :query,
:"created_after" => :query,
:"created_before" => :query,
:"type" => :query,
:"include_data" => :query
}
%{}
|> method(:get)
|> url("/templates/#{template_id}/submissions")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.ListSubmissionsResponse{})
end
@doc """
Get a list of all templates
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :query (String.t): Search By Name
- :parent_folder_id (String.t): Filter By Folder Id
- :page (integer()): Default: 1
- :per_page (integer()): Default: 50
## Returns
{:ok, [%Template{}, ...]} on success
{:error, info} on failure
"""
@spec list_templates(Tesla.Env.client, keyword()) :: {:ok, list(Docspring.Model.Template.t)} | {:error, Tesla.Env.t}
def list_templates(connection, opts \\ []) do
optional_params = %{
:"query" => :query,
:"parent_folder_id" => :query,
:"page" => :query,
:"per_page" => :query
}
%{}
|> method(:get)
|> url("/templates")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode([%Docspring.Model.Template{}])
end
@doc """
Move a folder
## Parameters
- connection (Docspring.Connection): Connection to server
- folder_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :move_folder_data (MoveFolderData):
## Returns
{:ok, %Docspring.Model.Folder{}} on success
{:error, info} on failure
"""
@spec move_folder_to_folder(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.Folder.t} | {:error, Tesla.Env.t}
def move_folder_to_folder(connection, folder_id, opts \\ []) do
optional_params = %{
:"MoveFolderData" => :body
}
%{}
|> method(:post)
|> url("/folders/#{folder_id}/move")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.Folder{})
end
@doc """
Move Template to folder
## Parameters
- connection (Docspring.Connection): Connection to server
- template_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :move_template_data (MoveTemplateData):
## Returns
{:ok, %Docspring.Model.Template{}} on success
{:error, info} on failure
"""
@spec move_template_to_folder(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.Template.t} | {:error, Tesla.Env.t}
def move_template_to_folder(connection, template_id, opts \\ []) do
optional_params = %{
:"MoveTemplateData" => :body
}
%{}
|> method(:post)
|> url("/templates/#{template_id}/move")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.Template{})
end
@doc """
Rename a folder
## Parameters
- connection (Docspring.Connection): Connection to server
- folder_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :rename_folder_data (RenameFolderData):
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
@spec rename_folder(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def rename_folder(connection, folder_id, opts \\ []) do
optional_params = %{
:"RenameFolderData" => :body
}
%{}
|> method(:post)
|> url("/folders/#{folder_id}/rename")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
end
@doc """
Test Authentication
## Parameters
- connection (Docspring.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Docspring.Model.AuthenticationSuccessResponse{}} on success
{:error, info} on failure
"""
@spec test_authentication(Tesla.Env.client, keyword()) :: {:ok, Docspring.Model.AuthenticationSuccessResponse.t} | {:error, Tesla.Env.t}
def test_authentication(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/authentication")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.AuthenticationSuccessResponse{})
end
@doc """
Update a submission data request
## Parameters
- connection (Docspring.Connection): Connection to server
- data_request_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :update_submission_data_request_data (UpdateSubmissionDataRequestData):
## Returns
{:ok, %Docspring.Model.UpdateDataRequestResponse{}} on success
{:error, info} on failure
"""
@spec update_data_request(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.UpdateDataRequestResponse.t} | {:error, Tesla.Env.t}
def update_data_request(connection, data_request_id, opts \\ []) do
optional_params = %{
:"UpdateSubmissionDataRequestData" => :body
}
%{}
|> method(:put)
|> url("/data_requests/#{data_request_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.UpdateDataRequestResponse{})
end
@doc """
Update a Template
## Parameters
- connection (Docspring.Connection): Connection to server
- template_id (String.t):
- opts (KeywordList): [optional] Optional parameters
- :update_template_data (UpdateTemplateData):
## Returns
{:ok, %Docspring.Model.UpdateTemplateResponse{}} on success
{:error, info} on failure
"""
@spec update_template(Tesla.Env.client, String.t, keyword()) :: {:ok, Docspring.Model.UpdateTemplateResponse.t} | {:error, Tesla.Env.t}
def update_template(connection, template_id, opts \\ []) do
optional_params = %{
:"UpdateTemplateData" => :body
}
%{}
|> method(:put)
|> url("/templates/#{template_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Docspring.Model.UpdateTemplateResponse{})
end
end