@gpt-platform/admin 0.11.1 → 0.11.2

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.
@@ -1,94 +1,278 @@
1
- import type { EmailOutboundEmail, EmailMarketingSenderProfile, EmailTrackingEvent } from "../_internal/types.gen";
1
+ import type { EmailOutboundEmail, EmailMarketingSenderProfile, EmailTrackingEvent, EmailUnsubscriber, EmailRecipient, EmailInclusion, EmailInboundAddress, EmailInboundEmail } from "../_internal/types.gen";
2
2
  import type { RequestOptions } from "../base-client";
3
3
  import { RequestBuilder } from "../request-builder";
4
- /** Attributes for creating an outbound email draft. */
5
- export type CreateOutboundEmailAttributes = {
4
+ /** Context reference type — links an email to a domain entity for history tracking. */
5
+ export type ContextRefType = "custom" | "deal" | "session" | "ticket";
6
+ /** Inclusion content category. */
7
+ export type InclusionType = "chart" | "custom" | "goal" | "metric" | "resource" | "supplement";
8
+ /** Recipient role on an outbound email. */
9
+ export type RecipientType = "to" | "cc" | "bcc";
10
+ /** Inbound email routing target. */
11
+ export type InboundRoutingTarget = "extraction" | "agent" | "invoices" | "crm";
12
+ /**
13
+ * A file attachment on an outbound email.
14
+ *
15
+ * Upload the file to platform storage first, then reference its
16
+ * `storage_key` here. Maximum 10 attachments per email.
17
+ */
18
+ export interface EmailAttachment {
19
+ /** Platform storage key returned by the upload API. */
20
+ storage_key: string;
21
+ /** Display filename shown to the recipient. */
22
+ filename: string;
23
+ /** MIME type (e.g. `"application/pdf"`). */
24
+ content_type: string;
25
+ }
26
+ /** Daily send quota record for a workspace. */
27
+ export interface EmailSendLimit {
28
+ id: string;
29
+ date: string;
6
30
  workspace_id: string;
31
+ limit_with_unsubscribe: number;
32
+ limit_without_unsubscribe: number;
33
+ sent_with_unsubscribe: number;
34
+ sent_without_unsubscribe: number;
35
+ remaining_with_unsubscribe?: number;
36
+ remaining_without_unsubscribe?: number;
37
+ inserted_at: string;
38
+ updated_at: string;
39
+ }
40
+ /**
41
+ * Attributes for creating an outbound email draft.
42
+ *
43
+ * Workspace is resolved from the authenticated actor — do not pass
44
+ * `workspace_id`.
45
+ */
46
+ export interface CreateOutboundEmailAttributes {
47
+ /** Email subject line. Required. */
7
48
  subject: string;
49
+ /** HTML body content. */
8
50
  body_html?: string;
51
+ /** Plain-text body (fallback for non-HTML clients). */
9
52
  body_text?: string;
53
+ /** Sender profile to use. Falls back to workspace default if omitted. */
54
+ sender_profile_id?: string;
55
+ /** CRM contact reference for tracking. */
10
56
  contact_ref_id?: string;
57
+ /** ID of the linked domain entity. */
11
58
  context_ref_id?: string;
12
- context_ref_type?: "custom" | "deal" | "session" | "ticket";
59
+ /** Type of the linked domain entity. */
60
+ context_ref_type?: ContextRefType;
61
+ /** Append a CAN-SPAM unsubscribe link to the email footer. */
13
62
  include_unsubscribe_link?: boolean;
63
+ /** File attachments (max 10). */
64
+ attachments?: EmailAttachment[];
65
+ }
66
+ /**
67
+ * Attributes for updating an outbound email (PATCH semantics).
68
+ *
69
+ * Only emails in `draft` status can be updated.
70
+ */
71
+ export interface UpdateOutboundEmailAttributes {
72
+ /** Updated subject line. */
73
+ subject?: string;
74
+ /** Updated HTML body. */
75
+ body_html?: string;
76
+ /** Updated plain-text body. */
77
+ body_text?: string;
78
+ /** Change the sender profile. */
14
79
  sender_profile_id?: string;
15
- attachments?: Array<Record<string, unknown>>;
16
- };
17
- /** Attributes for creating a sender profile. */
18
- export type CreateSenderProfileAttributes = {
19
- workspace_id: string;
80
+ /** Toggle unsubscribe link. */
81
+ include_unsubscribe_link?: boolean;
82
+ /** Replace the attachment list. */
83
+ attachments?: EmailAttachment[];
84
+ }
85
+ /**
86
+ * Attributes for creating a sender profile.
87
+ *
88
+ * Workspace is resolved from the authenticated actor — do not pass
89
+ * `workspace_id`.
90
+ */
91
+ export interface CreateSenderProfileAttributes {
92
+ /** Sender email address. Must be unique per workspace. */
20
93
  email: string;
94
+ /** Display name shown in the From header. */
21
95
  name: string;
96
+ /** Physical mailing address (CAN-SPAM compliance). */
22
97
  address?: string;
98
+ /** Company name for the email footer. */
23
99
  company?: string;
100
+ /** Set as the workspace default on creation. */
24
101
  is_default?: boolean;
102
+ /** Contact phone number. */
25
103
  phone?: string;
104
+ /** HTML signature block. */
26
105
  signature?: string;
27
- };
28
- /** Attributes for updating a sender profile. */
29
- export type UpdateSenderProfileAttributes = {
106
+ }
107
+ /** Attributes for updating a sender profile (PATCH semantics). */
108
+ export interface UpdateSenderProfileAttributes {
109
+ /** Updated display name. */
30
110
  name?: string;
111
+ /** Updated mailing address. */
31
112
  address?: string;
113
+ /** Updated company name. */
32
114
  company?: string;
115
+ /** DKIM selector override. */
33
116
  dkim_selector?: string;
117
+ /** Change default status. */
34
118
  is_default?: boolean;
119
+ /** Updated phone number. */
35
120
  phone?: string;
121
+ /** Updated HTML signature. */
36
122
  signature?: string;
37
- };
123
+ }
124
+ /** Attributes for adding a recipient to an outbound email. */
125
+ export interface CreateRecipientAttributes {
126
+ /** ID of the outbound email. */
127
+ outbound_email_id: string;
128
+ /** Recipient email address. */
129
+ email: string;
130
+ /** Recipient display name. */
131
+ name?: string;
132
+ /** Role: primary (`to`), carbon copy (`cc`), or blind copy (`bcc`). */
133
+ recipient_type?: RecipientType;
134
+ }
135
+ /** Attributes for attaching a structured data inclusion to a draft email. */
136
+ export interface CreateInclusionAttributes {
137
+ /** ID of the outbound email. */
138
+ outbound_email_id: string;
139
+ /** Content category. */
140
+ inclusion_type: InclusionType;
141
+ /** Platform object ID referenced by this inclusion. */
142
+ ref_id?: string;
143
+ /** Display title. */
144
+ title?: string;
145
+ /** Structured payload (shape depends on `inclusion_type`). */
146
+ data?: Record<string, unknown>;
147
+ /** Ordering position (0-indexed). */
148
+ position?: number;
149
+ }
150
+ /** Attributes for updating an inclusion (PATCH semantics). */
151
+ export interface UpdateInclusionAttributes {
152
+ /** Updated display title. */
153
+ title?: string;
154
+ /** Pre-rendered HTML. */
155
+ rendered_html?: string;
156
+ /** Updated structured payload. */
157
+ data?: Record<string, unknown>;
158
+ /** Updated ordering position. */
159
+ position?: number;
160
+ }
38
161
  /**
39
- * Admin-level email namespace cross-workspace outbound email and sender profile management.
162
+ * Attributes for creating an inbound address.
40
163
  *
41
- * Provides ISV administrators with visibility into outbound emails, sender profiles,
42
- * and tracking events across all workspaces.
164
+ * Unlike outbound resources, `workspace_id` is an explicit argument here.
165
+ */
166
+ export interface CreateInboundAddressAttributes {
167
+ /** Workspace to create the address in. */
168
+ workspace_id: string;
169
+ /** Human-readable label. */
170
+ name: string;
171
+ /** Where received emails are routed. */
172
+ routing_target: InboundRoutingTarget;
173
+ /** Routing-target-specific configuration. */
174
+ handler_config?: Record<string, unknown>;
175
+ /** Max attachment size in MB (1–100, default 25). */
176
+ max_attachment_size_mb?: number;
177
+ /** Restrict accepted MIME types. `null` allows all. */
178
+ allowed_mime_types?: string[] | null;
179
+ /** Max emails per day (1–10,000, default 100). */
180
+ daily_receive_limit?: number;
181
+ }
182
+ /** Attributes for updating an inbound address (PATCH semantics). */
183
+ export interface UpdateInboundAddressAttributes {
184
+ /** Updated label. */
185
+ name?: string;
186
+ /** Change routing target. */
187
+ routing_target?: InboundRoutingTarget;
188
+ /** Updated routing configuration. */
189
+ handler_config?: Record<string, unknown>;
190
+ /** Updated max attachment size in MB. */
191
+ max_attachment_size_mb?: number;
192
+ /** Updated MIME type restrictions. */
193
+ allowed_mime_types?: string[] | null;
194
+ /** Updated daily receive limit. */
195
+ daily_receive_limit?: number;
196
+ }
197
+ /**
198
+ * Parameters for AI-assisted email composition.
199
+ *
200
+ * Workspace is resolved from the authenticated actor — do not pass it.
201
+ */
202
+ export interface ComposeWithAiAttributes {
203
+ /** Email addresses of primary recipients. */
204
+ to: string[];
205
+ /** AI drafting instructions. */
206
+ prompt: string;
207
+ /** Structured context data passed to the AI. */
208
+ context?: Record<string, unknown>;
209
+ /** Sender profile ID — uses workspace default if omitted. */
210
+ sender_profile_id?: string;
211
+ /** CRM contact reference. */
212
+ contact_ref_id?: string;
213
+ /** Link the composed email to a domain entity. */
214
+ context_ref_type?: ContextRefType;
215
+ /** ID of the linked domain entity. */
216
+ context_ref_id?: string;
217
+ /** Include a CAN-SPAM unsubscribe link. */
218
+ include_unsubscribe_link?: boolean;
219
+ }
220
+ /**
221
+ * Admin-level email namespace — full cross-workspace email management.
222
+ *
223
+ * Provides ISV administrators with complete outbound email lifecycle,
224
+ * sender profile management, recipient/inclusion CRUD, inbound address
225
+ * routing, and tracking event visibility across all workspaces.
43
226
  */
