Table of Contents

Interface ITeamMailboxService

Namespace
Tharga.Team
Assembly
Tharga.Team.dll

A team's mailbox: its address, and the mail that arrived at it.

public interface ITeamMailboxService

Remarks

Wholly team-bound. Every operation names its team first, and a mail id alone never reaches a mail — the store requires the team too — so holding an id from another team reaches nothing.

Operations, not CRUD. Issuing a key, rotating it and recording what became of a mail are separate facts under separate scopes. Nothing here registers a mail anywhere: what a mail becomes is the host's, and SetOutcomeAsync(string, string, string, MailThreadOwner, CancellationToken) only records the host's answer.

Methods

EnsureKeyAsync(string, CancellationToken)

Issues the team's first key; does nothing when it already has one.

[RequireScope("mailbox:manage", Audit = AuditMode.Change)]
Task<TeamMailAddresses> EnsureKeyAsync(string teamKey, CancellationToken cancellationToken = default)

Parameters

teamKey string
cancellationToken CancellationToken

Returns

Task<TeamMailAddresses>

GetAddressesAsync(string, CancellationToken)

The team's keys and addresses; Primary is null before a key is issued.

[RequireScope("mailbox:read")]
Task<TeamMailAddresses> GetAddressesAsync(string teamKey, CancellationToken cancellationToken = default)

Parameters

teamKey string
cancellationToken CancellationToken

Returns

Task<TeamMailAddresses>

GetContentAsync(string, string, CancellationToken)

The mail as it arrived, or null when the team has none by this id.

[RequireScope("mailbox:read", Audit = AuditMode.Access)]
Task<MailContent> GetContentAsync(string teamKey, string mailId, CancellationToken cancellationToken = default)

Parameters

teamKey string
mailId string
cancellationToken CancellationToken

Returns

Task<MailContent>

GetItemAddressAsync(string, string, CancellationToken)

The address of an item inside the team — {key}{suffix}+{itemKey}@{domain} on the primary key — or null when the team has no key yet.

[RequireScope("mailbox:read")]
Task<string> GetItemAddressAsync(string teamKey, string itemKey, CancellationToken cancellationToken = default)

Parameters

teamKey string
itemKey string
cancellationToken CancellationToken

Returns

Task<string>

GetMailAsync(string, string, CancellationToken)

One mail, or null when the team has none by this id.

[RequireScope("mailbox:read", Audit = AuditMode.Access)]
Task<InboundMailItem> GetMailAsync(string teamKey, string mailId, CancellationToken cancellationToken = default)

Parameters

teamKey string
mailId string
cancellationToken CancellationToken

Returns

Task<InboundMailItem>

GetUnhandledCountAsync(string, CancellationToken)

How many of the team's mails nobody has handled.

[RequireScope("mailbox:read")]
Task<int> GetUnhandledCountAsync(string teamKey, CancellationToken cancellationToken = default)

Parameters

teamKey string
cancellationToken CancellationToken

Returns

Task<int>

ListMailAsync(string, InboundMailFilter, string, int, CancellationToken)

A page of the team's mail, newest first.

[RequireScope("mailbox:read")]
Task<InboundMailPage> ListMailAsync(string teamKey, InboundMailFilter filter = InboundMailFilter.Unhandled, string cursor = null, int pageSize = 50, CancellationToken cancellationToken = default)

Parameters

teamKey string
filter InboundMailFilter
cursor string
pageSize int
cancellationToken CancellationToken

Returns

Task<InboundMailPage>

RotateKeyAsync(string, CancellationToken)

Makes a new primary key and keeps the current one as the secondary until it retires; a previous secondary retires at once.

[RequireScope("mailbox:manage", Audit = AuditMode.Change)]
Task<TeamMailAddresses> RotateKeyAsync(string teamKey, CancellationToken cancellationToken = default)

Parameters

teamKey string
cancellationToken CancellationToken

Returns

Task<TeamMailAddresses>

SetOutcomeAsync(string, string, string, MailThreadOwner, CancellationToken)

Records what became of a mail and what it belongs to; a null outcome returns it to the unhandled mail.

[RequireScope("mailbox:handle", Audit = AuditMode.Change)]
Task<InboundMailItem> SetOutcomeAsync(string teamKey, string mailId, string outcome, MailThreadOwner owner = null, CancellationToken cancellationToken = default)

Parameters

teamKey string
mailId string
outcome string
owner MailThreadOwner
cancellationToken CancellationToken

Returns

Task<InboundMailItem>