Interface IUserMailHistoryService
- Namespace
- Tharga.Team
- Assembly
- Tharga.Team.dll
The mail sent to one user — messages, notices, mail queued on its own and invitations — read by that user or by staff holding Manage.
public interface IUserMailHistoryService
Remarks
Checked in the service, not by scope attributes, because the rule is "your own, or anyone's with
users:manage", which a scope alone cannot say. A caller who is neither is refused with
UnauthorizedAccessException, and the refusal is audited; staff reading someone else's history is
audited too, with how many mails were read and never an address.
A user's history holds every mail queued for their key, and every mail queued to their current address alone, such as the invitation that brought them in. It reaches back as far as the queue keeps mail.
Methods
GetForUserAsync(string, string, int, CancellationToken)
One page of the mail sent to the user with this key, newest first.
Task<UserMailHistoryPage> GetForUserAsync(string userKey, string cursor = null, int pageSize = 20, CancellationToken cancellationToken = default)
Parameters
userKeystringcursorstringpageSizeintcancellationTokenCancellationToken
Returns
Exceptions
- ArgumentException
The user key is empty, or the cursor was not issued for this list.
- UnauthorizedAccessException
The caller is not this user and does not hold
users:manage.
GetMineAsync(string, int, CancellationToken)
One page of the mail sent to the signed-in user, newest first; empty when nobody is signed in.
Task<UserMailHistoryPage> GetMineAsync(string cursor = null, int pageSize = 20, CancellationToken cancellationToken = default)
Parameters
cursorstringpageSizeintcancellationTokenCancellationToken
Returns
Exceptions
- ArgumentException
The cursor was not issued for this list.
ListAllAsync(UserMailFilter, string, int, CancellationToken)
One page of all mail the application sent or tried to send — to users and, for staff messages to contacts, to addresses
alone — newest first and narrowed by filter, for staff holding Manage.
Task<UserMailHistoryPage> ListAllAsync(UserMailFilter filter = null, string cursor = null, int pageSize = 50, CancellationToken cancellationToken = default)
Parameters
filterUserMailFiltercursorstringpageSizeintcancellationTokenCancellationToken
Returns
Remarks
Read by staff only, never by the user the mail is for: it is audited with how many mails were read and never an address, and a refusal is audited too. Bodies and files are not returned. Each item names the user it is for when it is for one, and the team when the mail records one.
Exceptions
- ArgumentException
The cursor was not issued for this list.
- UnauthorizedAccessException
The caller does not hold
users:manage.