Functions 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.
BambooHR returns no response body for this endpoint — the created
employee is identified only by the Location header, which points to
the employee's page in the BambooHR web app (and includes the new
employee's ID). This function surfaces that header as "location"; if
the upstream response has no Location header, the result is {:ok, %{}}.
Parameters
client- Client configuration created withBambooHR.Client.new/1employee_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, %{"location" => "https://acme.bamboohr.com/employees/employee.php?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/1employee_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/1employee_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, %{}}