This module provides functions for managing people resources in the Humaans API.
Summary
Functions
Creates a new person.
Deletes a specific person by ID.
Lists all people.
Retrieves a specific person by ID.
Updates a specific person by ID.
Types
@type delete_response() :: {:ok, %{id: String.t(), deleted: bool()}} | {:error, Humaans.Error.t()}
@type list_response() :: {:ok, [ %Humaans.Resources.Person{ address: term(), bio: term(), birthday: term(), calendar_feed_token: term(), city: term(), company_id: term(), contract_type: term(), country: term(), country_code: term(), created_at: term(), demo: term(), dietary_preference: term(), email: term(), employee_id: term(), employment_end_date: term(), employment_start_date: term(), first_name: term(), first_working_day: term(), food_allergies: term(), formatted_personal_phone_number: term(), formatted_phone_number: term(), gender: term(), github: term(), id: term(), is_birthday_hidden: term(), is_verified: term(), is_work_email_hidden: term(), last_name: term(), last_working_day: term(), leaving_file_id: term(), leaving_note: term(), leaving_reason: term(), linked_in: term(), location_id: term(), middle_name: term(), nationalities: term(), nationality: term(), payroll_provider: term(), personal_email: term(), personal_phone_number: term(), phone_number: term(), postcode: term(), preferred_name: term(), probation_end_date: term(), profile_photo: term(), profile_photo_id: term(), public_holiday_calendar_id: term(), remote_city: term(), remote_country_code: term(), remote_region_code: term(), remote_timezone: term(), role: term(), seen_documents_at: term(), source: term(), source_id: term(), spoken_languages: term(), state: term(), status: term(), tax_code: term(), tax_id: term(), teams: term(), timezone: term(), turnover_impact: term(), twitter: term(), updated_at: term(), working_days: term() } ]} | {:error, Humaans.Error.t()}
@type response() :: {:ok, %Humaans.Resources.Person{ address: term(), bio: term(), birthday: term(), calendar_feed_token: term(), city: term(), company_id: term(), contract_type: term(), country: term(), country_code: term(), created_at: term(), demo: term(), dietary_preference: term(), email: term(), employee_id: term(), employment_end_date: term(), employment_start_date: term(), first_name: term(), first_working_day: term(), food_allergies: term(), formatted_personal_phone_number: term(), formatted_phone_number: term(), gender: term(), github: term(), id: term(), is_birthday_hidden: term(), is_verified: term(), is_work_email_hidden: term(), last_name: term(), last_working_day: term(), leaving_file_id: term(), leaving_note: term(), leaving_reason: term(), linked_in: term(), location_id: term(), middle_name: term(), nationalities: term(), nationality: term(), payroll_provider: term(), personal_email: term(), personal_phone_number: term(), phone_number: term(), postcode: term(), preferred_name: term(), probation_end_date: term(), profile_photo: term(), profile_photo_id: term(), public_holiday_calendar_id: term(), remote_city: term(), remote_country_code: term(), remote_region_code: term(), remote_timezone: term(), role: term(), seen_documents_at: term(), source: term(), source_id: term(), spoken_languages: term(), state: term(), status: term(), tax_code: term(), tax_id: term(), teams: term(), timezone: term(), turnover_impact: term(), twitter: term(), updated_at: term(), working_days: term() }} | {:error, Humaans.Error.t()}
Functions
@spec create(client :: map(), params :: map() | keyword()) :: {:ok, Humaans.Resources.Person.t()} | {:error, Humaans.Error.t()}
Creates a new person.
Parameters
client- Client created withHumaans.new/1params- Map of attributes for the new person
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{firstName: "Jane", lastName: "Doe", email: "jane@example.com"}
{:ok, person} = Humaans.People.create(client, params)
@spec delete(client :: map(), id :: String.t()) :: {:ok, %{id: String.t(), deleted: boolean()}} | {:error, Humaans.Error.t()}
Deletes a specific person by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the person to delete
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, %{id: "person_id", deleted: true}} = Humaans.People.delete(client, "person_id")
@spec list(client :: map(), params :: map() | keyword()) :: {:ok, [Humaans.Resources.Person.t()]} | {:error, Humaans.Error.t()}
Lists all people.
Returns a list of people 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, people} = Humaans.People.list(client)
{:ok, people} = Humaans.People.list(client, %{})
@spec retrieve(client :: map(), id :: String.t()) :: {:ok, Humaans.Resources.Person.t()} | {:error, Humaans.Error.t()}
Retrieves a specific person by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the person to retrieve
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, person} = Humaans.People.retrieve(client, "person_id")
@spec update(client :: map(), id :: String.t(), params :: map() | keyword()) :: {:ok, Humaans.Resources.Person.t()} | {:error, Humaans.Error.t()}
Updates a specific person by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the person to updateparams- Map of attributes to update
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{firstName: "Janet"}
{:ok, person} = Humaans.People.update(client, "person_id", params)