Kantoor.Provisioning.Mailboxes (Kantoor v1.0.0)

Mailboxes for the provisioning API. See Kantoor.Provisioning.

A mailbox is named by its address, which is its natural key: creating an address that exists in the same domain returns it. This interface makes mailboxes only: aliases and the catch-all are managed by the domain's administrators in the domain settings (Kantoor.Admin, Kantoor.Aliases), not by an operator key.

Summary

Functions

Deletes the mailbox with its folders and message index, its grants and identities. Karta is told to forget this instance's copies of the mail (best effort, in the background); what Karta still holds is bounded by its own retention. Deleting what is not there is :ok.

The mailbox local_part@domain of the operator's domain; nil otherwise.

The domain's mailboxes by address. Options :limit, :after (the last address). {rows, next}.

Creates local_part@domain (attrs["quota_bytes"]: the mailbox's own quota, nil for the domain default) with its default folders, or returns the one that exists. The domain must not be suspended.

Sets the mailbox's own quota (attrs["quota_bytes"], null for the domain default); held mail that now fits is released.

Bytes of visible mail per mailbox id, for the given mailboxes (0 for an empty one).

Functions

delete(key, domain_ref, local_part)

@spec delete(Kantoor.ApiKeys.ApiKey.t(), String.t(), String.t()) :: :ok

Deletes the mailbox with its folders and message index, its grants and identities. Karta is told to forget this instance's copies of the mail (best effort, in the background); what Karta still holds is bounded by its own retention. Deleting what is not there is :ok.

get(key, domain_ref, local_part)

The mailbox local_part@domain of the operator's domain; nil otherwise.

list(key, domain_ref, opts \\ [])

@spec list(Kantoor.ApiKeys.ApiKey.t(), String.t(), keyword()) ::
  {:ok, {[Kantoor.Mailboxes.Mailbox.t()], String.t() | nil}}
  | {:error, :not_found}

The domain's mailboxes by address. Options :limit, :after (the last address). {rows, next}.

put(key, domain_ref, local_part, attrs)

@spec put(Kantoor.ApiKeys.ApiKey.t(), String.t(), String.t(), map()) ::
  {:ok, Kantoor.Mailboxes.Mailbox.t(), :created | :existing} | {:error, term()}

Creates local_part@domain (attrs["quota_bytes"]: the mailbox's own quota, nil for the domain default) with its default folders, or returns the one that exists. The domain must not be suspended.

update(key, domain_ref, local_part, attrs)

@spec update(Kantoor.ApiKeys.ApiKey.t(), String.t(), String.t(), map()) ::
  {:ok, Kantoor.Mailboxes.Mailbox.t()} | {:error, term()}

Sets the mailbox's own quota (attrs["quota_bytes"], null for the domain default); held mail that now fits is released.

usages(mailboxes)

@spec usages([Kantoor.Mailboxes.Mailbox.t()]) :: %{
  required(Ecto.UUID.t()) => non_neg_integer()
}

Bytes of visible mail per mailbox id, for the given mailboxes (0 for an empty one).