Humaans.DocumentFolders (Humaans v0.6.0)

Copy Markdown View Source

This module provides functions for managing document folder resources in the Humaans API.

Summary

Functions

Creates a new document_folder.

Deletes a specific document_folder by ID.

Lists all document_folders.

Retrieves a specific document_folder by ID.

Updates a specific document_folder by ID.

Types

delete_response()

@type delete_response() ::
  {:ok, %{id: String.t(), deleted: bool()}} | {:error, Humaans.Error.t()}

list_response()

@type list_response() ::
  {:ok,
   [
     %Humaans.Resources.DocumentFolder{
       audience: term(),
       company_id: term(),
       created_at: term(),
       created_by: term(),
       deleted_at: term(),
       id: term(),
       name: term(),
       updated_at: term()
     }
   ]}
  | {:error, Humaans.Error.t()}

response()

@type response() ::
  {:ok,
   %Humaans.Resources.DocumentFolder{
     audience: term(),
     company_id: term(),
     created_at: term(),
     created_by: term(),
     deleted_at: term(),
     id: term(),
     name: term(),
     updated_at: term()
   }}
  | {:error, Humaans.Error.t()}

Functions

create(client, params)

@spec create(client :: map(), params :: map() | keyword()) ::
  {:ok, Humaans.Resources.DocumentFolder.t()} | {:error, Humaans.Error.t()}

Creates a new document_folder.

Parameters

  • client - Client created with Humaans.new/1
  • params - Map of attributes for the new document_folder

Examples

client = Humaans.new(access_token: "your_access_token")
params = %{name: "Onboarding"}
{:ok, document_folder} = Humaans.DocumentFolders.create(client, params)

delete(client, id)

@spec delete(client :: map(), id :: String.t()) ::
  {:ok, %{id: String.t(), deleted: boolean()}} | {:error, Humaans.Error.t()}

Deletes a specific document_folder by ID.

Parameters

  • client - Client created with Humaans.new/1
  • id - String ID of the document_folder to delete

Examples

client = Humaans.new(access_token: "your_access_token")
{:ok, %{id: "document_folder_id", deleted: true}} = Humaans.DocumentFolders.delete(client, "document_folder_id")

list(client, params \\ %{})

@spec list(client :: map(), params :: map() | keyword() | [{String.t(), term()}]) ::
  {:ok, [Humaans.Resources.DocumentFolder.t()]} | {:error, Humaans.Error.t()}

Lists all document_folders.

Returns a list of document_folders matching the optional filter params.

Parameters

  • client - Client created with Humaans.new/1
  • params - Optional map of filter parameters (default: %{})

Examples

client = Humaans.new(access_token: "your_access_token")
{:ok, document_folders} = Humaans.DocumentFolders.list(client)
{:ok, document_folders} = Humaans.DocumentFolders.list(client, %{})

retrieve(client, id)

@spec retrieve(client :: map(), id :: String.t()) ::
  {:ok, Humaans.Resources.DocumentFolder.t()} | {:error, Humaans.Error.t()}

Retrieves a specific document_folder by ID.

Parameters

  • client - Client created with Humaans.new/1
  • id - String ID of the document_folder to retrieve

Examples

client = Humaans.new(access_token: "your_access_token")
{:ok, document_folder} = Humaans.DocumentFolders.retrieve(client, "document_folder_id")

update(client, id, params)

@spec update(client :: map(), id :: String.t(), params :: map() | keyword()) ::
  {:ok, Humaans.Resources.DocumentFolder.t()} | {:error, Humaans.Error.t()}

Updates a specific document_folder by ID.

Parameters

  • client - Client created with Humaans.new/1
  • id - String ID of the document_folder to update
  • params - Map of attributes to update

Examples

client = Humaans.new(access_token: "your_access_token")
params = %{name: "Onboarding Documents"}
{:ok, document_folder} = Humaans.DocumentFolders.update(client, "document_folder_id", params)