Current section

Files

Jump to
docusign lib docusign api workspace_items.ex
Raw

lib/docusign/api/workspace_items.ex

# NOTE: This file is auto generated by OpenAPI Generator 7.12.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule DocuSign.Api.WorkspaceItems do
@moduledoc """
API calls for all endpoints tagged `WorkspaceItems`.
"""
import DocuSign.RequestBuilder
alias DocuSign.Connection
alias DocuSign.Model.ErrorDetails
alias DocuSign.Model.PageImages
alias DocuSign.Model.WorkspaceFolderContents
alias DocuSign.Model.WorkspaceItem
@doc """
Gets a workspace file
This method returns a binary version of a file in a workspace.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `file_id` (String.t): The ID of the file.
- `folder_id` (String.t): The ID of the folder.
- `workspace_id` (String.t): The ID of the workspace.
- `opts` (keyword): Optional parameters
- `:is_download` (String.t): When **true,** the `Content-Disposition` header is set in the response. The value of the header provides the filename of the file. The default is **false.**
- `:pdf_version` (String.t): When **true** the file is returned in PDF format.
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_file_get_workspace_file(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword()
) :: {:ok, nil} | {:ok, ErrorDetails.t()} | {:error, Tesla.Env.t()}
def workspace_file_get_workspace_file(connection, account_id, file_id, folder_id, workspace_id, opts \\ []) do
optional_params = %{
:is_download => :query,
:pdf_version => :query
}
request =
%{}
|> method(:get)
|> url("/v2.1/accounts/#{account_id}/workspaces/#{workspace_id}/folders/#{folder_id}/files/#{file_id}")
|> add_optional_params(optional_params, opts)
|> Enum.to_list()
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{400, ErrorDetails}
])
end
@doc """
List File Pages
This method returns a workspace file as rasterized pages.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `file_id` (String.t): The ID of the file.
- `folder_id` (String.t): The ID of the folder.
- `workspace_id` (String.t): The ID of the workspace.
- `opts` (keyword): Optional parameters
- `:count` (String.t): The maximum number of results to return. Use `start_position` to specify the number of results to skip.
- `:dpi` (String.t): The number of dots per inch (DPI) for the resulting images. Valid values are 1-310 DPI. The default value is 94.
- `:max_height` (String.t): Sets the maximum height of the returned images in pixels.
- `:max_width` (String.t): Sets the maximum width of the returned images in pixels.
- `:start_position` (String.t): The zero-based index of the result from which to start returning results. Use with `count` to limit the number of results. The default value is `0`.
### Returns
- `{:ok, DocuSign.Model.PageImages.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_file_pages_get_workspace_file_pages(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword()
) ::
{:ok, ErrorDetails.t()}
| {:ok, PageImages.t()}
| {:error, Tesla.Env.t()}
def workspace_file_pages_get_workspace_file_pages(
connection,
account_id,
file_id,
folder_id,
workspace_id,
opts \\ []
) do
optional_params = %{
:count => :query,
:dpi => :query,
:max_height => :query,
:max_width => :query,
:start_position => :query
}
request =
%{}
|> method(:get)
|> url("/v2.1/accounts/#{account_id}/workspaces/#{workspace_id}/folders/#{folder_id}/files/#{file_id}/pages")
|> add_optional_params(optional_params, opts)
|> Enum.to_list()
connection
|> Connection.request(request)
|> evaluate_response([
{200, PageImages},
{400, ErrorDetails}
])
end
@doc """
Creates a workspace file.
This method adds a file to a workspace.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `folder_id` (String.t): The ID of the folder.
- `workspace_id` (String.t): The ID of the workspace.
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, DocuSign.Model.WorkspaceItem.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_file_post_workspace_files(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword()
) ::
{:ok, WorkspaceItem.t()}
| {:ok, ErrorDetails.t()}
| {:error, Tesla.Env.t()}
def workspace_file_post_workspace_files(connection, account_id, folder_id, workspace_id, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v2.1/accounts/#{account_id}/workspaces/#{workspace_id}/folders/#{folder_id}/files")
|> ensure_body()
|> Enum.to_list()
connection
|> Connection.request(request)
|> evaluate_response([
{201, WorkspaceItem},
{400, ErrorDetails}
])
end
@doc """
Update workspace file or folder metadata
This method updates the metadata for one or more specific files or folders in a workspace.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `file_id` (String.t): The ID of the file.
- `folder_id` (String.t): The ID of the folder.
- `workspace_id` (String.t): The ID of the workspace.
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, DocuSign.Model.WorkspaceItem.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_file_put_workspace_file(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
String.t(),
keyword()
) ::
{:ok, WorkspaceItem.t()}
| {:ok, ErrorDetails.t()}
| {:error, Tesla.Env.t()}
def workspace_file_put_workspace_file(connection, account_id, file_id, folder_id, workspace_id, _opts \\ []) do
request =
%{}
|> method(:put)
|> url("/v2.1/accounts/#{account_id}/workspaces/#{workspace_id}/folders/#{folder_id}/files/#{file_id}")
|> ensure_body()
|> Enum.to_list()
connection
|> Connection.request(request)
|> evaluate_response([
{200, WorkspaceItem},
{400, ErrorDetails}
])
end
@doc """
Deletes files or sub-folders from a workspace.
This method deletes one or more files or sub-folders from a workspace folder or root. Note: To delete items from a workspace, the `status` of the workspace must be `active`.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `folder_id` (String.t): The ID of the folder.
- `workspace_id` (String.t): The ID of the workspace.
- `opts` (keyword): Optional parameters
- `:body` (WorkspaceItemList):
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_folder_delete_workspace_items(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword()
) :: {:ok, nil} | {:ok, ErrorDetails.t()} | {:error, Tesla.Env.t()}
def workspace_folder_delete_workspace_items(connection, account_id, folder_id, workspace_id, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:delete)
|> url("/v2.1/accounts/#{account_id}/workspaces/#{workspace_id}/folders/#{folder_id}")
|> add_optional_params(optional_params, opts)
|> Enum.to_list()
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{400, ErrorDetails}
])
end
@doc """
List workspace folder contents
This method returns the contents of a workspace folder, which can include sub-folders and files.
### Parameters
- `connection` (DocuSign.Connection): Connection to server
- `account_id` (String.t): The external account number (int) or account ID GUID.
- `folder_id` (String.t): The ID of the folder.
- `workspace_id` (String.t): The ID of the workspace.
- `opts` (keyword): Optional parameters
- `:count` (String.t): The maximum number of results to return. Use `start_position` to specify the number of results to skip.
- `:include_files` (String.t): When **true,** the response includes file information (in addition to folder information). The default is **false.**
- `:include_sub_folders` (String.t): When **true,** the response includes information about the sub-folders of the current folder. The default is **false.**
- `:include_thumbnails` (String.t): When **true,** the response returns thumbnails. The default is **false.**
- `:include_user_detail` (String.t): When **true,** the response includes extended details about the user. The default is **false.**
- `:start_position` (String.t): The zero-based index of the result from which to start returning results. Use with `count` to limit the number of results. The default value is `0`.
- `:workspace_user_id` (String.t): If set, the response only includes results associated with the `userId` that you specify.
### Returns
- `{:ok, DocuSign.Model.WorkspaceFolderContents.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec workspace_folder_get_workspace_folder(
Tesla.Env.client(),
String.t(),
String.t(),
String.t(),
keyword()
) ::
{:ok, ErrorDetails.t()}
| {:ok, WorkspaceFolderContents.t()}
| {:error, Tesla.Env.t()}
def workspace_folder_get_workspace_folder(connection, account_id, folder_id, workspace_id, opts \\ []) do
optional_params = %{
:count => :query,
:include_files => :query,
:include_sub_folders => :query,
:include_thumbnails => :query,
:include_user_detail => :query,
:start_position => :query,
:workspace_user_id => :query
}
request =
%{}
|> method(:get)
|> url("/v2.1/accounts/#{account_id}/workspaces/#{workspace_id}/folders/#{folder_id}")
|> add_optional_params(optional_params, opts)
|> Enum.to_list()
connection
|> Connection.request(request)
|> evaluate_response([
{200, WorkspaceFolderContents},
{400, ErrorDetails}
])
end
end