BambooHR.Employee (BambooHR v0.3.0)
View SourceFunctions for interacting with employee resources in the BambooHR API.
Summary
Functions
Adds a new employee.
Retrieves information about a specific employee.
Retrieves the company's employee directory.
Updates information for an existing employee.
Functions
@spec add(BambooHR.Client.t(), map()) :: BambooHR.Client.response()
Adds a new employee.
Parameters
client
- Client configuration created withBambooHR.Client.new/1
employee_data
- Map containing the employee information (firstName and lastName are required)
Examples
iex> employee_data = %{"firstName" => "Jane", "lastName" => "Smith"}
iex> BambooHR.Employee.add(client, employee_data)
{:ok, %{"id" => 124}}
@spec get(BambooHR.Client.t(), integer(), [String.t()]) :: BambooHR.Client.response()
Retrieves information about a specific employee.
Parameters
client
- Client configuration created withBambooHR.Client.new/1
employee_id
- The ID of the employee to retrievefields
- List of field names to retrieve (e.g., ["firstName", "lastName", "jobTitle"])
Examples
iex> BambooHR.Employee.get(client, 123, ["firstName", "lastName", "jobTitle"])
{:ok, %{
"firstName" => "John",
"lastName" => "Doe",
"jobTitle" => "Software Engineer"
}}
@spec get_directory(BambooHR.Client.t()) :: BambooHR.Client.response()
Retrieves the company's employee directory.
Returns a list of all employees with basic information like name and contact details.
Parameters
client
- Client configuration created withBambooHR.Client.new/1
Examples
iex> BambooHR.Employee.get_directory(client)
{:ok, %{
"employees" => [
%{
"id" => 123,
"displayName" => "John Doe",
"jobTitle" => "Developer",
"workEmail" => "john@example.com"
}
]
}}
@spec update(BambooHR.Client.t(), integer(), map()) :: BambooHR.Client.response()
Updates information for an existing employee.
Parameters
client
- Client configuration created withBambooHR.Client.new/1
employee_id
- The ID of the employee to updateemployee_data
- Map containing the updated employee information
Examples
iex> update_data = %{"firstName" => "Jane", "lastName" => "Smith-Jones"}
iex> BambooHR.Employee.update(client, 124, update_data)
{:ok, %{}}