Attio.Attributes (Attio v0.2.0)

Copy Markdown View Source

Functions for managing attributes on objects and lists.

Attributes are the typed properties that define the shape of records and list entries. Both system-defined (e.g. email_addresses on people) and user-defined attributes are accessible through these functions.

Targets

Attributes belong to either an object or a list, identified by the target parameter:

  • :objects – attributes on an object (e.g. people, companies)
  • :lists – attributes on a list

Scopes

Requires object_configuration:read or list_configuration:read for reads, and their :read-write counterparts for mutations.

Summary

Functions

Creates an attribute on an object or list.

Gets a single attribute by its ID or slug.

Lists attributes on an object or list.

Updates an attribute's configuration.

Types

target()

@type target() :: :objects | :lists

Functions

create(client, target, identifier, attrs)

@spec create(Attio.Client.t(), target(), String.t(), map()) ::
  {:ok, map()} | {:error, term()}

Creates an attribute on an object or list.

Required attributes

  • "api_slug" - URL-safe identifier for the attribute.
  • "title" - Human-readable name.
  • "type" - Attribute type. One of: "text", "number", "checkbox", "currency", "date", "timestamp", "rating", "status", "select", "record-reference", "actor-reference", "location", "domain", "email-address", "phone-number".

Example

Attio.Attributes.create(client, :objects, "people", %{
  "api_slug" => "linkedin_url",
  "title" => "LinkedIn URL",
  "type" => "text"
})

delete(client, target, identifier, attribute_id)

@spec delete(Attio.Client.t(), target(), String.t(), String.t()) ::
  {:ok, map()} | {:error, term()}

Deletes a custom attribute.

System-defined attributes cannot be deleted and will return a 403 error.

Example

Attio.Attributes.delete(client, :objects, "people", "linkedin_url")

get(client, target, identifier, attribute_id)

@spec get(Attio.Client.t(), target(), String.t(), String.t()) ::
  {:ok, map()} | {:error, term()}

Gets a single attribute by its ID or slug.

Example

Attio.Attributes.get(client, :objects, "people", "email_addresses")

list(client, target, identifier, params \\ [])

@spec list(Attio.Client.t(), target(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

Lists attributes on an object or list.

Options

  • :limit - Maximum number of attributes to return.
  • :offset - Number of attributes to skip (offset-based pagination).

Example

Attio.Attributes.list(client, :objects, "people")

update(client, target, identifier, attribute_id, attrs)

@spec update(Attio.Client.t(), target(), String.t(), String.t(), map()) ::
  {:ok, map()} | {:error, term()}

Updates an attribute's configuration.

Only the supplied fields are changed; others are left untouched.

Example

Attio.Attributes.update(client, :objects, "people", "linkedin_url", %{
  "title" => "LinkedIn Profile"
})