samva 0.13.0 → 0.15.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/AGENTS.md +9 -0
- package/README.md +55 -6
- package/dist/{categories-Bcwq5jPV.js → categories-BGUBFdH9.js} +9 -1
- package/dist/client/sdk.gen.d.ts +129 -27
- package/dist/client/types.gen.d.ts +920 -166
- package/dist/{client-DYPNDvVU.js → client-CDg7zJs0.js} +760 -147
- package/dist/effect/analytics.d.ts +6 -6
- package/dist/effect/analytics.js +1 -1
- package/dist/effect/api-keys.d.ts +20 -20
- package/dist/effect/api-keys.js +1 -1
- package/dist/effect/attachments.js +1 -1
- package/dist/effect/brands.js +2 -2
- package/dist/effect/campaigns.d.ts +12 -12
- package/dist/effect/campaigns.js +1 -1
- package/dist/effect/categories.js +1 -1
- package/dist/effect/client.js +1 -1
- package/dist/effect/contact-groups.d.ts +9 -9
- package/dist/effect/contact-groups.js +1 -1
- package/dist/effect/contacts.d.ts +126 -73
- package/dist/effect/contacts.js +1 -1
- package/dist/effect/conversations.d.ts +20 -20
- package/dist/effect/conversations.js +1 -1
- package/dist/effect/custom-fields.d.ts +1 -1
- package/dist/effect/custom-fields.js +1 -1
- package/dist/effect/email.d.ts +26 -26
- package/dist/effect/email.js +2 -2
- package/dist/effect/extension-installations.d.ts +3 -3
- package/dist/effect/extension-installations.js +1 -1
- package/dist/effect/extensions.d.ts +3 -3
- package/dist/effect/extensions.js +1 -1
- package/dist/effect/feedback.d.ts +1 -1
- package/dist/effect/feedback.js +2 -2
- package/dist/effect/generated-metadata.d.ts +8 -0
- package/dist/effect/generated.d.ts +6335 -1112
- package/dist/effect/index.d.ts +2 -1
- package/dist/effect/index.js +6 -5
- package/dist/effect/internal/client.d.ts +2 -2
- package/dist/effect/internal/operation.d.ts +9 -9
- package/dist/effect/mailboxes.d.ts +1775 -109
- package/dist/effect/mailboxes.js +3 -3
- package/dist/effect/media.d.ts +1 -1
- package/dist/effect/media.js +1 -1
- package/dist/effect/messages.d.ts +19 -17
- package/dist/effect/messages.js +1 -1
- package/dist/effect/namespaces.js +1 -1
- package/dist/effect/operations.d.ts +6 -6
- package/dist/effect/operations.js +1 -1
- package/dist/effect/organizations.d.ts +30 -0
- package/dist/effect/organizations.js +4 -2
- package/dist/effect/retry.js +1 -1
- package/dist/effect/scheduled-messages.d.ts +6 -6
- package/dist/effect/scheduled-messages.js +1 -1
- package/dist/effect/subscriptions.d.ts +15 -0
- package/dist/effect/subscriptions.js +9 -0
- package/dist/effect/templates.d.ts +52 -14
- package/dist/effect/templates.js +5 -3
- package/dist/effect/unsubscribe-groups.d.ts +1 -1
- package/dist/effect/unsubscribe-groups.js +1 -1
- package/dist/effect/webhooks.d.ts +15 -15
- package/dist/effect/webhooks.js +2 -2
- package/dist/index.js +4 -4
- package/dist/{inline-attachments-B56eS0MF.js → inline-attachments-UxLeyytJ.js} +2 -2
- package/dist/{mailbox-events-CsbF35vH.js → mailbox-events-VKR4f3qq.js} +6 -4
- package/dist/mailbox-events.d.ts +1 -1
- package/dist/{mailboxes-D3Kx7elM.js → mailboxes-BH_JPmOE.js} +17 -5
- package/dist/{operation-B_Ty1LG-.js → operation-BZ5Xov-x.js} +37 -3
- package/dist/promises/errors.gen.d.ts +26 -2
- package/dist/promises/index.d.ts +6 -4
- package/dist/promises/index.js +4 -4
- package/dist/promises/types.gen.d.ts +1 -1
- package/dist/{promises-D9FJyU0q.js → promises-Cd6Jamqk.js} +1004 -47
- package/dist/service-map.d.ts +45 -0
- package/package.json +7 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as withUploadedAttachments, n as mediaCreateBody, o as CLIENT_ATTRIBUTION_HEADER, r as planInlineUploads, s as clientAttribution, t as MediaUploadError } from "./inline-attachments-
|
|
2
|
-
import { t as MailboxEventStream } from "./mailbox-events-
|
|
1
|
+
import { a as withUploadedAttachments, n as mediaCreateBody, o as CLIENT_ATTRIBUTION_HEADER, r as planInlineUploads, s as clientAttribution, t as MediaUploadError } from "./inline-attachments-UxLeyytJ.js";
|
|
2
|
+
import { t as MailboxEventStream } from "./mailbox-events-VKR4f3qq.js";
|
|
3
3
|
import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-B79uJIeb.js";
|
|
4
4
|
//#region src/client/core/bodySerializer.gen.ts
|
|
5
5
|
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
@@ -4098,7 +4098,7 @@ var Contacts = class {
|
|
|
4098
4098
|
/**
|
|
4099
4099
|
* List contacts
|
|
4100
4100
|
*
|
|
4101
|
-
* Returns contact summaries for the organization, newest first, filterable by search term, status, and creation time (`after`, `before`). Pass `nextCursor` back as `cursor` for the next page; it is null on the last page. Read
|
|
4101
|
+
* Returns contact summaries for the organization, newest first, filterable by search term, status, and creation time (`after`, `before`). `fields` is a comma-separated list of defined custom field keys to return in each summary's `customFields`; omitted keys and unselected fields are not returned. Filter by one defined custom field with `customField` and a JSON-encoded scalar `customFieldValue` (for example, `"creator"`, `42`, or `true`). Both filter parameters are required together, and unknown keys or values of the wrong type are rejected. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page. Read full identities, profile, and metadata with `GET /v1/contacts/{id}`.
|
|
4102
4102
|
*/
|
|
4103
4103
|
static list(parameters, options) {
|
|
4104
4104
|
const params = buildClientParams([parameters], [{ args: [
|
|
@@ -4118,6 +4118,18 @@ var Contacts = class {
|
|
|
4118
4118
|
in: "query",
|
|
4119
4119
|
key: "status"
|
|
4120
4120
|
},
|
|
4121
|
+
{
|
|
4122
|
+
in: "query",
|
|
4123
|
+
key: "fields"
|
|
4124
|
+
},
|
|
4125
|
+
{
|
|
4126
|
+
in: "query",
|
|
4127
|
+
key: "customField"
|
|
4128
|
+
},
|
|
4129
|
+
{
|
|
4130
|
+
in: "query",
|
|
4131
|
+
key: "customFieldValue"
|
|
4132
|
+
},
|
|
4121
4133
|
{
|
|
4122
4134
|
in: "query",
|
|
4123
4135
|
key: "after"
|
|
@@ -4242,31 +4254,16 @@ var Contacts = class {
|
|
|
4242
4254
|
/**
|
|
4243
4255
|
* Find or create a contact
|
|
4244
4256
|
*
|
|
4245
|
-
* Returns
|
|
4257
|
+
* Looks up exactly one identifier through `lookup: { type, value }`. Returns `{ contact, created: false }` unchanged when it exists. Otherwise creates the lookup identity (or external ID), applies `create` attributes, and returns `{ contact, created: true }`. Additional addresses belong in `create.identities`, custom fields in `create.profile.customFields`; custom field keys must be defined and values must match their types. An external ID lookup cannot be contradicted by `create.externalId`. Creation returns HTTP 409 ConflictError if an externalId or address belongs to another contact; the conflicting field is named and no contact is created. Use the update endpoint to change an existing contact.
|
|
4246
4258
|
*/
|
|
4247
4259
|
static findOrCreate(parameters, options) {
|
|
4248
|
-
const params = buildClientParams([parameters], [{ args: [
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
key: "phone"
|
|
4256
|
-
},
|
|
4257
|
-
{
|
|
4258
|
-
in: "body",
|
|
4259
|
-
key: "externalId"
|
|
4260
|
-
},
|
|
4261
|
-
{
|
|
4262
|
-
in: "body",
|
|
4263
|
-
key: "name"
|
|
4264
|
-
},
|
|
4265
|
-
{
|
|
4266
|
-
in: "body",
|
|
4267
|
-
key: "displayName"
|
|
4268
|
-
}
|
|
4269
|
-
] }]);
|
|
4260
|
+
const params = buildClientParams([parameters], [{ args: [{
|
|
4261
|
+
in: "body",
|
|
4262
|
+
key: "lookup"
|
|
4263
|
+
}, {
|
|
4264
|
+
in: "body",
|
|
4265
|
+
key: "create"
|
|
4266
|
+
}] }]);
|
|
4270
4267
|
return (options?.client ?? client).post({
|
|
4271
4268
|
security: [{
|
|
4272
4269
|
name: "x-api-key",
|
|
@@ -4743,6 +4740,59 @@ var Contacts = class {
|
|
|
4743
4740
|
});
|
|
4744
4741
|
}
|
|
4745
4742
|
};
|
|
4743
|
+
var Subscriptions = class {
|
|
4744
|
+
/**
|
|
4745
|
+
* Request subscription confirmation
|
|
4746
|
+
*
|
|
4747
|
+
* Sends a confirmation email from your sender. Only the recipient's explicit confirmation adds them to the active static contact group and clears the optional unsubscribe group. The link expires after seven days and can be used once. A custom published email template receives confirmUrl. Sending follows ordinary sender, admission, billing, and brand-footer settings. Requires email send authority in addition to the declared contact grants, including the optional unsubscribe preference change.
|
|
4748
|
+
*/
|
|
4749
|
+
static subscribe(parameters, options) {
|
|
4750
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
4751
|
+
{
|
|
4752
|
+
in: "body",
|
|
4753
|
+
key: "email"
|
|
4754
|
+
},
|
|
4755
|
+
{
|
|
4756
|
+
in: "body",
|
|
4757
|
+
key: "contactGroupId"
|
|
4758
|
+
},
|
|
4759
|
+
{
|
|
4760
|
+
in: "body",
|
|
4761
|
+
key: "from"
|
|
4762
|
+
},
|
|
4763
|
+
{
|
|
4764
|
+
in: "body",
|
|
4765
|
+
key: "unsubscribeGroupId"
|
|
4766
|
+
},
|
|
4767
|
+
{
|
|
4768
|
+
in: "body",
|
|
4769
|
+
key: "templateSlug"
|
|
4770
|
+
},
|
|
4771
|
+
{
|
|
4772
|
+
in: "body",
|
|
4773
|
+
key: "consentIp"
|
|
4774
|
+
},
|
|
4775
|
+
{
|
|
4776
|
+
in: "body",
|
|
4777
|
+
key: "consentSource"
|
|
4778
|
+
}
|
|
4779
|
+
] }]);
|
|
4780
|
+
return (options?.client ?? client).post({
|
|
4781
|
+
security: [{
|
|
4782
|
+
name: "x-api-key",
|
|
4783
|
+
type: "apiKey"
|
|
4784
|
+
}],
|
|
4785
|
+
url: "/v1/subscriptions",
|
|
4786
|
+
...options,
|
|
4787
|
+
...params,
|
|
4788
|
+
headers: {
|
|
4789
|
+
"Content-Type": "application/json",
|
|
4790
|
+
...options?.headers,
|
|
4791
|
+
...params.headers
|
|
4792
|
+
}
|
|
4793
|
+
});
|
|
4794
|
+
}
|
|
4795
|
+
};
|
|
4746
4796
|
var ContactGroups = class {
|
|
4747
4797
|
/**
|
|
4748
4798
|
* List contact groups
|
|
@@ -6454,6 +6504,49 @@ var Templates = class {
|
|
|
6454
6504
|
});
|
|
6455
6505
|
}
|
|
6456
6506
|
/**
|
|
6507
|
+
* Render a template publication
|
|
6508
|
+
*
|
|
6509
|
+
* Renders one immutable publication against the `data` you pass, formatted in the `locale` and `timeZone` you name as a send formats them, and returns the subject, preheader, HTML and plain text a send would produce. `data` is validated against the publication's input schema exactly as a send validates it; invalid input returns a validation error that names each failing field. Nothing is sent or stored. Unpublished workspace edits are never rendered: only a publication id renders.
|
|
6510
|
+
*/
|
|
6511
|
+
static renderPublication(parameters, options) {
|
|
6512
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
6513
|
+
{
|
|
6514
|
+
in: "path",
|
|
6515
|
+
key: "id"
|
|
6516
|
+
},
|
|
6517
|
+
{
|
|
6518
|
+
in: "path",
|
|
6519
|
+
key: "publicationId"
|
|
6520
|
+
},
|
|
6521
|
+
{
|
|
6522
|
+
in: "body",
|
|
6523
|
+
key: "data"
|
|
6524
|
+
},
|
|
6525
|
+
{
|
|
6526
|
+
in: "body",
|
|
6527
|
+
key: "locale"
|
|
6528
|
+
},
|
|
6529
|
+
{
|
|
6530
|
+
in: "body",
|
|
6531
|
+
key: "timeZone"
|
|
6532
|
+
}
|
|
6533
|
+
] }]);
|
|
6534
|
+
return (options?.client ?? client).post({
|
|
6535
|
+
security: [{
|
|
6536
|
+
name: "x-api-key",
|
|
6537
|
+
type: "apiKey"
|
|
6538
|
+
}],
|
|
6539
|
+
url: "/v1/templates/{id}/publications/{publicationId}/render",
|
|
6540
|
+
...options,
|
|
6541
|
+
...params,
|
|
6542
|
+
headers: {
|
|
6543
|
+
"Content-Type": "application/json",
|
|
6544
|
+
...options?.headers,
|
|
6545
|
+
...params.headers
|
|
6546
|
+
}
|
|
6547
|
+
});
|
|
6548
|
+
}
|
|
6549
|
+
/**
|
|
6457
6550
|
* List a template's input contracts
|
|
6458
6551
|
*
|
|
6459
6552
|
* Returns the immutable input contracts this template has published under, newest version first. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page. Send against a contract to follow later publications that validate input identically.
|
|
@@ -6842,7 +6935,7 @@ var Webhooks = class {
|
|
|
6842
6935
|
/**
|
|
6843
6936
|
* Create a webhook
|
|
6844
6937
|
*
|
|
6845
|
-
* Creates a signed webhook endpoint for Samva delivery and inbound events, stores subscriptions, and returns the endpoint and signing secret with a 201 response.
|
|
6938
|
+
* Creates a signed webhook endpoint for Samva delivery and inbound events, stores subscriptions, and returns the endpoint and signing secret with a 201 response. `mailboxIds` and `namespaceId` confine mailbox events; when both are set, every mailbox must belong to the namespace.
|
|
6846
6939
|
*/
|
|
6847
6940
|
static create(parameters, options) {
|
|
6848
6941
|
const params = buildClientParams([parameters], [{ args: [
|
|
@@ -6937,7 +7030,7 @@ var Webhooks = class {
|
|
|
6937
7030
|
/**
|
|
6938
7031
|
* Update a webhook
|
|
6939
7032
|
*
|
|
6940
|
-
* Updates a webhook's name, URL, subscribed events, channels, custom headers, or status and returns the updated endpoint.
|
|
7033
|
+
* Updates a webhook's name, URL, subscribed events, channels, custom headers, mailbox scope, or status and returns the updated endpoint. A change to `mailboxIds` or `namespaceId` is checked as the endpoint will stand afterward: every mailbox must belong to the namespace when both are set.
|
|
6941
7034
|
*/
|
|
6942
7035
|
static update(parameters, options) {
|
|
6943
7036
|
const params = buildClientParams([parameters], [{ args: [
|
|
@@ -7237,6 +7330,21 @@ var Organizations = class {
|
|
|
7237
7330
|
});
|
|
7238
7331
|
}
|
|
7239
7332
|
/**
|
|
7333
|
+
* Get organization trust tier and sending limits
|
|
7334
|
+
*
|
|
7335
|
+
* Returns the current trust tier, plan and probation sending limits, and measured probation graduation progress. Limits are additional to billing allowance, domain readiness, and enforcement. Graduation is evaluated on delivery events.
|
|
7336
|
+
*/
|
|
7337
|
+
static getTrustTier(options) {
|
|
7338
|
+
return (options?.client ?? client).get({
|
|
7339
|
+
security: [{
|
|
7340
|
+
name: "x-api-key",
|
|
7341
|
+
type: "apiKey"
|
|
7342
|
+
}],
|
|
7343
|
+
url: "/v1/organizations/trust-tier",
|
|
7344
|
+
...options
|
|
7345
|
+
});
|
|
7346
|
+
}
|
|
7347
|
+
/**
|
|
7240
7348
|
* Get organization usage
|
|
7241
7349
|
*
|
|
7242
7350
|
* Returns usage statistics for the current organization between `after` and `before`, which default to the current calendar month so far. `usage.periodStart` and `usage.periodEnd` echo the window counted.
|
|
@@ -7597,7 +7705,7 @@ var Mailboxes = class {
|
|
|
7597
7705
|
/**
|
|
7598
7706
|
* Create a mailbox
|
|
7599
7707
|
*
|
|
7600
|
-
* Creates a mailbox with
|
|
7708
|
+
* Creates a mailbox with one address and returns it with status 201; the caller gets an admin grant on it. The address must be under the organization's Samva-hosted mail domain or a verified domain with receiving enabled, and the mailbox sends from it. The slug defaults to the address's local part. Pass `slug` when that is taken or not a valid slug. The mailbox receives mail from now on; mail that arrived earlier is not added to it. Conflicts if the address or slug is already in use. Returns 402 when the organization is at its plan's mailbox allowance or at its mailbox storage allowance; incoming mail is still received past the storage allowance.
|
|
7601
7709
|
*/
|
|
7602
7710
|
static create(parameters, options) {
|
|
7603
7711
|
const params = buildClientParams([parameters], [{ args: [
|
|
@@ -7607,19 +7715,15 @@ var Mailboxes = class {
|
|
|
7607
7715
|
},
|
|
7608
7716
|
{
|
|
7609
7717
|
in: "body",
|
|
7610
|
-
key: "
|
|
7611
|
-
},
|
|
7612
|
-
{
|
|
7613
|
-
in: "body",
|
|
7614
|
-
key: "slug"
|
|
7718
|
+
key: "address"
|
|
7615
7719
|
},
|
|
7616
7720
|
{
|
|
7617
7721
|
in: "body",
|
|
7618
|
-
key: "
|
|
7722
|
+
key: "name"
|
|
7619
7723
|
},
|
|
7620
7724
|
{
|
|
7621
7725
|
in: "body",
|
|
7622
|
-
key: "
|
|
7726
|
+
key: "slug"
|
|
7623
7727
|
},
|
|
7624
7728
|
{
|
|
7625
7729
|
in: "body",
|
|
@@ -7694,7 +7798,7 @@ var Mailboxes = class {
|
|
|
7694
7798
|
},
|
|
7695
7799
|
{
|
|
7696
7800
|
in: "body",
|
|
7697
|
-
key: "
|
|
7801
|
+
key: "name"
|
|
7698
7802
|
},
|
|
7699
7803
|
{
|
|
7700
7804
|
in: "body",
|
|
@@ -7721,6 +7825,64 @@ var Mailboxes = class {
|
|
|
7721
7825
|
});
|
|
7722
7826
|
}
|
|
7723
7827
|
/**
|
|
7828
|
+
* Add an address to a mailbox
|
|
7829
|
+
*
|
|
7830
|
+
* Adds an address to a mailbox and returns the mailbox with status 201. The address follows the same rules as the address of a new mailbox: it must be under the organization's Samva-hosted mail domain or a verified domain with receiving enabled, and no mailbox may already hold it (409). Mail sent to it reaches the mailbox from now on; the mailbox keeps sending from its current default address until you change `defaultFrom`.
|
|
7831
|
+
*/
|
|
7832
|
+
static createAddress(parameters, options) {
|
|
7833
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
7834
|
+
{
|
|
7835
|
+
in: "path",
|
|
7836
|
+
key: "id"
|
|
7837
|
+
},
|
|
7838
|
+
{
|
|
7839
|
+
in: "body",
|
|
7840
|
+
key: "address"
|
|
7841
|
+
},
|
|
7842
|
+
{
|
|
7843
|
+
in: "body",
|
|
7844
|
+
key: "displayName"
|
|
7845
|
+
}
|
|
7846
|
+
] }]);
|
|
7847
|
+
return (options?.client ?? client).post({
|
|
7848
|
+
security: [{
|
|
7849
|
+
name: "x-api-key",
|
|
7850
|
+
type: "apiKey"
|
|
7851
|
+
}],
|
|
7852
|
+
url: "/v1/mailboxes/{id}/addresses",
|
|
7853
|
+
...options,
|
|
7854
|
+
...params,
|
|
7855
|
+
headers: {
|
|
7856
|
+
"Content-Type": "application/json",
|
|
7857
|
+
...options?.headers,
|
|
7858
|
+
...params.headers
|
|
7859
|
+
}
|
|
7860
|
+
});
|
|
7861
|
+
}
|
|
7862
|
+
/**
|
|
7863
|
+
* Remove an address from a mailbox
|
|
7864
|
+
*
|
|
7865
|
+
* Removes an address from a mailbox and returns the mailbox. Mail sent to the address stops reaching the mailbox; its existing threads and messages stay. A mailbox keeps at least one address, so removing the last one is refused (422). When the removed address was the default `From`, the mailbox sends from its oldest remaining address, without a sender name of its own.
|
|
7866
|
+
*/
|
|
7867
|
+
static removeAddress(parameters, options) {
|
|
7868
|
+
const params = buildClientParams([parameters], [{ args: [{
|
|
7869
|
+
in: "path",
|
|
7870
|
+
key: "id"
|
|
7871
|
+
}, {
|
|
7872
|
+
in: "path",
|
|
7873
|
+
key: "addressId"
|
|
7874
|
+
}] }]);
|
|
7875
|
+
return (options?.client ?? client).delete({
|
|
7876
|
+
security: [{
|
|
7877
|
+
name: "x-api-key",
|
|
7878
|
+
type: "apiKey"
|
|
7879
|
+
}],
|
|
7880
|
+
url: "/v1/mailboxes/{id}/addresses/{addressId}",
|
|
7881
|
+
...options,
|
|
7882
|
+
...params
|
|
7883
|
+
});
|
|
7884
|
+
}
|
|
7885
|
+
/**
|
|
7724
7886
|
* Pause a mailbox
|
|
7725
7887
|
*
|
|
7726
7888
|
* Stops the mailbox sending and stops new inbound mail reaching it. Mail that arrives while it is paused is not added when it resumes. Resume it with `POST /v1/mailboxes/{id}/resume`.
|
|
@@ -8649,7 +8811,7 @@ var Mailboxes = class {
|
|
|
8649
8811
|
/**
|
|
8650
8812
|
* Send a new message
|
|
8651
8813
|
*
|
|
8652
|
-
*
|
|
8814
|
+
* Records a send action and returns 202 with its current receipt and a Location for action status. An installation, grant, or policy may require approval; otherwise the send is queued. Observe the same action through acceptance and mailbox completion. A policy refusal returns 403 with the recorded receipt.
|
|
8653
8815
|
*/
|
|
8654
8816
|
static sendMessage(parameters, options) {
|
|
8655
8817
|
const params = buildClientParams([parameters], [{ args: [
|
|
@@ -8786,6 +8948,36 @@ var Mailboxes = class {
|
|
|
8786
8948
|
});
|
|
8787
8949
|
}
|
|
8788
8950
|
/**
|
|
8951
|
+
* Copy a message attachment
|
|
8952
|
+
*
|
|
8953
|
+
* Copies one of a received message's attachments into the organization's media and returns it as a draft attachment (`mediaId`), so a draft can carry it. A draft that forwards a message saves each original attachment this way.
|
|
8954
|
+
*/
|
|
8955
|
+
static copyMessageAttachment(parameters, options) {
|
|
8956
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
8957
|
+
{
|
|
8958
|
+
in: "path",
|
|
8959
|
+
key: "id"
|
|
8960
|
+
},
|
|
8961
|
+
{
|
|
8962
|
+
in: "path",
|
|
8963
|
+
key: "messageId"
|
|
8964
|
+
},
|
|
8965
|
+
{
|
|
8966
|
+
in: "path",
|
|
8967
|
+
key: "attachmentId"
|
|
8968
|
+
}
|
|
8969
|
+
] }]);
|
|
8970
|
+
return (options?.client ?? client).post({
|
|
8971
|
+
security: [{
|
|
8972
|
+
name: "x-api-key",
|
|
8973
|
+
type: "apiKey"
|
|
8974
|
+
}],
|
|
8975
|
+
url: "/v1/mailboxes/{id}/messages/{messageId}/attachments/{attachmentId}/copy",
|
|
8976
|
+
...options,
|
|
8977
|
+
...params
|
|
8978
|
+
});
|
|
8979
|
+
}
|
|
8980
|
+
/**
|
|
8789
8981
|
* Reply to a message
|
|
8790
8982
|
*
|
|
8791
8983
|
* Replies to the message's Reply-To address, or its sender, in the same thread. The server sets the recipients, subject, and threading headers.
|
|
@@ -9277,7 +9469,7 @@ var Mailboxes = class {
|
|
|
9277
9469
|
/**
|
|
9278
9470
|
* List mailbox actions
|
|
9279
9471
|
*
|
|
9280
|
-
* Returns the actions proposed on a mailbox, newest first, filterable by `state` (`approvalRequired` lists the sends waiting for a person) and creation time (`after`, `before`). Pass `nextCursor` back as `cursor` for the next page; it is null on the last page.
|
|
9472
|
+
* Returns the actions proposed on a mailbox, newest first, filterable by `threadId`, `state` (`approvalRequired` lists the sends waiting for a person), and creation time (`after`, `before`). Filters apply together within the mailbox. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page.
|
|
9281
9473
|
*/
|
|
9282
9474
|
static listActions(parameters, options) {
|
|
9283
9475
|
const params = buildClientParams([parameters], [{ args: [
|
|
@@ -9293,6 +9485,10 @@ var Mailboxes = class {
|
|
|
9293
9485
|
in: "query",
|
|
9294
9486
|
key: "cursor"
|
|
9295
9487
|
},
|
|
9488
|
+
{
|
|
9489
|
+
in: "query",
|
|
9490
|
+
key: "threadId"
|
|
9491
|
+
},
|
|
9296
9492
|
{
|
|
9297
9493
|
in: "query",
|
|
9298
9494
|
key: "state"
|
|
@@ -9317,9 +9513,78 @@ var Mailboxes = class {
|
|
|
9317
9513
|
});
|
|
9318
9514
|
}
|
|
9319
9515
|
/**
|
|
9516
|
+
* Get a mailbox action
|
|
9517
|
+
*
|
|
9518
|
+
* Returns one action with its current progress. Send actions expose their immutable approved content, deadline, problem, and accepted receipt. A caller with mailbox read access may inspect actions; send-only callers may inspect only their own proposals. Acceptance and mailbox completion do not mean recipient delivery.
|
|
9519
|
+
*/
|
|
9520
|
+
static getAction(parameters, options) {
|
|
9521
|
+
const params = buildClientParams([parameters], [{ args: [{
|
|
9522
|
+
in: "path",
|
|
9523
|
+
key: "id"
|
|
9524
|
+
}, {
|
|
9525
|
+
in: "path",
|
|
9526
|
+
key: "actionId"
|
|
9527
|
+
}] }]);
|
|
9528
|
+
return (options?.client ?? client).get({
|
|
9529
|
+
security: [{
|
|
9530
|
+
name: "x-api-key",
|
|
9531
|
+
type: "apiKey"
|
|
9532
|
+
}],
|
|
9533
|
+
url: "/v1/mailboxes/{id}/actions/{actionId}",
|
|
9534
|
+
...options,
|
|
9535
|
+
...params
|
|
9536
|
+
});
|
|
9537
|
+
}
|
|
9538
|
+
/**
|
|
9539
|
+
* Cancel a mailbox send
|
|
9540
|
+
*
|
|
9541
|
+
* Cancels a definitely unsent action and reopens its draft atomically. Only an authorized person who proposed the send or can approve actions may cancel. Accepted sends return 409 with their winning receipt and cannot be withdrawn. An uncertain send requires reconciliation and cannot be cancelled as unsent.
|
|
9542
|
+
*/
|
|
9543
|
+
static cancelAction(parameters, options) {
|
|
9544
|
+
const params = buildClientParams([parameters], [{ args: [{
|
|
9545
|
+
in: "path",
|
|
9546
|
+
key: "id"
|
|
9547
|
+
}, {
|
|
9548
|
+
in: "path",
|
|
9549
|
+
key: "actionId"
|
|
9550
|
+
}] }]);
|
|
9551
|
+
return (options?.client ?? client).post({
|
|
9552
|
+
security: [{
|
|
9553
|
+
name: "x-api-key",
|
|
9554
|
+
type: "apiKey"
|
|
9555
|
+
}],
|
|
9556
|
+
url: "/v1/mailboxes/{id}/actions/{actionId}/cancel",
|
|
9557
|
+
...options,
|
|
9558
|
+
...params
|
|
9559
|
+
});
|
|
9560
|
+
}
|
|
9561
|
+
/**
|
|
9562
|
+
* Resume a mailbox send
|
|
9563
|
+
*
|
|
9564
|
+
* Resumes the same action only after its previous execution is confirmed ended and safe continuation is possible. Only an authorized person who proposed the send or can approve actions may retry. Automatic waits need no manual Retry. This does not grant new approval, reset the original deadline, replace the message identity, or resubmit an accepted or uncertain send.
|
|
9565
|
+
*/
|
|
9566
|
+
static retryAction(parameters, options) {
|
|
9567
|
+
const params = buildClientParams([parameters], [{ args: [{
|
|
9568
|
+
in: "path",
|
|
9569
|
+
key: "id"
|
|
9570
|
+
}, {
|
|
9571
|
+
in: "path",
|
|
9572
|
+
key: "actionId"
|
|
9573
|
+
}] }]);
|
|
9574
|
+
return (options?.client ?? client).post({
|
|
9575
|
+
security: [{
|
|
9576
|
+
name: "x-api-key",
|
|
9577
|
+
type: "apiKey"
|
|
9578
|
+
}],
|
|
9579
|
+
url: "/v1/mailboxes/{id}/actions/{actionId}/retry",
|
|
9580
|
+
...options,
|
|
9581
|
+
...params
|
|
9582
|
+
});
|
|
9583
|
+
}
|
|
9584
|
+
/**
|
|
9320
9585
|
* Approve a mailbox action
|
|
9321
9586
|
*
|
|
9322
|
-
*
|
|
9587
|
+
* Records approval of a send and returns 202 while it is pending. A send is queued for automatic retry within 15 minutes of approval; repeating approval does not extend this deadline. Accepted, completed, and notSent replays return 200. No expiry applies before approval. Only a person signed in or through OAuth may approve, and never the proposer. Non-send approvals execute synchronously and return 200 with their own execution states.
|
|
9323
9588
|
*/
|
|
9324
9589
|
static approveAction(parameters, options) {
|
|
9325
9590
|
const params = buildClientParams([parameters], [{ args: [{
|
|
@@ -9377,7 +9642,7 @@ var Mailboxes = class {
|
|
|
9377
9642
|
/**
|
|
9378
9643
|
* List mailbox events
|
|
9379
9644
|
*
|
|
9380
|
-
* Returns
|
|
9645
|
+
* Returns mailbox audit records, newest first, filterable by when they happened (`after`, `before`). Audit event types: `mailbox.created`, `address.attached`, `address.detached`, `email.received`, `email.released`, `email.sent`, `thread.created`, `action.proposed`, `action.policy_decided`, `action.approval_requested`, `action.approval_resolved`, `action.accepted`, `action.executed`, `action.failed`. Thread and draft changes have no dedicated audit event types. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page.
|
|
9381
9646
|
*/
|
|
9382
9647
|
static listEvents(parameters, options) {
|
|
9383
9648
|
const params = buildClientParams([parameters], [{ args: [
|
|
@@ -10058,6 +10323,20 @@ var InternalError = class extends SamvaApiError {
|
|
|
10058
10323
|
Object.assign(this, payload);
|
|
10059
10324
|
}
|
|
10060
10325
|
};
|
|
10326
|
+
var MailboxSendConflictError = class extends SamvaApiError {
|
|
10327
|
+
_tag = "MailboxSendConflictError";
|
|
10328
|
+
constructor(payload, context = {}) {
|
|
10329
|
+
super(messageOf("MailboxSendConflictError", payload), context);
|
|
10330
|
+
Object.assign(this, payload);
|
|
10331
|
+
}
|
|
10332
|
+
};
|
|
10333
|
+
var MailboxSendRefusedError = class extends SamvaApiError {
|
|
10334
|
+
_tag = "MailboxSendRefusedError";
|
|
10335
|
+
constructor(payload, context = {}) {
|
|
10336
|
+
super(messageOf("MailboxSendRefusedError", payload), context);
|
|
10337
|
+
Object.assign(this, payload);
|
|
10338
|
+
}
|
|
10339
|
+
};
|
|
10061
10340
|
var OnboardingReviewRequiredError = class extends SamvaApiError {
|
|
10062
10341
|
_tag = "OnboardingReviewRequiredError";
|
|
10063
10342
|
constructor(payload, context = {}) {
|
|
@@ -10120,6 +10399,8 @@ const constructors = {
|
|
|
10120
10399
|
ForbiddenError,
|
|
10121
10400
|
GatewayTimeoutError,
|
|
10122
10401
|
InternalError,
|
|
10402
|
+
MailboxSendConflictError,
|
|
10403
|
+
MailboxSendRefusedError,
|
|
10123
10404
|
OnboardingReviewRequiredError,
|
|
10124
10405
|
PaymentRequiredError,
|
|
10125
10406
|
RateLimitedError,
|
|
@@ -10328,6 +10609,680 @@ const payloadSchemas = {
|
|
|
10328
10609
|
"x-category": ["transient"],
|
|
10329
10610
|
"x-retryable": true
|
|
10330
10611
|
},
|
|
10612
|
+
MailboxSendConflictError: {
|
|
10613
|
+
type: "object",
|
|
10614
|
+
properties: {
|
|
10615
|
+
_tag: {
|
|
10616
|
+
type: "string",
|
|
10617
|
+
enum: ["MailboxSendConflictError"]
|
|
10618
|
+
},
|
|
10619
|
+
message: { type: "string" },
|
|
10620
|
+
resource: { type: "string" },
|
|
10621
|
+
id: {
|
|
10622
|
+
type: "string",
|
|
10623
|
+
pattern: "^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10624
|
+
"x-samva-brand": "MailboxActionId"
|
|
10625
|
+
},
|
|
10626
|
+
receipt: {
|
|
10627
|
+
type: "object",
|
|
10628
|
+
properties: {
|
|
10629
|
+
actionId: {
|
|
10630
|
+
type: "string",
|
|
10631
|
+
pattern: "^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10632
|
+
"x-samva-brand": "MailboxActionId"
|
|
10633
|
+
},
|
|
10634
|
+
draftId: { anyOf: [{
|
|
10635
|
+
type: "string",
|
|
10636
|
+
pattern: "^mdraft_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10637
|
+
"x-samva-brand": "MailboxDraftId"
|
|
10638
|
+
}, { type: "null" }] },
|
|
10639
|
+
messageId: { anyOf: [{
|
|
10640
|
+
type: "string",
|
|
10641
|
+
pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10642
|
+
"x-samva-brand": "MessageId"
|
|
10643
|
+
}, { type: "null" }] },
|
|
10644
|
+
threadId: { anyOf: [{
|
|
10645
|
+
type: "string",
|
|
10646
|
+
pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10647
|
+
"x-samva-brand": "MailboxThreadId"
|
|
10648
|
+
}, { type: "null" }] },
|
|
10649
|
+
state: {
|
|
10650
|
+
type: "string",
|
|
10651
|
+
enum: [
|
|
10652
|
+
"approvalRequired",
|
|
10653
|
+
"queued",
|
|
10654
|
+
"accepted",
|
|
10655
|
+
"completed",
|
|
10656
|
+
"notSent",
|
|
10657
|
+
"uncertain"
|
|
10658
|
+
]
|
|
10659
|
+
},
|
|
10660
|
+
acceptedAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
10661
|
+
waitReason: { anyOf: [{
|
|
10662
|
+
type: "string",
|
|
10663
|
+
enum: [
|
|
10664
|
+
"rate",
|
|
10665
|
+
"daily-quota",
|
|
10666
|
+
"domain-health",
|
|
10667
|
+
"sending-paused",
|
|
10668
|
+
"upstream-unavailable",
|
|
10669
|
+
"retry",
|
|
10670
|
+
"campaign-paused",
|
|
10671
|
+
"domain-warming",
|
|
10672
|
+
"onboarding-review",
|
|
10673
|
+
"content-review",
|
|
10674
|
+
"screening-unavailable"
|
|
10675
|
+
]
|
|
10676
|
+
}, { type: "null" }] },
|
|
10677
|
+
reviewExpectedAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
10678
|
+
skippedRecipients: {
|
|
10679
|
+
type: "array",
|
|
10680
|
+
items: {
|
|
10681
|
+
type: "object",
|
|
10682
|
+
properties: {
|
|
10683
|
+
address: { type: "string" },
|
|
10684
|
+
reason: {
|
|
10685
|
+
type: "string",
|
|
10686
|
+
enum: [
|
|
10687
|
+
"bounce",
|
|
10688
|
+
"complaint",
|
|
10689
|
+
"unsubscribe",
|
|
10690
|
+
"manual",
|
|
10691
|
+
"group-unsubscribe"
|
|
10692
|
+
]
|
|
10693
|
+
},
|
|
10694
|
+
unsubscribeGroupId: { anyOf: [{
|
|
10695
|
+
type: "string",
|
|
10696
|
+
pattern: "^unsub_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10697
|
+
"x-samva-brand": "UnsubscribeId"
|
|
10698
|
+
}, { type: "null" }] }
|
|
10699
|
+
},
|
|
10700
|
+
required: ["address", "reason"],
|
|
10701
|
+
additionalProperties: false
|
|
10702
|
+
}
|
|
10703
|
+
},
|
|
10704
|
+
executeUntil: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
10705
|
+
retryAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
10706
|
+
problem: { anyOf: [{
|
|
10707
|
+
type: "object",
|
|
10708
|
+
properties: {
|
|
10709
|
+
code: { type: "string" },
|
|
10710
|
+
message: { type: "string" },
|
|
10711
|
+
error: { anyOf: [{ anyOf: [
|
|
10712
|
+
{
|
|
10713
|
+
type: "object",
|
|
10714
|
+
properties: {
|
|
10715
|
+
_tag: {
|
|
10716
|
+
type: "string",
|
|
10717
|
+
enum: ["SenderNotReadyError"]
|
|
10718
|
+
},
|
|
10719
|
+
message: { type: "string" },
|
|
10720
|
+
sender: { type: "string" },
|
|
10721
|
+
retryAfterSeconds: { anyOf: [{ type: "number" }, { type: "null" }] }
|
|
10722
|
+
},
|
|
10723
|
+
required: [
|
|
10724
|
+
"_tag",
|
|
10725
|
+
"message",
|
|
10726
|
+
"sender"
|
|
10727
|
+
],
|
|
10728
|
+
additionalProperties: false
|
|
10729
|
+
},
|
|
10730
|
+
{
|
|
10731
|
+
type: "object",
|
|
10732
|
+
properties: {
|
|
10733
|
+
_tag: {
|
|
10734
|
+
type: "string",
|
|
10735
|
+
enum: ["RateLimitedError"]
|
|
10736
|
+
},
|
|
10737
|
+
message: { type: "string" },
|
|
10738
|
+
retryAfterSeconds: { type: "number" }
|
|
10739
|
+
},
|
|
10740
|
+
required: [
|
|
10741
|
+
"_tag",
|
|
10742
|
+
"message",
|
|
10743
|
+
"retryAfterSeconds"
|
|
10744
|
+
],
|
|
10745
|
+
additionalProperties: false
|
|
10746
|
+
},
|
|
10747
|
+
{
|
|
10748
|
+
type: "object",
|
|
10749
|
+
properties: {
|
|
10750
|
+
_tag: {
|
|
10751
|
+
type: "string",
|
|
10752
|
+
enum: ["OnboardingReviewRequiredError"]
|
|
10753
|
+
},
|
|
10754
|
+
message: { type: "string" },
|
|
10755
|
+
code: {
|
|
10756
|
+
type: "string",
|
|
10757
|
+
enum: [
|
|
10758
|
+
"review_required",
|
|
10759
|
+
"review_in_progress",
|
|
10760
|
+
"information_required",
|
|
10761
|
+
"review_rejected",
|
|
10762
|
+
"identity_review_required",
|
|
10763
|
+
"identity_review_rejected",
|
|
10764
|
+
"identity_changed"
|
|
10765
|
+
]
|
|
10766
|
+
},
|
|
10767
|
+
decision: {
|
|
10768
|
+
type: "string",
|
|
10769
|
+
enum: [
|
|
10770
|
+
"undecided",
|
|
10771
|
+
"approved",
|
|
10772
|
+
"rejected"
|
|
10773
|
+
]
|
|
10774
|
+
},
|
|
10775
|
+
stage: {
|
|
10776
|
+
type: "string",
|
|
10777
|
+
enum: [
|
|
10778
|
+
"collecting",
|
|
10779
|
+
"automated_review",
|
|
10780
|
+
"manual_review",
|
|
10781
|
+
"information_requested",
|
|
10782
|
+
"complete"
|
|
10783
|
+
]
|
|
10784
|
+
},
|
|
10785
|
+
nextAction: {
|
|
10786
|
+
type: "string",
|
|
10787
|
+
enum: [
|
|
10788
|
+
"wait_for_review",
|
|
10789
|
+
"provide_information",
|
|
10790
|
+
"verify_sending_identity",
|
|
10791
|
+
"reapply",
|
|
10792
|
+
"contact_support"
|
|
10793
|
+
]
|
|
10794
|
+
},
|
|
10795
|
+
identityId: { anyOf: [{ type: "string" }, { type: "null" }] }
|
|
10796
|
+
},
|
|
10797
|
+
required: [
|
|
10798
|
+
"_tag",
|
|
10799
|
+
"message",
|
|
10800
|
+
"code",
|
|
10801
|
+
"decision",
|
|
10802
|
+
"stage",
|
|
10803
|
+
"nextAction"
|
|
10804
|
+
],
|
|
10805
|
+
additionalProperties: false
|
|
10806
|
+
},
|
|
10807
|
+
{
|
|
10808
|
+
type: "object",
|
|
10809
|
+
properties: {
|
|
10810
|
+
_tag: {
|
|
10811
|
+
type: "string",
|
|
10812
|
+
enum: ["PaymentRequiredError"]
|
|
10813
|
+
},
|
|
10814
|
+
message: { type: "string" },
|
|
10815
|
+
resource: { type: "string" },
|
|
10816
|
+
currentUsage: { type: "number" },
|
|
10817
|
+
limit: { type: "number" }
|
|
10818
|
+
},
|
|
10819
|
+
required: [
|
|
10820
|
+
"_tag",
|
|
10821
|
+
"message",
|
|
10822
|
+
"resource",
|
|
10823
|
+
"currentUsage",
|
|
10824
|
+
"limit"
|
|
10825
|
+
],
|
|
10826
|
+
additionalProperties: false
|
|
10827
|
+
},
|
|
10828
|
+
{
|
|
10829
|
+
type: "object",
|
|
10830
|
+
properties: {
|
|
10831
|
+
_tag: {
|
|
10832
|
+
type: "string",
|
|
10833
|
+
enum: ["ValidationError"]
|
|
10834
|
+
},
|
|
10835
|
+
message: { type: "string" },
|
|
10836
|
+
fields: { anyOf: [{
|
|
10837
|
+
type: "object",
|
|
10838
|
+
additionalProperties: {
|
|
10839
|
+
type: "array",
|
|
10840
|
+
items: { type: "string" }
|
|
10841
|
+
}
|
|
10842
|
+
}, { type: "null" }] }
|
|
10843
|
+
},
|
|
10844
|
+
required: ["_tag", "message"],
|
|
10845
|
+
additionalProperties: false
|
|
10846
|
+
},
|
|
10847
|
+
{
|
|
10848
|
+
type: "object",
|
|
10849
|
+
properties: {
|
|
10850
|
+
_tag: {
|
|
10851
|
+
type: "string",
|
|
10852
|
+
enum: ["ForbiddenError"]
|
|
10853
|
+
},
|
|
10854
|
+
message: { type: "string" }
|
|
10855
|
+
},
|
|
10856
|
+
required: ["_tag", "message"],
|
|
10857
|
+
additionalProperties: false
|
|
10858
|
+
},
|
|
10859
|
+
{
|
|
10860
|
+
type: "object",
|
|
10861
|
+
properties: {
|
|
10862
|
+
_tag: {
|
|
10863
|
+
type: "string",
|
|
10864
|
+
enum: ["ResourceNotFoundError"]
|
|
10865
|
+
},
|
|
10866
|
+
resource: { type: "string" },
|
|
10867
|
+
id: { type: "string" },
|
|
10868
|
+
message: { type: "string" }
|
|
10869
|
+
},
|
|
10870
|
+
required: [
|
|
10871
|
+
"_tag",
|
|
10872
|
+
"resource",
|
|
10873
|
+
"id",
|
|
10874
|
+
"message"
|
|
10875
|
+
],
|
|
10876
|
+
additionalProperties: false
|
|
10877
|
+
}
|
|
10878
|
+
] }, { type: "null" }] }
|
|
10879
|
+
},
|
|
10880
|
+
required: ["code", "message"],
|
|
10881
|
+
additionalProperties: false
|
|
10882
|
+
}, { type: "null" }] },
|
|
10883
|
+
retryEligible: { type: "boolean" },
|
|
10884
|
+
decision: { anyOf: [{
|
|
10885
|
+
type: "object",
|
|
10886
|
+
properties: {
|
|
10887
|
+
outcome: {
|
|
10888
|
+
type: "string",
|
|
10889
|
+
enum: [
|
|
10890
|
+
"allow",
|
|
10891
|
+
"requireApproval",
|
|
10892
|
+
"deny"
|
|
10893
|
+
]
|
|
10894
|
+
},
|
|
10895
|
+
reason: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
10896
|
+
policyId: { anyOf: [{
|
|
10897
|
+
type: "string",
|
|
10898
|
+
pattern: "^mbxpol_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10899
|
+
"x-samva-brand": "MailboxPolicyId"
|
|
10900
|
+
}, { type: "null" }] },
|
|
10901
|
+
source: { anyOf: [{
|
|
10902
|
+
type: "string",
|
|
10903
|
+
enum: [
|
|
10904
|
+
"grant",
|
|
10905
|
+
"installation",
|
|
10906
|
+
"policy"
|
|
10907
|
+
]
|
|
10908
|
+
}, { type: "null" }] },
|
|
10909
|
+
decidedAt: { type: "string" }
|
|
10910
|
+
},
|
|
10911
|
+
required: [
|
|
10912
|
+
"outcome",
|
|
10913
|
+
"reason",
|
|
10914
|
+
"policyId",
|
|
10915
|
+
"source",
|
|
10916
|
+
"decidedAt"
|
|
10917
|
+
],
|
|
10918
|
+
additionalProperties: false
|
|
10919
|
+
}, { type: "null" }] },
|
|
10920
|
+
createdAt: { type: "string" },
|
|
10921
|
+
updatedAt: { type: "string" }
|
|
10922
|
+
},
|
|
10923
|
+
required: [
|
|
10924
|
+
"actionId",
|
|
10925
|
+
"draftId",
|
|
10926
|
+
"messageId",
|
|
10927
|
+
"threadId",
|
|
10928
|
+
"state",
|
|
10929
|
+
"acceptedAt",
|
|
10930
|
+
"waitReason",
|
|
10931
|
+
"reviewExpectedAt",
|
|
10932
|
+
"skippedRecipients",
|
|
10933
|
+
"executeUntil",
|
|
10934
|
+
"retryAt",
|
|
10935
|
+
"problem",
|
|
10936
|
+
"retryEligible",
|
|
10937
|
+
"decision",
|
|
10938
|
+
"createdAt",
|
|
10939
|
+
"updatedAt"
|
|
10940
|
+
],
|
|
10941
|
+
additionalProperties: false
|
|
10942
|
+
}
|
|
10943
|
+
},
|
|
10944
|
+
required: [
|
|
10945
|
+
"_tag",
|
|
10946
|
+
"message",
|
|
10947
|
+
"resource",
|
|
10948
|
+
"id",
|
|
10949
|
+
"receipt"
|
|
10950
|
+
],
|
|
10951
|
+
additionalProperties: false
|
|
10952
|
+
},
|
|
10953
|
+
MailboxSendRefusedError: {
|
|
10954
|
+
type: "object",
|
|
10955
|
+
properties: {
|
|
10956
|
+
_tag: {
|
|
10957
|
+
type: "string",
|
|
10958
|
+
enum: ["MailboxSendRefusedError"]
|
|
10959
|
+
},
|
|
10960
|
+
message: { type: "string" },
|
|
10961
|
+
receipt: {
|
|
10962
|
+
type: "object",
|
|
10963
|
+
properties: {
|
|
10964
|
+
actionId: {
|
|
10965
|
+
type: "string",
|
|
10966
|
+
pattern: "^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10967
|
+
"x-samva-brand": "MailboxActionId"
|
|
10968
|
+
},
|
|
10969
|
+
draftId: { anyOf: [{
|
|
10970
|
+
type: "string",
|
|
10971
|
+
pattern: "^mdraft_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10972
|
+
"x-samva-brand": "MailboxDraftId"
|
|
10973
|
+
}, { type: "null" }] },
|
|
10974
|
+
messageId: { anyOf: [{
|
|
10975
|
+
type: "string",
|
|
10976
|
+
pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10977
|
+
"x-samva-brand": "MessageId"
|
|
10978
|
+
}, { type: "null" }] },
|
|
10979
|
+
threadId: { anyOf: [{
|
|
10980
|
+
type: "string",
|
|
10981
|
+
pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
10982
|
+
"x-samva-brand": "MailboxThreadId"
|
|
10983
|
+
}, { type: "null" }] },
|
|
10984
|
+
state: {
|
|
10985
|
+
type: "string",
|
|
10986
|
+
enum: [
|
|
10987
|
+
"approvalRequired",
|
|
10988
|
+
"queued",
|
|
10989
|
+
"accepted",
|
|
10990
|
+
"completed",
|
|
10991
|
+
"notSent",
|
|
10992
|
+
"uncertain"
|
|
10993
|
+
]
|
|
10994
|
+
},
|
|
10995
|
+
acceptedAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
10996
|
+
waitReason: { anyOf: [{
|
|
10997
|
+
type: "string",
|
|
10998
|
+
enum: [
|
|
10999
|
+
"rate",
|
|
11000
|
+
"daily-quota",
|
|
11001
|
+
"domain-health",
|
|
11002
|
+
"sending-paused",
|
|
11003
|
+
"upstream-unavailable",
|
|
11004
|
+
"retry",
|
|
11005
|
+
"campaign-paused",
|
|
11006
|
+
"domain-warming",
|
|
11007
|
+
"onboarding-review",
|
|
11008
|
+
"content-review",
|
|
11009
|
+
"screening-unavailable"
|
|
11010
|
+
]
|
|
11011
|
+
}, { type: "null" }] },
|
|
11012
|
+
reviewExpectedAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
11013
|
+
skippedRecipients: {
|
|
11014
|
+
type: "array",
|
|
11015
|
+
items: {
|
|
11016
|
+
type: "object",
|
|
11017
|
+
properties: {
|
|
11018
|
+
address: { type: "string" },
|
|
11019
|
+
reason: {
|
|
11020
|
+
type: "string",
|
|
11021
|
+
enum: [
|
|
11022
|
+
"bounce",
|
|
11023
|
+
"complaint",
|
|
11024
|
+
"unsubscribe",
|
|
11025
|
+
"manual",
|
|
11026
|
+
"group-unsubscribe"
|
|
11027
|
+
]
|
|
11028
|
+
},
|
|
11029
|
+
unsubscribeGroupId: { anyOf: [{
|
|
11030
|
+
type: "string",
|
|
11031
|
+
pattern: "^unsub_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
11032
|
+
"x-samva-brand": "UnsubscribeId"
|
|
11033
|
+
}, { type: "null" }] }
|
|
11034
|
+
},
|
|
11035
|
+
required: ["address", "reason"],
|
|
11036
|
+
additionalProperties: false
|
|
11037
|
+
}
|
|
11038
|
+
},
|
|
11039
|
+
executeUntil: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
11040
|
+
retryAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
11041
|
+
problem: { anyOf: [{
|
|
11042
|
+
type: "object",
|
|
11043
|
+
properties: {
|
|
11044
|
+
code: { type: "string" },
|
|
11045
|
+
message: { type: "string" },
|
|
11046
|
+
error: { anyOf: [{ anyOf: [
|
|
11047
|
+
{
|
|
11048
|
+
type: "object",
|
|
11049
|
+
properties: {
|
|
11050
|
+
_tag: {
|
|
11051
|
+
type: "string",
|
|
11052
|
+
enum: ["SenderNotReadyError"]
|
|
11053
|
+
},
|
|
11054
|
+
message: { type: "string" },
|
|
11055
|
+
sender: { type: "string" },
|
|
11056
|
+
retryAfterSeconds: { anyOf: [{ type: "number" }, { type: "null" }] }
|
|
11057
|
+
},
|
|
11058
|
+
required: [
|
|
11059
|
+
"_tag",
|
|
11060
|
+
"message",
|
|
11061
|
+
"sender"
|
|
11062
|
+
],
|
|
11063
|
+
additionalProperties: false
|
|
11064
|
+
},
|
|
11065
|
+
{
|
|
11066
|
+
type: "object",
|
|
11067
|
+
properties: {
|
|
11068
|
+
_tag: {
|
|
11069
|
+
type: "string",
|
|
11070
|
+
enum: ["RateLimitedError"]
|
|
11071
|
+
},
|
|
11072
|
+
message: { type: "string" },
|
|
11073
|
+
retryAfterSeconds: { type: "number" }
|
|
11074
|
+
},
|
|
11075
|
+
required: [
|
|
11076
|
+
"_tag",
|
|
11077
|
+
"message",
|
|
11078
|
+
"retryAfterSeconds"
|
|
11079
|
+
],
|
|
11080
|
+
additionalProperties: false
|
|
11081
|
+
},
|
|
11082
|
+
{
|
|
11083
|
+
type: "object",
|
|
11084
|
+
properties: {
|
|
11085
|
+
_tag: {
|
|
11086
|
+
type: "string",
|
|
11087
|
+
enum: ["OnboardingReviewRequiredError"]
|
|
11088
|
+
},
|
|
11089
|
+
message: { type: "string" },
|
|
11090
|
+
code: {
|
|
11091
|
+
type: "string",
|
|
11092
|
+
enum: [
|
|
11093
|
+
"review_required",
|
|
11094
|
+
"review_in_progress",
|
|
11095
|
+
"information_required",
|
|
11096
|
+
"review_rejected",
|
|
11097
|
+
"identity_review_required",
|
|
11098
|
+
"identity_review_rejected",
|
|
11099
|
+
"identity_changed"
|
|
11100
|
+
]
|
|
11101
|
+
},
|
|
11102
|
+
decision: {
|
|
11103
|
+
type: "string",
|
|
11104
|
+
enum: [
|
|
11105
|
+
"undecided",
|
|
11106
|
+
"approved",
|
|
11107
|
+
"rejected"
|
|
11108
|
+
]
|
|
11109
|
+
},
|
|
11110
|
+
stage: {
|
|
11111
|
+
type: "string",
|
|
11112
|
+
enum: [
|
|
11113
|
+
"collecting",
|
|
11114
|
+
"automated_review",
|
|
11115
|
+
"manual_review",
|
|
11116
|
+
"information_requested",
|
|
11117
|
+
"complete"
|
|
11118
|
+
]
|
|
11119
|
+
},
|
|
11120
|
+
nextAction: {
|
|
11121
|
+
type: "string",
|
|
11122
|
+
enum: [
|
|
11123
|
+
"wait_for_review",
|
|
11124
|
+
"provide_information",
|
|
11125
|
+
"verify_sending_identity",
|
|
11126
|
+
"reapply",
|
|
11127
|
+
"contact_support"
|
|
11128
|
+
]
|
|
11129
|
+
},
|
|
11130
|
+
identityId: { anyOf: [{ type: "string" }, { type: "null" }] }
|
|
11131
|
+
},
|
|
11132
|
+
required: [
|
|
11133
|
+
"_tag",
|
|
11134
|
+
"message",
|
|
11135
|
+
"code",
|
|
11136
|
+
"decision",
|
|
11137
|
+
"stage",
|
|
11138
|
+
"nextAction"
|
|
11139
|
+
],
|
|
11140
|
+
additionalProperties: false
|
|
11141
|
+
},
|
|
11142
|
+
{
|
|
11143
|
+
type: "object",
|
|
11144
|
+
properties: {
|
|
11145
|
+
_tag: {
|
|
11146
|
+
type: "string",
|
|
11147
|
+
enum: ["PaymentRequiredError"]
|
|
11148
|
+
},
|
|
11149
|
+
message: { type: "string" },
|
|
11150
|
+
resource: { type: "string" },
|
|
11151
|
+
currentUsage: { type: "number" },
|
|
11152
|
+
limit: { type: "number" }
|
|
11153
|
+
},
|
|
11154
|
+
required: [
|
|
11155
|
+
"_tag",
|
|
11156
|
+
"message",
|
|
11157
|
+
"resource",
|
|
11158
|
+
"currentUsage",
|
|
11159
|
+
"limit"
|
|
11160
|
+
],
|
|
11161
|
+
additionalProperties: false
|
|
11162
|
+
},
|
|
11163
|
+
{
|
|
11164
|
+
type: "object",
|
|
11165
|
+
properties: {
|
|
11166
|
+
_tag: {
|
|
11167
|
+
type: "string",
|
|
11168
|
+
enum: ["ValidationError"]
|
|
11169
|
+
},
|
|
11170
|
+
message: { type: "string" },
|
|
11171
|
+
fields: { anyOf: [{
|
|
11172
|
+
type: "object",
|
|
11173
|
+
additionalProperties: {
|
|
11174
|
+
type: "array",
|
|
11175
|
+
items: { type: "string" }
|
|
11176
|
+
}
|
|
11177
|
+
}, { type: "null" }] }
|
|
11178
|
+
},
|
|
11179
|
+
required: ["_tag", "message"],
|
|
11180
|
+
additionalProperties: false
|
|
11181
|
+
},
|
|
11182
|
+
{
|
|
11183
|
+
type: "object",
|
|
11184
|
+
properties: {
|
|
11185
|
+
_tag: {
|
|
11186
|
+
type: "string",
|
|
11187
|
+
enum: ["ForbiddenError"]
|
|
11188
|
+
},
|
|
11189
|
+
message: { type: "string" }
|
|
11190
|
+
},
|
|
11191
|
+
required: ["_tag", "message"],
|
|
11192
|
+
additionalProperties: false
|
|
11193
|
+
},
|
|
11194
|
+
{
|
|
11195
|
+
type: "object",
|
|
11196
|
+
properties: {
|
|
11197
|
+
_tag: {
|
|
11198
|
+
type: "string",
|
|
11199
|
+
enum: ["ResourceNotFoundError"]
|
|
11200
|
+
},
|
|
11201
|
+
resource: { type: "string" },
|
|
11202
|
+
id: { type: "string" },
|
|
11203
|
+
message: { type: "string" }
|
|
11204
|
+
},
|
|
11205
|
+
required: [
|
|
11206
|
+
"_tag",
|
|
11207
|
+
"resource",
|
|
11208
|
+
"id",
|
|
11209
|
+
"message"
|
|
11210
|
+
],
|
|
11211
|
+
additionalProperties: false
|
|
11212
|
+
}
|
|
11213
|
+
] }, { type: "null" }] }
|
|
11214
|
+
},
|
|
11215
|
+
required: ["code", "message"],
|
|
11216
|
+
additionalProperties: false
|
|
11217
|
+
}, { type: "null" }] },
|
|
11218
|
+
retryEligible: { type: "boolean" },
|
|
11219
|
+
decision: { anyOf: [{
|
|
11220
|
+
type: "object",
|
|
11221
|
+
properties: {
|
|
11222
|
+
outcome: {
|
|
11223
|
+
type: "string",
|
|
11224
|
+
enum: [
|
|
11225
|
+
"allow",
|
|
11226
|
+
"requireApproval",
|
|
11227
|
+
"deny"
|
|
11228
|
+
]
|
|
11229
|
+
},
|
|
11230
|
+
reason: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
11231
|
+
policyId: { anyOf: [{
|
|
11232
|
+
type: "string",
|
|
11233
|
+
pattern: "^mbxpol_[0-9a-hjkmnp-tv-z]{16,24}$",
|
|
11234
|
+
"x-samva-brand": "MailboxPolicyId"
|
|
11235
|
+
}, { type: "null" }] },
|
|
11236
|
+
source: { anyOf: [{
|
|
11237
|
+
type: "string",
|
|
11238
|
+
enum: [
|
|
11239
|
+
"grant",
|
|
11240
|
+
"installation",
|
|
11241
|
+
"policy"
|
|
11242
|
+
]
|
|
11243
|
+
}, { type: "null" }] },
|
|
11244
|
+
decidedAt: { type: "string" }
|
|
11245
|
+
},
|
|
11246
|
+
required: [
|
|
11247
|
+
"outcome",
|
|
11248
|
+
"reason",
|
|
11249
|
+
"policyId",
|
|
11250
|
+
"source",
|
|
11251
|
+
"decidedAt"
|
|
11252
|
+
],
|
|
11253
|
+
additionalProperties: false
|
|
11254
|
+
}, { type: "null" }] },
|
|
11255
|
+
createdAt: { type: "string" },
|
|
11256
|
+
updatedAt: { type: "string" }
|
|
11257
|
+
},
|
|
11258
|
+
required: [
|
|
11259
|
+
"actionId",
|
|
11260
|
+
"draftId",
|
|
11261
|
+
"messageId",
|
|
11262
|
+
"threadId",
|
|
11263
|
+
"state",
|
|
11264
|
+
"acceptedAt",
|
|
11265
|
+
"waitReason",
|
|
11266
|
+
"reviewExpectedAt",
|
|
11267
|
+
"skippedRecipients",
|
|
11268
|
+
"executeUntil",
|
|
11269
|
+
"retryAt",
|
|
11270
|
+
"problem",
|
|
11271
|
+
"retryEligible",
|
|
11272
|
+
"decision",
|
|
11273
|
+
"createdAt",
|
|
11274
|
+
"updatedAt"
|
|
11275
|
+
],
|
|
11276
|
+
additionalProperties: false
|
|
11277
|
+
}
|
|
11278
|
+
},
|
|
11279
|
+
required: [
|
|
11280
|
+
"_tag",
|
|
11281
|
+
"message",
|
|
11282
|
+
"receipt"
|
|
11283
|
+
],
|
|
11284
|
+
additionalProperties: false
|
|
11285
|
+
},
|
|
10331
11286
|
OnboardingReviewRequiredError: {
|
|
10332
11287
|
type: "object",
|
|
10333
11288
|
properties: {
|
|
@@ -10576,9 +11531,9 @@ function fromApiError(error, context = {}) {
|
|
|
10576
11531
|
* const samva = createClient({ apiKey: "<samva-api-key>" });
|
|
10577
11532
|
*
|
|
10578
11533
|
* try {
|
|
10579
|
-
* const contact = await samva.contacts.findOrCreate({
|
|
10580
|
-
* name: "Ada Lovelace",
|
|
10581
|
-
* email: "ada@example.com",
|
|
11534
|
+
* const { contact } = await samva.contacts.findOrCreate({
|
|
11535
|
+
* create: { name: "Ada Lovelace" },
|
|
11536
|
+
* lookup: { type: "email", value: "ada@example.com" },
|
|
10582
11537
|
* });
|
|
10583
11538
|
* await samva.email.send({
|
|
10584
11539
|
* to: contact,
|
|
@@ -10788,6 +11743,7 @@ function createClient(config) {
|
|
|
10788
11743
|
attachments: createBoundService(Attachments, clientInstance),
|
|
10789
11744
|
contactGroups: createBoundService(ContactGroups, clientInstance),
|
|
10790
11745
|
customFields: createBoundService(CustomFields, clientInstance),
|
|
11746
|
+
subscriptions: createBoundService(Subscriptions, clientInstance),
|
|
10791
11747
|
unsubscribeGroups: createBoundService(Unsubscribe, clientInstance),
|
|
10792
11748
|
analytics: createBoundService(Analytics, clientInstance),
|
|
10793
11749
|
feedback: createBoundService(Feedback, clientInstance),
|
|
@@ -10798,7 +11754,7 @@ function createClient(config) {
|
|
|
10798
11754
|
};
|
|
10799
11755
|
const streamConnection = {
|
|
10800
11756
|
baseUrl: config.baseUrl ?? "https://api.samva.dev",
|
|
10801
|
-
headers: Object.fromEntries(mergeHeaders({ [CLIENT_ATTRIBUTION_HEADER]: clientAttribution("typescript-promise") }, config.headers, authHeaders).entries()),
|
|
11757
|
+
headers: async () => Object.fromEntries(mergeHeaders({ [CLIENT_ATTRIBUTION_HEADER]: clientAttribution("typescript-promise") }, config.headers, authHeaders).entries()),
|
|
10802
11758
|
fetch: config.fetch
|
|
10803
11759
|
};
|
|
10804
11760
|
const promiseMessages = createPromiseMessagesTransport(clientInstance);
|
|
@@ -10821,6 +11777,7 @@ function createClient(config) {
|
|
|
10821
11777
|
attachments: createDirectService(raw.attachments),
|
|
10822
11778
|
contactGroups: createDirectService(raw.contactGroups),
|
|
10823
11779
|
customFields: createDirectService(raw.customFields),
|
|
11780
|
+
subscriptions: createDirectService(raw.subscriptions),
|
|
10824
11781
|
unsubscribeGroups: createDirectService(raw.unsubscribeGroups),
|
|
10825
11782
|
analytics: createDirectService(raw.analytics),
|
|
10826
11783
|
feedback: createDirectService(raw.feedback),
|
|
@@ -10831,6 +11788,6 @@ function createClient(config) {
|
|
|
10831
11788
|
};
|
|
10832
11789
|
}
|
|
10833
11790
|
//#endregion
|
|
10834
|
-
export {
|
|
11791
|
+
export { UnauthorizedError as C, SenderNotReadyError as S, fromApiError as T, PaymentRequiredError as _, CampaignFooterRequiredError as a, SamvaApiError as b, EmailChannelError as c, ForbiddenError as d, GatewayTimeoutError as f, OnboardingReviewRequiredError as g, MailboxSendRefusedError as h, BrandAddressRequiredError as i, ExternalServiceError as l, MailboxSendConflictError as m, AnalyticsQueryError as n, ConflictError as o, InternalError as p, BillingProviderError as r, DeliveryUnavailableError as s, createClient as t, FlagDisabledError as u, RateLimitedError as v, ValidationError as w, SamvaTransportError as x, ResourceNotFoundError as y };
|
|
10835
11792
|
|
|
10836
|
-
//# sourceMappingURL=promises-
|
|
11793
|
+
//# sourceMappingURL=promises-Cd6Jamqk.js.map
|