Attio
An Elixir client for the Attio REST API.
Installation
Add attio to your dependencies in mix.exs:
def deps do
[
{:attio, "~> 0.2.0"}
]
endUsage
client = Attio.Client.new(api_key: System.fetch_env!("ATTIO_API_KEY"))
# List people
{:ok, response} = Attio.Records.list(client, "people")
# Stream all companies across pages
companies =
client
|> Attio.Records.stream("companies")
|> Enum.to_list()
# Create a person record
{:ok, record} =
Attio.Records.create(client, "people", %{
"name" => [%{"first_name" => "Alice", "last_name" => "Smith"}],
"email_addresses" => [%{"email_address" => "alice@example.com"}]
})
# Upsert (assert) a record
{:ok, %{"action" => action}} =
Attio.Records.assert(client, "people", %{
"email_addresses" => [%{"email_address" => "alice@example.com"}]
})
All functions return {:ok, response} or {:error, %Attio.Error{}}. See the
Attio module for a full resource reference and the Attio API docs
for attribute value formats.
Development
Prerequisites
This project targets Elixir ~> 1.17 and OTP 25–28. The exact versions used for
development are pinned in .tool-versions:
- Erlang 28.4
- Elixir 1.19.4-otp-28
If you use asdf or mise, the correct versions will be selected automatically.
Getting started
mix deps.get # fetch dependencies
mix test # run the test suiteCode quality
mix format # auto-format source files
mix format --check-formatted # check formatting (run by CI)
mix credo --strict # static analysisGenerating documentation
mix docs
Open doc/index.html in a browser to preview the generated site.
License
Attio is released under the BSD 2-Clause license.