@internxt/sdk 1.17.9 → 1.17.10

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
  *
@@ -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
@@ -524,6 +554,8 @@ export interface components {
524
554
  /** @example false */
525
555
  isFlagged: boolean;
526
556
  /** @example false */
557
+ isDraft: boolean;
558
+ /** @example false */
527
559
  hasAttachment: boolean;
528
560
  /**
529
561
  * @description Size in bytes
@@ -616,6 +648,11 @@ export interface components {
616
648
  * @example Ma1f09b…
617
649
  */
618
650
  inReplyToEmailId?: string;
651
+ /**
652
+ * @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.
653
+ * @example Ma1f09b…
654
+ */
655
+ draftId?: string;
619
656
  };
620
657
  EmailCreatedResponseDto: {
621
658
  /**
@@ -634,6 +671,8 @@ export interface components {
634
671
  textBody?: string;
635
672
  /** @example <p>Still working on this…</p> */
636
673
  htmlBody?: string;
674
+ /** @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. */
675
+ encryption?: components['schemas']['EncryptionBlockDto'];
637
676
  attachments?: components['schemas']['AttachmentRefDto'][];
638
677
  };
639
678
  UploadAttachmentResponseDto: {
@@ -944,8 +983,98 @@ export interface operations {
944
983
  [name: string]: unknown;
945
984
  };
946
985
  content: {
947
- 'application/json': components['schemas']['EmailCreatedResponseDto'];
986
+ 'application/json': components['schemas']['EmailResponseDto'];
987
+ };
988
+ };
989
+ };
990
+ };
991
+ EmailController_getDraft: {
992
+ parameters: {
993
+ query?: never;
994
+ header?: never;
995
+ path: {
996
+ /** @description Draft ID */
997
+ id: string;
998
+ };
999
+ cookie?: never;
1000
+ };
1001
+ requestBody?: never;
1002
+ responses: {
1003
+ 200: {
1004
+ headers: {
1005
+ [name: string]: unknown;
948
1006
  };
1007
+ content: {
1008
+ 'application/json': components['schemas']['EmailResponseDto'];
1009
+ };
1010
+ };
1011
+ /** @description Draft not found */
1012
+ 404: {
1013
+ headers: {
1014
+ [name: string]: unknown;
1015
+ };
1016
+ content?: never;
1017
+ };
1018
+ };
1019
+ };
1020
+ EmailController_discardDraft: {
1021
+ parameters: {
1022
+ query?: never;
1023
+ header?: never;
1024
+ path: {
1025
+ /** @description Draft ID */
1026
+ id: string;
1027
+ };
1028
+ cookie?: never;
1029
+ };
1030
+ requestBody?: never;
1031
+ responses: {
1032
+ /** @description Draft discarded successfully */
1033
+ 204: {
1034
+ headers: {
1035
+ [name: string]: unknown;
1036
+ };
1037
+ content?: never;
1038
+ };
1039
+ /** @description Draft not found */
1040
+ 404: {
1041
+ headers: {
1042
+ [name: string]: unknown;
1043
+ };
1044
+ content?: never;
1045
+ };
1046
+ };
1047
+ };
1048
+ EmailController_updateDraft: {
1049
+ parameters: {
1050
+ query?: never;
1051
+ header?: never;
1052
+ path: {
1053
+ id: string;
1054
+ };
1055
+ cookie?: never;
1056
+ };
1057
+ requestBody: {
1058
+ content: {
1059
+ 'application/json': components['schemas']['DraftEmailRequestDto'];
1060
+ };
1061
+ };
1062
+ responses: {
1063
+ /** @description Draft updated successfully */
1064
+ 200: {
1065
+ headers: {
1066
+ [name: string]: unknown;
1067
+ };
1068
+ content: {
1069
+ 'application/json': components['schemas']['EmailResponseDto'];
1070
+ };
1071
+ };
1072
+ /** @description Draft not found */
1073
+ 404: {
1074
+ headers: {
1075
+ [name: string]: unknown;
1076
+ };
1077
+ content?: never;
949
1078
  };
950
1079
  };
951
1080
  };
@@ -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.10",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",