This module provides functions for managing document type resources in the Humaans API. Note that document types do not support deletion.
Summary
Functions
Creates a new document_type.
Lists all document_types.
Retrieves a specific document_type by ID.
Updates a specific document_type by ID.
Types
Functions
@spec create(client :: map(), params :: map() | keyword()) :: {:ok, Humaans.Resources.DocumentType.t()} | {:error, Humaans.Error.t()}
Creates a new document_type.
Parameters
client- Client created withHumaans.new/1params- Map of attributes for the new document_type
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{name: "Passport"}
{:ok, document_type} = Humaans.DocumentTypes.create(client, params)
@spec list(client :: map(), params :: map() | keyword() | [{String.t(), term()}]) :: {:ok, [Humaans.Resources.DocumentType.t()]} | {:error, Humaans.Error.t()}
Lists all document_types.
Returns a list of document_types matching the optional filter params.
Parameters
client- Client created withHumaans.new/1params- Optional map of filter parameters (default:%{})
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, document_types} = Humaans.DocumentTypes.list(client)
{:ok, document_types} = Humaans.DocumentTypes.list(client, %{})
@spec retrieve(client :: map(), id :: String.t()) :: {:ok, Humaans.Resources.DocumentType.t()} | {:error, Humaans.Error.t()}
Retrieves a specific document_type by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the document_type to retrieve
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, document_type} = Humaans.DocumentTypes.retrieve(client, "document_type_id")
@spec update(client :: map(), id :: String.t(), params :: map() | keyword()) :: {:ok, Humaans.Resources.DocumentType.t()} | {:error, Humaans.Error.t()}
Updates a specific document_type by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the document_type to updateparams- Map of attributes to update
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{name: "Identity Document"}
{:ok, document_type} = Humaans.DocumentTypes.update(client, "document_type_id", params)