BambooHR.Client (BambooHR v0.2.0)

View Source

Client for interacting with the BambooHR API.

Configuration

To use this client, you'll need information from BambooHR:

  • Your company's subdomain
  • An API key

Usage

client = BambooHR.Client.new("your_company", "your_api_key")
{:ok, company_info} = BambooHR.Company.get_information(client)

Summary

Functions

Makes a GET request to the BambooHR API.

Creates a new client configuration.

Makes a POST request to the BambooHR API.

Types

config()

@type config() :: %{
  company_domain: String.t(),
  api_key: String.t(),
  base_url: String.t()
}

response()

@type response() :: {:ok, map()} | {:error, any()}

Functions

get(path, config, opts \\ [])

@spec get(String.t(), config(), keyword()) :: response()

Makes a GET request to the BambooHR API.

This function is meant to be used by resource modules.

new(company_domain, api_key, base_url \\ nil)

@spec new(String.t(), String.t(), String.t() | nil) :: config()

Creates a new client configuration.

Parameters

  • company_domain - Your company's subdomain
  • api_key - Your API key
  • base_url - Optional custom base URL for the API (defaults to BambooHR's standard API URL)

Examples

iex> client = BambooHR.Client.new("acme", "api_key_123")
%{
  company_domain: "acme",
  api_key: "api_key_123",
  base_url: "https://api.bamboohr.com/api/gateway.php"
}

# With custom base URL
iex> client = BambooHR.Client.new("acme", "api_key_123", "https://custom-api.example.com")
%{
  company_domain: "acme",
  api_key: "api_key_123",
  base_url: "https://custom-api.example.com"
}

post(path, config, opts)

@spec post(String.t(), config(), keyword()) :: response()

Makes a POST request to the BambooHR API.

This function is meant to be used by resource modules.