This module provides functions for managing time away allocation resources in the Humaans API.
Summary
Functions
Creates a new time_away_allocation.
Deletes a specific time_away_allocation by ID.
Lists all time_away_allocations.
Retrieves a specific time_away_allocation by ID.
Updates a specific time_away_allocation by ID.
Types
@type delete_response() :: {:ok, %{id: String.t(), deleted: bool()}} | {:error, Humaans.Error.t()}
@type list_response() :: {:ok, [ %Humaans.Resources.TimeAwayAllocation{ amount: term(), created_at: term(), end_date: term(), id: term(), person_id: term(), start_date: term(), time_away_policy_id: term(), time_away_type_id: term(), unit: term(), updated_at: term() } ]} | {:error, Humaans.Error.t()}
Functions
@spec create(client :: map(), params :: map() | keyword()) :: {:ok, Humaans.Resources.TimeAwayAllocation.t()} | {:error, Humaans.Error.t()}
Creates a new time_away_allocation.
Parameters
client- Client created withHumaans.new/1params- Map of attributes for the new time_away_allocation
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{personId: "person_abc", timeAwayTypeId: "type_abc", timeAwayPolicyId: "policy_abc", amount: 25, unit: "days", startDate: "2025-01-01"}
{:ok, time_away_allocation} = Humaans.TimeAwayAllocations.create(client, params)
@spec delete(client :: map(), id :: String.t()) :: {:ok, %{id: String.t(), deleted: boolean()}} | {:error, Humaans.Error.t()}
Deletes a specific time_away_allocation by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the time_away_allocation to delete
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, %{id: "time_away_allocation_id", deleted: true}} = Humaans.TimeAwayAllocations.delete(client, "time_away_allocation_id")
@spec list(client :: map(), params :: map() | keyword() | [{String.t(), term()}]) :: {:ok, [Humaans.Resources.TimeAwayAllocation.t()]} | {:error, Humaans.Error.t()}
Lists all time_away_allocations.
Returns a list of time_away_allocations 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, time_away_allocations} = Humaans.TimeAwayAllocations.list(client)
{:ok, time_away_allocations} = Humaans.TimeAwayAllocations.list(client, %{})
@spec retrieve(client :: map(), id :: String.t()) :: {:ok, Humaans.Resources.TimeAwayAllocation.t()} | {:error, Humaans.Error.t()}
Retrieves a specific time_away_allocation by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the time_away_allocation to retrieve
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, time_away_allocation} = Humaans.TimeAwayAllocations.retrieve(client, "time_away_allocation_id")
@spec update(client :: map(), id :: String.t(), params :: map() | keyword()) :: {:ok, Humaans.Resources.TimeAwayAllocation.t()} | {:error, Humaans.Error.t()}
Updates a specific time_away_allocation by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the time_away_allocation to updateparams- Map of attributes to update
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{amount: 30}
{:ok, time_away_allocation} = Humaans.TimeAwayAllocations.update(client, "time_away_allocation_id", params)