Company management: create, list, iterate, get, update and remove.
CorvoNfse.Resources.Companies.create(client, %{
"legalName" => "Acme Ltda",
"taxId" => "12345678000199",
"taxRegime" => "Simples Nacional"
})
Summary
Functions
Creates a company (POST /v1/companies).
Reads one company (GET /v1/companies/:id).
Lazily iterates every company across pages.
Lists companies (GET /v1/companies) with cursor pagination.
Deletes a company (DELETE /v1/companies/:id); 204 yields {:ok, nil}.
Updates a company (PATCH /v1/companies/:id).
Types
@type list_option() :: {:limit, pos_integer()} | {:cursor, String.t()}
Functions
@spec create(CorvoNfse.Client.t(), CorvoNfse.Types.Company.create_params()) :: {:ok, map()} | {:error, CorvoNfse.Error.t()}
Creates a company (POST /v1/companies).
@spec get(CorvoNfse.Client.t(), String.t()) :: {:ok, map()} | {:error, CorvoNfse.Error.t()}
Reads one company (GET /v1/companies/:id).
@spec iterate(CorvoNfse.Client.t(), [list_option()]) :: {:ok, Enumerable.t()} | {:error, CorvoNfse.Error.t()}
Lazily iterates every company across pages.
The first page is fetched eagerly: {:error, error} means it failed and
nothing was produced; {:ok, stream} yields companies one by one. A failure
in a later page raises the %CorvoNfse.Error{} while consuming the stream.
@spec list(CorvoNfse.Client.t(), [list_option()]) :: {:ok, CorvoNfse.Types.Common.page()} | {:error, CorvoNfse.Error.t()}
Lists companies (GET /v1/companies) with cursor pagination.
Returns {:ok, %{data: [map], pagination: map}}; pagination keeps the
server's camelCase keys (limit, hasMore, nextCursor) unchanged.
@spec remove(CorvoNfse.Client.t(), String.t()) :: {:ok, nil} | {:error, CorvoNfse.Error.t()}
Deletes a company (DELETE /v1/companies/:id); 204 yields {:ok, nil}.
@spec update( CorvoNfse.Client.t(), String.t(), CorvoNfse.Types.Company.update_params() ) :: {:ok, map()} | {:error, CorvoNfse.Error.t()}
Updates a company (PATCH /v1/companies/:id).