BambooHR.Employee (BambooHR v0.3.0)

View Source

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

add(client, employee_data)

Adds a new employee.

Parameters

  • client - Client configuration created with BambooHR.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}}

get(client, employee_id, fields)

Retrieves information about a specific employee.

Parameters

  • client - Client configuration created with BambooHR.Client.new/1
  • employee_id - The ID of the employee to retrieve
  • fields - 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"
}}

get_directory(client)

@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

Examples

iex> BambooHR.Employee.get_directory(client)
{:ok, %{
  "employees" => [
    %{
      "id" => 123,
      "displayName" => "John Doe",
      "jobTitle" => "Developer",
      "workEmail" => "john@example.com"
    }
  ]
}}

update(client, employee_id, employee_data)

Updates information for an existing employee.

Parameters

  • client - Client configuration created with BambooHR.Client.new/1
  • employee_id - The ID of the employee to update
  • employee_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, %{}}