Current section

Files

Jump to
humaans lib humaans.ex
Raw

lib/humaans.ex

defmodule Humaans do
@moduledoc """
A client for the Humaans API.
"""
alias Humaans.{BankAccounts, Companies, CompensationTypes, Compensations}
@doc """
Creates a new client with the given base URL and API key.
"""
def new(base_url, api_key) do
http_client = Req.new(base_url: base_url)
|> Req.Request.put_header("authorization", "Bearer #{api_key}")
%{
http_client: http_client,
bank_accounts: BankAccounts.new(http_client),
companies: Companies.new(http_client),
compensation_types: CompensationTypes.new(http_client),
compensations: Compensations.new(http_client)
}
end
end