https://github.com/sgerrand/ex_humaans
An Elixir client for the Humaans API
https://github.com/sgerrand/ex_humaans
api-client api-client-elixir elixir-package humaans
Last synced: 3 months ago
JSON representation
An Elixir client for the Humaans API
- Host: GitHub
- URL: https://github.com/sgerrand/ex_humaans
- Owner: sgerrand
- License: mit
- Created: 2024-09-26T16:11:20.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-03-04T16:32:53.000Z (4 months ago)
- Last Synced: 2025-03-09T17:50:21.585Z (4 months ago)
- Topics: api-client, api-client-elixir, elixir-package, humaans
- Language: Elixir
- Homepage: https://hexdocs.pm/humaans
- Size: 155 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Humaans
[](https://hex.pm/packages/humaans) [](https://hexdocs.pm/humaans/)
An Elixir client for the [Humaans API][humaans-api-docs].
## Installation
The package can be installed by adding `humaans` to your list of dependencies in
`mix.exs`:```elixir
def deps do
[
{:humaans, "~> 0.4"}
]
end
```## Usage
To use this client with the Humaans API, you'll need to generate an API access token in the Humaans application.
### Client-based approach
The recommended way to use this library is to instantiate a client first:
```elixir
# Create a client with your access token
client = Humaans.new(access_token: "YOUR_ACCESS_TOKEN")# Make API requests passing the client as the first argument
{:ok, people} = Humaans.People.list(client)
{:ok, person} = Humaans.People.retrieve(client, "person_id")
{:ok, company} = Humaans.Companies.retrieve(client, "company_id")
```This approach allows you to create multiple clients with different access tokens and use them independently.
### Module access helpers
The library provides convenience functions to access the different resource modules:
```elixir
client = Humaans.new(access_token: "YOUR_ACCESS_TOKEN")# Use the module access helpers
{:ok, people} = Humaans.people().list(client)
{:ok, accounts} = Humaans.bank_accounts().list(client)
{:ok, companies} = Humaans.companies().list(client)
```### Available resources
- `Humaans.People` - Work with people resources
- `Humaans.BankAccounts` - Work with bank account resources
- `Humaans.Companies` - Work with company resources
- `Humaans.CompensationTypes` - Work with compensation type resources
- `Humaans.Compensations` - Work with compensation resources
- `Humaans.TimesheetEntries` - Work with timesheet entry resources
- `Humaans.TimesheetSubmissions` - Work with timesheet submission resources## License
Humaans is [released under the MIT license](LICENSE).
[humaans-api-docs]: https://docs.humaans.io/api/