|
1 | | -# Archived Email Service API |
| 1 | +--- |
| 2 | +aside: false |
| 3 | +--- |
2 | 4 |
|
3 | | -The Archived Email Service is responsible for retrieving archived emails and their details from the database and storage. |
| 5 | +# Archived Email API |
4 | 6 |
|
5 | | -## Endpoints |
| 7 | +Endpoints for retrieving and deleting archived emails. All endpoints require authentication and the appropriate `archive` permission. |
6 | 8 |
|
7 | | -All endpoints in this service require authentication. |
| 9 | +## List Emails for an Ingestion Source |
8 | 10 |
|
9 | | -### GET /api/v1/archived-emails/ingestion-source/:ingestionSourceId |
| 11 | +<OAOperation operationId="getArchivedEmails" /> |
10 | 12 |
|
11 | | -Retrieves a paginated list of archived emails for a specific ingestion source. |
| 13 | +## Get a Single Email |
12 | 14 |
|
13 | | -**Access:** Authenticated |
| 15 | +<OAOperation operationId="getArchivedEmailById" /> |
14 | 16 |
|
15 | | -#### URL Parameters |
| 17 | +## Delete an Email |
16 | 18 |
|
17 | | -| Parameter | Type | Description | |
18 | | -| :------------------ | :----- | :------------------------------------------------ | |
19 | | -| `ingestionSourceId` | string | The ID of the ingestion source to get emails for. | |
20 | | - |
21 | | -#### Query Parameters |
22 | | - |
23 | | -| Parameter | Type | Description | Default | |
24 | | -| :-------- | :----- | :------------------------------ | :------ | |
25 | | -| `page` | number | The page number for pagination. | 1 | |
26 | | -| `limit` | number | The number of items per page. | 10 | |
27 | | - |
28 | | -#### Responses |
29 | | - |
30 | | -- **200 OK:** A paginated list of archived emails. |
31 | | - |
32 | | - ```json |
33 | | - { |
34 | | - "items": [ |
35 | | - { |
36 | | - "id": "email-id", |
37 | | - "subject": "Test Email", |
38 | | - "from": "sender@example.com", |
39 | | - "sentAt": "2023-10-27T10:00:00.000Z", |
40 | | - "hasAttachments": true, |
41 | | - "recipients": [{ "name": "Recipient 1", "email": "recipient1@example.com" }] |
42 | | - } |
43 | | - ], |
44 | | - "total": 100, |
45 | | - "page": 1, |
46 | | - "limit": 10 |
47 | | - } |
48 | | - ``` |
49 | | - |
50 | | -- **500 Internal Server Error:** An unexpected error occurred. |
51 | | - |
52 | | -### GET /api/v1/archived-emails/:id |
53 | | - |
54 | | -Retrieves a single archived email by its ID, including its raw content and attachments. |
55 | | - |
56 | | -**Access:** Authenticated |
57 | | - |
58 | | -#### URL Parameters |
59 | | - |
60 | | -| Parameter | Type | Description | |
61 | | -| :-------- | :----- | :---------------------------- | |
62 | | -| `id` | string | The ID of the archived email. | |
63 | | - |
64 | | -#### Responses |
65 | | - |
66 | | -- **200 OK:** The archived email details. |
67 | | - |
68 | | - ```json |
69 | | - { |
70 | | - "id": "email-id", |
71 | | - "subject": "Test Email", |
72 | | - "from": "sender@example.com", |
73 | | - "sentAt": "2023-10-27T10:00:00.000Z", |
74 | | - "hasAttachments": true, |
75 | | - "recipients": [{ "name": "Recipient 1", "email": "recipient1@example.com" }], |
76 | | - "raw": "...", |
77 | | - "attachments": [ |
78 | | - { |
79 | | - "id": "attachment-id", |
80 | | - "filename": "document.pdf", |
81 | | - "mimeType": "application/pdf", |
82 | | - "sizeBytes": 12345 |
83 | | - } |
84 | | - ] |
85 | | - } |
86 | | - ``` |
87 | | - |
88 | | -- **404 Not Found:** The archived email with the specified ID was not found. |
89 | | -- **500 Internal Server Error:** An unexpected error occurred. |
90 | | - |
91 | | -## Service Methods |
92 | | - |
93 | | -### `getArchivedEmails(ingestionSourceId: string, page: number, limit: number): Promise<PaginatedArchivedEmails>` |
94 | | - |
95 | | -Retrieves a paginated list of archived emails from the database for a given ingestion source. |
96 | | - |
97 | | -- **ingestionSourceId:** The ID of the ingestion source. |
98 | | -- **page:** The page number for pagination. |
99 | | -- **limit:** The number of items per page. |
100 | | -- **Returns:** A promise that resolves to a `PaginatedArchivedEmails` object. |
101 | | - |
102 | | -### `getArchivedEmailById(emailId: string): Promise<ArchivedEmail | null>` |
103 | | - |
104 | | -Retrieves a single archived email by its ID, including its raw content and attachments. |
105 | | - |
106 | | -- **emailId:** The ID of the archived email. |
107 | | -- **Returns:** A promise that resolves to an `ArchivedEmail` object or `null` if not found. |
| 19 | +<OAOperation operationId="deleteArchivedEmail" /> |
0 commit comments