BambooHR
View SourceAn Elixir client for the Bamboo HR API.
Installation
The package can be installed by adding bamboo_hr
to your
list of dependencies in mix.exs
:
def deps do
[
{:bamboo_hr, "~> 0.2"}
]
end
Usage
To use this client, you'll need information from BambooHR:
- Your company's subdomain
- An API key
API Structure
The library is organized into several modules, each representing different API resources:
BambooHR.Client
- Core client functionality and configurationBambooHR.Company
- Company information and EINsBambooHR.Employee
- Employee managementBambooHR.TimeTracking
- Time entries and timesheets
Examples
Getting Started
First, create a client configuration:
config = BambooHR.Client.new(company_domain: "your_company", api_key: "your_api_key")
You can also specify optional parameters:
config = BambooHR.Client.new(
company_domain: "your_company",
api_key: "your_api_key",
base_url: "https://custom-api.example.com",
http_client: YourCustomHTTPClient
)
Company Information
# Get basic company information
{:ok, company_info} = BambooHR.Company.get_information(config)
# Get company EINs
{:ok, eins_data} = BambooHR.Company.get_eins(config)
Employee Management
# Get employee directory
{:ok, directory} = BambooHR.Employee.get_directory(config)
# Get specific employee details
{:ok, employee} = BambooHR.Employee.get(config, 123, ["firstName", "lastName", "jobTitle"])
# Add a new employee
employee_data = %{"firstName" => "Jane", "lastName" => "Smith"}
{:ok, result} = BambooHR.Employee.add(config, employee_data)
# Update an employee
update_data = %{"firstName" => "Jane", "lastName" => "Smith-Jones"}
{:ok, _} = BambooHR.Employee.update(config, 124, update_data)
Time Tracking
# Get timesheet entries
params = %{
"start" => "2024-01-01",
"end" => "2024-01-31",
"employeeIds" => "123,124"
}
{:ok, timesheet_data} = BambooHR.TimeTracking.get_timesheet_entries(config, params)
# Clock in an employee
clock_data = %{
"date" => "2024-01-15",
"start" => "09:00",
"timezone" => "America/New_York"
}
{:ok, _} = BambooHR.TimeTracking.clock_in(config, 123, clock_data)
# Clock out an employee
clock_out_data = %{
"date" => "2024-01-15",
"end" => "17:00",
"timezone" => "America/New_York"
}
{:ok, _} = BambooHR.TimeTracking.clock_out(config, 123, clock_out_data)
License
BambooHR is released under the MIT license.