This module provides functions for managing identity document resources in the Humaans API.
Summary
Functions
Creates a new identity_document.
Deletes a specific identity_document by ID.
Lists all identity_documents.
Retrieves a specific identity_document by ID.
Updates a specific identity_document by ID.
Types
@type delete_response() :: {:ok, %{id: String.t(), deleted: bool()}} | {:error, Humaans.Error.t()}
@type list_response() :: {:ok, [ %Humaans.Resources.IdentityDocument{ created_at: term(), expiry_date: term(), file: term(), file_id: term(), id: term(), identity_document_type_id: term(), issue_date: term(), issuing_country: term(), name: term(), number: term(), person_id: term(), updated_at: term() } ]} | {:error, Humaans.Error.t()}
@type response() :: {:ok, %Humaans.Resources.IdentityDocument{ created_at: term(), expiry_date: term(), file: term(), file_id: term(), id: term(), identity_document_type_id: term(), issue_date: term(), issuing_country: term(), name: term(), number: term(), person_id: term(), updated_at: term() }} | {:error, Humaans.Error.t()}
Functions
@spec create(client :: map(), params :: map() | keyword()) :: {:ok, Humaans.Resources.IdentityDocument.t()} | {:error, Humaans.Error.t()}
Creates a new identity_document.
Parameters
client- Client created withHumaans.new/1params- Map of attributes for the new identity_document
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{personId: "person_abc", identityDocumentTypeId: "type_abc", name: "UK Passport", number: "123456789"}
{:ok, identity_document} = Humaans.IdentityDocuments.create(client, params)
@spec delete(client :: map(), id :: String.t()) :: {:ok, %{id: String.t(), deleted: boolean()}} | {:error, Humaans.Error.t()}
Deletes a specific identity_document by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the identity_document to delete
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, %{id: "identity_document_id", deleted: true}} = Humaans.IdentityDocuments.delete(client, "identity_document_id")
@spec list(client :: map(), params :: map() | keyword() | [{String.t(), term()}]) :: {:ok, [Humaans.Resources.IdentityDocument.t()]} | {:error, Humaans.Error.t()}
Lists all identity_documents.
Returns a list of identity_documents 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, identity_documents} = Humaans.IdentityDocuments.list(client)
{:ok, identity_documents} = Humaans.IdentityDocuments.list(client, %{})
@spec retrieve(client :: map(), id :: String.t()) :: {:ok, Humaans.Resources.IdentityDocument.t()} | {:error, Humaans.Error.t()}
Retrieves a specific identity_document by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the identity_document to retrieve
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, identity_document} = Humaans.IdentityDocuments.retrieve(client, "identity_document_id")
@spec update(client :: map(), id :: String.t(), params :: map() | keyword()) :: {:ok, Humaans.Resources.IdentityDocument.t()} | {:error, Humaans.Error.t()}
Updates a specific identity_document by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the identity_document to updateparams- Map of attributes to update
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{number: "987654321"}
{:ok, identity_document} = Humaans.IdentityDocuments.update(client, "identity_document_id", params)