@agentisend/sdk-node 0.5.0 → 0.5.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.
- package/dist/cli/commands.js +11 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +60 -1
- package/dist/cli/main.js.map +1 -1
- package/dist/client.d.ts +247 -27
- package/dist/client.js +184 -17
- package/dist/client.js.map +1 -1
- package/dist/compat-resend.d.ts +10 -8
- package/dist/compat-resend.js +90 -8
- package/dist/compat-resend.js.map +1 -1
- package/dist/types.d.ts +221 -15
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -2
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiKey, AutomationRun, ReceivedAttachment, ReceivedEmail, ReceivedThread, SentAttachment, RequestLogEntry, EventDefinition, EventFieldType, ApiKeyPermission, BatchItemResult, CreatedApiKey, CreatedWebhookEndpoint, DeadLetter, Deleted, Domain, DomainRegion, DomainSetup, LegacyDomainRegion, Email, EventType, Limit, LimitPeriod, ListEmailsQuery, ListQuery, MetricsQuery, ExplainReport, Page, PreflightReport, ReplayResult, ContactTopic, SendEmailPayload, ServiceStatus, SuppressionBatchItem, AuditEntry, TeamInvite, TeamMember, Topic, BillingPlan, TrustStanding, WebhookEndpoint } from './types.js';
|
|
1
|
+
import type { ApiKey, BroadcastClickedLinksQuery, BroadcastRecipientsQuery, EngagementList, AutomationConnection, AutomationGraphStep, AutomationRun, ReceivedAttachment, ReceivedEmail, ReceivedThread, SentAttachment, RequestLogEntry, EventDefinition, EventFieldType, ApiKeyPermission, BatchItemResult, CreatedApiKey, CreatedWebhookEndpoint, DeadLetter, Deleted, Domain, DomainCapabilities, DomainClaim, DomainRegion, DomainSetup, LegacyDomainRegion, Email, EventType, Limit, LimitPeriod, ListEmailsQuery, ListQuery, MetricsQuery, ExplainReport, Page, PreflightReport, ReplayResult, ContactTopic, SendEmailPayload, TemplateCreatePayload, ServiceStatus, SuppressionBatchItem, AuditEntry, TeamInvite, TeamMember, Topic, BillingPlan, TrustStanding, WebhookEndpoint } from './types.js';
|
|
2
2
|
export declare const DEFAULT_BASE_URL = "https://api.agentisend.com";
|
|
3
3
|
export interface FetchResponse {
|
|
4
4
|
status: number;
|
|
@@ -85,15 +85,28 @@ export declare class AgentiSend {
|
|
|
85
85
|
}>;
|
|
86
86
|
get: (id: string) => Promise<Email>;
|
|
87
87
|
list: (query?: ListEmailsQuery) => Promise<Page<Email>>;
|
|
88
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Account-level email metrics in Resend's shape: totals for a range, or
|
|
90
|
+
* rows by period, domain, email or broadcast. since/until answer in the
|
|
91
|
+
* GET /metrics shape instead. Lists are sent comma-separated.
|
|
92
|
+
*/
|
|
89
93
|
metrics: (query?: MetricsQuery) => Promise<Record<string, unknown>>;
|
|
90
94
|
/** M5.10 — what this email carried, after it was sent. */
|
|
91
95
|
attachments: (id: string) => Promise<Page<SentAttachment>>;
|
|
92
|
-
/**
|
|
93
|
-
|
|
96
|
+
/**
|
|
97
|
+
* A link anyone can open to read one sent or received email, with no
|
|
98
|
+
* sign-in. `expires_in` is a duration such as "10m", "2 hours" or "1 day";
|
|
99
|
+
* the default and the most is 48 hours.
|
|
100
|
+
*/
|
|
101
|
+
share: (id: string, payload?: {
|
|
102
|
+
expires_in?: string;
|
|
103
|
+
}, options?: RequestOptions) => Promise<{
|
|
104
|
+
object: "email";
|
|
94
105
|
id: string;
|
|
95
|
-
|
|
106
|
+
url: string;
|
|
96
107
|
}>;
|
|
108
|
+
/** Stop a scheduled or queued email. Sent mail is history, not cancellable. Answers with the cancelled email. */
|
|
109
|
+
cancel: (id: string, options?: RequestOptions) => Promise<Email>;
|
|
97
110
|
/** Delete a sent email and its events for good. A scheduled one must be cancelled first. */
|
|
98
111
|
remove: (id: string, options?: RequestOptions) => Promise<{
|
|
99
112
|
id: string;
|
|
@@ -188,6 +201,17 @@ export declare class AgentiSend {
|
|
|
188
201
|
}>;
|
|
189
202
|
};
|
|
190
203
|
readonly domains: {
|
|
204
|
+
/** Whether create would accept this name, and the refusal it would give. Creates nothing. */
|
|
205
|
+
check: (name: string) => Promise<{
|
|
206
|
+
name: string;
|
|
207
|
+
can_add: boolean;
|
|
208
|
+
blocklist: "listed" | "clean" | "unknown";
|
|
209
|
+
problems: Array<{
|
|
210
|
+
code: string;
|
|
211
|
+
message: string;
|
|
212
|
+
fix: string;
|
|
213
|
+
}>;
|
|
214
|
+
}>;
|
|
191
215
|
create: (payload: {
|
|
192
216
|
name: string;
|
|
193
217
|
region?: DomainRegion | LegacyDomainRegion;
|
|
@@ -197,18 +221,54 @@ export declare class AgentiSend {
|
|
|
197
221
|
open_tracking?: boolean;
|
|
198
222
|
click_tracking?: boolean;
|
|
199
223
|
tls_mode?: "opportunistic" | "enforced";
|
|
224
|
+
/** Sending defaults to enabled, receiving to disabled. At least one must be enabled. */
|
|
225
|
+
capabilities?: DomainCapabilities;
|
|
200
226
|
}, options?: RequestOptions) => Promise<Domain>;
|
|
201
227
|
list: (query?: ListQuery) => Promise<Page<Domain>>;
|
|
202
228
|
get: (id: string) => Promise<Domain>;
|
|
203
229
|
/** One-shot DNS sheet: zone file, copy-paste commands, provider. */
|
|
204
230
|
setup: (id: string) => Promise<DomainSetup>;
|
|
231
|
+
/** A page the person who owns DNS can open. No sign-in. Lasts 7 days. A new call replaces it. */
|
|
232
|
+
setupLink: (id: string, options?: RequestOptions) => Promise<{
|
|
233
|
+
url: string;
|
|
234
|
+
expires_at: string;
|
|
235
|
+
}>;
|
|
236
|
+
/** Withdraw the live setup link. The page stops opening. */
|
|
237
|
+
revokeSetupLink: (id: string, options?: RequestOptions) => Promise<{
|
|
238
|
+
revoked: true;
|
|
239
|
+
}>;
|
|
205
240
|
verify: (id: string, options?: RequestOptions) => Promise<Domain>;
|
|
241
|
+
/** Who may write to this domain: allow and block rules, newest first. */
|
|
242
|
+
listInboundRules: (id: string, query?: ListQuery & {
|
|
243
|
+
kind?: "allow" | "block";
|
|
244
|
+
}) => Promise<Page<Record<string, unknown>>>;
|
|
245
|
+
/** One rule: an address, a bare domain, or *@sub.example.com. Block wins over allow. */
|
|
246
|
+
addInboundRule: (id: string, payload: {
|
|
247
|
+
kind: "allow" | "block";
|
|
248
|
+
pattern: string;
|
|
249
|
+
note?: string;
|
|
250
|
+
}, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
251
|
+
addInboundRules: (id: string, payload: {
|
|
252
|
+
kind: "allow" | "block";
|
|
253
|
+
patterns: string[];
|
|
254
|
+
note?: string;
|
|
255
|
+
}, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
256
|
+
removeInboundRules: (id: string, payload: {
|
|
257
|
+
ids?: string[];
|
|
258
|
+
kind?: "allow" | "block";
|
|
259
|
+
patterns?: string[];
|
|
260
|
+
}, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
261
|
+
removeInboundRule: (id: string, ruleId: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
206
262
|
/** A8 + P3b: click/open tracking, TLS mode, or a new tracking_subdomain. Never removed. */
|
|
207
263
|
update: (id: string, payload: {
|
|
208
264
|
click_tracking?: boolean;
|
|
209
265
|
open_tracking?: boolean;
|
|
210
266
|
tracking_subdomain?: string;
|
|
211
267
|
tls_mode?: "opportunistic" | "enforced";
|
|
268
|
+
/** monitor labels received mail. hold keeps a review message until release. */
|
|
269
|
+
inbound_hold_mode?: "monitor" | "hold";
|
|
270
|
+
/** Name one or both; the other keeps its value. At least one stays enabled. */
|
|
271
|
+
capabilities?: DomainCapabilities;
|
|
212
272
|
}, options?: RequestOptions) => Promise<Domain>;
|
|
213
273
|
delete: (id: string, options?: RequestOptions) => Promise<Deleted>;
|
|
214
274
|
/**
|
|
@@ -231,6 +291,25 @@ export declare class AgentiSend {
|
|
|
231
291
|
events: (id: string, query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
|
|
232
292
|
/** Alias of setup: detects the DNS provider and returns the exact records to add. */
|
|
233
293
|
connect: (id: string) => Promise<DomainSetup>;
|
|
294
|
+
/**
|
|
295
|
+
* Start a claim for a domain another account has verified. Publish the TXT
|
|
296
|
+
* `record` it returns, then `verifyClaim`. Nothing moves until the safety
|
|
297
|
+
* checks pass.
|
|
298
|
+
*/
|
|
299
|
+
claim: (payload: {
|
|
300
|
+
name: string;
|
|
301
|
+
region?: DomainRegion | LegacyDomainRegion;
|
|
302
|
+
tracking?: boolean;
|
|
303
|
+
tracking_subdomain?: string;
|
|
304
|
+
return_path_subdomain?: string;
|
|
305
|
+
open_tracking?: boolean;
|
|
306
|
+
click_tracking?: boolean;
|
|
307
|
+
tls_mode?: "opportunistic" | "enforced";
|
|
308
|
+
}, options?: RequestOptions) => Promise<DomainClaim>;
|
|
309
|
+
/** The latest claim for the placeholder domain a claim created. Poll it until `completed`. */
|
|
310
|
+
getClaim: (domainId: string) => Promise<DomainClaim>;
|
|
311
|
+
/** Check the claim's TXT record and, when it is there, run the ownership checks and move the domain. */
|
|
312
|
+
verifyClaim: (domainId: string, options?: RequestOptions) => Promise<DomainClaim>;
|
|
234
313
|
};
|
|
235
314
|
readonly webhooks: {
|
|
236
315
|
create: (payload: {
|
|
@@ -273,6 +352,24 @@ export declare class AgentiSend {
|
|
|
273
352
|
rotated_at: string;
|
|
274
353
|
previous_secret_expires_at: string;
|
|
275
354
|
}>;
|
|
355
|
+
/** The same rotation on Resend's path. */
|
|
356
|
+
rotateSigningSecret: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
357
|
+
/** What was sent to this endpoint: pending, attempting, success or failed. */
|
|
358
|
+
listEvents: (id: string, query?: {
|
|
359
|
+
limit?: number;
|
|
360
|
+
after?: string;
|
|
361
|
+
}) => Promise<Page<Record<string, unknown>>>;
|
|
362
|
+
getEvent: (id: string, eventId: string) => Promise<Record<string, unknown>>;
|
|
363
|
+
/** Each attempt to deliver one event, with the status code and body the endpoint answered. */
|
|
364
|
+
listEventAttempts: (id: string, eventId: string, query?: {
|
|
365
|
+
limit?: number;
|
|
366
|
+
after?: string;
|
|
367
|
+
}) => Promise<Page<Record<string, unknown>>>;
|
|
368
|
+
/** Send one event to the endpoint again, as a new delivery marked as a replay. */
|
|
369
|
+
replayEvent: (id: string, eventId: string, options?: RequestOptions) => Promise<{
|
|
370
|
+
object: string;
|
|
371
|
+
id: string;
|
|
372
|
+
}>;
|
|
276
373
|
};
|
|
277
374
|
readonly limits: {
|
|
278
375
|
list: (query?: ListQuery) => Promise<Page<Limit>>;
|
|
@@ -326,8 +423,11 @@ export declare class AgentiSend {
|
|
|
326
423
|
from?: string;
|
|
327
424
|
since?: string;
|
|
328
425
|
until?: string;
|
|
426
|
+
held?: boolean;
|
|
329
427
|
}) => Promise<Page<ReceivedEmail>>;
|
|
330
428
|
get: (id: string) => Promise<ReceivedEmail>;
|
|
429
|
+
/** How many messages each domain's sender rules refused. */
|
|
430
|
+
refusals: () => Promise<Record<string, unknown>>;
|
|
331
431
|
/** Delete one received email for good. */
|
|
332
432
|
remove: (id: string, options?: RequestOptions) => Promise<{
|
|
333
433
|
id: string;
|
|
@@ -355,6 +455,8 @@ export declare class AgentiSend {
|
|
|
355
455
|
attachment: (id: string, attachmentId: string) => Promise<Uint8Array>;
|
|
356
456
|
/** The message exactly as it arrived, headers and all. */
|
|
357
457
|
raw: (id: string) => Promise<string>;
|
|
458
|
+
/** Release a held message. The arrival webhook fires once. */
|
|
459
|
+
release: (id: string, reason: string, options?: RequestOptions) => Promise<ReceivedEmail>;
|
|
358
460
|
};
|
|
359
461
|
/**
|
|
360
462
|
* M5.7 — the custom-event registry. Declaring an event's fields turns a
|
|
@@ -368,6 +470,17 @@ export declare class AgentiSend {
|
|
|
368
470
|
}, options?: RequestOptions) => Promise<{
|
|
369
471
|
fired: number;
|
|
370
472
|
}>;
|
|
473
|
+
/** Resend's form: one event for one contact, by contact_id or email. */
|
|
474
|
+
send: (payload: {
|
|
475
|
+
event: string;
|
|
476
|
+
contact_id?: string;
|
|
477
|
+
email?: string;
|
|
478
|
+
payload?: Record<string, unknown>;
|
|
479
|
+
}, options?: RequestOptions) => Promise<{
|
|
480
|
+
object: "event";
|
|
481
|
+
event: string;
|
|
482
|
+
fired: number;
|
|
483
|
+
}>;
|
|
371
484
|
list: (query?: ListQuery) => Promise<Page<EventDefinition>>;
|
|
372
485
|
get: (id: string) => Promise<EventDefinition>;
|
|
373
486
|
update: (id: string, payload: {
|
|
@@ -379,19 +492,53 @@ export declare class AgentiSend {
|
|
|
379
492
|
};
|
|
380
493
|
/** M5.6 — what an automation actually did, after it did it. */
|
|
381
494
|
readonly automations: {
|
|
495
|
+
/**
|
|
496
|
+
* Linear: `{ name, trigger, steps }` with steps of kind email, webhook or
|
|
497
|
+
* ab_split. Graph (Resend's shape): `{ name, status?, steps, connections }`
|
|
498
|
+
* with steps `{ key, type, config }`.
|
|
499
|
+
*/
|
|
382
500
|
create: (payload: {
|
|
383
501
|
name: string;
|
|
502
|
+
status?: "enabled" | "disabled";
|
|
384
503
|
trigger: Record<string, unknown>;
|
|
385
504
|
steps: Record<string, unknown>[];
|
|
505
|
+
} | {
|
|
506
|
+
name: string;
|
|
507
|
+
status?: "enabled" | "disabled";
|
|
508
|
+
steps: AutomationGraphStep[];
|
|
509
|
+
connections: AutomationConnection[];
|
|
386
510
|
}, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
387
|
-
list: (query?: ListQuery
|
|
511
|
+
list: (query?: ListQuery & {
|
|
512
|
+
status?: "enabled" | "disabled";
|
|
513
|
+
}) => Promise<Page<Record<string, unknown>>>;
|
|
388
514
|
get: (id: string) => Promise<Record<string, unknown>>;
|
|
389
515
|
update: (id: string, payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
390
516
|
enable: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
391
517
|
disable: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
392
518
|
versions: (id: string) => Promise<Page<Record<string, unknown>>>;
|
|
519
|
+
/** Copy an automation, disabled. Edit the copy, enable it, then stop the original. */
|
|
520
|
+
duplicate: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
521
|
+
/**
|
|
522
|
+
* No new runs start; runs in progress finish as they started.
|
|
523
|
+
* `cancelRuns: true` cancels those as well.
|
|
524
|
+
*/
|
|
525
|
+
stop: (id: string, query?: {
|
|
526
|
+
cancelRuns?: boolean;
|
|
527
|
+
}, options?: RequestOptions) => Promise<{
|
|
528
|
+
object: "automation";
|
|
529
|
+
id: string;
|
|
530
|
+
status: "disabled";
|
|
531
|
+
runs_cancelled: number;
|
|
532
|
+
}>;
|
|
533
|
+
/** Delete an automation; runs in progress are cancelled first. */
|
|
534
|
+
remove: (id: string, options?: RequestOptions) => Promise<{
|
|
535
|
+
object: "automation";
|
|
536
|
+
id: string;
|
|
537
|
+
deleted: true;
|
|
538
|
+
}>;
|
|
539
|
+
/** `status` is one value or a comma-separated list. */
|
|
393
540
|
runs: (automationId: string, query?: ListQuery & {
|
|
394
|
-
status?: "
|
|
541
|
+
status?: AutomationRun["status"] | string;
|
|
395
542
|
}) => Promise<Page<AutomationRun>>;
|
|
396
543
|
run: (automationId: string, runId: string) => Promise<AutomationRun>;
|
|
397
544
|
};
|
|
@@ -426,17 +573,38 @@ export declare class AgentiSend {
|
|
|
426
573
|
}, options?: RequestOptions) => Promise<{
|
|
427
574
|
data: Record<string, unknown>[];
|
|
428
575
|
}>;
|
|
429
|
-
/**
|
|
576
|
+
/**
|
|
577
|
+
* CSV in `csv`. Finishes in this response; read it back with imports.get.
|
|
578
|
+
* `column_map` is Resend's, a field on the left and a CSV column on the right.
|
|
579
|
+
* `on_conflict` defaults to skip.
|
|
580
|
+
*/
|
|
430
581
|
importCsv: (payload: {
|
|
431
582
|
csv: string;
|
|
432
|
-
column_map?: Record<string,
|
|
583
|
+
column_map?: Record<string, unknown>;
|
|
433
584
|
on_conflict?: "skip" | "upsert";
|
|
585
|
+
segments?: Array<{
|
|
586
|
+
id: string;
|
|
587
|
+
}>;
|
|
588
|
+
topics?: Array<{
|
|
589
|
+
id: string;
|
|
590
|
+
subscription: "opt_in" | "opt_out";
|
|
591
|
+
}>;
|
|
434
592
|
}, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
435
|
-
/**
|
|
593
|
+
/** Past contact imports, newest first. */
|
|
594
|
+
imports: {
|
|
595
|
+
list: (query?: {
|
|
596
|
+
status?: "queued" | "in_progress" | "completed" | "failed";
|
|
597
|
+
limit?: number;
|
|
598
|
+
after?: string;
|
|
599
|
+
before?: string;
|
|
600
|
+
}) => Promise<Page<Record<string, unknown>>>;
|
|
601
|
+
get: (id: string) => Promise<Record<string, unknown>>;
|
|
602
|
+
};
|
|
603
|
+
/** Segments this contact is in: rule matches and direct additions. The id may be an email. */
|
|
436
604
|
segments: (id: string) => Promise<Page<Record<string, unknown>>>;
|
|
437
|
-
/**
|
|
605
|
+
/** Add a contact to a segment. It stays in until removed, whatever the rules say. */
|
|
438
606
|
addSegment: (id: string, segmentId: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
439
|
-
/**
|
|
607
|
+
/** Remove a contact that was added to a segment. One in it only by its rules is refused. */
|
|
440
608
|
removeSegment: (id: string, segmentId: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
441
609
|
/** Lift a marketing unsubscribe after the person opts back in. */
|
|
442
610
|
resubscribe: (id: string, payload: {
|
|
@@ -444,16 +612,49 @@ export declare class AgentiSend {
|
|
|
444
612
|
consent_at: string;
|
|
445
613
|
}, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
446
614
|
};
|
|
447
|
-
/**
|
|
615
|
+
/** Declared properties with their fallback_value, and the names contacts already hold. */
|
|
448
616
|
readonly contactProperties: {
|
|
449
617
|
list: () => Promise<Page<Record<string, unknown>>>;
|
|
450
618
|
get: (id: string) => Promise<Record<string, unknown>>;
|
|
619
|
+
/** Declare a property. type is string or number; fallback_value fills in for a contact with none. */
|
|
620
|
+
create: (payload: {
|
|
621
|
+
key: string;
|
|
622
|
+
type: "string" | "number";
|
|
623
|
+
fallback_value?: string | number | null;
|
|
624
|
+
}, options?: RequestOptions) => Promise<{
|
|
625
|
+
object: "contact_property";
|
|
626
|
+
id: string;
|
|
627
|
+
}>;
|
|
628
|
+
/** Change the fallback_value. The key and type cannot change. */
|
|
629
|
+
update: (id: string, payload: {
|
|
630
|
+
fallback_value: string | number | null;
|
|
631
|
+
}, options?: RequestOptions) => Promise<{
|
|
632
|
+
object: "contact_property";
|
|
633
|
+
id: string;
|
|
634
|
+
}>;
|
|
635
|
+
/** Remove a declared property. Values contacts hold under its key stay on them. */
|
|
636
|
+
delete: (id: string, options?: RequestOptions) => Promise<{
|
|
637
|
+
object: "contact_property";
|
|
638
|
+
id: string;
|
|
639
|
+
deleted: true;
|
|
640
|
+
}>;
|
|
451
641
|
};
|
|
452
642
|
/**
|
|
453
|
-
*
|
|
454
|
-
*
|
|
643
|
+
* Audiences are segments. createContact adds the contact to that segment.
|
|
644
|
+
* listContacts returns that segment's members.
|
|
455
645
|
*/
|
|
456
646
|
readonly audiences: {
|
|
647
|
+
create: (payload: {
|
|
648
|
+
name: string;
|
|
649
|
+
}, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
650
|
+
list: (query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
|
|
651
|
+
get: (id: string) => Promise<Record<string, unknown>>;
|
|
652
|
+
delete: (id: string, options?: RequestOptions) => Promise<Deleted>;
|
|
653
|
+
/** Contacts in this audience (the segment's members). */
|
|
654
|
+
contacts: (id: string, query?: ListQuery & {
|
|
655
|
+
email?: string;
|
|
656
|
+
}) => Promise<Page<Record<string, unknown>>>;
|
|
657
|
+
members: (id: string) => Promise<Page<Record<string, unknown>>>;
|
|
457
658
|
createContact: (audienceId: string, payload: {
|
|
458
659
|
email: string;
|
|
459
660
|
properties?: Record<string, unknown>;
|
|
@@ -467,6 +668,12 @@ export declare class AgentiSend {
|
|
|
467
668
|
};
|
|
468
669
|
readonly broadcasts: {
|
|
469
670
|
create: (payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
671
|
+
/** Delete a draft. A scheduled or sent broadcast is refused; archive it instead. */
|
|
672
|
+
delete: (id: string, options?: RequestOptions) => Promise<{
|
|
673
|
+
object: "broadcast";
|
|
674
|
+
id: string;
|
|
675
|
+
deleted: boolean;
|
|
676
|
+
}>;
|
|
470
677
|
list: (query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
|
|
471
678
|
get: (id: string) => Promise<Record<string, unknown>>;
|
|
472
679
|
/** Sent, delivered, opened, clicked, bounced, complained and unsubscribed. A test send is not included. */
|
|
@@ -490,6 +697,14 @@ export declare class AgentiSend {
|
|
|
490
697
|
/** Archive, not delete: a sent broadcast is history worth keeping (F14). */
|
|
491
698
|
archive: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
492
699
|
messages: (id: string, query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
|
|
700
|
+
/**
|
|
701
|
+
* Who the broadcast reached and what they did, for one event `type`
|
|
702
|
+
* (Resend: list-broadcast-recipients). Rows page with opaque `id` cursors
|
|
703
|
+
* through `after` and `before`.
|
|
704
|
+
*/
|
|
705
|
+
recipients: (id: string, query: BroadcastRecipientsQuery) => Promise<EngagementList<Record<string, unknown>>>;
|
|
706
|
+
/** Every link clicked in the broadcast, most clicked first, with total and unique clicks. */
|
|
707
|
+
clickedLinks: (id: string, query?: BroadcastClickedLinksQuery) => Promise<EngagementList<Record<string, unknown>>>;
|
|
493
708
|
/** Cancel a scheduled broadcast, or stop one that is still sending. Mail already handed off is not pulled back. A scheduled broadcast returns to draft. */
|
|
494
709
|
cancel: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
495
710
|
/** Copy a broadcast into a new draft: the message, segment, reply_to, preview_text and topic_id. No schedule, sends or history. */
|
|
@@ -497,13 +712,14 @@ export declare class AgentiSend {
|
|
|
497
712
|
name?: string;
|
|
498
713
|
}, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
499
714
|
};
|
|
715
|
+
/**
|
|
716
|
+
* Templates. Wherever a method takes `id`, the template's alias works too
|
|
717
|
+
* (Resend: "The Template ID or alias"). Editing a published template opens
|
|
718
|
+
* a draft from its live version; the live version keeps sending until
|
|
719
|
+
* `publish`.
|
|
720
|
+
*/
|
|
500
721
|
readonly templates: {
|
|
501
|
-
create: (payload:
|
|
502
|
-
name: string;
|
|
503
|
-
subject: string;
|
|
504
|
-
content: unknown;
|
|
505
|
-
variables?: unknown[];
|
|
506
|
-
}, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
722
|
+
create: (payload: TemplateCreatePayload, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
507
723
|
list: (query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
|
|
508
724
|
get: (id: string) => Promise<Record<string, unknown>>;
|
|
509
725
|
update: (id: string, payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
@@ -573,11 +789,6 @@ export declare class AgentiSend {
|
|
|
573
789
|
get: (id: string) => Promise<Record<string, unknown>>;
|
|
574
790
|
update: (id: string, payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
575
791
|
delete: (id: string, options?: RequestOptions) => Promise<Deleted>;
|
|
576
|
-
/** The account contact list. An audience id on this path does not select a second list. */
|
|
577
|
-
contacts: (id: string, query?: ListQuery & {
|
|
578
|
-
email?: string;
|
|
579
|
-
}) => Promise<Page<Record<string, unknown>>>;
|
|
580
|
-
members: (id: string) => Promise<Page<Record<string, unknown>>>;
|
|
581
792
|
};
|
|
582
793
|
/**
|
|
583
794
|
* M4.9 — this account's own history. `action` takes a family (`api_key`) or
|
|
@@ -670,7 +881,7 @@ export declare class AgentiSend {
|
|
|
670
881
|
*/
|
|
671
882
|
readonly dnsCheck: (domain: string) => Promise<Record<string, unknown>>;
|
|
672
883
|
/** Send, delivery and engagement figures with a daily series, over a window. */
|
|
673
|
-
readonly metrics: (query?: MetricsQuery & {
|
|
884
|
+
readonly metrics: (query?: Pick<MetricsQuery, "since" | "until" | "start_date" | "end_date"> & {
|
|
674
885
|
group_by?: string;
|
|
675
886
|
event?: "sent" | "delivered" | "bounced" | "complained" | "opened" | "clicked";
|
|
676
887
|
domain?: string;
|
|
@@ -766,6 +977,15 @@ export declare class AgentiSend {
|
|
|
766
977
|
plan: () => Promise<BillingPlan>;
|
|
767
978
|
/** Plan, usage against each published limit, and what the next tier changes. Buying stays in the console. */
|
|
768
979
|
get: () => Promise<Record<string, unknown>>;
|
|
980
|
+
/** This account's invoices and one-time receipts, newest first. */
|
|
981
|
+
invoices: (query?: {
|
|
982
|
+
limit?: number;
|
|
983
|
+
starting_after?: string;
|
|
984
|
+
}) => Promise<Record<string, unknown>>;
|
|
985
|
+
/** Unpaid invoices, oldest first, and the total still due. */
|
|
986
|
+
openInvoices: () => Promise<Record<string, unknown>>;
|
|
987
|
+
/** Record that this key's account opened an invoice or its PDF. */
|
|
988
|
+
invoiceOpened: (id: string, action: "view" | "pdf", options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
769
989
|
};
|
|
770
990
|
}
|
|
771
991
|
export {};
|