Humaans.Companies (Humaans v0.5.1)

Copy Markdown View Source

This module provides functions for managing company resources in the Humaans API. Note that unlike other resources, companies can only be listed, retrieved, and updated, but not created or deleted through the API.

Summary

Functions

Retrieves a specific company by ID.

Lists all companies.

Updates a specific company by ID.

Types

list_response()

@type list_response() ::
  {:ok,
   [
     %Humaans.Resources.Company{
       autogenerate_employee_id: term(),
       autogenerate_employee_id_for_new_hires: term(),
       created_at: term(),
       domains: term(),
       id: term(),
       is_timesheet_enabled: term(),
       name: term(),
       next_employee_id: term(),
       package: term(),
       payment_status: term(),
       status: term(),
       trial_end_date: term(),
       updated_at: term()
     }
   ]}
  | {:error, Humaans.Error.t()}

response()

@type response() ::
  {:ok,
   %Humaans.Resources.Company{
     autogenerate_employee_id: term(),
     autogenerate_employee_id_for_new_hires: term(),
     created_at: term(),
     domains: term(),
     id: term(),
     is_timesheet_enabled: term(),
     name: term(),
     next_employee_id: term(),
     package: term(),
     payment_status: term(),
     status: term(),
     trial_end_date: term(),
     updated_at: term()
   }}
  | {:error, Humaans.Error.t()}

Functions

get(client, id)

@spec get(client :: map(), id :: String.t()) :: response()

Retrieves a specific company by ID.

Parameters

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

Examples

client = Humaans.new(access_token: "your_access_token")

{:ok, company} = Humaans.Companies.get(client, "company_id")

list(client, params \\ %{})

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

Lists all companies.

Returns a list of companies 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, companies} = Humaans.Companies.list(client)
{:ok, companies} = Humaans.Companies.list(client, %{})

update(client, id, params)

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

Updates a specific company by ID.

Parameters

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

Examples

client = Humaans.new(access_token: "your_access_token")
{:ok, company} = Humaans.Companies.update(client, "company_id", %{})