omise v0.5.2 Omise.Document

Provides Document API interfaces.

https://www.omise.co/documents-api

Link to this section Summary

Link to this section Types

Link to this type t()
t() :: %Omise.Document{deleted: boolean, filename: String.t, id: String.t, livemode: boolean, location: String.t, object: String.t}

Link to this section Functions

Link to this function create(path, params, opts \\ [])
create(String.t, Keyword.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Upload a document.

Returns {:ok, document} if the request is successful, {:error, error} otherwise.

Request Parameter:

  • file - (required) The file to upload. Valid files include PNG and JPG images and PDF files. The uploaded file should also includes metadata such as filename and content type.

Examples

Omise.Document.create("disputes/dspt_test_4zgf15h89w8t775kcm8", file: "pictures/screenshot.jpg")
Link to this function destroy(path, id, opts \\ [])
destroy(String.t, String.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Destroy a document.

Returns {:ok, document} if the request is successful, {:error, error} otherwise.

Examples

Omise.Document.destroy("disputes/dspt_test_4zgf15h89w8t775kcm8", "docu_test_55a1e900ys2srz0xu2r")
Link to this function list(path, params \\ [], opts \\ [])
list(String.t, Keyword.t, Keyword.t) ::
  {:ok, Omise.List.t} |
  {:error, Omise.Error.t}

List all documents.

Returns {:ok, documents} if the request is successful, {:error, error} otherwise.

Query Parameters:

  • offset - (optional, default: 0) The offset of the first record returned.
  • limit - (optional, default: 20, maximum: 100) The maximum amount of records returned.
  • from - (optional, default: 1970-01-01T00:00:00Z, format: ISO 8601) The UTC date and time limiting the beginning of returned records.
  • to - (optional, default: current UTC Datetime, format: ISO 8601) The UTC date and time limiting the end of returned records.

Examples

Omise.Document.list("disputes/dspt_test_53f77r87n5czrdwldvz")

Omise.Document.list("disputes/dspt_test_53f77r87n5czrdwldvz", offset: 2)
Link to this function retrieve(path, id, opts \\ [])
retrieve(String.t, String.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Retrieve a document.

Returns {:ok, document} if the request is successful, {:error, error} otherwise.

Examples

Omise.Document.retrieve("disputes/dspt_test_51yfnnpsxajeybpytm4", "docu_test_55a1e900ys2srz0xu2r")