44
227
  export declare function createEmailNamespace(rb: RequestBuilder): {
45
228
  /**
46
- * Outbound email management admin view across all workspaces.
229
+ * Outbound Emailsfull lifecycle management.
47
230
  */
48
231
  outboundEmails: {
49
232
  /**
50
233
  * Get an outbound email by ID.
51
234
  *
52
- * @param id - The unique identifier of the outbound email.
235
+ * @param id - The outbound email ID.
53
236
  * @param options - Optional request-level overrides.
54
- * @returns A promise resolving to the {@link EmailOutboundEmail}.
55
- *
56
- * @example
57
- * ```typescript
58
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
59
- * const email = await admin.email.outboundEmails.get('oe_abc123');
60
- * ```
237
+ * @returns The requested {@link EmailOutboundEmail}.
61
238
  */
62
239
  get: (id: string, options?: RequestOptions) => Promise<EmailOutboundEmail>;
63
240
  /**
64
241
  * List outbound emails for a workspace.
65
242
  *
66
- * @param workspaceId - The ID of the workspace to query.
67
- * @param options - Optional pagination and request options.
68
- * @returns A promise resolving to an array of {@link EmailOutboundEmail}.
69
- *
70
- * @example
71
- * ```typescript
72
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
73
- * const emails = await admin.email.outboundEmails.listByWorkspace('ws_abc123');
74
- * ```
243
+ * @param workspaceId - The workspace ID.
244
+ * @param options - Pagination and request-level overrides.
245
+ * @returns An array of {@link EmailOutboundEmail} records.
75
246
  */
76
247
  listByWorkspace: (workspaceId: string, options?: {
77
248
  page?: number;
78
249
  pageSize?: number;
79
250
  } & RequestOptions) => Promise<EmailOutboundEmail[]>;
251
+ /**
252
+ * List emails sent to a specific contact within a workspace.
253
+ *
254
+ * @param workspaceId - The workspace ID.
255
+ * @param contactRefId - The CRM contact reference ID.
256
+ * @param options - Pagination and request-level overrides.
257
+ * @returns An array of {@link EmailOutboundEmail} records.
258
+ */
259
+ listByContact: (workspaceId: string, contactRefId: string, options?: {
260
+ page?: number;
261
+ pageSize?: number;
262
+ } & RequestOptions) => Promise<EmailOutboundEmail[]>;
80
263
  /**
81
264
  * Create an outbound email draft.
82
265
  *
83
- * @param attributes - Email attributes including `workspace_id`, `subject`, `body_html`, `sender_profile_id`.
266
+ * Workspace is resolved from the authenticated actor.
267
+ *
268
+ * @param attributes - Email attributes. `subject` is required.
84
269
  * @param options - Optional request-level overrides.
85
- * @returns A promise resolving to the created {@link EmailOutboundEmail}.
270
+ * @returns The newly created {@link EmailOutboundEmail} draft.
86
271
  *
87
272
  * @example
88
273
  * ```typescript
89
274
  * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
90
- * const email = await admin.email.outboundEmails.create({
91
- * workspace_id: 'ws_abc123',
275
+ * const draft = await admin.email.outboundEmails.create({
92
276
  * subject: 'Admin notification',
93
277
  * body_html: '<p>Hello</p>',
94
278
  * sender_profile_id: 'sp_noreply',
@@ -97,50 +281,78 @@ export declare function createEmailNamespace(rb: RequestBuilder): {
97
281
  */
98
282
  create: (attributes: CreateOutboundEmailAttributes, options?: RequestOptions) => Promise<EmailOutboundEmail>;
99
283
  /**
100
- * Delete an outbound email draft.
284
+ * AI-draft an email from a prompt and structured context.
101
285
  *
102
- * @param id - The unique identifier of the outbound email to delete.
286
+ * @param attributes - AI composition parameters. `to` and `prompt` are required.
103
287
  * @param options - Optional request-level overrides.
104
- * @returns A promise that resolves to `true` on successful deletion.
288
+ * @returns The AI-generated {@link EmailOutboundEmail} draft.
289
+ */
290
+ composeWithAi: (attributes: ComposeWithAiAttributes, options?: RequestOptions) => Promise<EmailOutboundEmail>;
291
+ /**
292
+ * Update a draft outbound email (PATCH semantics).
105
293
  *
106
- * @example
107
- * ```typescript
108
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
109
- * await admin.email.outboundEmails.delete('oe_abc123');
110
- * ```
294
+ * Only emails in `draft` status can be updated.
295
+ *
296
+ * @param id - The outbound email ID.
297
+ * @param attributes - Fields to update.
298
+ * @param options - Optional request-level overrides.
299
+ * @returns The updated {@link EmailOutboundEmail}.
300
+ */
301
+ update: (id: string, attributes: UpdateOutboundEmailAttributes, options?: RequestOptions) => Promise<EmailOutboundEmail>;
302
+ /**
303
+ * Delete a draft outbound email.
304
+ *
305
+ * @param id - The outbound email ID.
306
+ * @param options - Optional request-level overrides.
307
+ * @returns `true` on successful deletion.
111
308
  */
112
309
  delete: (id: string, options?: RequestOptions) => Promise<true>;
310
+ /**
311
+ * Send a draft email immediately.
312
+ *
313
+ * @param id - The outbound email ID.
314
+ * @param options - Optional request-level overrides.
315
+ * @returns The email in `ready` status.
316
+ */
317
+ send: (id: string, options?: RequestOptions) => Promise<EmailOutboundEmail>;
318
+ /**
319
+ * Schedule a draft for future delivery.
320
+ *
321
+ * @param id - The outbound email ID.
322
+ * @param attributes - Must include `scheduled_for` as ISO 8601 datetime.
323
+ * @param options - Optional request-level overrides.
324
+ * @returns The email in `scheduled` status.
325
+ */
326
+ schedule: (id: string, attributes: {
327
+ scheduled_for: string;
328
+ }, options?: RequestOptions) => Promise<EmailOutboundEmail>;
329
+ /**
330
+ * Cancel a scheduled email (returns to `draft` status).
331
+ *
332
+ * @param id - The outbound email ID.
333
+ * @param options - Optional request-level overrides.
334
+ * @returns The email back in `draft` status.
335
+ */
336
+ cancelSchedule: (id: string, options?: RequestOptions) => Promise<EmailOutboundEmail>;
113
337
  };
114
338
  /**
115
- * Sender profile management admin view across all workspaces.
339
+ * Sender Profilesverified from-address identities.
116
340
  */
117
341
  senderProfiles: {
118
342
  /**
119
343
  * Get a sender profile by ID.
120
344
  *
121
- * @param id - The unique identifier of the sender profile.
345
+ * @param id - The sender profile ID.
122
346
  * @param options - Optional request-level overrides.
123
- * @returns A promise resolving to the {@link EmailMarketingSenderProfile}.
124
- *
125
- * @example
126
- * ```typescript
127
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
128
- * const profile = await admin.email.senderProfiles.get('sp_abc123');
129
- * ```
347
+ * @returns The requested {@link EmailMarketingSenderProfile}.
130
348
  */
131
349
  get: (id: string, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
132
350
  /**
133
351
  * List sender profiles for a workspace.
134
352
  *
135
- * @param workspaceId - The ID of the workspace to query.
136
- * @param options - Optional pagination and request options.
137
- * @returns A promise resolving to an array of {@link EmailMarketingSenderProfile}.
138
- *
139
- * @example
140
- * ```typescript
141
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
142
- * const profiles = await admin.email.senderProfiles.listByWorkspace('ws_abc123');
143
- * ```
353
+ * @param workspaceId - The workspace ID.
354
+ * @param options - Pagination and request-level overrides.
355
+ * @returns An array of {@link EmailMarketingSenderProfile} records.
144
356
  */
145
357
  listByWorkspace: (workspaceId: string, options?: {
146
358
  page?: number;
@@ -149,122 +361,311 @@ export declare function createEmailNamespace(rb: RequestBuilder): {
149
361
  /**
150
362
  * Create a new sender profile.
151
363
  *
152
- * @param attributes - Profile attributes including `workspace_id`, `email`, `name`.
153
- * @param options - Optional request-level overrides.
154
- * @returns A promise resolving to the created {@link EmailMarketingSenderProfile}.
364
+ * Workspace is resolved from the authenticated actor.
155
365
  *
156
- * @example
157
- * ```typescript
158
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
159
- * const profile = await admin.email.senderProfiles.create({
160
- * workspace_id: 'ws_abc123',
161
- * email: 'noreply@acme.com',
162
- * name: 'Acme Team',
163
- * });
164
- * ```
366
+ * @param attributes - Profile attributes. `email` and `name` are required.
367
+ * @param options - Optional request-level overrides.
368
+ * @returns The newly created {@link EmailMarketingSenderProfile}.
165
369
  */
166
370
  create: (attributes: CreateSenderProfileAttributes, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
167
371
  /**
168
- * Update a sender profile.
372
+ * Update a sender profile (PATCH semantics).
169
373
  *
170
- * @param id - The unique identifier of the sender profile to update.
171
- * @param attributes - Attributes to update.
374
+ * @param id - The sender profile ID.
375
+ * @param attributes - Fields to update.
172
376
  * @param options - Optional request-level overrides.
173
- * @returns A promise resolving to the updated {@link EmailMarketingSenderProfile}.
174
- *
175
- * @example
176
- * ```typescript
177
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
178
- * const profile = await admin.email.senderProfiles.update('sp_abc123', {
179
- * name: 'Acme Support',
180
- * });
181
- * ```
377
+ * @returns The updated {@link EmailMarketingSenderProfile}.
182
378
  */
183
379
  update: (id: string, attributes: UpdateSenderProfileAttributes, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
184
380
  /**
185
381
  * Delete a sender profile.
186
382
  *
187
- * @param id - The unique identifier of the sender profile to delete.
383
+ * @param id - The sender profile ID.
188
384
  * @param options - Optional request-level overrides.
189
- * @returns A promise that resolves to `true` on successful deletion.
190
- *
191
- * @example
192
- * ```typescript
193
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
194
- * await admin.email.senderProfiles.delete('sp_abc123');
195
- * ```
385
+ * @returns `true` on successful deletion.
196
386
  */
197
387
  delete: (id: string, options?: RequestOptions) => Promise<true>;
198
388
  /**
199
- * Trigger DNS validation for a sender profile (verifies SPF/DKIM/DMARC).
389
+ * Trigger DNS validation (SPF/DKIM/DMARC).
200
390
  *
201
- * @param id - The unique identifier of the sender profile.
391
+ * @param id - The sender profile ID.
202
392
  * @param options - Optional request-level overrides.
203
- * @returns A promise resolving to the updated {@link EmailMarketingSenderProfile} with DNS status.
204
- *
205
- * @example
206
- * ```typescript
207
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
208
- * const result = await admin.email.senderProfiles.validateDns('sp_abc123');
209
- * console.log(result.attributes.spf_valid, result.attributes.dkim_valid);
210
- * ```
393
+ * @returns The profile (DNS status may still be pending).
211
394
  */
212
395
  validateDns: (id: string, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
213
396
  /**
214
397
  * Set a sender profile as the workspace default.
215
398
  *
216
- * The default sender profile is used automatically when no
217
- * `sender_profile_id` is specified on an outbound email or campaign.
218
- * Only one profile can be the default per workspace at a time.
399
+ * @param id - The sender profile ID.
400
+ * @param options - Optional request-level overrides.
401
+ * @returns The profile with `is_default` set to `true`.
402
+ */
403
+ setDefault: (id: string, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
404
+ };
405
+ /**
406
+ * Recipients — to/cc/bcc addresses on an outbound email.
407
+ */
408
+ recipients: {
409
+ /**
410
+ * Get a recipient by ID.
219
411
  *
220
- * @param id - The unique identifier of the sender profile to set as default.
412
+ * @param id - The recipient record ID.
221
413
  * @param options - Optional request-level overrides.
222
- * @returns A promise resolving to the updated {@link EmailMarketingSenderProfile}
223
- * with `is_default` set to `true`.
414
+ * @returns The requested {@link EmailRecipient}.
415
+ */
416
+ get: (id: string, options?: RequestOptions) => Promise<EmailRecipient>;
417
+ /**
418
+ * Add a recipient to an outbound email.
224
419
  *
225
- * @example
226
- * ```typescript
227
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
228
- * await admin.email.senderProfiles.setDefault('sp_abc123');
229
- * ```
420
+ * @param attributes - Recipient details. `outbound_email_id` and `email` are required.
421
+ * @param options - Optional request-level overrides.
422
+ * @returns The newly created {@link EmailRecipient}.
230
423
  */
231
- setDefault: (id: string, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
424
+ create: (attributes: CreateRecipientAttributes, options?: RequestOptions) => Promise<EmailRecipient>;
425
+ /**
426
+ * Remove a recipient from an outbound email.
427
+ *
428
+ * @param id - The recipient record ID.
429
+ * @param options - Optional request-level overrides.
430
+ * @returns `true` on successful deletion.
431
+ */
432
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
433
+ /**
434
+ * List all recipients for an outbound email.
435
+ *
436
+ * @param outboundEmailId - The outbound email ID.
437
+ * @param options - Optional request-level overrides.
438
+ * @returns An array of {@link EmailRecipient} records.
439
+ */
440
+ listByEmail: (outboundEmailId: string, options?: RequestOptions) => Promise<EmailRecipient[]>;
441
+ };
442
+ /**
443
+ * Inclusions — structured data embedded in email bodies.
444
+ */
445
+ inclusions: {
446
+ /**
447
+ * Get an inclusion by ID.
448
+ *
449
+ * @param id - The inclusion ID.
450
+ * @param options - Optional request-level overrides.
451
+ * @returns The requested {@link EmailInclusion}.
452
+ */
453
+ get: (id: string, options?: RequestOptions) => Promise<EmailInclusion>;
454
+ /**
455
+ * Attach a structured data inclusion to a draft email.
456
+ *
457
+ * @param attributes - Inclusion details. `outbound_email_id` and `inclusion_type` are required.
458
+ * @param options - Optional request-level overrides.
459
+ * @returns The newly created {@link EmailInclusion}.
460
+ */
461
+ create: (attributes: CreateInclusionAttributes, options?: RequestOptions) => Promise<EmailInclusion>;
462
+ /**
463
+ * Update an inclusion (PATCH semantics).
464
+ *
465
+ * @param id - The inclusion ID.
466
+ * @param attributes - Fields to update.
467
+ * @param options - Optional request-level overrides.
468
+ * @returns The updated {@link EmailInclusion}.
469
+ */
470
+ update: (id: string, attributes: UpdateInclusionAttributes, options?: RequestOptions) => Promise<EmailInclusion>;
471
+ /**
472
+ * Remove an inclusion from a draft email.
473
+ *
474
+ * @param id - The inclusion ID.
475
+ * @param options - Optional request-level overrides.
476
+ * @returns `true` on successful deletion.
477
+ */
478
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
479
+ /**
480
+ * List all inclusions for an outbound email.
481
+ *
482
+ * @param outboundEmailId - The outbound email ID.
483
+ * @param options - Optional request-level overrides.
484
+ * @returns An array of {@link EmailInclusion} records.
485
+ */
486
+ listByEmail: (outboundEmailId: string, options?: RequestOptions) => Promise<EmailInclusion[]>;
232
487
  };
233
488
  /**
234
- * Tracking event management admin view across all workspaces.
489
+ * Tracking Eventsopen/click/bounce event history. Read-only.
235
490
  */
236
491
  trackingEvents: {
237
492
  /**
238
493
  * Get a tracking event by ID.
239
494
  *
240
- * @param id - The unique identifier of the tracking event.
495
+ * @param id - The tracking event ID.
241
496
  * @param options - Optional request-level overrides.
242
- * @returns A promise resolving to the tracking event record.
243
- *
244
- * @example
245
- * ```typescript
246
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
247
- * const event = await admin.email.trackingEvents.get('te_abc123');
248
- * ```
497
+ * @returns The requested {@link EmailTrackingEvent}.
249
498
  */
250
499
  get: (id: string, options?: RequestOptions) => Promise<EmailTrackingEvent>;
251
500
  /**
252
501
  * List tracking events for a workspace.
253
502
  *
254
- * @param workspaceId - The ID of the workspace to query.
255
- * @param options - Optional pagination and request options.
256
- * @returns A promise resolving to an array of {@link EmailTrackingEvent} records.
257
- *
258
- * @example
259
- * ```typescript
260
- * const admin = new GptAdmin({ apiKey: 'sk_srv_...' });
261
- * const events = await admin.email.trackingEvents.listByWorkspace('ws_abc123');
262
- * ```
503
+ * @param workspaceId - The workspace ID.
504
+ * @param options - Pagination and request-level overrides.
505
+ * @returns An array of {@link EmailTrackingEvent} records.
263
506
  */
264
507
  listByWorkspace: (workspaceId: string, options?: {
265
508
  page?: number;
266
509
  pageSize?: number;
267
510
  } & RequestOptions) => Promise<EmailTrackingEvent[]>;
268
511
  };
512
+ /**
513
+ * Unsubscribers — CAN-SPAM global unsubscribe registry. Read-only.
514
+ */
515
+ unsubscribers: {
516
+ /**
517
+ * Get an unsubscribe record by ID.
518
+ *
519
+ * @param id - The unsubscriber record ID.
520
+ * @param options - Optional request-level overrides.
521
+ * @returns The requested {@link EmailUnsubscriber}.
522
+ */
523
+ get: (id: string, options?: RequestOptions) => Promise<EmailUnsubscriber>;
524
+ /**
525
+ * List unsubscriber records for a workspace.
526
+ *
527
+ * @param workspaceId - The workspace ID.
528
+ * @param options - Pagination and request-level overrides.
529
+ * @returns An array of {@link EmailUnsubscriber} records.
530
+ */
531
+ listByWorkspace: (workspaceId: string, options?: {
532
+ page?: number;
533
+ pageSize?: number;
534
+ } & RequestOptions) => Promise<EmailUnsubscriber[]>;
535
+ };
536
+ /**
537
+ * Send Limits — daily send quota records.
538
+ */
539
+ sendLimits: {
540
+ /**
541
+ * Get a send limit record by ID.
542
+ *
543
+ * @param id - The send limit record ID.
544
+ * @param options - Optional request-level overrides.
545
+ * @returns The requested {@link EmailSendLimit} record.
546
+ */
547
+ get: (id: string, options?: RequestOptions) => Promise<EmailSendLimit>;
548
+ /**
549
+ * List send limit records for a workspace (historical).
550
+ *
551
+ * @param workspaceId - The workspace ID.
552
+ * @param options - Pagination and request-level overrides.
553
+ * @returns An array of {@link EmailSendLimit} records.
554
+ */
555
+ listByWorkspace: (workspaceId: string, options?: {
556
+ page?: number;
557
+ pageSize?: number;
558
+ } & RequestOptions) => Promise<EmailSendLimit[]>;
559
+ };
560
+ /**
561
+ * Inbound Addresses — workspace-scoped email addresses for receiving mail.
562
+ */
563
+ inbound: {
564
+ addresses: {
565
+ /**
566
+ * Get an inbound address by ID.
567
+ *
568
+ * @param id - The inbound address ID.
569
+ * @param options - Optional request-level overrides.
570
+ * @returns The requested {@link EmailInboundAddress}.
571
+ */
572
+ get: (id: string, options?: RequestOptions) => Promise<EmailInboundAddress>;
573
+ /**
574
+ * Create a new inbound address.
575
+ *
576
+ * `workspace_id` is an explicit required parameter.
577
+ *
578
+ * @param attributes - Address configuration.
579
+ * @param options - Optional request-level overrides.
580
+ * @returns The newly created {@link EmailInboundAddress}.
581
+ */
582
+ create: (attributes: CreateInboundAddressAttributes, options?: RequestOptions) => Promise<EmailInboundAddress>;
583
+ /**
584
+ * Update an inbound address (PATCH semantics).
585
+ *
586
+ * @param id - The inbound address ID.
587
+ * @param attributes - Fields to update.
588
+ * @param options - Optional request-level overrides.
589
+ * @returns The updated {@link EmailInboundAddress}.
590
+ */
591
+ update: (id: string, attributes: UpdateInboundAddressAttributes, options?: RequestOptions) => Promise<EmailInboundAddress>;
592
+ /**
593
+ * Delete an inbound address.
594
+ *
595
+ * @param id - The inbound address ID.
596
+ * @param options - Optional request-level overrides.
597
+ * @returns `true` on successful deletion.
598
+ */
599
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
600
+ /**
601
+ * Rotate the inbound address token (invalidates the old token).
602
+ *
603
+ * @param id - The inbound address ID.
604
+ * @param options - Optional request-level overrides.
605
+ * @returns The address with the new token.
606
+ */
607
+ rotateToken: (id: string, options?: RequestOptions) => Promise<EmailInboundAddress>;
608
+ /**
609
+ * Disable an inbound address.
610
+ *
611
+ * @param id - The inbound address ID.
612
+ * @param options - Optional request-level overrides.
613
+ * @returns The address with `is_active` set to `false`.
614
+ */
615
+ disable: (id: string, options?: RequestOptions) => Promise<EmailInboundAddress>;
616
+ /**
617
+ * Re-enable a disabled inbound address.
618
+ *
619
+ * @param id - The inbound address ID.
620
+ * @param options - Optional request-level overrides.
621
+ * @returns The address with `is_active` set to `true`.
622
+ */
623
+ enable: (id: string, options?: RequestOptions) => Promise<EmailInboundAddress>;
624
+ /**
625
+ * List all inbound addresses in a workspace.
626
+ *
627
+ * @param workspaceId - The workspace ID.
628
+ * @param options - Pagination and request-level overrides.
629
+ * @returns An array of {@link EmailInboundAddress} records.
630
+ */
631
+ listByWorkspace: (workspaceId: string, options?: {
632
+ page?: number;
633
+ pageSize?: number;
634
+ } & RequestOptions) => Promise<EmailInboundAddress[]>;
635
+ };
636
+ /** Received — read-only log of received inbound emails. */
637
+ received: {
638
+ /**
639
+ * Get a received inbound email by ID.
640
+ *
641
+ * @param id - The inbound email ID.
642
+ * @param options - Optional request-level overrides.
643
+ * @returns The requested {@link EmailInboundEmail}.
644
+ */
645
+ get: (id: string, options?: RequestOptions) => Promise<EmailInboundEmail>;
646
+ /**
647
+ * List received emails by inbound address.
648
+ *
649
+ * @param addressId - The inbound address ID.
650
+ * @param options - Pagination and request-level overrides.
651
+ * @returns An array of {@link EmailInboundEmail} records.
652
+ */
653
+ listByAddress: (addressId: string, options?: {
654
+ page?: number;
655
+ pageSize?: number;
656
+ } & RequestOptions) => Promise<EmailInboundEmail[]>;
657
+ /**
658
+ * List all received emails in a workspace.
659
+ *
660
+ * @param workspaceId - The workspace ID.
661
+ * @param options - Pagination and request-level overrides.
662
+ * @returns An array of {@link EmailInboundEmail} records.
663
+ */
664
+ listByWorkspace: (workspaceId: string, options?: {
665
+ page?: number;
666
+ pageSize?: number;
667
+ } & RequestOptions) => Promise<EmailInboundEmail[]>;
668
+ };
669
+ };
269
670
  };
270
671
  //# sourceMappingURL=email.d.ts.map