shipmail 0.1.31 → 0.1.33
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/README.md +80 -0
- package/dist/index.cjs +162 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +250 -37
- package/dist/index.d.ts +250 -37
- package/dist/index.js +161 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -442,6 +442,13 @@ var Domains = class extends ApiResource {
|
|
|
442
442
|
methodOptions: options
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
|
+
getDnsRecords(id, options) {
|
|
446
|
+
return this.client.request({
|
|
447
|
+
method: "GET",
|
|
448
|
+
path: `/domains/${encodeURIComponent(id)}/dns-records`,
|
|
449
|
+
methodOptions: options
|
|
450
|
+
});
|
|
451
|
+
}
|
|
445
452
|
update(id, params, options) {
|
|
446
453
|
return this.client.request({
|
|
447
454
|
method: "PATCH",
|
|
@@ -484,6 +491,14 @@ var Domains = class extends ApiResource {
|
|
|
484
491
|
|
|
485
492
|
// src/resources/mailboxes.ts
|
|
486
493
|
var Mailboxes = class extends ApiResource {
|
|
494
|
+
injectSandboxInbound(id, params, options) {
|
|
495
|
+
return this.client.request({
|
|
496
|
+
method: "POST",
|
|
497
|
+
path: `/mailboxes/${encodeURIComponent(id)}/sandbox/inbound`,
|
|
498
|
+
body: params,
|
|
499
|
+
methodOptions: options
|
|
500
|
+
});
|
|
501
|
+
}
|
|
487
502
|
create(params, options) {
|
|
488
503
|
return this.client.request({
|
|
489
504
|
method: "POST",
|
|
@@ -532,6 +547,34 @@ var Mailboxes = class extends ApiResource {
|
|
|
532
547
|
methodOptions: options
|
|
533
548
|
});
|
|
534
549
|
}
|
|
550
|
+
suspend(id, options) {
|
|
551
|
+
return this.client.request({
|
|
552
|
+
method: "POST",
|
|
553
|
+
path: `/mailboxes/${encodeURIComponent(id)}/suspend`,
|
|
554
|
+
methodOptions: options
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
resume(id, options) {
|
|
558
|
+
return this.client.request({
|
|
559
|
+
method: "POST",
|
|
560
|
+
path: `/mailboxes/${encodeURIComponent(id)}/resume`,
|
|
561
|
+
methodOptions: options
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
createExport(id, options) {
|
|
565
|
+
return this.client.request({
|
|
566
|
+
method: "POST",
|
|
567
|
+
path: `/mailboxes/${encodeURIComponent(id)}/exports`,
|
|
568
|
+
methodOptions: options
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
getExport(id, exportId, options) {
|
|
572
|
+
return this.client.request({
|
|
573
|
+
method: "GET",
|
|
574
|
+
path: `/mailboxes/${encodeURIComponent(id)}/exports/${encodeURIComponent(exportId)}`,
|
|
575
|
+
methodOptions: options
|
|
576
|
+
});
|
|
577
|
+
}
|
|
535
578
|
listFolders(id, options) {
|
|
536
579
|
return this.client.request({
|
|
537
580
|
method: "GET",
|
|
@@ -649,6 +692,28 @@ var Mailboxes = class extends ApiResource {
|
|
|
649
692
|
methodOptions: options
|
|
650
693
|
});
|
|
651
694
|
}
|
|
695
|
+
listForwarding(id, options) {
|
|
696
|
+
return this.client.request({
|
|
697
|
+
method: "GET",
|
|
698
|
+
path: `/mailboxes/${encodeURIComponent(id)}/forwarding`,
|
|
699
|
+
methodOptions: options
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
createForwarding(id, params, options) {
|
|
703
|
+
return this.client.request({
|
|
704
|
+
method: "POST",
|
|
705
|
+
path: `/mailboxes/${encodeURIComponent(id)}/forwarding`,
|
|
706
|
+
body: params,
|
|
707
|
+
methodOptions: options
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
deleteForwarding(id, forwardingId, options) {
|
|
711
|
+
return this.client.request({
|
|
712
|
+
method: "DELETE",
|
|
713
|
+
path: `/mailboxes/${encodeURIComponent(id)}/forwarding/${encodeURIComponent(forwardingId)}`,
|
|
714
|
+
methodOptions: options
|
|
715
|
+
});
|
|
716
|
+
}
|
|
652
717
|
updateAutoReply(id, params, options) {
|
|
653
718
|
return this.client.request({
|
|
654
719
|
method: "PATCH",
|
|
@@ -727,6 +792,7 @@ var Messages = class extends ApiResource {
|
|
|
727
792
|
path: "/messages",
|
|
728
793
|
query: {
|
|
729
794
|
mailbox_id: params.mailbox_id,
|
|
795
|
+
client_reference: params.client_reference,
|
|
730
796
|
cursor: params.cursor,
|
|
731
797
|
limit: params.limit
|
|
732
798
|
},
|
|
@@ -736,6 +802,7 @@ var Messages = class extends ApiResource {
|
|
|
736
802
|
listAutoPaginating(params) {
|
|
737
803
|
return new Page(this.client, "/messages", {
|
|
738
804
|
mailbox_id: params.mailbox_id,
|
|
805
|
+
client_reference: params.client_reference,
|
|
739
806
|
limit: params.limit
|
|
740
807
|
});
|
|
741
808
|
}
|
|
@@ -907,6 +974,72 @@ var Newsletters = class extends ApiResource {
|
|
|
907
974
|
}
|
|
908
975
|
};
|
|
909
976
|
|
|
977
|
+
// src/resources/partner.ts
|
|
978
|
+
var Partner = class extends ApiResource {
|
|
979
|
+
listOrganizations(options) {
|
|
980
|
+
return this.client.request({
|
|
981
|
+
method: "GET",
|
|
982
|
+
path: "/partner/organizations",
|
|
983
|
+
methodOptions: options
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
createOrganization(params, options) {
|
|
987
|
+
return this.client.request({
|
|
988
|
+
method: "POST",
|
|
989
|
+
path: "/partner/organizations",
|
|
990
|
+
body: params,
|
|
991
|
+
methodOptions: options
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
getOrganization(id, options) {
|
|
995
|
+
return this.client.request({
|
|
996
|
+
method: "GET",
|
|
997
|
+
path: `/partner/organizations/${encodeURIComponent(id)}`,
|
|
998
|
+
methodOptions: options
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
updateOrganization(id, params, options) {
|
|
1002
|
+
return this.client.request({
|
|
1003
|
+
method: "PATCH",
|
|
1004
|
+
path: `/partner/organizations/${encodeURIComponent(id)}`,
|
|
1005
|
+
body: params,
|
|
1006
|
+
methodOptions: options
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
resendOwnershipInvitation(id, params = {}, options) {
|
|
1010
|
+
return this.client.request({
|
|
1011
|
+
method: "POST",
|
|
1012
|
+
path: `/partner/organizations/${encodeURIComponent(id)}/ownership-invitations`,
|
|
1013
|
+
body: params,
|
|
1014
|
+
methodOptions: options
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
suspendOrganization(id, options) {
|
|
1018
|
+
return this.client.request({
|
|
1019
|
+
method: "POST",
|
|
1020
|
+
path: `/partner/organizations/${encodeURIComponent(id)}/suspend`,
|
|
1021
|
+
methodOptions: options
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
resumeOrganization(id, options) {
|
|
1025
|
+
return this.client.request({
|
|
1026
|
+
method: "POST",
|
|
1027
|
+
path: `/partner/organizations/${encodeURIComponent(id)}/resume`,
|
|
1028
|
+
methodOptions: options
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
offboardOrganization(id, options) {
|
|
1032
|
+
return this.client.request({
|
|
1033
|
+
method: "DELETE",
|
|
1034
|
+
path: `/partner/organizations/${encodeURIComponent(id)}`,
|
|
1035
|
+
methodOptions: options
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
usage(options) {
|
|
1039
|
+
return this.client.request({ method: "GET", path: "/partner/usage", methodOptions: options });
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
|
|
910
1043
|
// src/resources/status.ts
|
|
911
1044
|
var Status = class extends ApiResource {
|
|
912
1045
|
get(options) {
|
|
@@ -1072,10 +1205,24 @@ var Webhooks = class extends ApiResource {
|
|
|
1072
1205
|
}
|
|
1073
1206
|
);
|
|
1074
1207
|
}
|
|
1208
|
+
getDelivery(id, deliveryId, options) {
|
|
1209
|
+
return this.client.request({
|
|
1210
|
+
method: "GET",
|
|
1211
|
+
path: `/webhooks/${encodeURIComponent(id)}/deliveries/${encodeURIComponent(deliveryId)}`,
|
|
1212
|
+
methodOptions: options
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
replayDelivery(id, deliveryId, options) {
|
|
1216
|
+
return this.client.request({
|
|
1217
|
+
method: "POST",
|
|
1218
|
+
path: `/webhooks/${encodeURIComponent(id)}/deliveries/${encodeURIComponent(deliveryId)}/replay`,
|
|
1219
|
+
methodOptions: options
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1075
1222
|
};
|
|
1076
1223
|
|
|
1077
1224
|
// src/version.ts
|
|
1078
|
-
var VERSION = "0.1.
|
|
1225
|
+
var VERSION = "0.1.33";
|
|
1079
1226
|
|
|
1080
1227
|
// src/client.ts
|
|
1081
1228
|
var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
|
|
@@ -1118,6 +1265,7 @@ var ShipMailClient = class {
|
|
|
1118
1265
|
this.timeout = DEFAULT_TIMEOUT;
|
|
1119
1266
|
this.fetchFn = globalThis.fetch;
|
|
1120
1267
|
this.defaultHeaders = {};
|
|
1268
|
+
this.organizationId = void 0;
|
|
1121
1269
|
} else {
|
|
1122
1270
|
this.apiKey = config.apiKey;
|
|
1123
1271
|
this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
@@ -1125,6 +1273,7 @@ var ShipMailClient = class {
|
|
|
1125
1273
|
this.timeout = config.timeout ?? DEFAULT_TIMEOUT;
|
|
1126
1274
|
this.fetchFn = config.fetch ?? globalThis.fetch;
|
|
1127
1275
|
this.defaultHeaders = config.defaultHeaders ? { ...config.defaultHeaders } : {};
|
|
1276
|
+
this.organizationId = config.organizationId;
|
|
1128
1277
|
}
|
|
1129
1278
|
this.audiences = new Audiences(this);
|
|
1130
1279
|
this.bookingPages = new BookingPages(this);
|
|
@@ -1133,6 +1282,7 @@ var ShipMailClient = class {
|
|
|
1133
1282
|
this.mailboxes = new Mailboxes(this);
|
|
1134
1283
|
this.messages = new Messages(this);
|
|
1135
1284
|
this.newsletters = new Newsletters(this);
|
|
1285
|
+
this.partner = new Partner(this);
|
|
1136
1286
|
this.suppressions = new Suppressions(this);
|
|
1137
1287
|
this.threads = new Threads(this);
|
|
1138
1288
|
this.webhooks = new Webhooks(this);
|
|
@@ -1173,6 +1323,10 @@ var ShipMailClient = class {
|
|
|
1173
1323
|
if (methodOpts?.idempotencyKey) {
|
|
1174
1324
|
headers["Idempotency-Key"] = methodOpts.idempotencyKey;
|
|
1175
1325
|
}
|
|
1326
|
+
const targetOrganizationId = methodOpts?.organizationId ?? this.organizationId;
|
|
1327
|
+
if (targetOrganizationId) {
|
|
1328
|
+
headers["X-ShipMail-Organization-Id"] = targetOrganizationId;
|
|
1329
|
+
}
|
|
1176
1330
|
let body = null;
|
|
1177
1331
|
if (options.rawBody !== void 0) {
|
|
1178
1332
|
headers["Content-Type"] = options.contentType ?? "application/octet-stream";
|
|
@@ -1229,6 +1383,9 @@ var ShipMailClient = class {
|
|
|
1229
1383
|
}
|
|
1230
1384
|
};
|
|
1231
1385
|
|
|
1386
|
+
// src/types/booking-page.ts
|
|
1387
|
+
var CONFERENCING_PROVIDER_IDS = ["zoom", "google_meet"];
|
|
1388
|
+
|
|
1232
1389
|
// src/types/common.ts
|
|
1233
1390
|
var WEBHOOK_EVENT_TYPES = [
|
|
1234
1391
|
"message.received",
|
|
@@ -1236,6 +1393,7 @@ var WEBHOOK_EVENT_TYPES = [
|
|
|
1236
1393
|
"message.delivered",
|
|
1237
1394
|
"message.bounced",
|
|
1238
1395
|
"message.complained",
|
|
1396
|
+
"mailbox.rule_matched",
|
|
1239
1397
|
"domain.verified",
|
|
1240
1398
|
"domain.verification_failed",
|
|
1241
1399
|
"domain.degraded",
|
|
@@ -1244,6 +1402,7 @@ var WEBHOOK_EVENT_TYPES = [
|
|
|
1244
1402
|
"org.sending_suspended",
|
|
1245
1403
|
"org.reputation_recovered"
|
|
1246
1404
|
];
|
|
1405
|
+
var WEBHOOK_DELIVERY_EVENT_TYPES = ["webhook.test", ...WEBHOOK_EVENT_TYPES];
|
|
1247
1406
|
var DOMAIN_STATUSES = ["pending", "verifying", "verified", "degraded", "failed"];
|
|
1248
1407
|
var MESSAGE_STATUSES = [
|
|
1249
1408
|
"scheduled",
|
|
@@ -1307,6 +1466,6 @@ async function verifyWebhook(body, headers, secret, options) {
|
|
|
1307
1466
|
return parsed;
|
|
1308
1467
|
}
|
|
1309
1468
|
|
|
1310
|
-
export { AuthenticationError, AuthorizationError, ConflictError, ConnectionError, DOMAIN_STATUSES, InternalServerError, MESSAGE_SOURCES, MESSAGE_STATUSES, NotFoundError, Page, QuotaExceededError, RateLimitError, ShipMailClient, ShipMailError, ValidationError, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, WebhookVerificationError, ShipMailClient as default, verifyWebhook };
|
|
1469
|
+
export { AuthenticationError, AuthorizationError, CONFERENCING_PROVIDER_IDS, ConflictError, ConnectionError, DOMAIN_STATUSES, InternalServerError, MESSAGE_SOURCES, MESSAGE_STATUSES, NotFoundError, Page, QuotaExceededError, RateLimitError, ShipMailClient, ShipMailError, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, WebhookVerificationError, ShipMailClient as default, verifyWebhook };
|
|
1311
1470
|
//# sourceMappingURL=index.js.map
|
|
1312
1471
|
//# sourceMappingURL=index.js.map
|