View Source Yousign.API.Documents (yousign_ex v0.2.2)

Link to this section Summary

Functions

Creates a new document and adds it to the given signature request

Creates a new document

Downloads all the documents attached to a signature request

Gets a single document by its id

List all documents in a signature request

Link to this section Functions

Link to this function

add_to_signature_request(signature_request_id, body, filename \\ true)

View Source
@spec add_to_signature_request(
  String.t(),
  %Yousign.DocumentInput{
    file: term(),
    initials: term(),
    nature: term(),
    parse_anchors: term(),
    password: term()
  },
  String.t() | boolean()
) ::
  {:error, any()}
  | {:ok,
     %Yousign.Document{
       content_type: term(),
       created_at: term(),
       filename: term(),
       id: term(),
       initials: term(),
       is_locked: term(),
       is_protected: term(),
       is_signed: term(),
       nature: term(),
       sha256: term(),
       total_anchors: term(),
       total_pages: term()
     }}

Creates a new document and adds it to the given signature request

Link to this function

create(body, filename \\ true)

View Source
@spec create(
  %Yousign.DocumentInput{
    file: term(),
    initials: term(),
    nature: term(),
    parse_anchors: term(),
    password: term()
  },
  String.t() | boolean()
) ::
  {:error, any()}
  | {:ok,
     %Yousign.Document{
       content_type: term(),
       created_at: term(),
       filename: term(),
       id: term(),
       initials: term(),
       is_locked: term(),
       is_protected: term(),
       is_signed: term(),
       nature: term(),
       sha256: term(),
       total_anchors: term(),
       total_pages: term()
     }}

Creates a new document

Link to this function

download(signature_request_id, version \\ :current)

View Source
@spec download(String.t(), atom()) :: {:error, any()} | {:ok, any()}

Downloads all the documents attached to a signature request

Version Options:

  • :completed: downloads the completed version of the documents
  • :current: downloads the current version of the documents

Defaults to :current

Link to this function

get(signature_request_id, id)

View Source
@spec get(String.t(), String.t()) :: {:error, any()} | {:ok, any()}

Gets a single document by its id

## Examples

  iex> Yousign.API.Documents.get("123")
  {:ok, %{"data" => %{"id" => "123", "name" => "test"}}}

  iex> Yousign.API.Documents.get("invalid")
  {:error, 404}
Link to this function

list(signature_request_id)

View Source
@spec list(String.t()) :: {:error, any()} | {:ok, any()}

List all documents in a signature request

examples

Examples

iex> Yousign.API.Documents.list("123")
{:ok, %{"data" => [], "meta" => %{"pagination" => %{"total" => 0}}}}

iex> Yousign.API.Documents.list("123")
{:ok, %{"data" => [%{"id" => "123", "name" => "test"}], "meta" => %{"pagination" => %{"total" => 1}}}}