Manage Codat companies (your customers).
A company represents a customer's business entity. Every piece of financial data is scoped to a company.
Example
{:ok, company} = Codat.Platform.Companies.create(client, %{name: "Acme Corp"})
redirect_to(company["redirect"])
Summary
Functions
@spec create(Codat.Client.t() | map(), map() | keyword()) :: {:ok, map()} | {:error, Codat.Error.t()}
Creates a new company.
Example
{:ok, company} = Codat.Platform.Companies.create(client, %{
name: "Acme Corp",
tags: %{"tenant_id" => "t_123"}
})
@spec delete(Codat.Client.t() | String.t(), String.t() | keyword()) :: {:ok, nil} | {:error, Codat.Error.t()}
Permanently deletes a company and all its data.
@spec get(Codat.Client.t() | String.t(), String.t() | keyword()) :: {:ok, map()} | {:error, Codat.Error.t()}
Fetches a single company by ID.
@spec get_access_token(Codat.Client.t() | String.t(), String.t() | keyword()) :: {:ok, map()} | {:error, Codat.Error.t()}
Generates a short-lived access token for the Link flow.
@spec list( Codat.Client.t() | keyword(), keyword() ) :: {:ok, Codat.Pagination.t()} | {:error, Codat.Error.t()}
Returns a paginated list of companies.
Options
:page,:page_size— pagination:query— filter string:order_by— sort field:tags— filter by tag, e.g."region:us-east-1"
@spec stream( Codat.Client.t() | keyword(), keyword() ) :: Enumerable.t()
Returns a lazy Stream of all companies.
@spec update(Codat.Client.t() | String.t(), String.t() | map(), map() | keyword()) :: {:ok, map()} | {:error, Codat.Error.t()}
Updates a company's name, description, or tags.
Warning: Always include all tags you wish to retain. An empty
tagsmap removes all existing tags.