coss 0.2.0 → 0.4.0

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/index.d.ts CHANGED
@@ -70,7 +70,7 @@ interface HttpClientOptions {
70
70
  interface ApiRequest {
71
71
  /** Disable automatic retries for operations without server-side deduplication. */
72
72
  retry?: boolean;
73
- method: "GET" | "POST" | "PATCH" | "DELETE";
73
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
74
74
  /** Path including the version prefix, e.g. `/v1/emails`. */
75
75
  path: string;
76
76
  /** Query parameters; `undefined` values are left out. */
@@ -95,11 +95,59 @@ declare class HttpClient {
95
95
  request<T>(request: ApiRequest): Promise<CossResult<T>>;
96
96
  }
97
97
  //#endregion
98
+ //#region src/types/environment.d.ts
99
+ /** Environment wire types (hand-written mirrors of the API's `Environment` schema). */
100
+ /** A project or organization, as named in the dashboard. */
101
+ interface NamedResource {
102
+ id: string;
103
+ name: string;
104
+ /** As in dashboard URLs. */
105
+ slug: string;
106
+ }
107
+ /** `GET /v1/environment`: the environment the API key belongs to. */
108
+ interface Environment {
109
+ object: "environment";
110
+ id: string;
111
+ name: string;
112
+ slug: string;
113
+ /** `live` delivers email; `sandbox` (`coss_test_` keys) never does. */
114
+ mode: "live" | "sandbox";
115
+ project: NamedResource;
116
+ organization: NamedResource & {
117
+ /** The organization's pinned API version (for requests without `Coss-Version`). */
118
+ api_version: string;
119
+ };
120
+ /** The API key making the request. */
121
+ api_key: {
122
+ id: string;
123
+ name: string | null;
124
+ /** The key's first characters, as shown in the dashboard. */
125
+ start: string | null;
126
+ };
127
+ }
128
+ /** `DELETE /v1/api_key`: the key revoked itself. */
129
+ interface DeletedApiKey {
130
+ object: "api_key";
131
+ id: string;
132
+ deleted: true;
133
+ }
134
+ //#endregion
135
+ //#region src/resources/api-key.d.ts
136
+ type ReadOptions$18 = Pick<RequestOptions, "signal">;
137
+ /** `coss.apiKey`: the API key the client was created with. */
138
+ declare class ApiKeyResource {
139
+ #private;
140
+ /** @internal Use `new Coss().apiKey`. */
141
+ constructor(http: HttpClient);
142
+ /** Revokes the client's own API key, at once: every later request with it fails. */
143
+ revoke(options?: ReadOptions$18): Promise<CossResult<DeletedApiKey>>;
144
+ }
145
+ //#endregion
98
146
  //#region src/types/audit-event.d.ts
99
147
  /** Audit log wire types (hand-written mirrors of the API's schemas). */
100
148
  /**
101
- * `user`: a member, in the dashboard. `api_key`: a request made with an API key. `system`: COSS
102
- * itself, including COSS support.
149
+ * `user`: a member, in the dashboard. `api_key`: a request made with an API key. `system`: coss.com
150
+ * itself, including coss.com support.
103
151
  */
104
152
  type AuditActorType = "user" | "api_key" | "system";
105
153
  /** One change to the organization. */
@@ -111,7 +159,7 @@ interface AuditEvent {
111
159
  actor_type: AuditActorType;
112
160
  /** The user's or API key's id; `null` for the system. */
113
161
  actor_id: string | null;
114
- /** The user's email, the API key's id, or `COSS support` (copied when recorded). */
162
+ /** The user's email, the API key's id, or `coss.com support` (copied when recorded). */
115
163
  actor_label: string;
116
164
  /** `<resource>.<verb>`, e.g. `api_key.created`, `domain.deleted`, `member.role_changed`. */
117
165
  action: string;
@@ -151,13 +199,165 @@ interface ListAuditEventsParams {
151
199
  after?: string;
152
200
  }
153
201
  //#endregion
202
+ //#region src/types/email-template.d.ts
203
+ /** Wire types of email templates (`coss.email.templates`). */
204
+ /** A variable's type. `list` is an array of objects with the declared `fields`. */
205
+ type TemplateVariableType = "string" | "number" | "boolean" | "list";
206
+ type TemplateScalarType = "string" | "number" | "boolean";
207
+ /** A declared variable, used in the template as `{{name}}`. */
208
+ interface TemplateVariable {
209
+ name: string;
210
+ type: TemplateVariableType;
211
+ /** Sends must pass it unless it has a `default`. */
212
+ required: boolean;
213
+ /** Used when a send leaves it out. */
214
+ default?: string | number | boolean;
215
+ description?: string;
216
+ /** A list's item fields. */
217
+ fields?: {
218
+ name: string;
219
+ type: TemplateScalarType;
220
+ required: boolean;
221
+ }[];
222
+ }
223
+ /** A variable to declare. `required` defaults to true. */
224
+ interface TemplateVariableParams {
225
+ /** 1-64 letters, digits and underscores, not starting with a digit. */
226
+ name: string;
227
+ type: TemplateVariableType;
228
+ required?: boolean;
229
+ /** Not for lists. */
230
+ default?: string | number | boolean;
231
+ description?: string;
232
+ /** Required for lists, only for lists. */
233
+ fields?: {
234
+ name: string;
235
+ type: TemplateScalarType;
236
+ required?: boolean;
237
+ }[];
238
+ }
239
+ /** One locale's subject, HTML and text templates. */
240
+ interface TemplateContent {
241
+ /** A BCP 47 language tag, e.g. `"en"` or `"pt-BR"`. */
242
+ locale: string;
243
+ subject: string;
244
+ html: string | null;
245
+ text: string | null;
246
+ }
247
+ /** One locale's templates. Provide `html`, `text`, or both. */
248
+ interface TemplateContentParams {
249
+ locale: string;
250
+ subject: string;
251
+ html?: string | null;
252
+ text?: string | null;
253
+ }
254
+ /** A problem that keeps a draft from being published, at a line and column of one field. */
255
+ interface TemplateProblem {
256
+ locale: string;
257
+ field: "subject" | "html" | "text";
258
+ message: string;
259
+ line: number;
260
+ column: number;
261
+ }
262
+ interface EmailTemplate {
263
+ object: "email_template";
264
+ id: string;
265
+ /** Send it by this name in any environment that has a template with the same alias. */
266
+ alias: string | null;
267
+ name: string;
268
+ description: string | null;
269
+ /** The version sends use; `null` until the draft is first published. */
270
+ published_version: number | null;
271
+ /** ISO 8601 timestamp, or `null`. */
272
+ published_at: string | null;
273
+ /** Whether the draft was changed since it was last published. */
274
+ has_unpublished_changes: boolean;
275
+ created_at: string;
276
+ updated_at: string;
277
+ }
278
+ /** A template's draft (`version: null`) or a published version (which never changes). */
279
+ interface EmailTemplateVersion {
280
+ object: "email_template_version";
281
+ template_id: string;
282
+ version: number | null;
283
+ /** Counts the draft's saves; pass it back to refuse overwriting someone else's changes. */
284
+ revision: number;
285
+ /** The locale sends fall back to. */
286
+ default_locale: string;
287
+ variables: TemplateVariable[];
288
+ /** Example values for previews and test sends. */
289
+ sample_variables: Record<string, unknown>;
290
+ contents: TemplateContent[];
291
+ /** Problems of a draft; always empty for published versions. */
292
+ problems: TemplateProblem[];
293
+ published_at: string | null;
294
+ created_at: string;
295
+ updated_at: string;
296
+ }
297
+ interface TemplateDraftParams {
298
+ /** Defaults to the first entry of `contents` (or `"en"`). */
299
+ default_locale?: string;
300
+ variables?: TemplateVariableParams[];
301
+ sample_variables?: Record<string, unknown>;
302
+ contents?: TemplateContentParams[];
303
+ }
304
+ /** Parameters of `coss.email.templates.create`. */
305
+ interface CreateEmailTemplateParams extends TemplateDraftParams {
306
+ name: string;
307
+ /** 1-64 lower-case letters, digits, `-` and `_`, e.g. `"welcome"`. */
308
+ alias?: string;
309
+ description?: string;
310
+ }
311
+ /** Parameters of `coss.email.templates.update`. */
312
+ interface UpdateEmailTemplateParams {
313
+ name?: string;
314
+ /** `null` removes the alias. */
315
+ alias?: string | null;
316
+ description?: string | null;
317
+ }
318
+ /** Parameters of `coss.email.templates.updateDraft`: replaces the whole draft. */
319
+ interface UpdateEmailTemplateDraftParams extends TemplateDraftParams {
320
+ /** The `revision` you read: refused (`template_revision_mismatch`) if the draft changed since. */
321
+ revision?: number;
322
+ }
323
+ /** Parameters of `coss.email.templates.publish`. */
324
+ interface PublishEmailTemplateParams {
325
+ /** The draft `revision` you reviewed: refused if the draft changed since. */
326
+ revision?: number;
327
+ }
328
+ interface ListEmailTemplatesParams {
329
+ /** 1-100, default 50. */
330
+ limit?: number;
331
+ /** Cursor: the `id` of the last template of the previous page. */
332
+ after?: string;
333
+ }
334
+ interface ListEmailTemplateVersionsParams {
335
+ /** 1-20, default 10. */
336
+ limit?: number;
337
+ /** Cursor: the `version` of the last version of the previous page. */
338
+ after?: number;
339
+ }
340
+ interface DeletedEmailTemplate {
341
+ object: "email_template";
342
+ id: string;
343
+ deleted: true;
344
+ }
345
+ /** The template an email was rendered from. */
346
+ interface EmailTemplateReference {
347
+ id: string;
348
+ /** `null` for a dashboard test send of the draft. */
349
+ version: number | null;
350
+ locale: string;
351
+ }
352
+ //#endregion
154
353
  //#region src/types/suppression.d.ts
155
354
  /** Suppression list wire types (hand-written mirrors of the API's schemas). */
156
355
  /**
157
356
  * Why an address is suppressed. `bounce`: a permanent bounce. `complaint`: a spam complaint.
158
357
  * `manual`: added one by one through the API or the dashboard. `import`: added by a bulk import.
358
+ * `unsubscribe`: the recipient's one-click unsubscribe, scoped to the email's category.
159
359
  */
160
- type SuppressionReason = "bounce" | "complaint" | "manual" | "import";
360
+ type SuppressionReason = "bounce" | "complaint" | "manual" | "import" | "unsubscribe";
161
361
  /** An entry of the API key's environment's suppression list. */
162
362
  interface Suppression {
163
363
  object: "suppression";
@@ -292,7 +492,7 @@ interface EmailRecipient {
292
492
  /** ISO 8601 timestamp of the latest event for this recipient, or `null`. */
293
493
  last_event_at: string | null;
294
494
  }
295
- type EmailEventType = "email.sent" | "email.delivered" | "email.delivery_delayed" | "email.bounced" | "email.complained" | "email.failed" | "email.suppressed" | "email.scheduled" | "email.canceled" | "email.opened" | "email.clicked" | "email.rescheduled";
495
+ type EmailEventType = "email.sent" | "email.delivered" | "email.delivery_delayed" | "email.bounced" | "email.complained" | "email.failed" | "email.suppressed" | "email.scheduled" | "email.canceled" | "email.opened" | "email.clicked" | "email.rescheduled" | "email.unsubscribed";
296
496
  /** Details of an event; which member is present depends on the event type. */
297
497
  interface EmailEventData {
298
498
  bounce?: {
@@ -367,23 +567,35 @@ interface TrackingOptions {
367
567
  /** Add an invisible pixel to the HTML body and record `email.opened` events. */
368
568
  opens?: boolean;
369
569
  /**
370
- * Send HTML links through a COSS redirect and record `email.clicked` events. Links with a
570
+ * Send HTML links through a coss.com redirect and record `email.clicked` events. Links with a
371
571
  * `data-coss-no-track` attribute are left alone.
372
572
  */
373
573
  clicks?: boolean;
574
+ /**
575
+ * Add one-click unsubscribe headers (`List-Unsubscribe` and `List-Unsubscribe-Post`, RFC 8058).
576
+ * An unsubscribe suppresses the recipient for this email's category and records
577
+ * `email.unsubscribed`. Needs a `category`, a single recipient, no `List-Unsubscribe` header of
578
+ * your own and at most 13 custom headers.
579
+ */
580
+ unsubscribe?: boolean;
374
581
  }
375
- /** Body of `POST /v1/emails`. */
376
- interface SendEmailParams {
582
+ /**
583
+ * A React element, such as `<WelcomeEmail name="Ada" />`. Described by its shape so the SDK needs
584
+ * no React types: any JSX element fits.
585
+ */
586
+ interface ReactEmailElement {
587
+ type: unknown;
588
+ props: unknown;
589
+ key: unknown;
590
+ }
591
+ /** What every send has, with or without a template. */
592
+ interface SendEmailBaseParams {
377
593
  /** `"you@example.com"` or `"Your Name <you@example.com>"`. */
378
594
  from: string;
379
595
  to: string | string[];
380
596
  cc?: string | string[];
381
597
  bcc?: string | string[];
382
598
  reply_to?: string | string[];
383
- subject: string;
384
- /** At least one of `html` or `text` is required. */
385
- html?: string;
386
- text?: string;
387
599
  /** Custom headers. Names are case-insensitive; reserved names such as `subject` are rejected. */
388
600
  headers?: Record<string, string>;
389
601
  tags?: EmailTag[];
@@ -402,6 +614,44 @@ interface SendEmailParams {
402
614
  attachments?: EmailAttachmentParams[];
403
615
  tracking?: TrackingOptions;
404
616
  }
617
+ /** A send with its own subject and body. */
618
+ interface SendEmailContentParams extends SendEmailBaseParams {
619
+ subject: string;
620
+ /** At least one of `html`, `text` or `react` is required. */
621
+ html?: string;
622
+ /** Without it, an `html` email goes out with a text part generated from the HTML. */
623
+ text?: string;
624
+ /**
625
+ * A [React Email](https://react.email) component, rendered by the SDK into `html` and, unless you
626
+ * pass `text`, into `text` too. Needs the optional peer dependency `@react-email/render`
627
+ * (`npm install @react-email/render`). Can't be combined with `html`; never sent to the API as is.
628
+ */
629
+ react?: ReactEmailElement;
630
+ template_id?: never;
631
+ template_version?: never;
632
+ locale?: never;
633
+ variables?: never;
634
+ }
635
+ /** A send of a published email template (`coss.email.templates`). */
636
+ interface SendEmailTemplateParams extends SendEmailBaseParams {
637
+ /** The template's id or alias. */
638
+ template_id: string;
639
+ /** A published version to send; defaults to the latest one. */
640
+ template_version?: number;
641
+ /**
642
+ * The locale to send, e.g. `"pt-BR"`. Falls back to the language (`"pt"`), then to the
643
+ * template's default locale.
644
+ */
645
+ locale?: string;
646
+ /** Values for the template's variables, keyed by name. */
647
+ variables?: Record<string, unknown>;
648
+ subject?: never;
649
+ html?: never;
650
+ text?: never;
651
+ react?: never;
652
+ }
653
+ /** A send: a subject and body (or `react`, which the SDK renders before sending), or a template. */
654
+ type SendEmailParams = SendEmailContentParams | SendEmailTemplateParams;
405
655
  /** Parameters of `coss.email.reschedule`. */
406
656
  interface RescheduleEmailParams {
407
657
  /**
@@ -417,6 +667,8 @@ interface RescheduleEmailParams {
417
667
  interface EmailTracking {
418
668
  opens: boolean;
419
669
  clicks: boolean;
670
+ /** Whether the email carries one-click unsubscribe headers (RFC 8058). */
671
+ unsubscribe: boolean;
420
672
  open_count: number;
421
673
  /** ISO 8601 timestamps, or `null`. */
422
674
  first_opened_at: string | null;
@@ -425,7 +677,7 @@ interface EmailTracking {
425
677
  first_clicked_at: string | null;
426
678
  last_clicked_at: string | null;
427
679
  }
428
- /** A link COSS rewrote for click tracking. */
680
+ /** A link coss.com rewrote for click tracking. */
429
681
  interface EmailLink {
430
682
  object: "email_link";
431
683
  id: string;
@@ -437,6 +689,15 @@ interface EmailLink {
437
689
  first_clicked_at: string | null;
438
690
  last_clicked_at: string | null;
439
691
  }
692
+ /** Why an email failed as a whole. */
693
+ interface EmailFailure {
694
+ /**
695
+ * E.g. `all_recipients_suppressed`, `domain_not_verified`, `content_rejected`,
696
+ * `attachments_unavailable`, `dispatch_failed` or `provider_error`.
697
+ */
698
+ code: string;
699
+ message: string;
700
+ }
440
701
  /** An email as returned by the API. Recipient fields are always arrays. */
441
702
  interface Email {
442
703
  object: "email";
@@ -454,6 +715,8 @@ interface Email {
454
715
  tags: EmailTag[];
455
716
  category: string | null;
456
717
  status: EmailStatus;
718
+ /** Why the email failed; `null` unless `status` is `"failed"`. */
719
+ failure: EmailFailure | null;
457
720
  /** Every distinct recipient across `to`, `cc` and `bcc`, with its delivery status. */
458
721
  recipients: EmailRecipient[];
459
722
  /** Attachment metadata; the content is discarded once the email is sent. */
@@ -469,6 +732,33 @@ interface Email {
469
732
  scheduled_at: string | null;
470
733
  /** The batch that sent the email (`coss.email.sendBatch`), or `null` if it was sent alone. */
471
734
  batch_id: string | null;
735
+ /** The template the email was rendered from, or `null` if it was sent without one. */
736
+ template: EmailTemplateReference | null;
737
+ }
738
+ /** An email in a list (`coss.email.list`): everything but its content. */
739
+ type EmailSummary = Omit<Email, "html" | "text" | "headers" | "attachments">;
740
+ /** Filters of `coss.email.list`. Emails are returned newest first. */
741
+ interface ListEmailsParams {
742
+ /** Only emails with this recipient (in `to`, `cc` or `bcc`; the bare address, any case). */
743
+ to?: string;
744
+ /** Only emails with a recipient in one of these statuses (with `to`, that recipient's). */
745
+ recipient_status?: EmailRecipientStatus[];
746
+ /** Only emails in these statuses. */
747
+ status?: EmailStatus[];
748
+ /** Free text, matched against the subject and the `to` addresses. */
749
+ q?: string;
750
+ /** Only emails of this category. */
751
+ category?: string;
752
+ /** Only the emails of this batch. */
753
+ batch_id?: string;
754
+ /** Only emails created at or after this time. */
755
+ created_after?: Date | string;
756
+ /** Only emails created before this time. */
757
+ created_before?: Date | string;
758
+ /** 1-100, default 20. */
759
+ limit?: number;
760
+ /** Cursor: the `id` of the last email of the previous page. */
761
+ after?: string;
472
762
  }
473
763
  /** Emails sent together by `coss.email.sendBatch`. */
474
764
  interface EmailBatch {
@@ -481,19 +771,19 @@ interface EmailBatch {
481
771
  }
482
772
  //#endregion
483
773
  //#region src/resources/audit-events.d.ts
484
- type ReadOptions$12 = Pick<RequestOptions, "signal">;
774
+ type ReadOptions$17 = Pick<RequestOptions, "signal">;
485
775
  /**
486
776
  * `coss.auditEvents`: the organization's audit log, newest first: changes made by members, API
487
- * keys and COSS support. Organization-wide, whichever environment the key belongs to.
777
+ * keys and coss.com support. Organization-wide, whichever environment the key belongs to.
488
778
  */
489
779
  declare class AuditEventsResource {
490
780
  #private;
491
781
  /** @internal Use `new Coss().auditEvents`. */
492
782
  constructor(http: HttpClient);
493
783
  /** Lists audit events, newest first. Pass the last `id` as `after` while `has_more` is true. */
494
- list(params?: ListAuditEventsParams, options?: ReadOptions$12): Promise<CossResult<List<AuditEvent>>>;
784
+ list(params?: ListAuditEventsParams, options?: ReadOptions$17): Promise<CossResult<List<AuditEvent>>>;
495
785
  /** Retrieves one audit event. */
496
- get(id: string, options?: ReadOptions$12): Promise<CossResult<AuditEvent>>;
786
+ get(id: string, options?: ReadOptions$17): Promise<CossResult<AuditEvent>>;
497
787
  }
498
788
  //#endregion
499
789
  //#region src/types/billing.d.ts
@@ -502,7 +792,7 @@ declare class AuditEventsResource {
502
792
  * schemas). Amounts are integers in cents (USD); unit prices are dollar decimal strings.
503
793
  */
504
794
  type PlanKey = "free" | "pro" | "scale" | "enterprise";
505
- type Meter = "email.recipients" | "sms.segments" | "video.participant_minutes" | "scheduling.bookings";
795
+ type Meter = "email.recipients" | "email.dedicated_ip" | "sms.segments" | "video.participant_minutes" | "scheduling.bookings";
506
796
  type BillingHoldReason = "delinquent" | "spend_limit" | "admin";
507
797
  /** `GET /v1/billing`: the organization's plan, the current month so far, and its standing. */
508
798
  interface Billing {
@@ -560,12 +850,23 @@ interface Billing {
560
850
  brand: string | null;
561
851
  last4: string | null;
562
852
  } | null;
853
+ /** Add-ons of the contract in effect, charged on top of the plan. */
854
+ add_ons: {
855
+ /** e.g. `dedicated_ips`. */
856
+ key: string;
857
+ name: string;
858
+ quantity: number;
859
+ /** The price per unit and interval (cents). */
860
+ unit_amount: number;
861
+ interval: "month" | "quarter" | "year";
862
+ }[];
563
863
  features: {
564
864
  tracking_domains: boolean;
565
865
  audit_log: boolean;
566
866
  log_drains: boolean;
567
867
  sso: boolean;
568
868
  scim: boolean;
869
+ dedicated_ips: boolean;
569
870
  };
570
871
  /** Resource limits (`null`: unlimited). */
571
872
  limits: {
@@ -689,16 +990,16 @@ interface ListCreditsParams {
689
990
  }
690
991
  //#endregion
691
992
  //#region src/resources/billing.d.ts
692
- type ReadOptions$11 = Pick<RequestOptions, "signal">;
993
+ type ReadOptions$16 = Pick<RequestOptions, "signal">;
693
994
  /** `coss.billing.invoices`: the organization's invoices, newest first. */
694
995
  declare class BillingInvoicesResource {
695
996
  #private;
696
997
  /** @internal Use `new Coss().billing.invoices`. */
697
998
  constructor(http: HttpClient);
698
999
  /** Lists invoices (without lines). Pass the last `id` as `after` while `has_more` is true. */
699
- list(params?: ListInvoicesParams, options?: ReadOptions$11): Promise<CossResult<List<InvoiceSummary>>>;
1000
+ list(params?: ListInvoicesParams, options?: ReadOptions$16): Promise<CossResult<List<InvoiceSummary>>>;
700
1001
  /** Retrieves one invoice with its lines. */
701
- get(id: string, options?: ReadOptions$11): Promise<CossResult<Invoice>>;
1002
+ get(id: string, options?: ReadOptions$16): Promise<CossResult<Invoice>>;
702
1003
  }
703
1004
  /** `coss.billing.credits`: the organization's credits and what's left of them. */
704
1005
  declare class BillingCreditsResource {
@@ -706,7 +1007,7 @@ declare class BillingCreditsResource {
706
1007
  /** @internal Use `new Coss().billing.credits`. */
707
1008
  constructor(http: HttpClient);
708
1009
  /** Lists credits, newest first (usable ones by default). */
709
- list(params?: ListCreditsParams, options?: ReadOptions$11): Promise<CossResult<List<Credit>>>;
1010
+ list(params?: ListCreditsParams, options?: ReadOptions$16): Promise<CossResult<List<Credit>>>;
710
1011
  }
711
1012
  /**
712
1013
  * `coss.billing`: the organization's plan, usage, invoices and credits (read only; plan changes
@@ -719,9 +1020,9 @@ declare class BillingResource {
719
1020
  /** @internal Use `new Coss().billing`. */
720
1021
  constructor(http: HttpClient);
721
1022
  /** The plan, the current month's usage and estimate, standing and what the plan includes. */
722
- get(options?: ReadOptions$11): Promise<CossResult<Billing>>;
1023
+ get(options?: ReadOptions$16): Promise<CossResult<Billing>>;
723
1024
  /** Billable usage per meter and bucket (the current month, by day, by default), oldest first. */
724
- usage(params?: ListUsageParams, options?: ReadOptions$11): Promise<CossResult<List<Usage>>>;
1025
+ usage(params?: ListUsageParams, options?: ReadOptions$16): Promise<CossResult<List<Usage>>>;
725
1026
  }
726
1027
  //#endregion
727
1028
  //#region src/types/domain.d.ts
@@ -760,7 +1061,7 @@ interface DomainRecord {
760
1061
  found: string[];
761
1062
  }
762
1063
  /**
763
- * `pending` until the CNAME points at COSS and its certificate is issued, `active` once tracking
1064
+ * `pending` until the CNAME points at coss.com and its certificate is issued, `active` once tracking
764
1065
  * links of emails sent from the domain use it, `temporary_failure` when an active hostname stopped
765
1066
  * working (emails fall back to the default tracking host meanwhile), and `failed` when setup gave
766
1067
  * up (72 hours) — call `domains.verify` to start over. `deleting` is a removal in progress.
@@ -799,7 +1100,7 @@ interface ReceivingDomainRecord {
799
1100
  /** The mail exchange the record must point at. */
800
1101
  value: string;
801
1102
  priority: number;
802
- /** `verified` once the most preferred MX records point at COSS. */
1103
+ /** `verified` once the most preferred MX records point at coss.com. */
803
1104
  status: DomainRecordStatus;
804
1105
  /** What DNS returned when it did not match. */
805
1106
  found: string[];
@@ -814,6 +1115,39 @@ interface ReceivingDomain {
814
1115
  created_at: string;
815
1116
  last_checked_at: string | null;
816
1117
  }
1118
+ /**
1119
+ * `configured` when the BIMI record is valid and DMARC is enforced, `invalid` when a record exists
1120
+ * but something is wrong (see `issues`), `missing` when there is no record, and `not_checked` until
1121
+ * DNS has been consulted. coss.com checks DNS only: mailbox providers still validate the logo and the
1122
+ * certificate.
1123
+ */
1124
+ type BimiStatus = "not_checked" | "missing" | "invalid" | "configured";
1125
+ /** What keeps a domain's logo from showing, as far as DNS tells. */
1126
+ type BimiIssueCode = "dmarc_missing" | "dmarc_not_enforced" | "dmarc_partial" | "record_multiple" | "record_invalid" | "logo_missing" | "logo_not_https" | "certificate_missing" | "certificate_not_https";
1127
+ /** The last BIMI check of a domain (brand logos in inboxes; the certificate is your own). */
1128
+ interface DomainBimi {
1129
+ status: BimiStatus;
1130
+ /**
1131
+ * Where the BIMI record was found, or looked up when there is none: `default._bimi.<domain>`,
1132
+ * or the organizational domain's when only it has one.
1133
+ */
1134
+ name: string;
1135
+ /** The `v=BIMI1` record found. */
1136
+ record: string | null;
1137
+ /** The record's logo URL (`l=`). */
1138
+ logo_url: string | null;
1139
+ /** The record's VMC or CMC certificate URL (`a=`). */
1140
+ certificate_url: string | null;
1141
+ /**
1142
+ * The DMARC policy that applies to the domain (the organizational domain's `sp` when it has no
1143
+ * record of its own), `null` without a DMARC record.
1144
+ */
1145
+ dmarc_policy: "none" | "quarantine" | "reject" | null;
1146
+ issues: {
1147
+ code: BimiIssueCode;
1148
+ message: string;
1149
+ }[];
1150
+ }
817
1151
  /** A sending domain of the organization. */
818
1152
  interface Domain {
819
1153
  object: "domain";
@@ -838,6 +1172,8 @@ interface Domain {
838
1172
  tracking: TrackingDomain | null;
839
1173
  /** The receiving hostname, or `null` when the domain doesn't receive email. */
840
1174
  receiving: ReceivingDomain | null;
1175
+ /** The last BIMI check: whether mailbox providers can find the domain's brand logo. */
1176
+ bimi: DomainBimi;
841
1177
  }
842
1178
  /** Body of `POST /v1/domains`. */
843
1179
  interface CreateDomainParams {
@@ -864,6 +1200,201 @@ interface CreateReceivingDomainParams {
864
1200
  hostname: string;
865
1201
  }
866
1202
  //#endregion
1203
+ //#region src/types/dmarc.d.ts
1204
+ /** DMARC wire types (hand-written mirrors of the API's `DomainDmarc` and `DmarcReport` schemas). */
1205
+ type DmarcPolicy = "none" | "quarantine" | "reject";
1206
+ /** Where a domain is on the path from `p=none` to `p=reject`. */
1207
+ type DmarcStage = "not_checked" | "no_record" | "monitoring" | "quarantine" | "reject";
1208
+ /**
1209
+ * `publish` a first record, `add_reporting` (send reports to coss.com), `complete_rollout` (drop
1210
+ * `pct`/`t=y`) or `tighten` to the next policy.
1211
+ */
1212
+ type DmarcNextStepKind = "publish" | "add_reporting" | "complete_rollout" | "tighten";
1213
+ type DmarcCheckId = "coverage" | "recent" | "complete" | "time_at_policy" | "coss_pass_rate" | "pass_rate" | "sources";
1214
+ /** The DMARC record found at `_dmarc.<domain>` by the latest DNS check. */
1215
+ interface DmarcPublishedRecord {
1216
+ /** The `v=DMARC1` TXT record as published. */
1217
+ value: string;
1218
+ p: DmarcPolicy | null;
1219
+ sp: DmarcPolicy | null;
1220
+ np: DmarcPolicy | null;
1221
+ adkim: "r" | "s" | null;
1222
+ aspf: "r" | "s" | null;
1223
+ /** Removed by RFC 9989 but still honored by many receivers. */
1224
+ pct: number | null;
1225
+ t: "y" | "n" | null;
1226
+ /** Aggregate report addresses. */
1227
+ rua: string[];
1228
+ }
1229
+ /** Messages from one source IP with one From domain, over the report summary's period. */
1230
+ interface DmarcSource {
1231
+ source_ip: string;
1232
+ /** The domain in the messages' From header. */
1233
+ header_from: string;
1234
+ messages: number;
1235
+ /** Messages that passed DMARC. */
1236
+ passing: number;
1237
+ /** Signed with the domain's coss.com DKIM keys or sent from its coss.com MAIL FROM domain. */
1238
+ via_coss: boolean;
1239
+ }
1240
+ /** One readiness check gating `DomainDmarc.next`. */
1241
+ interface DmarcCheck {
1242
+ id: DmarcCheckId;
1243
+ ok: boolean;
1244
+ message: string;
1245
+ }
1246
+ /** The next step on the path to `p=reject`. */
1247
+ interface DmarcNextStep {
1248
+ kind: DmarcNextStepKind;
1249
+ policy: DmarcPolicy;
1250
+ /** The TXT record to publish at `_dmarc.<domain>`. */
1251
+ record: string;
1252
+ }
1253
+ /** A domain's DMARC status: its record, the guided next step and recent reports. */
1254
+ interface DomainDmarc {
1255
+ object: "domain_dmarc";
1256
+ domain_id: string;
1257
+ /** Where the domain's aggregate reports go; `null` when the deployment doesn't receive email. */
1258
+ report_address: string | null;
1259
+ /** The domain's own record. `null`: none found (or an invalid one), or DNS not checked yet. */
1260
+ record: DmarcPublishedRecord | null;
1261
+ /** The policy receivers apply: the domain's own, else its organizational domain's (`sp`, else `p`). */
1262
+ policy: DmarcPolicy | null;
1263
+ /** The organizational domain whose record applies, when the domain publishes none of its own. */
1264
+ inherited_from: string | null;
1265
+ /** ISO 8601 timestamp: when a DNS check first saw the current policy. */
1266
+ policy_since: string | null;
1267
+ stage: DmarcStage;
1268
+ /** The policy applies only partly (`pct` below 100, or `t=y`). */
1269
+ partial: boolean;
1270
+ /** The published record sends aggregate reports to `report_address`. */
1271
+ reporting: boolean;
1272
+ /** Whether `next` is safe to publish now. */
1273
+ ready: boolean;
1274
+ /** `null` at `p=reject`. */
1275
+ next: DmarcNextStep | null;
1276
+ checks: DmarcCheck[];
1277
+ warnings: string[];
1278
+ report_summary: {
1279
+ /** ISO 8601 timestamps of the summarized period (the last 14 days). */
1280
+ period_start: string;
1281
+ period_end: string;
1282
+ reports: number;
1283
+ messages: number;
1284
+ passing: number;
1285
+ coss_messages: number;
1286
+ coss_passing: number;
1287
+ first_report_at: string | null;
1288
+ last_report_at: string | null;
1289
+ /** The 50 sources with the most messages in the period. */
1290
+ sources: DmarcSource[];
1291
+ };
1292
+ }
1293
+ /** The policy a reporter found when it evaluated the mail. */
1294
+ interface DmarcPolicyPublished {
1295
+ domain: string;
1296
+ p: string | null;
1297
+ sp: string | null;
1298
+ np: string | null;
1299
+ adkim: string | null;
1300
+ aspf: string | null;
1301
+ pct: number | null;
1302
+ testing: string | null;
1303
+ }
1304
+ /** A DMARC aggregate report, without its rows (lists). */
1305
+ interface DmarcReportSummary {
1306
+ object: "dmarc_report";
1307
+ id: string;
1308
+ domain_id: string;
1309
+ reporter: {
1310
+ org_name: string;
1311
+ email: string | null;
1312
+ };
1313
+ /** The reporter's own id of the report. */
1314
+ report_id: string;
1315
+ /** ISO 8601 timestamps. */
1316
+ period_start: string;
1317
+ period_end: string;
1318
+ policy_published: DmarcPolicyPublished;
1319
+ messages: number;
1320
+ passing: number;
1321
+ /** The report listed more rows than are kept (10,000); totals cover the kept rows. */
1322
+ truncated: boolean;
1323
+ /** ISO 8601 timestamp. */
1324
+ received_at: string;
1325
+ }
1326
+ /** One row of a report: messages from one source IP with one outcome. */
1327
+ interface DmarcReportRecord {
1328
+ source_ip: string;
1329
+ count: number;
1330
+ /** What the receiver did with the messages. */
1331
+ disposition: DmarcPolicy;
1332
+ /** Aligned DKIM result. */
1333
+ dkim: "pass" | "fail";
1334
+ /** Aligned SPF result. */
1335
+ spf: "pass" | "fail";
1336
+ dmarc_pass: boolean;
1337
+ header_from: string;
1338
+ envelope_from: string | null;
1339
+ via_coss: boolean;
1340
+ auth_results: {
1341
+ dkim: {
1342
+ domain: string;
1343
+ selector: string | null;
1344
+ result: string;
1345
+ }[];
1346
+ spf: {
1347
+ domain: string;
1348
+ scope: string | null;
1349
+ result: string;
1350
+ }[];
1351
+ };
1352
+ reasons: {
1353
+ type: string;
1354
+ comment: string | null;
1355
+ }[];
1356
+ }
1357
+ /** A DMARC aggregate report with its rows. */
1358
+ interface DmarcReport extends DmarcReportSummary {
1359
+ records: DmarcReportRecord[];
1360
+ }
1361
+ /** Query of `coss.domains.dmarc.reports.list`. */
1362
+ interface ListDmarcReportsParams {
1363
+ /** 1-100, default 20. */
1364
+ limit?: number;
1365
+ /** The `id` of the last report of the previous page. */
1366
+ after?: string;
1367
+ }
1368
+ //#endregion
1369
+ //#region src/resources/dmarc.d.ts
1370
+ type ReadOptions$15 = Pick<RequestOptions, "signal">;
1371
+ /** `coss.domains.dmarc.reports`: the aggregate reports received about a domain. */
1372
+ declare class DmarcReportsResource {
1373
+ #private;
1374
+ /** @internal Use `new Coss().domains.dmarc.reports`. */
1375
+ constructor(http: HttpClient);
1376
+ /** Lists the domain's reports, newest first, without their rows. */
1377
+ list(domainId: string, params?: ListDmarcReportsParams, options?: ReadOptions$15): Promise<CossResult<List<DmarcReportSummary>>>;
1378
+ /** Retrieves one report with its rows. */
1379
+ get(domainId: string, reportId: string, options?: ReadOptions$15): Promise<CossResult<DmarcReport>>;
1380
+ }
1381
+ /**
1382
+ * `coss.domains.dmarc`: a domain's DMARC record, the guided path from `p=none` to `p=reject`, and
1383
+ * the aggregate reports mailbox providers send to its `report_address`.
1384
+ */
1385
+ declare class DmarcResource {
1386
+ #private;
1387
+ /** The domain's aggregate reports. */
1388
+ readonly reports: DmarcReportsResource;
1389
+ /** @internal Use `new Coss().domains.dmarc`. */
1390
+ constructor(http: HttpClient);
1391
+ /**
1392
+ * The domain's DMARC status: its published record, the record to publish next and whether
1393
+ * the last 14 days of reports say that is safe (`ready`), and a summary of those reports.
1394
+ */
1395
+ get(domainId: string, options?: ReadOptions$15): Promise<CossResult<DomainDmarc>>;
1396
+ }
1397
+ //#endregion
867
1398
  //#region src/resources/receiving-domains.d.ts
868
1399
  type DeleteOptions$1 = Pick<RequestOptions, "signal">;
869
1400
  /**
@@ -906,7 +1437,7 @@ declare class TrackingDomainsResource {
906
1437
  }
907
1438
  //#endregion
908
1439
  //#region src/resources/domains.d.ts
909
- type ReadOptions$10 = Pick<RequestOptions, "signal">;
1440
+ type ReadOptions$14 = Pick<RequestOptions, "signal">;
910
1441
  /**
911
1442
  * `coss.domains`: the domains live (`coss_live_…`) keys may send from. Domains belong to the
912
1443
  * organization, so every API key of the organization sees the same ones.
@@ -917,6 +1448,8 @@ declare class DomainsResource {
917
1448
  readonly tracking: TrackingDomainsResource;
918
1449
  /** Each domain's receiving hostname: start and stop receiving email at it. */
919
1450
  readonly receiving: ReceivingDomainsResource;
1451
+ /** Each domain's DMARC status, guidance and aggregate reports. */
1452
+ readonly dmarc: DmarcResource;
920
1453
  /** @internal Use `new Coss().domains`. */
921
1454
  constructor(http: HttpClient);
922
1455
  /**
@@ -925,9 +1458,9 @@ declare class DomainsResource {
925
1458
  */
926
1459
  create(params: CreateDomainParams, options?: RequestOptions): Promise<CossResult<Domain>>;
927
1460
  /** Lists the organization's domains, ordered by name. */
928
- list(options?: ReadOptions$10): Promise<CossResult<List<Domain>>>;
1461
+ list(options?: ReadOptions$14): Promise<CossResult<List<Domain>>>;
929
1462
  /** Retrieves a domain with the result of the last DNS check. */
930
- get(id: string, options?: ReadOptions$10): Promise<CossResult<Domain>>;
1463
+ get(id: string, options?: ReadOptions$14): Promise<CossResult<Domain>>;
931
1464
  /**
932
1465
  * Checks the domain's records now instead of waiting for the next background check. A `failed`
933
1466
  * domain starts verification over with fresh DKIM records, which have to be published again.
@@ -935,7 +1468,103 @@ declare class DomainsResource {
935
1468
  */
936
1469
  verify(id: string, options?: RequestOptions): Promise<CossResult<Domain>>;
937
1470
  /** Removes the domain. Emails already sent are unaffected; live keys can no longer use it. */
938
- delete(id: string, options?: ReadOptions$10): Promise<CossResult<DeletedDomain>>;
1471
+ delete(id: string, options?: ReadOptions$14): Promise<CossResult<DeletedDomain>>;
1472
+ }
1473
+ //#endregion
1474
+ //#region src/types/dedicated-ip.d.ts
1475
+ /** Dedicated IP wire types (hand-written mirrors of the API's `DedicatedIpPool` schema). */
1476
+ type DedicatedIpPoolStatus = "not_enabled" | "waiting" | "provisioning" | "warming" | "ready" | "releasing";
1477
+ /** `GET /v1/dedicated_ips`: the organization's dedicated IPs (the Dedicated IPs add-on). */
1478
+ interface DedicatedIpPool {
1479
+ object: "dedicated_ip_pool";
1480
+ /**
1481
+ * `warming`: live emails go through the pool while its IPs warm up (what they can't take yet
1482
+ * leaves from shared IPs); `ready`: at least 95% of the last 7 days' deliveries left from them.
1483
+ */
1484
+ status: DedicatedIpPoolStatus;
1485
+ /** The pool's IPs, with their deliveries in the last 7 days. */
1486
+ ips: {
1487
+ ip: string;
1488
+ delivered_7d: number;
1489
+ }[];
1490
+ /** Share (0–1) of the last 7 days' deliveries from the pool's IPs; `null` below 1,000. */
1491
+ dedicated_share: number | null;
1492
+ /** What is holding the pool up, if anything. */
1493
+ message: string | null;
1494
+ created_at: string | null;
1495
+ /** When it was first `ready`. */
1496
+ ready_at: string | null;
1497
+ }
1498
+ //#endregion
1499
+ //#region src/resources/dedicated-ips.d.ts
1500
+ type ReadOptions$13 = Pick<RequestOptions, "signal">;
1501
+ /**
1502
+ * `coss.email.dedicatedIps`: the organization's own sending IPs (the Dedicated IPs add-on),
1503
+ * managed and warmed up automatically.
1504
+ */
1505
+ declare class DedicatedIpsResource {
1506
+ #private;
1507
+ /** @internal Use `new Coss().email.dedicatedIps`. */
1508
+ constructor(http: HttpClient);
1509
+ /** The pool's status and IPs (`not_enabled` without the add-on). */
1510
+ get(options?: ReadOptions$13): Promise<CossResult<DedicatedIpPool>>;
1511
+ }
1512
+ //#endregion
1513
+ //#region src/resources/email-templates.d.ts
1514
+ type ReadOptions$12 = Pick<RequestOptions, "signal">;
1515
+ /** `coss.email.templates.versions`: a template's published versions. */
1516
+ declare class EmailTemplateVersionsResource {
1517
+ #private;
1518
+ /** @internal Use `new Coss().email.templates.versions`. */
1519
+ constructor(http: HttpClient);
1520
+ /** Published versions, newest first. */
1521
+ list(template: string, params?: ListEmailTemplateVersionsParams, options?: ReadOptions$12): Promise<CossResult<List<EmailTemplateVersion>>>;
1522
+ get(template: string, version: number, options?: ReadOptions$12): Promise<CossResult<EmailTemplateVersion>>;
1523
+ /**
1524
+ * Replaces the draft with this version's content; publish the draft to send it again. Never
1525
+ * automatically retried: every restore is a new draft revision, so a repeat could overwrite an
1526
+ * edit saved in between.
1527
+ */
1528
+ restore(template: string, version: number, options?: ReadOptions$12): Promise<CossResult<EmailTemplateVersion>>;
1529
+ }
1530
+ /**
1531
+ * `coss.email.templates`: the environment's email templates. Templates are addressed by id or
1532
+ * alias. Edit the draft, publish it, then send with `coss.email.send({ template_id, variables })`.
1533
+ */
1534
+ declare class EmailTemplatesResource {
1535
+ #private;
1536
+ /** Published versions. */
1537
+ readonly versions: EmailTemplateVersionsResource;
1538
+ /** @internal Use `new Coss().email.templates`. */
1539
+ constructor(http: HttpClient);
1540
+ /**
1541
+ * Creates a template and its draft. Never automatically retried: the API doesn't deduplicate it
1542
+ * (a template with an `alias` can't be created twice, though).
1543
+ */
1544
+ create(params: CreateEmailTemplateParams, options?: RequestOptions): Promise<CossResult<EmailTemplate>>;
1545
+ /** The environment's templates, newest first. */
1546
+ list(params?: ListEmailTemplatesParams, options?: ReadOptions$12): Promise<CossResult<List<EmailTemplate>>>;
1547
+ get(template: string, options?: ReadOptions$12): Promise<CossResult<EmailTemplate>>;
1548
+ /** Changes its name, alias or description. */
1549
+ update(template: string, params: UpdateEmailTemplateParams, options?: ReadOptions$12): Promise<CossResult<EmailTemplate>>;
1550
+ /** Deletes it with every version. Emails already sent keep their content. */
1551
+ delete(template: string, options?: ReadOptions$12): Promise<CossResult<DeletedEmailTemplate>>;
1552
+ /** The draft, with `problems` that keep it from being published. */
1553
+ getDraft(template: string, options?: ReadOptions$12): Promise<CossResult<EmailTemplateVersion>>;
1554
+ /**
1555
+ * Replaces the whole draft. Sends keep using the published version until you publish. Never
1556
+ * automatically retried: every save is a new revision, so a repeat whose first attempt was saved
1557
+ * would fail with `template_revision_mismatch` (or, without `revision`, overwrite an edit saved
1558
+ * in between). Read the draft again before retrying.
1559
+ */
1560
+ updateDraft(template: string, params: UpdateEmailTemplateDraftParams, options?: ReadOptions$12): Promise<CossResult<EmailTemplateVersion>>;
1561
+ /**
1562
+ * Publishes the draft as the next version, which sends use from then on. Automatically retried
1563
+ * only with a `revision`: a draft without changes since the last publish returns that version,
1564
+ * and one saved again since is refused. Without it, a retry could publish someone else's newer
1565
+ * edits as yet another version.
1566
+ */
1567
+ publish(template: string, params?: PublishEmailTemplateParams, options?: ReadOptions$12): Promise<CossResult<EmailTemplateVersion>>;
939
1568
  }
940
1569
  //#endregion
941
1570
  //#region src/types/received-email.d.ts
@@ -1027,7 +1656,7 @@ interface DeletedReceivedEmail {
1027
1656
  id: string;
1028
1657
  deleted: true;
1029
1658
  }
1030
- /** The environment's own domain under COSS's inbound domain: any address at it is received. */
1659
+ /** The environment's own domain under coss.com's inbound domain: any address at it is received. */
1031
1660
  interface InboundAddress {
1032
1661
  object: "inbound_address";
1033
1662
  environment_id: string;
@@ -1035,7 +1664,7 @@ interface InboundAddress {
1035
1664
  }
1036
1665
  //#endregion
1037
1666
  //#region src/resources/received-emails.d.ts
1038
- type ReadOptions$9 = Pick<RequestOptions, "signal">;
1667
+ type ReadOptions$11 = Pick<RequestOptions, "signal">;
1039
1668
  /**
1040
1669
  * `coss.email.received`: emails received by the API key's environment, at its inbound address
1041
1670
  * (`address()`) or at a receiving domain (`coss.domains.receiving`). An `email.received` webhook
@@ -1046,24 +1675,24 @@ declare class ReceivedEmailsResource {
1046
1675
  /** @internal Use `new Coss().email.received`. */
1047
1676
  constructor(http: HttpClient);
1048
1677
  /** Lists received emails, newest first, without bodies. Pass the last `id` as `after` while `has_more` is true. */
1049
- list(params?: ListReceivedEmailsParams, options?: ReadOptions$9): Promise<CossResult<List<ReceivedEmailSummary>>>;
1678
+ list(params?: ListReceivedEmailsParams, options?: ReadOptions$11): Promise<CossResult<List<ReceivedEmailSummary>>>;
1050
1679
  /** Retrieves a received email with its headers and bodies. */
1051
- get(id: string, options?: ReadOptions$9): Promise<CossResult<ReceivedEmail>>;
1680
+ get(id: string, options?: ReadOptions$11): Promise<CossResult<ReceivedEmail>>;
1052
1681
  /** The whole message as received (`message/rfc822` bytes). */
1053
- getRaw(id: string, options?: ReadOptions$9): Promise<CossResult<Uint8Array>>;
1682
+ getRaw(id: string, options?: ReadOptions$11): Promise<CossResult<Uint8Array>>;
1054
1683
  /** An attachment's bytes (untrusted: its declared type is the attachment's `content_type`). */
1055
- getAttachment(id: string, attachmentId: string, options?: ReadOptions$9): Promise<CossResult<Uint8Array>>;
1684
+ getAttachment(id: string, attachmentId: string, options?: ReadOptions$11): Promise<CossResult<Uint8Array>>;
1056
1685
  /**
1057
1686
  * The environment's inbound domain: email to any address at it (`support@<domain>`) is
1058
1687
  * received, with no DNS setup.
1059
1688
  */
1060
- address(options?: ReadOptions$9): Promise<CossResult<InboundAddress>>;
1689
+ address(options?: ReadOptions$11): Promise<CossResult<InboundAddress>>;
1061
1690
  /** Deletes a received email with its raw message and attachments right away. */
1062
- delete(id: string, options?: ReadOptions$9): Promise<CossResult<DeletedReceivedEmail>>;
1691
+ delete(id: string, options?: ReadOptions$11): Promise<CossResult<DeletedReceivedEmail>>;
1063
1692
  }
1064
1693
  //#endregion
1065
1694
  //#region src/resources/suppressions.d.ts
1066
- type ReadOptions$8 = Pick<RequestOptions, "signal">;
1695
+ type ReadOptions$10 = Pick<RequestOptions, "signal">;
1067
1696
  /**
1068
1697
  * `coss.email.suppressions`: the suppression list of the API key's environment. Sends skip
1069
1698
  * suppressed recipients; permanent bounces and complaints are added automatically.
@@ -1082,20 +1711,20 @@ declare class SuppressionResource {
1082
1711
  * and reported in `invalid`; entries already on the list count as `existing`. If a request
1083
1712
  * fails, the earlier batches stay imported: importing everything again is safe.
1084
1713
  */
1085
- import(params: ImportSuppressionsParams, options?: ReadOptions$8): Promise<CossResult<SuppressionImport>>;
1714
+ import(params: ImportSuppressionsParams, options?: ReadOptions$10): Promise<CossResult<SuppressionImport>>;
1086
1715
  /**
1087
1716
  * The whole list as CSV (`address,scope,reason,created_at,email_id,id`, oldest first), which
1088
1717
  * `import` (or the dashboard) accepts again.
1089
1718
  */
1090
- export(params?: ExportSuppressionsParams, options?: ReadOptions$8): Promise<CossResult<string>>;
1719
+ export(params?: ExportSuppressionsParams, options?: ReadOptions$10): Promise<CossResult<string>>;
1091
1720
  /** Lists entries, newest first. Pass the last `id` as `after` while `has_more` is true. */
1092
- list(params?: ListSuppressionsParams, options?: ReadOptions$8): Promise<CossResult<List<Suppression>>>;
1721
+ list(params?: ListSuppressionsParams, options?: ReadOptions$10): Promise<CossResult<List<Suppression>>>;
1093
1722
  /** Whether a send to `address` (with `category`, if given) would skip it. */
1094
- check(params: CheckSuppressionParams, options?: ReadOptions$8): Promise<CossResult<SuppressionCheck>>;
1723
+ check(params: CheckSuppressionParams, options?: ReadOptions$10): Promise<CossResult<SuppressionCheck>>;
1095
1724
  /** Retrieves one entry. */
1096
- get(id: string, options?: ReadOptions$8): Promise<CossResult<Suppression>>;
1725
+ get(id: string, options?: ReadOptions$10): Promise<CossResult<Suppression>>;
1097
1726
  /** Removes an entry, so later sends reach the address again (e.g. when a recipient resubscribes). */
1098
- remove(id: string, options?: ReadOptions$8): Promise<CossResult<DeletedSuppression>>;
1727
+ remove(id: string, options?: ReadOptions$10): Promise<CossResult<DeletedSuppression>>;
1099
1728
  }
1100
1729
  //#endregion
1101
1730
  //#region src/types/tracking.d.ts
@@ -1110,14 +1739,20 @@ interface TrackingRule {
1110
1739
  opens: boolean;
1111
1740
  /** Whether clicks are tracked. */
1112
1741
  clicks: boolean;
1742
+ /**
1743
+ * Whether emails get one-click unsubscribe headers (only emails with a category and a single
1744
+ * recipient).
1745
+ */
1746
+ unsubscribe: boolean;
1113
1747
  /** ISO 8601 timestamp. */
1114
1748
  created_at: string;
1115
1749
  /** ISO 8601 timestamp. */
1116
1750
  updated_at: string;
1117
1751
  }
1118
1752
  /**
1119
- * Open and click tracking settings of the API key's environment. For each of `opens` and
1120
- * `clicks`, a send's own `tracking` wins, then its category's rule, then `default`, then off.
1753
+ * Open and click tracking and one-click unsubscribe settings of the API key's environment. For
1754
+ * each of `opens`, `clicks` and `unsubscribe`, a send's own `tracking` wins, then its category's
1755
+ * rule, then `default`, then off.
1121
1756
  */
1122
1757
  interface TrackingSettings {
1123
1758
  object: "tracking_settings";
@@ -1128,11 +1763,13 @@ interface TrackingSettings {
1128
1763
  }
1129
1764
  /**
1130
1765
  * Body of `PATCH /v1/tracking_settings/default` and `…/categories/{category}`: at least one
1131
- * field. Fields left out keep their value; a new rule starts with both off.
1766
+ * field. Fields left out keep their value; a new rule starts with all off.
1132
1767
  */
1133
1768
  interface UpdateTrackingRuleParams {
1134
1769
  opens?: boolean;
1135
1770
  clicks?: boolean;
1771
+ /** Add one-click unsubscribe headers to emails with a category and a single recipient. */
1772
+ unsubscribe?: boolean;
1136
1773
  }
1137
1774
  /** Returned when a rule is removed. */
1138
1775
  interface DeletedTrackingRule {
@@ -1143,32 +1780,32 @@ interface DeletedTrackingRule {
1143
1780
  }
1144
1781
  //#endregion
1145
1782
  //#region src/resources/tracking.d.ts
1146
- type ReadOptions$7 = Pick<RequestOptions, "signal">;
1783
+ type ReadOptions$9 = Pick<RequestOptions, "signal">;
1147
1784
  /**
1148
1785
  * `coss.email.tracking`: which emails of the API key's environment have their opens and clicks
1149
- * tracked. Emails keep the settings that applied when they were sent; a send's own `tracking`
1150
- * option wins over them.
1786
+ * tracked and get one-click unsubscribe headers. Emails keep the settings that applied when they
1787
+ * were sent; a send's own `tracking` option wins over them.
1151
1788
  */
1152
1789
  declare class TrackingResource {
1153
1790
  #private;
1154
1791
  /** @internal Use `new Coss().email.tracking`. */
1155
1792
  constructor(http: HttpClient);
1156
1793
  /** The environment default and the category rules. */
1157
- get(options?: ReadOptions$7): Promise<CossResult<TrackingSettings>>;
1794
+ get(options?: ReadOptions$9): Promise<CossResult<TrackingSettings>>;
1158
1795
  /**
1159
1796
  * Sets the environment default, which applies to emails without a rule for their category.
1160
1797
  * Fields left out keep their value; a new default starts with both off.
1161
1798
  */
1162
- updateDefault(params: UpdateTrackingRuleParams, options?: ReadOptions$7): Promise<CossResult<TrackingRule>>;
1799
+ updateDefault(params: UpdateTrackingRuleParams, options?: ReadOptions$9): Promise<CossResult<TrackingRule>>;
1163
1800
  /** Removes the environment default: emails without a category rule are then not tracked. */
1164
- removeDefault(options?: ReadOptions$7): Promise<CossResult<DeletedTrackingRule>>;
1801
+ removeDefault(options?: ReadOptions$9): Promise<CossResult<DeletedTrackingRule>>;
1165
1802
  /**
1166
1803
  * Sets the rule for emails sent with `category`, which wins over the default. Fields left out
1167
1804
  * keep their value; a new rule starts with both off.
1168
1805
  */
1169
- updateCategory(category: string, params: UpdateTrackingRuleParams, options?: ReadOptions$7): Promise<CossResult<TrackingRule>>;
1806
+ updateCategory(category: string, params: UpdateTrackingRuleParams, options?: ReadOptions$9): Promise<CossResult<TrackingRule>>;
1170
1807
  /** Removes a category's rule: its emails follow the environment default again. */
1171
- removeCategory(category: string, options?: ReadOptions$7): Promise<CossResult<DeletedTrackingRule>>;
1808
+ removeCategory(category: string, options?: ReadOptions$9): Promise<CossResult<DeletedTrackingRule>>;
1172
1809
  }
1173
1810
  //#endregion
1174
1811
  //#region src/resources/email.d.ts
@@ -1181,13 +1818,19 @@ declare class EmailResource {
1181
1818
  readonly tracking: TrackingResource;
1182
1819
  /** Emails the environment received. */
1183
1820
  readonly received: ReceivedEmailsResource;
1821
+ /** The environment's email templates. */
1822
+ readonly templates: EmailTemplatesResource;
1823
+ /** The organization's dedicated IPs. */
1824
+ readonly dedicatedIps: DedicatedIpsResource;
1184
1825
  /** @internal Use `new Coss().email`. */
1185
1826
  constructor(http: HttpClient);
1186
1827
  /**
1187
- * Sends an email. It is returned `queued` and handed to the delivery provider moments later:
1828
+ * Sends an email, with its own subject and body or from a published template (`template_id`
1829
+ * and `variables`). It is returned `queued` and handed to the delivery provider moments later:
1188
1830
  * `get` it or listen for the `email.sent` / `email.failed` webhooks for the outcome. Safe to
1189
1831
  * retry: the request always carries an `Idempotency-Key` (yours, or a generated one reused
1190
- * across automatic retries), so the API never sends it twice.
1832
+ * across automatic retries), so the API never sends it twice. A `react` component is rendered
1833
+ * once, before the first attempt.
1191
1834
  */
1192
1835
  send(params: SendEmailParams, options?: RequestOptions): Promise<CossResult<Email>>;
1193
1836
  /**
@@ -1197,8 +1840,16 @@ declare class EmailResource {
1197
1840
  * the whole batch. Larger lists need several calls, each with its own key.
1198
1841
  */
1199
1842
  sendBatch(emails: SendEmailParams[], options?: RequestOptions): Promise<CossResult<EmailBatch>>;
1843
+ /** Retrieves a batch sent by `sendBatch`, with its emails' current statuses in request order. */
1844
+ getBatch(id: string, options?: Pick<RequestOptions, "signal">): Promise<CossResult<EmailBatch>>;
1200
1845
  /** Retrieves an email sent from the same environment as the API key. */
1201
1846
  get(id: string, options?: Pick<RequestOptions, "signal">): Promise<CossResult<Email>>;
1847
+ /**
1848
+ * Lists emails sent from the same environment as the API key, newest first and without their
1849
+ * content (`get` one for `html`, `text`, `headers` and `attachments`). Pass the last `id` as
1850
+ * `after` while `has_more` is true.
1851
+ */
1852
+ list(params?: ListEmailsParams, options?: Pick<RequestOptions, "signal">): Promise<CossResult<List<EmailSummary>>>;
1202
1853
  /**
1203
1854
  * Cancels a scheduled email. Canceling an already canceled email returns it; any other email
1204
1855
  * fails with `email_not_cancelable`.
@@ -1216,10 +1867,21 @@ declare class EmailResource {
1216
1867
  listLinks(id: string, options?: Pick<RequestOptions, "signal">): Promise<CossResult<List<EmailLink>>>;
1217
1868
  }
1218
1869
  //#endregion
1870
+ //#region src/resources/environment.d.ts
1871
+ type ReadOptions$8 = Pick<RequestOptions, "signal">;
1872
+ /** `coss.environment`: which environment, project and organization the API key belongs to. */
1873
+ declare class EnvironmentResource {
1874
+ #private;
1875
+ /** @internal Use `new Coss().environment`. */
1876
+ constructor(http: HttpClient);
1877
+ /** The API key's environment, its project and organization, and the key itself. */
1878
+ get(options?: ReadOptions$8): Promise<CossResult<Environment>>;
1879
+ }
1880
+ //#endregion
1219
1881
  //#region src/types/hooks.d.ts
1220
1882
  /**
1221
1883
  * Hooks wire types (webhooks as a service): you send a message to one of your applications once,
1222
- * COSS delivers it to every endpoint its users registered, signed, with retries.
1884
+ * coss.com delivers it to every endpoint its users registered, signed, with retries.
1223
1885
  */
1224
1886
  /** One of your customers (or users), with their own endpoints and portal. */
1225
1887
  interface HookApplication {
@@ -1376,7 +2038,7 @@ interface RecoverHookEndpointParams {
1376
2038
  /** Requeue failed deliveries of messages sent since then (ISO 8601 string or `Date`). */
1377
2039
  since: string | Date;
1378
2040
  }
1379
- /** A recovery: COSS requeues the matching failed deliveries in the background. */
2041
+ /** A recovery: coss.com requeues the matching failed deliveries in the background. */
1380
2042
  interface HookEndpointRecovery {
1381
2043
  object: "hook_endpoint_recovery";
1382
2044
  id: string;
@@ -1488,7 +2150,7 @@ interface HookPortalSession {
1488
2150
  }
1489
2151
  //#endregion
1490
2152
  //#region src/resources/hooks.d.ts
1491
- type ReadOptions$6 = Pick<RequestOptions, "signal">;
2153
+ type ReadOptions$7 = Pick<RequestOptions, "signal">;
1492
2154
  /** `coss.hooks.applications`: your customers, each with their own endpoints and portal. */
1493
2155
  declare class HookApplicationsResource {
1494
2156
  #private;
@@ -1497,12 +2159,12 @@ declare class HookApplicationsResource {
1497
2159
  /** Creates an application. Never automatically retried (the API does not deduplicate it). */
1498
2160
  create(params: CreateHookApplicationParams, options?: RequestOptions): Promise<CossResult<HookApplication>>;
1499
2161
  /** Lists the environment's applications, newest first. */
1500
- list(params?: ListHookApplicationsParams, options?: ReadOptions$6): Promise<CossResult<List<HookApplication>>>;
2162
+ list(params?: ListHookApplicationsParams, options?: ReadOptions$7): Promise<CossResult<List<HookApplication>>>;
1501
2163
  /** Retrieves an application by its id or uid. */
1502
- get(application: string, options?: ReadOptions$6): Promise<CossResult<HookApplication>>;
1503
- update(application: string, params: UpdateHookApplicationParams, options?: ReadOptions$6): Promise<CossResult<HookApplication>>;
2164
+ get(application: string, options?: ReadOptions$7): Promise<CossResult<HookApplication>>;
2165
+ update(application: string, params: UpdateHookApplicationParams, options?: ReadOptions$7): Promise<CossResult<HookApplication>>;
1504
2166
  /** Deletes the application with its endpoints and portal sessions. */
1505
- delete(application: string, options?: ReadOptions$6): Promise<CossResult<DeletedHookApplication>>;
2167
+ delete(application: string, options?: ReadOptions$7): Promise<CossResult<DeletedHookApplication>>;
1506
2168
  }
1507
2169
  /** `coss.hooks.eventTypes`: the catalog of messages you send, which your users subscribe from. */
1508
2170
  declare class HookEventTypesResource {
@@ -1512,12 +2174,12 @@ declare class HookEventTypesResource {
1512
2174
  /** Creates an event type. Never automatically retried (a retry would find it existing). */
1513
2175
  create(params: CreateHookEventTypeParams, options?: RequestOptions): Promise<CossResult<HookEventType>>;
1514
2176
  /** Lists event types by name (archived ones only with `include_archived`). */
1515
- list(params?: ListHookEventTypesParams, options?: ReadOptions$6): Promise<CossResult<List<HookEventType>>>;
1516
- get(name: string, options?: ReadOptions$6): Promise<CossResult<HookEventType>>;
2177
+ list(params?: ListHookEventTypesParams, options?: ReadOptions$7): Promise<CossResult<List<HookEventType>>>;
2178
+ get(name: string, options?: ReadOptions$7): Promise<CossResult<HookEventType>>;
1517
2179
  /** Changes its description, schema or examples, or archives or restores it. */
1518
- update(name: string, params: UpdateHookEventTypeParams, options?: ReadOptions$6): Promise<CossResult<HookEventType>>;
2180
+ update(name: string, params: UpdateHookEventTypeParams, options?: ReadOptions$7): Promise<CossResult<HookEventType>>;
1519
2181
  /** Archives it: hidden from the portal and new subscriptions. */
1520
- archive(name: string, options?: ReadOptions$6): Promise<CossResult<HookEventType>>;
2182
+ archive(name: string, options?: ReadOptions$7): Promise<CossResult<HookEventType>>;
1521
2183
  }
1522
2184
  /** `coss.hooks.endpoints`: an application's endpoints (usually added by its users in the portal). */
1523
2185
  declare class HookEndpointsResource {
@@ -1526,23 +2188,23 @@ declare class HookEndpointsResource {
1526
2188
  constructor(http: HttpClient);
1527
2189
  /** Creates an endpoint; the result carries its secret. Never automatically retried. */
1528
2190
  create(application: string, params: CreateHookEndpointParams, options?: RequestOptions): Promise<CossResult<HookEndpointWithSecret>>;
1529
- list(application: string, options?: ReadOptions$6): Promise<CossResult<List<HookEndpoint>>>;
1530
- get(application: string, id: string, options?: ReadOptions$6): Promise<CossResult<HookEndpoint>>;
1531
- update(application: string, id: string, params: UpdateHookEndpointParams, options?: ReadOptions$6): Promise<CossResult<HookEndpoint>>;
1532
- delete(application: string, id: string, options?: ReadOptions$6): Promise<CossResult<DeletedHookEndpoint>>;
2191
+ list(application: string, options?: ReadOptions$7): Promise<CossResult<List<HookEndpoint>>>;
2192
+ get(application: string, id: string, options?: ReadOptions$7): Promise<CossResult<HookEndpoint>>;
2193
+ update(application: string, id: string, params: UpdateHookEndpointParams, options?: ReadOptions$7): Promise<CossResult<HookEndpoint>>;
2194
+ delete(application: string, id: string, options?: ReadOptions$7): Promise<CossResult<DeletedHookEndpoint>>;
1533
2195
  /** The endpoint's current signing secret. */
1534
- getSecret(application: string, id: string, options?: ReadOptions$6): Promise<CossResult<HookEndpointSecret>>;
2196
+ getSecret(application: string, id: string, options?: ReadOptions$7): Promise<CossResult<HookEndpointSecret>>;
1535
2197
  /** Replaces the signing secret. Never automatically retried (a second roll would stop the first). */
1536
2198
  rollSecret(application: string, id: string, params?: RollHookEndpointSecretParams, options?: RequestOptions): Promise<CossResult<HookEndpointWithSecret>>;
1537
2199
  /** Requeues the endpoint's failed deliveries of messages sent since `since` (in the background). */
1538
2200
  recover(application: string, id: string, params: RecoverHookEndpointParams, options?: RequestOptions): Promise<CossResult<HookEndpointRecovery>>;
1539
- getRecovery(application: string, id: string, recoveryId: string, options?: ReadOptions$6): Promise<CossResult<HookEndpointRecovery>>;
2201
+ getRecovery(application: string, id: string, recoveryId: string, options?: ReadOptions$7): Promise<CossResult<HookEndpointRecovery>>;
1540
2202
  /** Sends a message to this endpoint only. Never automatically retried. */
1541
2203
  sendTest(application: string, id: string, params: SendHookTestParams, options?: RequestOptions): Promise<CossResult<HookMessage>>;
1542
2204
  /** The endpoint's deliveries, newest first. */
1543
- listDeliveries(application: string, id: string, params?: ListHookDeliveriesParams, options?: ReadOptions$6): Promise<CossResult<List<HookDelivery>>>;
2205
+ listDeliveries(application: string, id: string, params?: ListHookDeliveriesParams, options?: ReadOptions$7): Promise<CossResult<List<HookDelivery>>>;
1544
2206
  }
1545
- /** `coss.hooks.messages`: send a message once; COSS delivers it to every subscribed endpoint. */
2207
+ /** `coss.hooks.messages`: send a message once; coss.com delivers it to every subscribed endpoint. */
1546
2208
  declare class HookMessagesResource {
1547
2209
  #private;
1548
2210
  /** @internal Use `new Coss().hooks.messages`. */
@@ -1553,19 +2215,19 @@ declare class HookMessagesResource {
1553
2215
  */
1554
2216
  send(params: SendHookMessageParams, options?: RequestOptions): Promise<CossResult<HookMessage>>;
1555
2217
  /** The application's messages, newest first. */
1556
- list(application: string, params?: ListHookMessagesParams, options?: ReadOptions$6): Promise<CossResult<List<HookMessage>>>;
1557
- get(application: string, id: string, options?: ReadOptions$6): Promise<CossResult<HookMessage>>;
2218
+ list(application: string, params?: ListHookMessagesParams, options?: ReadOptions$7): Promise<CossResult<List<HookMessage>>>;
2219
+ get(application: string, id: string, options?: ReadOptions$7): Promise<CossResult<HookMessage>>;
1558
2220
  /** One delivery per endpoint the message went to. */
1559
- listDeliveries(application: string, id: string, options?: ReadOptions$6): Promise<CossResult<List<HookDelivery>>>;
2221
+ listDeliveries(application: string, id: string, options?: ReadOptions$7): Promise<CossResult<List<HookDelivery>>>;
1560
2222
  }
1561
2223
  /** `coss.hooks.deliveries`: one message's delivery to one endpoint. */
1562
2224
  declare class HookDeliveriesResource {
1563
2225
  #private;
1564
2226
  /** @internal Use `new Coss().hooks.deliveries`. */
1565
2227
  constructor(http: HttpClient);
1566
- get(application: string, id: string, options?: ReadOptions$6): Promise<CossResult<HookDelivery>>;
2228
+ get(application: string, id: string, options?: ReadOptions$7): Promise<CossResult<HookDelivery>>;
1567
2229
  /** Every HTTP request of the delivery, oldest first. */
1568
- listAttempts(application: string, id: string, options?: ReadOptions$6): Promise<CossResult<List<HookAttempt>>>;
2230
+ listAttempts(application: string, id: string, options?: ReadOptions$7): Promise<CossResult<List<HookAttempt>>>;
1569
2231
  /** Queues a finished delivery for one more attempt. Never automatically retried. */
1570
2232
  retry(application: string, id: string, options?: RequestOptions): Promise<CossResult<HookDelivery>>;
1571
2233
  }
@@ -1582,7 +2244,7 @@ declare class HookPortalResource {
1582
2244
  }
1583
2245
  /**
1584
2246
  * `coss.hooks`: webhooks as a service. Send a message to one of your applications once
1585
- * (`coss.hooks.messages.send`); COSS delivers it to every endpoint its users registered, signed
2247
+ * (`coss.hooks.messages.send`); coss.com delivers it to every endpoint its users registered, signed
1586
2248
  * (Standard Webhooks), with retries, and gives them a portal to manage it all.
1587
2249
  */
1588
2250
  declare class HooksResource {
@@ -1602,7 +2264,7 @@ declare class HooksResource {
1602
2264
  * `api`: a request to the API. `email`: an email event. `webhook`: a webhook delivery attempt.
1603
2265
  * `risk`: a risk assessment or its feedback.
1604
2266
  */
1605
- type LogSource = "api" | "email" | "webhook" | "risk";
2267
+ type LogSource = "api" | "email" | "webhook" | "risk" | "smtp";
1606
2268
  /**
1607
2269
  * `error`: 5xx responses, bounces, complaints, failures. `warning`: 4xx responses, delays,
1608
2270
  * suppressions, failed webhook attempts that will be retried. `info`: everything else.
@@ -1616,7 +2278,7 @@ interface Log {
1616
2278
  occurred_at: string;
1617
2279
  source: LogSource;
1618
2280
  level: LogLevel;
1619
- /** `api.request`, `webhook.attempt`, or an email event type such as `email.delivered`. */
2281
+ /** `api.request`, `webhook.attempt`, `webhook.forward` (`coss listen`), or an email event type such as `email.delivered`. */
1620
2282
  type: string;
1621
2283
  /** A one-line summary. */
1622
2284
  message: string;
@@ -1688,7 +2350,7 @@ interface LogDrain {
1688
2350
  sources: LogDrainSource[];
1689
2351
  /** A disabled drain receives nothing, and lines logged meanwhile are not kept for it. */
1690
2352
  enabled: boolean;
1691
- /** `manual`, or `failing`: a batch failed every attempt, so COSS disabled it. */
2353
+ /** `manual`, or `failing`: a batch failed every attempt, so coss.com disabled it. */
1692
2354
  disabled_reason: "manual" | "failing" | null;
1693
2355
  /** ISO 8601 timestamp; `null` while enabled. */
1694
2356
  disabled_at: string | null;
@@ -1705,7 +2367,7 @@ interface DeletedLogDrain {
1705
2367
  deleted: true;
1706
2368
  }
1707
2369
  interface CreateLogDrainParams {
1708
- /** An `https://` URL COSS posts batches to. */
2370
+ /** An `https://` URL coss.com posts batches to. */
1709
2371
  url: string;
1710
2372
  description?: string | null;
1711
2373
  /** Defaults to every source. */
@@ -1763,16 +2425,16 @@ interface ListLogDrainBatchesParams {
1763
2425
  type LogDrainLine = Log | AuditEvent;
1764
2426
  //#endregion
1765
2427
  //#region src/resources/log-drains.d.ts
1766
- type ReadOptions$5 = Pick<RequestOptions, "signal">;
2428
+ type ReadOptions$6 = Pick<RequestOptions, "signal">;
1767
2429
  /** `coss.logDrains.batches`: a drain's delivery log, each batch with every HTTP attempt. */
1768
2430
  declare class LogDrainBatchesResource {
1769
2431
  #private;
1770
2432
  /** @internal Use `new Coss().logDrains.batches`. */
1771
2433
  constructor(http: HttpClient);
1772
2434
  /** Lists the drain's batches, newest first. Pass the last `id` as `after` while `has_more` is true. */
1773
- list(drainId: string, params?: ListLogDrainBatchesParams, options?: ReadOptions$5): Promise<CossResult<List<LogDrainBatch>>>;
2435
+ list(drainId: string, params?: ListLogDrainBatchesParams, options?: ReadOptions$6): Promise<CossResult<List<LogDrainBatch>>>;
1774
2436
  /** Retrieves one batch of the drain. */
1775
- get(drainId: string, id: string, options?: ReadOptions$5): Promise<CossResult<LogDrainBatch>>;
2437
+ get(drainId: string, id: string, options?: ReadOptions$6): Promise<CossResult<LogDrainBatch>>;
1776
2438
  }
1777
2439
  /**
1778
2440
  * `coss.logDrains`: HTTPS endpoints the environment's log is streamed to (API requests, email
@@ -1793,21 +2455,21 @@ declare class LogDrainsResource {
1793
2455
  */
1794
2456
  create(params: CreateLogDrainParams, options?: RequestOptions): Promise<CossResult<LogDrainWithSecret>>;
1795
2457
  /** Lists the environment's drains, oldest first. Secrets are never included. */
1796
- list(options?: ReadOptions$5): Promise<CossResult<List<LogDrain>>>;
2458
+ list(options?: ReadOptions$6): Promise<CossResult<List<LogDrain>>>;
1797
2459
  /** Retrieves a drain of the API key's environment. */
1798
- get(id: string, options?: ReadOptions$5): Promise<CossResult<LogDrain>>;
2460
+ get(id: string, options?: ReadOptions$6): Promise<CossResult<LogDrain>>;
1799
2461
  /**
1800
2462
  * Changes the URL, description, sources or `enabled` flag. The signing secret stays the same.
1801
- * Disabling drops the lines still waiting for the drain; enabling it again (also after COSS
2463
+ * Disabling drops the lines still waiting for the drain; enabling it again (also after coss.com
1802
2464
  * disabled it for failing) sends lines logged from then on.
1803
2465
  */
1804
- update(id: string, params: UpdateLogDrainParams, options?: ReadOptions$5): Promise<CossResult<LogDrain>>;
2466
+ update(id: string, params: UpdateLogDrainParams, options?: ReadOptions$6): Promise<CossResult<LogDrain>>;
1805
2467
  /** Deletes the drain and its batch log. To pause it instead, update `enabled` to false. */
1806
- delete(id: string, options?: ReadOptions$5): Promise<CossResult<DeletedLogDrain>>;
2468
+ delete(id: string, options?: ReadOptions$6): Promise<CossResult<DeletedLogDrain>>;
1807
2469
  }
1808
2470
  //#endregion
1809
2471
  //#region src/resources/logs.d.ts
1810
- type ReadOptions$4 = Pick<RequestOptions, "signal">;
2472
+ type ReadOptions$5 = Pick<RequestOptions, "signal">;
1811
2473
  /**
1812
2474
  * `coss.logs`: the API key's environment log, newest first: API requests made with its keys,
1813
2475
  * email events and webhook delivery attempts.
@@ -1820,9 +2482,9 @@ declare class LogsResource {
1820
2482
  * Lists log lines, newest first (the last hour unless `from`/`to` say otherwise). Pass the last
1821
2483
  * `id` as `after` while `has_more` is true.
1822
2484
  */
1823
- list(params?: ListLogsParams, options?: ReadOptions$4): Promise<CossResult<List<Log>>>;
2485
+ list(params?: ListLogsParams, options?: ReadOptions$5): Promise<CossResult<List<Log>>>;
1824
2486
  /** Retrieves one log line. */
1825
- get(id: string, options?: ReadOptions$4): Promise<CossResult<Log>>;
2487
+ get(id: string, options?: ReadOptions$5): Promise<CossResult<Log>>;
1826
2488
  }
1827
2489
  //#endregion
1828
2490
  //#region src/types/reputation.d.ts
@@ -1849,7 +2511,7 @@ interface ReputationCheck {
1849
2511
  interface Reputation {
1850
2512
  object: "reputation";
1851
2513
  /**
1852
- * `suspended` means live sending is refused (`account_suspended`) until COSS support
2514
+ * `suspended` means live sending is refused (`account_suspended`) until coss.com support
1853
2515
  * reinstates the organization; sandbox keys keep working.
1854
2516
  */
1855
2517
  status: ReputationStatus;
@@ -1868,9 +2530,9 @@ interface Reputation {
1868
2530
  }
1869
2531
  //#endregion
1870
2532
  //#region src/resources/reputation.d.ts
1871
- type ReadOptions$3 = Pick<RequestOptions, "signal">;
2533
+ type ReadOptions$4 = Pick<RequestOptions, "signal">;
1872
2534
  /**
1873
- * `coss.reputation`: the organization's standing with the COSS reputation guard, which suspends
2535
+ * `coss.reputation`: the organization's standing with the coss.com reputation guard, which suspends
1874
2536
  * live sending automatically when bounce or complaint rates cross its thresholds.
1875
2537
  */
1876
2538
  declare class ReputationResource {
@@ -1878,7 +2540,7 @@ declare class ReputationResource {
1878
2540
  /** @internal Use `new Coss().reputation`. */
1879
2541
  constructor(http: HttpClient);
1880
2542
  /** The current status and the latest rates measured over live environments. */
1881
- get(options?: ReadOptions$3): Promise<CossResult<Reputation>>;
2543
+ get(options?: ReadOptions$4): Promise<CossResult<Reputation>>;
1882
2544
  }
1883
2545
  //#endregion
1884
2546
  //#region src/types/risk.d.ts
@@ -1896,9 +2558,16 @@ type RiskList = "allow" | "block";
1896
2558
  */
1897
2559
  type RiskListEntryType = "email" | "domain" | "ip" | "asn" | "country" | "user";
1898
2560
  /** Signal groups an assessment was made without (a lookup failed or timed out). */
1899
- type RiskDegradedSignal = "email_dns" | "domain_age" | "ip_data" | "velocity" | "captcha";
2561
+ type RiskDegradedSignal = "email_dns" | "domain_age" | "ip_data" | "velocity" | "captcha" | "content" | "ip_privacy";
2562
+ /** What content classification scores. */
2563
+ type RiskContentCategory = "spam" | "phishing" | "malware" | "fraud";
2564
+ /**
2565
+ * Per category, the model's probability (0-1) that the content belongs to it. Not calibrated:
2566
+ * pick thresholds by looking at your own traffic.
2567
+ */
2568
+ type RiskContentScores = Record<RiskContentCategory, number>;
1900
2569
  /** Every reason an assessment can give (see the reason catalog in the docs). */
1901
- type RiskReasonCode = "email.invalid" | "email.disposable" | "email.undeliverable" | "email.role_account" | "email.typo" | "email.domain_new" | "ip.tor" | "ip.vpn_network" | "ip.hosting_provider" | "ip.private" | "velocity.signups_per_ip_1h" | "velocity.signups_per_ip_24h" | "velocity.signups_per_subnet_1h" | "velocity.signups_per_email_domain_1h" | "velocity.signups_per_mailbox_24h" | "velocity.logins_per_ip_1h" | "velocity.logins_per_user_1h" | "velocity.events_per_ip_1h" | "velocity.events_per_user_1h" | "duplicate.canonical_mailbox" | "history.fraud_mailbox" | "history.fraud_user" | "history.fraud_ip" | "history.fraud_subnet" | "login.new_country" | "login.new_network" | "captcha.failed" | "captcha.missing" | "rule.matched" | "list.blocked" | "list.allowed";
2570
+ type RiskReasonCode = "email.invalid" | "email.disposable" | "email.undeliverable" | "email.role_account" | "email.typo" | "email.domain_new" | "ip.tor" | "ip.vpn_network" | "ip.hosting_provider" | "ip.vpn" | "ip.proxy" | "ip.relay" | "ip.private" | "velocity.signups_per_ip_1h" | "velocity.signups_per_ip_24h" | "velocity.signups_per_subnet_1h" | "velocity.signups_per_email_domain_1h" | "velocity.signups_per_mailbox_24h" | "velocity.signups_per_device_24h" | "velocity.checkouts_per_ip_1h" | "velocity.checkouts_per_user_1h" | "velocity.checkouts_per_card_24h" | "velocity.logins_per_ip_1h" | "velocity.logins_per_user_1h" | "velocity.events_per_ip_1h" | "velocity.events_per_user_1h" | "duplicate.canonical_mailbox" | "duplicate.device" | "history.fraud_mailbox" | "history.fraud_user" | "history.fraud_ip" | "history.fraud_subnet" | "history.fraud_card" | "history.fraud_device" | "checkout.card_country_mismatch" | "checkout.billing_country_mismatch" | "checkout.prepaid_card" | "device.automation" | "device.invalid" | "login.new_country" | "login.new_network" | "captcha.failed" | "captcha.missing" | "content.spam" | "content.phishing" | "content.malware" | "content.fraud" | "rule.matched" | "list.blocked" | "list.allowed";
1902
2571
  /** Why an assessment decided what it did. Never show reasons to the person being assessed. */
1903
2572
  interface RiskReason {
1904
2573
  code: RiskReasonCode;
@@ -1911,11 +2580,11 @@ interface RiskReason {
1911
2580
  window?: "1h" | "24h";
1912
2581
  /** `email.typo`: the likely domain, which you may show the user ("Did you mean …?"). */
1913
2582
  suggestion?: string;
1914
- /** `ip.hosting_provider`, `ip.vpn_network`: the network's operator. */
2583
+ /** `ip.hosting_provider`, `ip.vpn_network`: the network's operator; `ip.vpn`: the VPN service. */
1915
2584
  provider?: string;
1916
- /** `duplicate.canonical_mailbox`: your id of the user who has the mailbox, if known. */
2585
+ /** `duplicate.*`: your id of the user who has the mailbox or device, if known. */
1917
2586
  previous_user?: string | null;
1918
- /** `duplicate.canonical_mailbox`: the assessment that first saw the mailbox. */
2587
+ /** `duplicate.*`: the assessment that first saw the mailbox or device. */
1919
2588
  previous_assessment?: string;
1920
2589
  /** `list.*`: the matching list entry. */
1921
2590
  entry?: string;
@@ -1963,6 +2632,45 @@ interface RiskIpSignals {
1963
2632
  as_name: string | null;
1964
2633
  /** ISO 3166-1 alpha-2. */
1965
2634
  country: string | null;
2635
+ /**
2636
+ * From coss.com's IP privacy data provider; `null` when it isn't available or was not asked
2637
+ * (private addresses).
2638
+ */
2639
+ privacy: RiskIpPrivacy | null;
2640
+ }
2641
+ /** Whether an address is a VPN exit, a proxy or a privacy relay (iCloud Private Relay…). */
2642
+ interface RiskIpPrivacy {
2643
+ vpn: boolean;
2644
+ proxy: boolean;
2645
+ relay: boolean;
2646
+ /** The VPN or proxy service. */
2647
+ service: string | null;
2648
+ }
2649
+ /** How a card is funded, as your payment processor reports it. */
2650
+ type RiskCardFunding = "credit" | "debit" | "prepaid" | "unknown";
2651
+ /** What you sent in `checkout` (never the card). */
2652
+ interface RiskCheckoutSignals {
2653
+ amount: number;
2654
+ currency: string;
2655
+ card_country: string | null;
2656
+ card_funding: RiskCardFunding | null;
2657
+ billing_country: string | null;
2658
+ shipping_country: string | null;
2659
+ }
2660
+ /** What the browser reported through `coss/device` (its device id is only kept as a keyed hash). */
2661
+ interface RiskDeviceSignals {
2662
+ /** `false`: the token was malformed or too old. */
2663
+ valid: boolean;
2664
+ /** WebDriver control or a headless browser. */
2665
+ automation: boolean;
2666
+ /** IANA time zone (`Europe/London`). */
2667
+ timezone: string | null;
2668
+ /** The browser's first language. */
2669
+ language: string | null;
2670
+ platform: string | null;
2671
+ /** `<width>x<height>` in CSS pixels. */
2672
+ screen: string | null;
2673
+ touch: boolean | null;
1966
2674
  }
1967
2675
  /** An assessment of one event. */
1968
2676
  interface RiskAssessment {
@@ -1985,6 +2693,10 @@ interface RiskAssessment {
1985
2693
  velocity: Record<string, number> | null;
1986
2694
  captcha: RiskCaptchaSignals | null;
1987
2695
  login: RiskLoginSignals | null;
2696
+ /** `null` when no content was given or it couldn't be classified. */
2697
+ content: RiskContentScores | null;
2698
+ checkout: RiskCheckoutSignals | null;
2699
+ device: RiskDeviceSignals | null;
1988
2700
  };
1989
2701
  user: {
1990
2702
  id: string | null;
@@ -2022,6 +2734,38 @@ interface AssessRiskParams {
2022
2734
  captcha?: {
2023
2735
  token: string;
2024
2736
  };
2737
+ /**
2738
+ * Text the user wrote (a bio, a message, a listing), classified with the event and never
2739
+ * stored: its scores go in `signals.content`, and `content.*` reasons fire only at thresholds
2740
+ * you set.
2741
+ */
2742
+ content?: {
2743
+ text: string;
2744
+ };
2745
+ /** Only with `checkout` events: what is being paid for, and with which card. */
2746
+ checkout?: {
2747
+ /** In the currency's minor unit (cents for USD: 1999 is $19.99). */
2748
+ amount: number;
2749
+ /** ISO 4217, upper-case (`USD`). */
2750
+ currency: string;
2751
+ /** What your payment processor tells you about the card. */
2752
+ card?: {
2753
+ /**
2754
+ * Your processor's fingerprint of the card number (Stripe: `card.fingerprint`), kept as a
2755
+ * keyed hash only. Never send the card number.
2756
+ */
2757
+ fingerprint?: string;
2758
+ /** Where the card was issued (ISO 3166-1 alpha-2, upper-case). */
2759
+ country?: string;
2760
+ funding?: RiskCardFunding;
2761
+ };
2762
+ billing_country?: string;
2763
+ shipping_country?: string;
2764
+ };
2765
+ /** What `collectDevice()` from `coss/device` returned in the user's browser. */
2766
+ device?: {
2767
+ token: string;
2768
+ };
2025
2769
  }
2026
2770
  /** Query of `GET /v1/risk/assessments`. */
2027
2771
  interface ListRiskAssessmentsParams {
@@ -2114,6 +2858,10 @@ interface RiskSettings {
2114
2858
  provider: RiskCaptchaProvider;
2115
2859
  required: boolean;
2116
2860
  } | null;
2861
+ /** Per content category, the score at which `content.<category>` fires; `null`: never. */
2862
+ content_thresholds: Record<RiskContentCategory, number | null>;
2863
+ /** Reasons whose weight this environment changed; the rest weigh what the catalog says. */
2864
+ reason_weights: Partial<Record<RiskReasonCode, number>>;
2117
2865
  /** ISO 8601 timestamp; `null` while on the defaults. */
2118
2866
  updated_at: string | null;
2119
2867
  }
@@ -2130,9 +2878,48 @@ interface UpdateRiskSettingsParams {
2130
2878
  /** Assessments without a token get `captcha.missing`. */
2131
2879
  required?: boolean;
2132
2880
  } | null;
2881
+ /** Changes the categories given: a score in (0, 1] sets the threshold, `null` removes it. */
2882
+ content_thresholds?: Partial<Record<RiskContentCategory, number | null>>;
2883
+ /**
2884
+ * Changes the reasons given: a weight in [0, 0.99] replaces the default (for example
2885
+ * calibration's `suggested_weight`), `null` restores it. Not `list.*` or `rule.matched`.
2886
+ */
2887
+ reason_weights?: Partial<Record<RiskReasonCode, number | null>>;
2888
+ }
2889
+ /** Feedback counted against one reason or rule (`fraud` includes `abuse`). */
2890
+ interface RiskCalibrationCounts {
2891
+ fraud: number;
2892
+ legitimate: number;
2893
+ /** `fraud / (fraud + legitimate)`; `null` without feedback. */
2894
+ precision: number | null;
2895
+ }
2896
+ /** How often each reason and rule was right over the last 90 days, by your feedback. */
2897
+ interface RiskCalibration {
2898
+ object: "risk_calibration";
2899
+ window_days: number;
2900
+ /** Assessments in the window. */
2901
+ assessments: number;
2902
+ /** Of those, with feedback. */
2903
+ labeled: number;
2904
+ reasons: (RiskCalibrationCounts & {
2905
+ code: RiskReasonCode;
2906
+ /** Assessments it fired in. */
2907
+ fired: number;
2908
+ default_weight: number;
2909
+ /** Its weight in this environment now. */
2910
+ weight: number;
2911
+ /** What feedback supports; `null` with fewer than 20 assessments with feedback. */
2912
+ suggested_weight: number | null;
2913
+ })[];
2914
+ rules: (RiskCalibrationCounts & {
2915
+ rule: string;
2916
+ name: string;
2917
+ /** Assessments it decided. */
2918
+ matched: number;
2919
+ })[];
2133
2920
  }
2134
2921
  /** A field a rule condition can test (see the rules guide). */
2135
- type RiskRuleField = "email.valid" | "email.disposable" | "email.undeliverable" | "email.role_account" | "email.free_provider" | "email.typo" | "email.domain_new" | "email.domain" | "email.domain_age_days" | "ip.tor" | "ip.hosting" | "ip.vpn" | "ip.private" | "ip.country" | "ip.asn" | "ip.hosting_provider" | "captcha.passed" | "duplicate.canonical_mailbox" | "history.fraud" | "login.new_country" | "login.new_network" | "score" | "velocity.ip_1h" | "velocity.ip_24h" | "velocity.subnet_1h" | "velocity.subnet_24h" | "velocity.email_domain_1h" | "velocity.email_domain_24h" | "velocity.mailbox_1h" | "velocity.mailbox_24h" | "velocity.user_1h" | "velocity.user_24h";
2922
+ type RiskRuleField = "email.valid" | "email.disposable" | "email.undeliverable" | "email.role_account" | "email.free_provider" | "email.typo" | "email.domain_new" | "email.domain" | "email.domain_age_days" | "ip.tor" | "ip.hosting" | "ip.vpn" | "ip.proxy" | "ip.relay" | "ip.private" | "ip.country" | "ip.asn" | "ip.hosting_provider" | "captcha.passed" | "duplicate.canonical_mailbox" | "duplicate.device" | "history.fraud" | "login.new_country" | "login.new_network" | "content.spam" | "content.phishing" | "content.malware" | "content.fraud" | "checkout.amount" | "checkout.currency" | "checkout.card_country" | "checkout.card_funding" | "checkout.billing_country" | "checkout.shipping_country" | "device.automation" | "device.timezone" | "device.language" | "score" | "velocity.ip_1h" | "velocity.ip_24h" | "velocity.subnet_1h" | "velocity.subnet_24h" | "velocity.email_domain_1h" | "velocity.email_domain_24h" | "velocity.mailbox_1h" | "velocity.mailbox_24h" | "velocity.user_1h" | "velocity.user_24h" | "velocity.card_1h" | "velocity.card_24h" | "velocity.device_1h" | "velocity.device_24h";
2136
2923
  /** A test of one field. A field without a value (no IP, no email…) never matches. */
2137
2924
  interface RiskRuleCondition {
2138
2925
  field: RiskRuleField;
@@ -2179,21 +2966,122 @@ interface DeletedRiskRule {
2179
2966
  id: string;
2180
2967
  deleted: true;
2181
2968
  }
2969
+ /** Result of `coss.risk.checkEmail()`: what coss.com knows about an address. Nothing is stored. */
2970
+ interface RiskEmailCheck {
2971
+ object: "risk_email_check";
2972
+ email: string;
2973
+ valid: boolean;
2974
+ domain: string | null;
2975
+ /** The mailbox with the provider's aliasing folded (dots and `+tags` at Gmail…). */
2976
+ canonical: string | null;
2977
+ disposable: boolean;
2978
+ /** From DNS (MX, A, AAAA). `unknown` when the lookup failed or timed out. */
2979
+ deliverability: "deliverable" | "undeliverable" | "unknown";
2980
+ role_account: boolean;
2981
+ free_provider: boolean;
2982
+ /** The likely intended domain when this one looks like a typo of a popular one. */
2983
+ suggestion: string | null;
2984
+ /** Days since the domain was registered (RDAP); `null` when unknown or not looked up. */
2985
+ domain_age_days: number | null;
2986
+ /** Lookups that failed or timed out. */
2987
+ degraded: ("email_dns" | "domain_age")[];
2988
+ }
2989
+ /** Result of `coss.risk.checkIp()`. Nothing is stored. */
2990
+ interface RiskIpCheck extends RiskIpSignals {
2991
+ object: "risk_ip_check";
2992
+ ip: string;
2993
+ /**
2994
+ * `ip_data` when some IP data is unavailable at the moment; `ip_privacy` when the privacy data
2995
+ * provider failed or timed out.
2996
+ */
2997
+ degraded: ("ip_data" | "ip_privacy")[];
2998
+ }
2999
+ /** Result of `coss.risk.classify()`: scores only, neither stored nor logged. */
3000
+ interface RiskContentClassification {
3001
+ object: "risk_content_classification";
3002
+ scores: RiskContentScores;
3003
+ /** The text was longer than the model reads (8,000 characters): only its beginning counted. */
3004
+ truncated: boolean;
3005
+ }
3006
+ /** What `on_failure` answers while coss.com can't count. */
3007
+ type RiskLimitFailureMode = "allow" | "deny";
3008
+ /** One of your rate limit buckets: each key gets `burst` tokens, refilling `limit` per period. */
3009
+ interface RiskLimitBucket {
3010
+ object: "risk_limit_bucket";
3011
+ id: string;
3012
+ /** What `coss.risk.limit({ bucket })` names it by. */
3013
+ name: string;
3014
+ /** Tokens added per `period_seconds`. */
3015
+ limit: number;
3016
+ period_seconds: number;
3017
+ /** How many requests a key can make at once. */
3018
+ burst: number;
3019
+ on_failure: RiskLimitFailureMode;
3020
+ /** ISO 8601 timestamp. */
3021
+ created_at: string;
3022
+ /** ISO 8601 timestamp. */
3023
+ updated_at: string;
3024
+ }
3025
+ /** Body of `POST /v1/risk/limit_buckets`. */
3026
+ interface CreateRiskLimitBucketParams {
3027
+ /** 1-64 lower-case letters, digits, `.`, `_` or `-`; unique in the environment. */
3028
+ name: string;
3029
+ limit: number;
3030
+ /** 1 second to 1 day. */
3031
+ period_seconds: number;
3032
+ /** Defaults to `limit`. */
3033
+ burst?: number;
3034
+ /** Defaults to `allow`. */
3035
+ on_failure?: RiskLimitFailureMode;
3036
+ }
3037
+ /** Body of `PATCH /v1/risk/limit_buckets/{id}` (the name can't change). */
3038
+ type UpdateRiskLimitBucketParams = Partial<Omit<CreateRiskLimitBucketParams, "name">>;
3039
+ interface DeletedRiskLimitBucket {
3040
+ object: "risk_limit_bucket";
3041
+ id: string;
3042
+ deleted: true;
3043
+ }
3044
+ /** Body of `POST /v1/risk/limits`. */
3045
+ interface CheckRiskLimitParams {
3046
+ /** The bucket's name. */
3047
+ bucket: string;
3048
+ /** Who or what is limited (a user id, an email or IP address…); coss.com keeps only a hash. */
3049
+ key: string;
3050
+ /** Tokens this request takes. Default 1. */
3051
+ cost?: number;
3052
+ }
3053
+ /** Result of `coss.risk.limit()`. */
3054
+ interface RiskLimit {
3055
+ object: "risk_limit";
3056
+ bucket: string;
3057
+ /** Whether to let the request through. Denied requests take no tokens. */
3058
+ allowed: boolean;
3059
+ /** The bucket's size (`burst`). */
3060
+ limit: number;
3061
+ /** Tokens left for this key. */
3062
+ remaining: number;
3063
+ /** Milliseconds until the key's bucket is full again. */
3064
+ reset_ms: number;
3065
+ /** When denied: milliseconds until the same request would fit; `null` if it never would. */
3066
+ retry_after_ms: number | null;
3067
+ /** coss.com couldn't count: `allowed` is the bucket's `on_failure`. */
3068
+ degraded: boolean;
3069
+ }
2182
3070
  //#endregion
2183
3071
  //#region src/resources/risk.d.ts
2184
- type ReadOptions$2 = Pick<RequestOptions, "signal">;
3072
+ type ReadOptions$3 = Pick<RequestOptions, "signal">;
2185
3073
  /** `coss.risk.assessments`: reading past assessments (`assess` lives on `coss.risk`). */
2186
3074
  declare class RiskAssessmentsResource {
2187
3075
  #private;
2188
3076
  /** @internal Use `new Coss().risk.assessments`. */
2189
3077
  constructor(http: HttpClient);
2190
3078
  /** Retrieves one assessment. */
2191
- get(id: string, options?: ReadOptions$2): Promise<CossResult<RiskAssessment>>;
3079
+ get(id: string, options?: ReadOptions$3): Promise<CossResult<RiskAssessment>>;
2192
3080
  /**
2193
3081
  * Lists assessments, newest first (`review_status: "open"` is the review queue). Pass the last
2194
3082
  * `id` as `after` while `has_more` is true.
2195
3083
  */
2196
- list(params?: ListRiskAssessmentsParams, options?: ReadOptions$2): Promise<CossResult<List<RiskAssessment>>>;
3084
+ list(params?: ListRiskAssessmentsParams, options?: ReadOptions$3): Promise<CossResult<List<RiskAssessment>>>;
2197
3085
  }
2198
3086
  /** `coss.risk.lists`: the environment's allow and block lists. */
2199
3087
  declare class RiskListsResource {
@@ -2209,20 +3097,20 @@ declare class RiskListsResource {
2209
3097
  expires_at?: string | Date;
2210
3098
  }, options?: RequestOptions): Promise<CossResult<RiskListEntry>>;
2211
3099
  /** Lists entries, newest first. Pass the last `id` as `after` while `has_more` is true. */
2212
- list(params?: ListRiskListEntriesParams, options?: ReadOptions$2): Promise<CossResult<List<RiskListEntry>>>;
3100
+ list(params?: ListRiskListEntriesParams, options?: ReadOptions$3): Promise<CossResult<List<RiskListEntry>>>;
2213
3101
  /** Retrieves one entry. */
2214
- get(id: string, options?: ReadOptions$2): Promise<CossResult<RiskListEntry>>;
3102
+ get(id: string, options?: ReadOptions$3): Promise<CossResult<RiskListEntry>>;
2215
3103
  /** Removes an entry. */
2216
- remove(id: string, options?: ReadOptions$2): Promise<CossResult<DeletedRiskListEntry>>;
3104
+ remove(id: string, options?: ReadOptions$3): Promise<CossResult<DeletedRiskListEntry>>;
2217
3105
  }
2218
3106
  /** `coss.risk.settings`: the environment's thresholds, disabled reasons and captcha provider. */
2219
3107
  declare class RiskSettingsResource {
2220
3108
  #private;
2221
3109
  /** @internal Use `new Coss().risk.settings`. */
2222
3110
  constructor(http: HttpClient);
2223
- get(options?: ReadOptions$2): Promise<CossResult<RiskSettings>>;
3111
+ get(options?: ReadOptions$3): Promise<CossResult<RiskSettings>>;
2224
3112
  /** Changes the fields given. The captcha secret is write-only. */
2225
- update(params: UpdateRiskSettingsParams, options?: ReadOptions$2): Promise<CossResult<RiskSettings>>;
3113
+ update(params: UpdateRiskSettingsParams, options?: ReadOptions$3): Promise<CossResult<RiskSettings>>;
2226
3114
  }
2227
3115
  /**
2228
3116
  * `coss.risk.rules`: the environment's rules. After the lists, the first enabled rule whose
@@ -2233,24 +3121,40 @@ declare class RiskRulesResource {
2233
3121
  /** @internal Use `new Coss().risk.rules`. */
2234
3122
  constructor(http: HttpClient);
2235
3123
  /** Creates a rule. Not retried automatically: a retry could create it twice. */
2236
- create(params: CreateRiskRuleParams, options?: ReadOptions$2): Promise<CossResult<RiskRule>>;
3124
+ create(params: CreateRiskRuleParams, options?: ReadOptions$3): Promise<CossResult<RiskRule>>;
2237
3125
  /** Every rule, in evaluation order. */
2238
- list(options?: ReadOptions$2): Promise<CossResult<List<RiskRule>>>;
2239
- get(id: string, options?: ReadOptions$2): Promise<CossResult<RiskRule>>;
3126
+ list(options?: ReadOptions$3): Promise<CossResult<List<RiskRule>>>;
3127
+ get(id: string, options?: ReadOptions$3): Promise<CossResult<RiskRule>>;
2240
3128
  /** Changes the fields given; `conditions` replaces the whole list. */
2241
- update(id: string, params: UpdateRiskRuleParams, options?: ReadOptions$2): Promise<CossResult<RiskRule>>;
2242
- delete(id: string, options?: ReadOptions$2): Promise<CossResult<DeletedRiskRule>>;
3129
+ update(id: string, params: UpdateRiskRuleParams, options?: ReadOptions$3): Promise<CossResult<RiskRule>>;
3130
+ delete(id: string, options?: ReadOptions$3): Promise<CossResult<DeletedRiskRule>>;
2243
3131
  }
2244
- /** `coss.risk.users`: what COSS remembers about your users. */
3132
+ /**
3133
+ * `coss.risk.limitBuckets`: your rate limit buckets, which `coss.risk.limit()` charges per key.
3134
+ */
3135
+ declare class RiskLimitBucketsResource {
3136
+ #private;
3137
+ /** @internal Use `new Coss().risk.limitBuckets`. */
3138
+ constructor(http: HttpClient);
3139
+ /** Creates a bucket. Not retried automatically: a retry would find its name taken. */
3140
+ create(params: CreateRiskLimitBucketParams, options?: ReadOptions$3): Promise<CossResult<RiskLimitBucket>>;
3141
+ /** Every bucket, by name. */
3142
+ list(options?: ReadOptions$3): Promise<CossResult<List<RiskLimitBucket>>>;
3143
+ get(id: string, options?: ReadOptions$3): Promise<CossResult<RiskLimitBucket>>;
3144
+ /** Changes the fields given; the next check uses them. */
3145
+ update(id: string, params: UpdateRiskLimitBucketParams, options?: ReadOptions$3): Promise<CossResult<RiskLimitBucket>>;
3146
+ delete(id: string, options?: ReadOptions$3): Promise<CossResult<DeletedRiskLimitBucket>>;
3147
+ }
3148
+ /** `coss.risk.users`: what coss.com remembers about your users. */
2245
3149
  declare class RiskUsersResource {
2246
3150
  #private;
2247
3151
  /** @internal Use `new Coss().risk.users`. */
2248
3152
  constructor(http: HttpClient);
2249
3153
  /**
2250
- * Call when you delete a user: COSS deletes what identifies them (their mailbox, fraud reports,
3154
+ * Call when you delete a user: coss.com deletes what identifies them (their mailbox, fraud reports,
2251
3155
  * and the user id, email, IP and user agent on their assessments). Safe to repeat.
2252
3156
  */
2253
- forget(userId: string, options?: ReadOptions$2): Promise<CossResult<ForgottenRiskUser>>;
3157
+ forget(userId: string, options?: ReadOptions$3): Promise<CossResult<ForgottenRiskUser>>;
2254
3158
  }
2255
3159
  /**
2256
3160
  * `coss.risk`: assess sign-ups, logins and other events. Call it from your server and treat an
@@ -2273,6 +3177,8 @@ declare class RiskResource {
2273
3177
  readonly settings: RiskSettingsResource;
2274
3178
  /** Rules (`create`, `list`, `get`, `update`, `delete`). */
2275
3179
  readonly rules: RiskRulesResource;
3180
+ /** Your rate limit buckets (`create`, `list`, `get`, `update`, `delete`). */
3181
+ readonly limitBuckets: RiskLimitBucketsResource;
2276
3182
  /** @internal Use `new Coss().risk`. */
2277
3183
  constructor(http: HttpClient);
2278
3184
  /**
@@ -2282,9 +3188,42 @@ declare class RiskResource {
2282
3188
  assess(params: AssessRiskParams, options?: RequestOptions): Promise<CossResult<RiskAssessment>>;
2283
3189
  /**
2284
3190
  * Reports what an assessed user turned out to be: `fraud` and `abuse` teach later assessments to
2285
- * flag the same mailbox, user, IP and subnet; `legitimate` takes that back. Resolves a review.
3191
+ * flag the same mailbox, user, card, device, IP and subnet; `legitimate` takes that back.
3192
+ * Resolves a review, and counts in `calibration()`.
2286
3193
  */
2287
3194
  feedback(id: string, params: RiskFeedbackParams, options?: RequestOptions): Promise<CossResult<RiskAssessment>>;
3195
+ /**
3196
+ * How often each reason and rule was right over the last 90 days, by your feedback, and the
3197
+ * reason weights that supports. Apply them with `settings.update({ reason_weights })`.
3198
+ */
3199
+ calibration(options?: ReadOptions$3): Promise<CossResult<RiskCalibration>>;
3200
+ /**
3201
+ * Checks an email address on its own: syntax, disposable domains, deliverability, role
3202
+ * accounts, free providers, the canonical mailbox, typos and domain age. Nothing is stored.
3203
+ */
3204
+ checkEmail(email: string, options?: ReadOptions$3): Promise<CossResult<RiskEmailCheck>>;
3205
+ /**
3206
+ * Checks an IP address on its own: Tor, cloud, hosting and VPN networks, ASN and country, and
3207
+ * VPN, proxy and relay exits when coss.com's privacy data is available.
3208
+ */
3209
+ checkIp(ip: string, options?: ReadOptions$3): Promise<CossResult<RiskIpCheck>>;
3210
+ /**
3211
+ * Scores text for spam, phishing, malware and fraud. Scores only, never a verdict: you choose
3212
+ * the thresholds. The text is neither stored nor logged.
3213
+ */
3214
+ classify(params: {
3215
+ text: string;
3216
+ }, options?: ReadOptions$3): Promise<CossResult<RiskContentClassification>>;
3217
+ /**
3218
+ * Takes `cost` tokens (default 1) from `key`'s share of one of your buckets
3219
+ * (`coss.risk.limitBuckets`). Retries reuse one `Idempotency-Key`, so they are charged once.
3220
+ *
3221
+ * ```ts
3222
+ * const { data } = await coss.risk.limit({ bucket: "password_reset", key: email });
3223
+ * if (data && !data.allowed) return tooManyRequests(data.retry_after_ms);
3224
+ * ```
3225
+ */
3226
+ limit(params: CheckRiskLimitParams, options?: RequestOptions): Promise<CossResult<RiskLimit>>;
2288
3227
  }
2289
3228
  //#endregion
2290
3229
  //#region src/types/webhook.d.ts
@@ -2348,6 +3287,36 @@ interface ReceivedEmailWebhookEvent {
2348
3287
  created_at: string;
2349
3288
  data: ReceivedEmailWebhookEventData;
2350
3289
  }
3290
+ /** Events about the organization's domains (sent to live environments only). */
3291
+ type DomainEventType = "domain.dmarc_report_received";
3292
+ /** What a webhook says about a DMARC report; never its rows or source addresses. */
3293
+ interface DomainWebhookEventData {
3294
+ organization_id: string;
3295
+ domain_id: string;
3296
+ domain: string;
3297
+ /** Retrieve the report (its rows) with `coss.domains.dmarc.reports.get`. */
3298
+ dmarc_report_id: string;
3299
+ /** The reporting organization (`org_name`). */
3300
+ reporter: string;
3301
+ /** ISO 8601 timestamps of the period the report covers. */
3302
+ period_start: string;
3303
+ period_end: string;
3304
+ messages: number;
3305
+ passing: number;
3306
+ /** ISO 8601 timestamp. */
3307
+ occurred_at: string;
3308
+ }
3309
+ /** A DMARC aggregate report about a domain arrived. `id` equals the `webhook-id` header. */
3310
+ interface DomainWebhookEvent {
3311
+ id: string;
3312
+ object: "event";
3313
+ type: DomainEventType;
3314
+ /** The API version this event is rendered in: the receiving endpoint's `api_version`. */
3315
+ api_version: string;
3316
+ /** ISO 8601 timestamp. */
3317
+ created_at: string;
3318
+ data: DomainWebhookEventData;
3319
+ }
2351
3320
  /** Changes of the organization's reputation standing (sent to live environments only). */
2352
3321
  type AccountEventType = "account.reputation_warning" | "account.reputation_recovered" | "account.suspended" | "account.reinstated";
2353
3322
  interface AccountWebhookEventData {
@@ -2492,11 +3461,11 @@ interface HookEndpointWebhookEvent {
2492
3461
  data: HookEndpointWebhookEventData;
2493
3462
  }
2494
3463
  /** The JSON body of a webhook request; narrow on `type`. */
2495
- type WebhookEvent = EmailWebhookEvent | ReceivedEmailWebhookEvent | AccountWebhookEvent | BillingWebhookEvent | RiskWebhookEvent | HookEndpointWebhookEvent;
3464
+ type WebhookEvent = EmailWebhookEvent | ReceivedEmailWebhookEvent | DomainWebhookEvent | AccountWebhookEvent | BillingWebhookEvent | RiskWebhookEvent | HookEndpointWebhookEvent;
2496
3465
  //#endregion
2497
3466
  //#region src/types/webhook-endpoint.d.ts
2498
3467
  /** Every event type an endpoint can subscribe to. */
2499
- type WebhookEventType = EmailEventType | ReceivedEmailEventType | AccountEventType | BillingEventType | RiskEventType | HookOperationalEventType;
3468
+ type WebhookEventType = EmailEventType | ReceivedEmailEventType | DomainEventType | AccountEventType | BillingEventType | RiskEventType | HookOperationalEventType;
2500
3469
  /** Why an endpoint is disabled. */
2501
3470
  type WebhookEndpointDisabledReason = "manual" | "failing";
2502
3471
  /** A URL of the API key's environment that receives signed event notifications. */
@@ -2516,7 +3485,7 @@ interface WebhookEndpoint {
2516
3485
  enabled: boolean;
2517
3486
  /**
2518
3487
  * `manual`: someone disabled it. `failing`: its deliveries failed every attempt for five days,
2519
- * so COSS disabled it. `null` while enabled.
3488
+ * so coss.com disabled it. `null` while enabled.
2520
3489
  */
2521
3490
  disabled_reason: WebhookEndpointDisabledReason | null;
2522
3491
  /** When it was disabled (ISO 8601); `null` while enabled. */
@@ -2545,7 +3514,7 @@ interface WebhookEndpointWithSecret extends WebhookEndpoint {
2545
3514
  }
2546
3515
  /** Body of `POST /v1/webhook_endpoints`. */
2547
3516
  interface CreateWebhookEndpointParams {
2548
- /** An `https://` URL COSS posts events to. */
3517
+ /** An `https://` URL coss.com posts events to. */
2549
3518
  url: string;
2550
3519
  /** A note for your own reference. */
2551
3520
  description?: string | null;
@@ -2651,7 +3620,7 @@ interface ListWebhookDeliveriesParams {
2651
3620
  }
2652
3621
  //#endregion
2653
3622
  //#region src/resources/webhook-deliveries.d.ts
2654
- type ReadOptions$1 = Pick<RequestOptions, "signal">;
3623
+ type ReadOptions$2 = Pick<RequestOptions, "signal">;
2655
3624
  /**
2656
3625
  * `coss.webhookEndpoints.deliveries`: an endpoint's delivery log. Each delivery carries every
2657
3626
  * HTTP attempt and the payload as sent.
@@ -2661,9 +3630,9 @@ declare class WebhookDeliveriesResource {
2661
3630
  /** @internal Use `new Coss().webhookEndpoints.deliveries`. */
2662
3631
  constructor(http: HttpClient);
2663
3632
  /** Lists the endpoint's deliveries, newest first. Pass the last `id` as `after` while `has_more` is true. */
2664
- list(endpointId: string, params?: ListWebhookDeliveriesParams, options?: ReadOptions$1): Promise<CossResult<List<WebhookDelivery>>>;
3633
+ list(endpointId: string, params?: ListWebhookDeliveriesParams, options?: ReadOptions$2): Promise<CossResult<List<WebhookDelivery>>>;
2665
3634
  /** Retrieves one delivery of the endpoint. */
2666
- get(endpointId: string, id: string, options?: ReadOptions$1): Promise<CossResult<WebhookDelivery>>;
3635
+ get(endpointId: string, id: string, options?: ReadOptions$2): Promise<CossResult<WebhookDelivery>>;
2667
3636
  /**
2668
3637
  * Queues a finished delivery for one more attempt, made within seconds. A delivery that is
2669
3638
  * still `pending` is returned unchanged (it is already scheduled for `next_attempt_at`).
@@ -2674,7 +3643,7 @@ declare class WebhookDeliveriesResource {
2674
3643
  }
2675
3644
  //#endregion
2676
3645
  //#region src/resources/webhook-endpoints.d.ts
2677
- type ReadOptions = Pick<RequestOptions, "signal">;
3646
+ type ReadOptions$1 = Pick<RequestOptions, "signal">;
2678
3647
  /**
2679
3648
  * `coss.webhookEndpoints`: the URLs that receive signed event notifications. Endpoints belong to
2680
3649
  * the API key's own environment, so a `coss_test_…` key only ever manages sandbox endpoints.
@@ -2693,14 +3662,14 @@ declare class WebhookEndpointsResource {
2693
3662
  */
2694
3663
  create(params: CreateWebhookEndpointParams, options?: RequestOptions): Promise<CossResult<WebhookEndpointWithSecret>>;
2695
3664
  /** Lists the environment's endpoints, oldest first. Secrets are never included. */
2696
- list(options?: ReadOptions): Promise<CossResult<List<WebhookEndpoint>>>;
3665
+ list(options?: ReadOptions$1): Promise<CossResult<List<WebhookEndpoint>>>;
2697
3666
  /** Retrieves an endpoint of the API key's environment. */
2698
- get(id: string, options?: ReadOptions): Promise<CossResult<WebhookEndpoint>>;
3667
+ get(id: string, options?: ReadOptions$1): Promise<CossResult<WebhookEndpoint>>;
2699
3668
  /**
2700
3669
  * Changes the URL, description, subscribed event types or `enabled` flag. The signing secret
2701
3670
  * stays the same (see `rollSecret`), so receivers keep verifying deliveries.
2702
3671
  */
2703
- update(id: string, params: UpdateWebhookEndpointParams, options?: ReadOptions): Promise<CossResult<WebhookEndpoint>>;
3672
+ update(id: string, params: UpdateWebhookEndpointParams, options?: ReadOptions$1): Promise<CossResult<WebhookEndpoint>>;
2704
3673
  /**
2705
3674
  * Replaces the endpoint's signing secret; the result carries the new `secret`. Until
2706
3675
  * `previous_secret_expires_at` (a day by default), deliveries are signed with both secrets, so
@@ -2716,7 +3685,100 @@ declare class WebhookEndpointsResource {
2716
3685
  */
2717
3686
  recover(id: string, params: RecoverWebhookEndpointParams, options?: RequestOptions): Promise<CossResult<WebhookEndpointRecovery>>;
2718
3687
  /** Deletes the endpoint and its delivery log. To pause it instead, update `enabled` to false. */
2719
- delete(id: string, options?: ReadOptions): Promise<CossResult<DeletedWebhookEndpoint>>;
3688
+ delete(id: string, options?: ReadOptions$1): Promise<CossResult<DeletedWebhookEndpoint>>;
3689
+ }
3690
+ //#endregion
3691
+ //#region src/types/webhook-listener.d.ts
3692
+ /** A temporary subscriber of the API key's environment, open while it is polled. */
3693
+ interface WebhookListener {
3694
+ object: "webhook_listener";
3695
+ id: string;
3696
+ /** The API version events are rendered in. */
3697
+ api_version: string;
3698
+ /** Empty: every event type. */
3699
+ event_types: string[];
3700
+ description: string | null;
3701
+ /** When it closes unless polled again (every poll moves it 10 minutes ahead). */
3702
+ expires_at: string;
3703
+ created_at: string;
3704
+ }
3705
+ /** One event handed out by a poll, to forward and acknowledge. */
3706
+ interface WebhookListenerDelivery {
3707
+ object: "webhook_listener_delivery";
3708
+ id: string;
3709
+ /** Send it back in the acknowledgement. */
3710
+ ack_token: string;
3711
+ /** The event's id: the body's `id`, and the `webhook-id` header endpoints receive. */
3712
+ event_id: string;
3713
+ event_type: string;
3714
+ /** How many polls have handed it out (more than 1 after an unacknowledged answer). */
3715
+ attempt: number;
3716
+ /** The event body, exactly as an endpoint would receive it: forward these bytes. */
3717
+ body: string;
3718
+ created_at: string;
3719
+ }
3720
+ /** Answer of `POST /v1/webhook_listeners/{id}/poll`. */
3721
+ interface WebhookListenerPoll {
3722
+ object: "webhook_listener_poll";
3723
+ listener: WebhookListener;
3724
+ /** Oldest first; empty when nothing arrived while the poll waited. */
3725
+ deliveries: WebhookListenerDelivery[];
3726
+ /** How many of the request's acknowledgements were recorded. */
3727
+ acknowledged: number;
3728
+ }
3729
+ interface DeletedWebhookListener {
3730
+ object: "webhook_listener";
3731
+ id: string;
3732
+ deleted: true;
3733
+ }
3734
+ /** Body of `POST /v1/webhook_listeners`. */
3735
+ interface CreateWebhookListenerParams {
3736
+ /** Defaults to every event type. */
3737
+ event_types?: WebhookEventType[];
3738
+ /** Defaults to the client's `apiVersion`. */
3739
+ api_version?: ApiVersion;
3740
+ /** Where the events go, for your own reference (shown in the log). */
3741
+ description?: string | null;
3742
+ }
3743
+ /** What happened to one delivery handed out earlier. */
3744
+ interface WebhookListenerAck {
3745
+ delivery_id: string;
3746
+ ack_token: string;
3747
+ /** The local server's status; `null` when nothing answered, or the event was only printed. */
3748
+ status_code: number | null;
3749
+ duration_ms: number;
3750
+ /** Why forwarding failed; `null` if it didn't. */
3751
+ error: string | null;
3752
+ }
3753
+ /** Body of `POST /v1/webhook_listeners/{id}/poll`. */
3754
+ interface PollWebhookListenerParams {
3755
+ acks?: WebhookListenerAck[];
3756
+ /** How long to wait for events, in milliseconds (default 20000, at most 25000). */
3757
+ wait_ms?: number;
3758
+ /** The most deliveries to hand out (default 10, at most 50). */
3759
+ limit?: number;
3760
+ }
3761
+ //#endregion
3762
+ //#region src/resources/webhook-listeners.d.ts
3763
+ type ReadOptions = Pick<RequestOptions, "signal">;
3764
+ /**
3765
+ * `coss.webhookListeners`: what `coss listen` uses to forward an environment's events to a local
3766
+ * server. A listener receives events created after it opens, while it is polled; it is closed by
3767
+ * `delete` or after 10 minutes without a poll.
3768
+ */
3769
+ declare class WebhookListenersResource {
3770
+ #private;
3771
+ /** @internal Use `new Coss().webhookListeners`. */
3772
+ constructor(http: HttpClient);
3773
+ /** Opens a listener. Never retried automatically: a lost answer leaves one to expire. */
3774
+ create(params?: CreateWebhookListenerParams, options?: ReadOptions): Promise<CossResult<WebhookListener>>;
3775
+ /**
3776
+ * Acknowledges earlier deliveries and waits (up to `wait_ms`) for more. Never retried
3777
+ * automatically: call it in a loop, and keep unacknowledged acks for the next call after an error.
3778
+ */
3779
+ poll(id: string, params?: PollWebhookListenerParams, options?: ReadOptions): Promise<CossResult<WebhookListenerPoll>>;
3780
+ /** Closes a listener: it receives nothing more. */
3781
+ delete(id: string, options?: ReadOptions): Promise<CossResult<DeletedWebhookListener>>;
2720
3782
  }
2721
3783
  //#endregion
2722
3784
  //#region src/client.d.ts
@@ -2743,7 +3805,7 @@ interface CossOptions {
2743
3805
  dangerouslyAllowBrowser?: boolean;
2744
3806
  }
2745
3807
  /**
2746
- * The COSS client. One API key covers every product.
3808
+ * The coss.com client. One API key covers every product.
2747
3809
  *
2748
3810
  * ```ts
2749
3811
  * const coss = new Coss({ apiKey: "coss_test_…" });
@@ -2752,17 +3814,23 @@ interface CossOptions {
2752
3814
  */
2753
3815
  export declare class Coss {
2754
3816
  readonly email: EmailResource;
3817
+ /** The API key's environment, project and organization (`coss.environment.get()`). */
3818
+ readonly environment: EnvironmentResource;
3819
+ /** The client's own API key (`coss.apiKey.revoke()`). */
3820
+ readonly apiKey: ApiKeyResource;
2755
3821
  /** Sending domains of the organization (`coss.domains.create`, `.verify`, …). */
2756
3822
  readonly domains: DomainsResource;
2757
3823
  /** Webhook endpoints of the API key's environment. */
2758
3824
  readonly webhookEndpoints: WebhookEndpointsResource;
3825
+ /** Temporary listeners `coss listen` pulls the environment's events from. */
3826
+ readonly webhookListeners: WebhookListenersResource;
2759
3827
  /** The organization's sending reputation (`coss.reputation.get()`). */
2760
3828
  readonly reputation: ReputationResource;
2761
3829
  /** The environment's log: API requests, email events, webhook attempts (`coss.logs.list()`). */
2762
3830
  readonly logs: LogsResource;
2763
3831
  /** HTTPS endpoints the environment's log is streamed to (`coss.logDrains.create()`). */
2764
3832
  readonly logDrains: LogDrainsResource;
2765
- /** The organization's audit log: changes by members, API keys and COSS support (`coss.auditEvents.list()`). */
3833
+ /** The organization's audit log: changes by members, API keys and coss.com support (`coss.auditEvents.list()`). */
2766
3834
  readonly auditEvents: AuditEventsResource;
2767
3835
  /** Hooks, webhooks as a service: `coss.hooks.messages.send()` delivers to your users' endpoints. */
2768
3836
  readonly hooks: HooksResource;
@@ -2779,7 +3847,7 @@ export declare class Coss {
2779
3847
  //#endregion
2780
3848
  //#region src/version.d.ts
2781
3849
  /** SDK version, sent in the User-Agent. A test keeps it equal to package.json's `version`. */
2782
- export declare const VERSION = "0.2.0";
3850
+ export declare const VERSION = "0.4.0";
2783
3851
  //#endregion
2784
3852
  //#region src/webhooks.d.ts
2785
3853
  /** A webhook request failed verification: reject it (e.g. respond 400). */
@@ -2803,7 +3871,7 @@ interface VerifyWebhookOptions {
2803
3871
  * const event = await verifyWebhook(await request.text(), request.headers, process.env.COSS_WEBHOOK_SECRET);
2804
3872
  * ```
2805
3873
  *
2806
- * The same check verifies messages your own users receive from COSS Hooks (`coss.hooks`): pass
3874
+ * The same check verifies messages your own users receive from coss.com Hooks (`coss.hooks`): pass
2807
3875
  * the endpoint's secret and name your payload type, e.g. `verifyWebhook<InvoicePaid>(…)`.
2808
3876
  */
2809
3877
  export declare function verifyWebhook<T = WebhookEvent>(payload: string, headers: WebhookHeaders, secret: string, options?: VerifyWebhookOptions): Promise<T>;
@@ -2820,4 +3888,4 @@ export declare function verifyWebhook<T = WebhookEvent>(payload: string, headers
2820
3888
  */
2821
3889
  export declare function verifyLogDrainBatch(payload: string, headers: WebhookHeaders, secret: string, options?: VerifyWebhookOptions): Promise<LogDrainLine[]>;
2822
3890
  //#endregion
2823
- export type { AccountEventType, AccountWebhookEvent, AccountWebhookEventData, ApiVersion, AssessRiskParams, AuditActorType, AuditEvent, AuditEventsResource, Billing, BillingCreditsResource, BillingEventType, BillingHoldReason, BillingInvoicesResource, BillingResource, BillingWebhookEvent, CheckSuppressionParams, CossError, CossErrorIssue, CossErrorType, CossOptions, CossResult, CreateDomainParams, CreateHookApplicationParams, CreateHookEndpointParams, CreateHookEventTypeParams, CreateHookPortalSessionParams, CreateLogDrainParams, CreateReceivingDomainParams, CreateRiskListEntryParams, CreateRiskRuleParams, CreateSuppressionParams, CreateTrackingDomainParams, CreateWebhookEndpointParams, Credit, DeletedDomain, DeletedHookApplication, DeletedHookEndpoint, DeletedLogDrain, DeletedReceivedEmail, DeletedRiskListEntry, DeletedRiskRule, DeletedSuppression, DeletedTrackingRule, DeletedWebhookEndpoint, Domain, DomainRecord, DomainRecordPurpose, DomainRecordStatus, DomainStatus, DomainsResource, Email, EmailAttachment, EmailAttachmentParams, EmailBatch, EmailEvent, EmailEventData, EmailEventType, EmailLink, EmailRecipient, EmailRecipientStatus, EmailResource, EmailStatus, EmailTag, EmailTracking, EmailWebhookEvent, EmailWebhookEventData, ExportSuppressionsParams, FetchLike, ForgottenRiskUser, HookApplication, HookApplicationsResource, HookAttempt, HookDeliveriesResource, HookDelivery, HookDeliveryStatus, HookEndpoint, HookEndpointDisabledReason, HookEndpointRecovery, HookEndpointSecret, HookEndpointWebhookEvent, HookEndpointWebhookEventData, HookEndpointWithSecret, HookEndpointsResource, HookEventType, HookEventTypesResource, HookMessage, HookMessagesResource, HookOperationalEventType, HookPortalResource, HookPortalSession, HooksResource, ImportSuppressionEntry, ImportSuppressionsParams, InboundAddress, Invoice, InvoiceLine, InvoiceLineKind, InvoiceStatus, InvoiceSummary, List, ListAuditEventsParams, ListCreditsParams, ListHookApplicationsParams, ListHookDeliveriesParams, ListHookEventTypesParams, ListHookMessagesParams, ListInvoicesParams, ListLogDrainBatchesParams, ListLogsParams, ListReceivedEmailsParams, ListRiskAssessmentsParams, ListRiskListEntriesParams, ListSuppressionsParams, ListUsageParams, ListWebhookDeliveriesParams, Log, LogDrain, LogDrainAttempt, LogDrainBatch, LogDrainBatchStatus, LogDrainBatchesResource, LogDrainLine, LogDrainSource, LogDrainWithSecret, LogDrainsResource, LogLevel, LogSource, LogsResource, MailFromStatus, Meter, PlanKey, ReceivedEmail, ReceivedEmailAttachment, ReceivedEmailEventType, ReceivedEmailStatus, ReceivedEmailSummary, ReceivedEmailVerdicts, ReceivedEmailWebhookEvent, ReceivedEmailWebhookEventData, ReceivedEmailsResource, ReceivingDomain, ReceivingDomainRecord, ReceivingDomainsResource, RecoverHookEndpointParams, RecoverWebhookEndpointParams, Reputation, ReputationCheck, ReputationCheckSeverity, ReputationResource, ReputationStatus, RequestOptions, RescheduleEmailParams, RiskAssessment, RiskAssessmentsResource, RiskCaptchaProvider, RiskCaptchaSignals, RiskDecision, RiskDegradedSignal, RiskEmailSignals, RiskEvent, RiskEventType, RiskFeedbackParams, RiskIpSignals, RiskList, RiskListEntry, RiskListEntryType, RiskListEntryValue, RiskListsResource, RiskLoginSignals, RiskOutcome, RiskReason, RiskReasonCode, RiskResource, RiskRule, RiskRuleCondition, RiskRuleField, RiskRulesResource, RiskSettings, RiskSettingsResource, RiskUsersResource, RiskWebhookEvent, RiskWebhookEventData, RollHookEndpointSecretParams, RollWebhookEndpointSecretParams, SendEmailParams, SendHookMessageParams, SendHookTestParams, Suppression, SuppressionCheck, SuppressionImport, SuppressionReason, SuppressionResource, TrackingDomain, TrackingDomainRecord, TrackingDomainStatus, TrackingDomainsResource, TrackingOptions, TrackingResource, TrackingRule, TrackingSettings, UpdateHookApplicationParams, UpdateHookEndpointParams, UpdateHookEventTypeParams, UpdateLogDrainParams, UpdateRiskRuleParams, UpdateRiskSettingsParams, UpdateTrackingRuleParams, UpdateWebhookEndpointParams, Usage, VerdictStatus, VerifyWebhookOptions, WebhookAttempt, WebhookDeliveriesResource, WebhookDelivery, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointDisabledReason, WebhookEndpointRecovery, WebhookEndpointWithSecret, WebhookEndpointsResource, WebhookEvent, WebhookEventType, WebhookHeaders };
3891
+ export type { AccountEventType, AccountWebhookEvent, AccountWebhookEventData, ApiKeyResource, ApiVersion, AssessRiskParams, AuditActorType, AuditEvent, AuditEventsResource, Billing, BillingCreditsResource, BillingEventType, BillingHoldReason, BillingInvoicesResource, BillingResource, BillingWebhookEvent, BimiIssueCode, BimiStatus, CheckRiskLimitParams, CheckSuppressionParams, CossError, CossErrorIssue, CossErrorType, CossOptions, CossResult, CreateDomainParams, CreateEmailTemplateParams, CreateHookApplicationParams, CreateHookEndpointParams, CreateHookEventTypeParams, CreateHookPortalSessionParams, CreateLogDrainParams, CreateReceivingDomainParams, CreateRiskLimitBucketParams, CreateRiskListEntryParams, CreateRiskRuleParams, CreateSuppressionParams, CreateTrackingDomainParams, CreateWebhookEndpointParams, CreateWebhookListenerParams, Credit, DedicatedIpPool, DedicatedIpPoolStatus, DedicatedIpsResource, DeletedApiKey, DeletedDomain, DeletedEmailTemplate, DeletedHookApplication, DeletedHookEndpoint, DeletedLogDrain, DeletedReceivedEmail, DeletedRiskLimitBucket, DeletedRiskListEntry, DeletedRiskRule, DeletedSuppression, DeletedTrackingRule, DeletedWebhookEndpoint, DeletedWebhookListener, DmarcCheck, DmarcCheckId, DmarcNextStep, DmarcNextStepKind, DmarcPolicy, DmarcPolicyPublished, DmarcPublishedRecord, DmarcReport, DmarcReportRecord, DmarcReportSummary, DmarcReportsResource, DmarcResource, DmarcSource, DmarcStage, Domain, DomainBimi, DomainDmarc, DomainEventType, DomainRecord, DomainRecordPurpose, DomainRecordStatus, DomainStatus, DomainWebhookEvent, DomainWebhookEventData, DomainsResource, Email, EmailAttachment, EmailAttachmentParams, EmailBatch, EmailEvent, EmailEventData, EmailEventType, EmailFailure, EmailLink, EmailRecipient, EmailRecipientStatus, EmailResource, EmailStatus, EmailSummary, EmailTag, EmailTemplate, EmailTemplateReference, EmailTemplateVersion, EmailTemplateVersionsResource, EmailTemplatesResource, EmailTracking, EmailWebhookEvent, EmailWebhookEventData, Environment, EnvironmentResource, ExportSuppressionsParams, FetchLike, ForgottenRiskUser, HookApplication, HookApplicationsResource, HookAttempt, HookDeliveriesResource, HookDelivery, HookDeliveryStatus, HookEndpoint, HookEndpointDisabledReason, HookEndpointRecovery, HookEndpointSecret, HookEndpointWebhookEvent, HookEndpointWebhookEventData, HookEndpointWithSecret, HookEndpointsResource, HookEventType, HookEventTypesResource, HookMessage, HookMessagesResource, HookOperationalEventType, HookPortalResource, HookPortalSession, HooksResource, ImportSuppressionEntry, ImportSuppressionsParams, InboundAddress, Invoice, InvoiceLine, InvoiceLineKind, InvoiceStatus, InvoiceSummary, List, ListAuditEventsParams, ListCreditsParams, ListDmarcReportsParams, ListEmailTemplateVersionsParams, ListEmailTemplatesParams, ListEmailsParams, ListHookApplicationsParams, ListHookDeliveriesParams, ListHookEventTypesParams, ListHookMessagesParams, ListInvoicesParams, ListLogDrainBatchesParams, ListLogsParams, ListReceivedEmailsParams, ListRiskAssessmentsParams, ListRiskListEntriesParams, ListSuppressionsParams, ListUsageParams, ListWebhookDeliveriesParams, Log, LogDrain, LogDrainAttempt, LogDrainBatch, LogDrainBatchStatus, LogDrainBatchesResource, LogDrainLine, LogDrainSource, LogDrainWithSecret, LogDrainsResource, LogLevel, LogSource, LogsResource, MailFromStatus, Meter, NamedResource, PlanKey, PollWebhookListenerParams, PublishEmailTemplateParams, ReactEmailElement, ReceivedEmail, ReceivedEmailAttachment, ReceivedEmailEventType, ReceivedEmailStatus, ReceivedEmailSummary, ReceivedEmailVerdicts, ReceivedEmailWebhookEvent, ReceivedEmailWebhookEventData, ReceivedEmailsResource, ReceivingDomain, ReceivingDomainRecord, ReceivingDomainsResource, RecoverHookEndpointParams, RecoverWebhookEndpointParams, Reputation, ReputationCheck, ReputationCheckSeverity, ReputationResource, ReputationStatus, RequestOptions, RescheduleEmailParams, RiskAssessment, RiskAssessmentsResource, RiskCalibration, RiskCaptchaProvider, RiskCaptchaSignals, RiskCardFunding, RiskCheckoutSignals, RiskContentCategory, RiskContentClassification, RiskContentScores, RiskDecision, RiskDegradedSignal, RiskDeviceSignals, RiskEmailCheck, RiskEmailSignals, RiskEvent, RiskEventType, RiskFeedbackParams, RiskIpCheck, RiskIpPrivacy, RiskIpSignals, RiskLimit, RiskLimitBucket, RiskLimitBucketsResource, RiskLimitFailureMode, RiskList, RiskListEntry, RiskListEntryType, RiskListEntryValue, RiskListsResource, RiskLoginSignals, RiskOutcome, RiskReason, RiskReasonCode, RiskResource, RiskRule, RiskRuleCondition, RiskRuleField, RiskRulesResource, RiskSettings, RiskSettingsResource, RiskUsersResource, RiskWebhookEvent, RiskWebhookEventData, RollHookEndpointSecretParams, RollWebhookEndpointSecretParams, SendEmailBaseParams, SendEmailContentParams, SendEmailParams, SendEmailTemplateParams, SendHookMessageParams, SendHookTestParams, Suppression, SuppressionCheck, SuppressionImport, SuppressionReason, SuppressionResource, TemplateContent, TemplateContentParams, TemplateProblem, TemplateScalarType, TemplateVariable, TemplateVariableParams, TemplateVariableType, TrackingDomain, TrackingDomainRecord, TrackingDomainStatus, TrackingDomainsResource, TrackingOptions, TrackingResource, TrackingRule, TrackingSettings, UpdateEmailTemplateDraftParams, UpdateEmailTemplateParams, UpdateHookApplicationParams, UpdateHookEndpointParams, UpdateHookEventTypeParams, UpdateLogDrainParams, UpdateRiskLimitBucketParams, UpdateRiskRuleParams, UpdateRiskSettingsParams, UpdateTrackingRuleParams, UpdateWebhookEndpointParams, Usage, VerdictStatus, VerifyWebhookOptions, WebhookAttempt, WebhookDeliveriesResource, WebhookDelivery, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointDisabledReason, WebhookEndpointRecovery, WebhookEndpointWithSecret, WebhookEndpointsResource, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookListener, WebhookListenerAck, WebhookListenerDelivery, WebhookListenerPoll, WebhookListenersResource };