View Source ExPersona.Document (ex_persona v1.0.2)

Module for getting a document's metadata and downloading its contents.

For instance:

doc = ExPersona.Document.get("an-id") |> ExPersona.request!()
if Document.has_file?(doc, "front_image") do
  {:ok, body} = Document.download_file(doc, "front_image")
  File.write("front_image.png", body)
end  

Link to this section Summary

Functions

Create an ExPersona.Client.Operation to then request for a file's contents.

Get a specific ExPersona.Document.

Determind if the ExPersona.Document contains a file with the given name.

Link to this section Types

@type t() :: %ExPersona.Document{data: map(), id: String.t()}

Link to this section Functions

Link to this function

download_file(document, name)

View Source
@spec download_file(t(), String.t()) :: ExPersona.Client.Operation.t()

Create an ExPersona.Client.Operation to then request for a file's contents.

Get a specific ExPersona.Document.

Link to this function

has_file?(document, name)

View Source
@spec has_file?(t(), String.t()) :: boolean()

Determind if the ExPersona.Document contains a file with the given name.