@internxt/sdk 1.17.9 → 1.17.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -102,9 +102,30 @@ export declare class MailApi {
102
102
  * Saves a draft email
103
103
  *
104
104
  * @param body - The body of the draft email to save
105
- * @returns The created email - `EmailCreatedResponse`
105
+ * @returns The created email - `EmailResponse`
106
106
  */
107
- saveDraft(body: DraftEmailRequest): Promise<EmailCreatedResponse>;
107
+ saveDraft(body: DraftEmailRequest): Promise<EmailResponse>;
108
+ /**
109
+ * Updates the draft with the corresponding id
110
+ *
111
+ * @param id - The id of the draft to update
112
+ * @param body - The new body of the draft
113
+ * @returns The new Draft Id for this email
114
+ */
115
+ updateDraft(id: string, body: DraftEmailRequest): Promise<EmailResponse>;
116
+ /**
117
+ * Gets the draft with the corresponding id
118
+ *
119
+ * @param id - The id of the draft
120
+ * @returns The draft with the corresponding id - `EmailResponse`
121
+ */
122
+ getDraft(id: string): Promise<EmailResponse>;
123
+ /**
124
+ * Discards an existent mail draft
125
+ * @param id - The id of the draft we want to discard
126
+ * @returns A promise that resolves when the draft is discarded
127
+ */
128
+ discardDraft(id: string): Promise<void>;
108
129
  /**
109
130
  * Returns the list of active domains for the email gateway
110
131
  *
@@ -138,11 +138,38 @@ class MailApi {
138
138
  * Saves a draft email
139
139
  *
140
140
  * @param body - The body of the draft email to save
141
- * @returns The created email - `EmailCreatedResponse`
141
+ * @returns The created email - `EmailResponse`
142
142
  */
143
143
  saveDraft(body) {
144
144
  return this.client.post('/email/drafts', body, this.headers());
145
145
  }
146
+ /**
147
+ * Updates the draft with the corresponding id
148
+ *
149
+ * @param id - The id of the draft to update
150
+ * @param body - The new body of the draft
151
+ * @returns The new Draft Id for this email
152
+ */
153
+ updateDraft(id, body) {
154
+ return this.client.patch(`/email/drafts/${id}`, body, this.headers());
155
+ }
156
+ /**
157
+ * Gets the draft with the corresponding id
158
+ *
159
+ * @param id - The id of the draft
160
+ * @returns The draft with the corresponding id - `EmailResponse`
161
+ */
162
+ getDraft(id) {
163
+ return this.client.get(`/email/drafts/${id}`, this.headers());
164
+ }
165
+ /**
166
+ * Discards an existent mail draft
167
+ * @param id - The id of the draft we want to discard
168
+ * @returns A promise that resolves when the draft is discarded
169
+ */
170
+ discardDraft(id) {
171
+ return this.client.delete(`/email/drafts/${id}`, this.headers());
172
+ }
146
173
  /**
147
174
  * Returns the list of active domains for the email gateway
148
175
  *
@@ -68,7 +68,7 @@ export interface paths {
68
68
  };
69
69
  /**
70
70
  * List emails
71
- * @description Paginated list of email summaries. Filter by mailbox or omit to list all.
71
+ * @description Paginated list of email summaries. Filter by mailbox or omit to list all. Responses collapse by thread in every mailbox except `drafts`: each row represents the most recent email of the thread in that mailbox and carries `threadSize`, `lastReceivedAt` and `participants` (cross-mailbox).
72
72
  */
73
73
  get: operations['EmailController_list'];
74
74
  put?: never;
@@ -170,7 +170,7 @@ export interface paths {
170
170
  put?: never;
171
171
  /**
172
172
  * Save a draft
173
- * @description Creates a new draft email. All fields are optional so partial drafts can be saved.
173
+ * @description Creates a new draft email. All fields are optional so partial drafts can be saved. Pass `encryption` to store the body encrypted only with the sender's key — the sender is the only reader and can decrypt it on retrieval.
174
174
  */
175
175
  post: operations['EmailController_saveDraft'];
176
176
  delete?: never;
@@ -179,6 +179,34 @@ export interface paths {
179
179
  patch?: never;
180
180
  trace?: never;
181
181
  };
182
+ '/email/drafts/{id}': {
183
+ parameters: {
184
+ query?: never;
185
+ header?: never;
186
+ path?: never;
187
+ cookie?: never;
188
+ };
189
+ /**
190
+ * Get a draft
191
+ * @description Returns a draft
192
+ */
193
+ get: operations['EmailController_getDraft'];
194
+ put?: never;
195
+ post?: never;
196
+ /**
197
+ * Discard a draft
198
+ * @description Permanently discards a draft by ID. Returns 404 if the email exists but is not a draft.
199
+ */
200
+ delete: operations['EmailController_discardDraft'];
201
+ options?: never;
202
+ head?: never;
203
+ /**
204
+ * Update a draft
205
+ * @description Updates a draft email. All fields are optional so partial drafts can be saved. Pass `encryption` with a fresh envelope to replace the stored body — the previous envelope is dropped together with the destroyed draft.
206
+ */
207
+ patch: operations['EmailController_updateDraft'];
208
+ trace?: never;
209
+ };
182
210
  '/email/attachment': {
183
211
  parameters: {
184
212
  query?: never;
@@ -430,6 +458,8 @@ export interface components {
430
458
  /** @example false */
431
459
  isFlagged: boolean;
432
460
  /** @example false */
461
+ isDraft: boolean;
462
+ /** @example false */
433
463
  hasAttachment: boolean;
434
464
  /**
435
465
  * @description Size in bytes
@@ -438,6 +468,18 @@ export interface components {
438
468
  size: number;
439
469
  /** @description Present only for encrypted emails. Carries the encrypted preview and the de-identified wrapped keys for inline client-side decryption. */
440
470
  encryption?: components['schemas']['EncryptedSummaryDto'] | null;
471
+ /**
472
+ * @description Total number of emails in the thread (cross-mailbox). Set only when the list collapses threads.
473
+ * @example 3
474
+ */
475
+ threadSize?: number;
476
+ /**
477
+ * @description receivedAt of the most recent email in the thread (cross-mailbox). Set only when the list collapses threads.
478
+ * @example 2025-06-15T10:30:00Z
479
+ */
480
+ lastReceivedAt?: string;
481
+ /** @description Unique senders that have written in the thread (cross-mailbox), deduplicated by email. Set only when the list collapses threads. */
482
+ participants?: components['schemas']['EmailAddressDto'][];
441
483
  };
442
484
  EmailListResponseDto: {
443
485
  emails: components['schemas']['EmailSummaryResponseDto'][];
@@ -524,6 +566,8 @@ export interface components {
524
566
  /** @example false */
525
567
  isFlagged: boolean;
526
568
  /** @example false */
569
+ isDraft: boolean;
570
+ /** @example false */
527
571
  hasAttachment: boolean;
528
572
  /**
529
573
  * @description Size in bytes
@@ -532,6 +576,18 @@ export interface components {
532
576
  size: number;
533
577
  /** @description Present only for encrypted emails. Carries the encrypted preview and the de-identified wrapped keys for inline client-side decryption. */
534
578
  encryption?: components['schemas']['EncryptedSummaryDto'] | null;
579
+ /**
580
+ * @description Total number of emails in the thread (cross-mailbox). Set only when the list collapses threads.
581
+ * @example 3
582
+ */
583
+ threadSize?: number;
584
+ /**
585
+ * @description receivedAt of the most recent email in the thread (cross-mailbox). Set only when the list collapses threads.
586
+ * @example 2025-06-15T10:30:00Z
587
+ */
588
+ lastReceivedAt?: string;
589
+ /** @description Unique senders that have written in the thread (cross-mailbox), deduplicated by email. Set only when the list collapses threads. */
590
+ participants?: components['schemas']['EmailAddressDto'][];
535
591
  cc: components['schemas']['EmailAddressDto'][];
536
592
  bcc: components['schemas']['EmailAddressDto'][];
537
593
  replyTo: components['schemas']['EmailAddressDto'][];
@@ -616,6 +672,11 @@ export interface components {
616
672
  * @example Ma1f09b…
617
673
  */
618
674
  inReplyToEmailId?: string;
675
+ /**
676
+ * @description JMAP id of the draft being sent. When present, the draft is destroyed after the email is sent so it no longer appears in the Drafts folder.
677
+ * @example Ma1f09b…
678
+ */
679
+ draftId?: string;
619
680
  };
620
681
  EmailCreatedResponseDto: {
621
682
  /**
@@ -634,6 +695,8 @@ export interface components {
634
695
  textBody?: string;
635
696
  /** @example <p>Still working on this…</p> */
636
697
  htmlBody?: string;
698
+ /** @description When present, the draft body is stored encrypted. Only the sender can decrypt it later, so wrappedKeys / attachmentWrappedKeys should contain a single entry built from the sender's own public key. */
699
+ encryption?: components['schemas']['EncryptionBlockDto'];
637
700
  attachments?: components['schemas']['AttachmentRefDto'][];
638
701
  };
639
702
  UploadAttachmentResponseDto: {
@@ -944,9 +1007,99 @@ export interface operations {
944
1007
  [name: string]: unknown;
945
1008
  };
946
1009
  content: {
947
- 'application/json': components['schemas']['EmailCreatedResponseDto'];
1010
+ 'application/json': components['schemas']['EmailResponseDto'];
1011
+ };
1012
+ };
1013
+ };
1014
+ };
1015
+ EmailController_getDraft: {
1016
+ parameters: {
1017
+ query?: never;
1018
+ header?: never;
1019
+ path: {
1020
+ /** @description Draft ID */
1021
+ id: string;
1022
+ };
1023
+ cookie?: never;
1024
+ };
1025
+ requestBody?: never;
1026
+ responses: {
1027
+ 200: {
1028
+ headers: {
1029
+ [name: string]: unknown;
1030
+ };
1031
+ content: {
1032
+ 'application/json': components['schemas']['EmailResponseDto'];
948
1033
  };
949
1034
  };
1035
+ /** @description Draft not found */
1036
+ 404: {
1037
+ headers: {
1038
+ [name: string]: unknown;
1039
+ };
1040
+ content?: never;
1041
+ };
1042
+ };
1043
+ };
1044
+ EmailController_discardDraft: {
1045
+ parameters: {
1046
+ query?: never;
1047
+ header?: never;
1048
+ path: {
1049
+ /** @description Draft ID */
1050
+ id: string;
1051
+ };
1052
+ cookie?: never;
1053
+ };
1054
+ requestBody?: never;
1055
+ responses: {
1056
+ /** @description Draft discarded successfully */
1057
+ 204: {
1058
+ headers: {
1059
+ [name: string]: unknown;
1060
+ };
1061
+ content?: never;
1062
+ };
1063
+ /** @description Draft not found */
1064
+ 404: {
1065
+ headers: {
1066
+ [name: string]: unknown;
1067
+ };
1068
+ content?: never;
1069
+ };
1070
+ };
1071
+ };
1072
+ EmailController_updateDraft: {
1073
+ parameters: {
1074
+ query?: never;
1075
+ header?: never;
1076
+ path: {
1077
+ id: string;
1078
+ };
1079
+ cookie?: never;
1080
+ };
1081
+ requestBody: {
1082
+ content: {
1083
+ 'application/json': components['schemas']['DraftEmailRequestDto'];
1084
+ };
1085
+ };
1086
+ responses: {
1087
+ /** @description Draft updated successfully */
1088
+ 200: {
1089
+ headers: {
1090
+ [name: string]: unknown;
1091
+ };
1092
+ content: {
1093
+ 'application/json': components['schemas']['EmailResponseDto'];
1094
+ };
1095
+ };
1096
+ /** @description Draft not found */
1097
+ 404: {
1098
+ headers: {
1099
+ [name: string]: unknown;
1100
+ };
1101
+ content?: never;
1102
+ };
950
1103
  };
951
1104
  };
952
1105
  EmailController_uploadAttachment: {
@@ -11,6 +11,8 @@ export type LookupRecipientKeysRequest = components['schemas']['LookupRecipientK
11
11
  export type LookupRecipientKeysResponse = components['schemas']['LookupRecipientKeysResponseDto'];
12
12
  export type RecipientKey = components['schemas']['RecipientKeyDto'];
13
13
  export type DraftEmailRequest = components['schemas']['DraftEmailRequestDto'];
14
+ export type GetDraftPayload = operations['EmailController_getDraft']['parameters']['query'];
15
+ export type DiscardDraftPayload = operations['EmailController_discardDraft']['parameters']['query'];
14
16
  export type UpdateEmailRequest = components['schemas']['UpdateEmailRequestDto'];
15
17
  export type EmailAddress = components['schemas']['EmailAddressDto'];
16
18
  export type ListEmailsQuery = operations['EmailController_list']['parameters']['query'];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@internxt/sdk",
3
3
  "author": "Internxt <hello@internxt.com>",
4
- "version": "1.17.9",
4
+ "version": "1.17.11",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",