shipmail 0.1.31 → 0.1.32

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 CHANGED
@@ -18,6 +18,7 @@ Official TypeScript SDK for the [Shipmail](https://shipmail.to) API. Zero runtim
18
18
  - [Domains](#domains)
19
19
  - [Mailboxes](#mailboxes)
20
20
  - [Messages](#messages)
21
+ - [Sandbox](#sandbox)
21
22
  - [Threads](#threads)
22
23
  - [Webhooks](#webhooks)
23
24
  - [Suppressions](#suppressions)
@@ -60,7 +61,12 @@ const message = await shipmail.messages.send({
60
61
  subject: "Hello",
61
62
  text: "Hi there",
62
63
  html: "<p>Hi there</p>",
64
+ client_reference: "crm-123",
65
+ metadata: { campaign: "onboarding" },
66
+ source_rfc_message_id: "<crm-123@example.com>",
63
67
  });
68
+
69
+ const sameMessage = await shipmail.messages.list({ client_reference: "crm-123" });
64
70
  ```
65
71
 
66
72
  The SDK does not auto-read environment variables. Pass the key explicitly.
@@ -99,6 +105,7 @@ const shipmail = new ShipMailClient({
99
105
  await shipmail.domains.create({ name: "example.com" });
100
106
  await shipmail.domains.list({ limit: 10 });
101
107
  await shipmail.domains.get("dom_...");
108
+ await shipmail.domains.getDnsRecords("dom_...");
102
109
  await shipmail.domains.update("dom_...", { catch_all_mailbox_id: "mbx_..." });
103
110
  await shipmail.domains.delete("dom_...");
104
111
  await shipmail.domains.verify("dom_...");
@@ -121,12 +128,20 @@ await shipmail.domains.register({
121
128
  await shipmail.mailboxes.create({
122
129
  domain_id: "dom_...",
123
130
  address: "hello",
131
+ password: "StrongPass123",
124
132
  display_name: "Hello",
125
133
  });
126
134
  await shipmail.mailboxes.list({ domain_id: "dom_..." });
127
135
  await shipmail.mailboxes.get("mbx_...");
128
136
  await shipmail.mailboxes.update("mbx_...", { display_name: "New Name" });
137
+ await shipmail.mailboxes.suspend("mbx_...");
138
+ await shipmail.mailboxes.resume("mbx_...");
129
139
  await shipmail.mailboxes.resetPassword("mbx_...", { password: "NewPassword1" });
140
+ const forwarding = await shipmail.mailboxes.createForwarding("mbx_...", {
141
+ destination: "owner@example.net",
142
+ });
143
+ const forwardingList = await shipmail.mailboxes.listForwarding("mbx_...");
144
+ await shipmail.mailboxes.deleteForwarding("mbx_...", forwarding.id);
130
145
  const folders = await shipmail.mailboxes.listFolders("mbx_...");
131
146
  const folder = await shipmail.mailboxes.createFolder("mbx_...", {
132
147
  name: "VIP",
@@ -170,6 +185,28 @@ await shipmail.messages.reply("msg_...", {
170
185
  });
171
186
  ```
172
187
 
188
+ ## Sandbox
189
+
190
+ Create a test API key (`sm_test_...`) to simulate email without contacting real recipients. Test messages, threads, rules, webhooks, quota, suppressions, and reputation are isolated from live mode.
191
+
192
+ ```ts
193
+ const testClient = new ShipMailClient("sm_test_...");
194
+
195
+ await testClient.messages.send({
196
+ mailbox_id: "mbx_...",
197
+ to: ["customer@example.com"],
198
+ subject: "Sandbox test",
199
+ text: "Not delivered",
200
+ sandbox_outcome: "bounced",
201
+ });
202
+
203
+ await testClient.mailboxes.injectSandboxInbound("mbx_...", {
204
+ from: "customer@example.com",
205
+ subject: "Re: Sandbox test",
206
+ text: "Fake inbound reply",
207
+ });
208
+ ```
209
+
173
210
  ## Threads
174
211
 
175
212
  ```ts
@@ -200,6 +237,10 @@ await shipmail.webhooks.delete("whk_...");
200
237
  await shipmail.webhooks.rotateSecret("whk_...");
201
238
  await shipmail.webhooks.test("whk_...");
202
239
  await shipmail.webhooks.listDeliveries("whk_...");
240
+ await shipmail.webhooks.getDelivery("whk_...", "dlv_...");
241
+ await shipmail.webhooks.replayDelivery("whk_...", "dlv_...", {
242
+ idempotencyKey: "replay-dlv-123",
243
+ });
203
244
  ```
204
245
 
205
246
  Supported event types:
package/dist/index.cjs CHANGED
@@ -446,6 +446,13 @@ var Domains = class extends ApiResource {
446
446
  methodOptions: options
447
447
  });
448
448
  }
449
+ getDnsRecords(id, options) {
450
+ return this.client.request({
451
+ method: "GET",
452
+ path: `/domains/${encodeURIComponent(id)}/dns-records`,
453
+ methodOptions: options
454
+ });
455
+ }
449
456
  update(id, params, options) {
450
457
  return this.client.request({
451
458
  method: "PATCH",
@@ -488,6 +495,14 @@ var Domains = class extends ApiResource {
488
495
 
489
496
  // src/resources/mailboxes.ts
490
497
  var Mailboxes = class extends ApiResource {
498
+ injectSandboxInbound(id, params, options) {
499
+ return this.client.request({
500
+ method: "POST",
501
+ path: `/mailboxes/${encodeURIComponent(id)}/sandbox/inbound`,
502
+ body: params,
503
+ methodOptions: options
504
+ });
505
+ }
491
506
  create(params, options) {
492
507
  return this.client.request({
493
508
  method: "POST",
@@ -536,6 +551,34 @@ var Mailboxes = class extends ApiResource {
536
551
  methodOptions: options
537
552
  });
538
553
  }
554
+ suspend(id, options) {
555
+ return this.client.request({
556
+ method: "POST",
557
+ path: `/mailboxes/${encodeURIComponent(id)}/suspend`,
558
+ methodOptions: options
559
+ });
560
+ }
561
+ resume(id, options) {
562
+ return this.client.request({
563
+ method: "POST",
564
+ path: `/mailboxes/${encodeURIComponent(id)}/resume`,
565
+ methodOptions: options
566
+ });
567
+ }
568
+ createExport(id, options) {
569
+ return this.client.request({
570
+ method: "POST",
571
+ path: `/mailboxes/${encodeURIComponent(id)}/exports`,
572
+ methodOptions: options
573
+ });
574
+ }
575
+ getExport(id, exportId, options) {
576
+ return this.client.request({
577
+ method: "GET",
578
+ path: `/mailboxes/${encodeURIComponent(id)}/exports/${encodeURIComponent(exportId)}`,
579
+ methodOptions: options
580
+ });
581
+ }
539
582
  listFolders(id, options) {
540
583
  return this.client.request({
541
584
  method: "GET",
@@ -653,6 +696,28 @@ var Mailboxes = class extends ApiResource {
653
696
  methodOptions: options
654
697
  });
655
698
  }
699
+ listForwarding(id, options) {
700
+ return this.client.request({
701
+ method: "GET",
702
+ path: `/mailboxes/${encodeURIComponent(id)}/forwarding`,
703
+ methodOptions: options
704
+ });
705
+ }
706
+ createForwarding(id, params, options) {
707
+ return this.client.request({
708
+ method: "POST",
709
+ path: `/mailboxes/${encodeURIComponent(id)}/forwarding`,
710
+ body: params,
711
+ methodOptions: options
712
+ });
713
+ }
714
+ deleteForwarding(id, forwardingId, options) {
715
+ return this.client.request({
716
+ method: "DELETE",
717
+ path: `/mailboxes/${encodeURIComponent(id)}/forwarding/${encodeURIComponent(forwardingId)}`,
718
+ methodOptions: options
719
+ });
720
+ }
656
721
  updateAutoReply(id, params, options) {
657
722
  return this.client.request({
658
723
  method: "PATCH",
@@ -731,6 +796,7 @@ var Messages = class extends ApiResource {
731
796
  path: "/messages",
732
797
  query: {
733
798
  mailbox_id: params.mailbox_id,
799
+ client_reference: params.client_reference,
734
800
  cursor: params.cursor,
735
801
  limit: params.limit
736
802
  },
@@ -740,6 +806,7 @@ var Messages = class extends ApiResource {
740
806
  listAutoPaginating(params) {
741
807
  return new Page(this.client, "/messages", {
742
808
  mailbox_id: params.mailbox_id,
809
+ client_reference: params.client_reference,
743
810
  limit: params.limit
744
811
  });
745
812
  }
@@ -1076,10 +1143,24 @@ var Webhooks = class extends ApiResource {
1076
1143
  }
1077
1144
  );
1078
1145
  }
1146
+ getDelivery(id, deliveryId, options) {
1147
+ return this.client.request({
1148
+ method: "GET",
1149
+ path: `/webhooks/${encodeURIComponent(id)}/deliveries/${encodeURIComponent(deliveryId)}`,
1150
+ methodOptions: options
1151
+ });
1152
+ }
1153
+ replayDelivery(id, deliveryId, options) {
1154
+ return this.client.request({
1155
+ method: "POST",
1156
+ path: `/webhooks/${encodeURIComponent(id)}/deliveries/${encodeURIComponent(deliveryId)}/replay`,
1157
+ methodOptions: options
1158
+ });
1159
+ }
1079
1160
  };
1080
1161
 
1081
1162
  // src/version.ts
1082
- var VERSION = "0.1.31";
1163
+ var VERSION = "0.1.32";
1083
1164
 
1084
1165
  // src/client.ts
1085
1166
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -1240,6 +1321,7 @@ var WEBHOOK_EVENT_TYPES = [
1240
1321
  "message.delivered",
1241
1322
  "message.bounced",
1242
1323
  "message.complained",
1324
+ "mailbox.rule_matched",
1243
1325
  "domain.verified",
1244
1326
  "domain.verification_failed",
1245
1327
  "domain.degraded",
@@ -1248,6 +1330,7 @@ var WEBHOOK_EVENT_TYPES = [
1248
1330
  "org.sending_suspended",
1249
1331
  "org.reputation_recovered"
1250
1332
  ];
1333
+ var WEBHOOK_DELIVERY_EVENT_TYPES = ["webhook.test", ...WEBHOOK_EVENT_TYPES];
1251
1334
  var DOMAIN_STATUSES = ["pending", "verifying", "verified", "degraded", "failed"];
1252
1335
  var MESSAGE_STATUSES = [
1253
1336
  "scheduled",
@@ -1326,6 +1409,7 @@ exports.RateLimitError = RateLimitError;
1326
1409
  exports.ShipMailClient = ShipMailClient;
1327
1410
  exports.ShipMailError = ShipMailError;
1328
1411
  exports.ValidationError = ValidationError;
1412
+ exports.WEBHOOK_DELIVERY_EVENT_TYPES = WEBHOOK_DELIVERY_EVENT_TYPES;
1329
1413
  exports.WEBHOOK_DELIVERY_STATUSES = WEBHOOK_DELIVERY_STATUSES;
1330
1414
  exports.WEBHOOK_EVENT_TYPES = WEBHOOK_EVENT_TYPES;
1331
1415
  exports.WebhookVerificationError = WebhookVerificationError;