shipmail 0.1.32 → 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 CHANGED
@@ -87,6 +87,7 @@ const shipmail = new ShipMailClient({
87
87
  timeout: 30_000,
88
88
  fetch: customFetch,
89
89
  defaultHeaders: { "x-app-name": "my-app" },
90
+ organizationId: "00000000-0000-4000-8000-000000000123",
90
91
  });
91
92
  ```
92
93
 
@@ -98,6 +99,7 @@ const shipmail = new ShipMailClient({
98
99
  | `timeout` | `number` | `30_000` | Per-request timeout in ms. |
99
100
  | `fetch` | `typeof fetch` | `globalThis.fetch` | Custom fetch implementation. |
100
101
  | `defaultHeaders` | `Record<string, string>` | `{}` | Headers added to every request. |
102
+ | `organizationId` | `string` | none | Delegated child organization for approved infrastructure calls. |
101
103
 
102
104
  ## Domains
103
105
 
@@ -349,6 +351,42 @@ URLs, and video thumbnails contribute to deliverability checks.
349
351
  Block prose fields are plain text in API requests. Use newlines for paragraph
350
352
  breaks, and use `body_html` or `custom_html` only when you need raw HTML.
351
353
 
354
+ ## Partner beta
355
+
356
+ Approved partner accounts can create isolated operator-owned organizations and read consolidated
357
+ usage:
358
+
359
+ ```ts
360
+ const child = await shipmail.partner.createOrganization(
361
+ {
362
+ name: "Operator",
363
+ external_reference: "operator_123",
364
+ owner_email: "owner@example.com",
365
+ mailbox_limit: 3,
366
+ data_classification: "internal_test",
367
+ },
368
+ { idempotencyKey: "operator-123" },
369
+ );
370
+
371
+ const delegated = new ShipMailClient({
372
+ apiKey: process.env.SHIPMAIL_API_KEY!,
373
+ organizationId: child.organization_id,
374
+ });
375
+
376
+ await delegated.domains.list();
377
+ await delegated.mailboxes.create({
378
+ domain_id: "dom_...",
379
+ address: "support",
380
+ generate_password: true,
381
+ });
382
+ await shipmail.partner.usage();
383
+ ```
384
+
385
+ Use a separate client for delegated infrastructure. Partner target context is not accepted by
386
+ message, thread, calendar, contacts, export, suppression, billing, or password endpoints. The beta
387
+ requires Shipmail approval and externally owned domains. Delegated mailbox creation must use
388
+ `generate_password: true`; the generated primary password is never returned to the partner.
389
+
352
390
  ## Status
353
391
 
354
392
  ```ts
@@ -435,6 +473,7 @@ type MethodOptions = {
435
473
  signal?: AbortSignal;
436
474
  headers?: Record<string, string>;
437
475
  idempotencyKey?: string;
476
+ organizationId?: string;
438
477
  };
439
478
  ```
440
479
 
package/dist/index.cjs CHANGED
@@ -978,6 +978,72 @@ var Newsletters = class extends ApiResource {
978
978
  }
979
979
  };
980
980
 
981
+ // src/resources/partner.ts
982
+ var Partner = class extends ApiResource {
983
+ listOrganizations(options) {
984
+ return this.client.request({
985
+ method: "GET",
986
+ path: "/partner/organizations",
987
+ methodOptions: options
988
+ });
989
+ }
990
+ createOrganization(params, options) {
991
+ return this.client.request({
992
+ method: "POST",
993
+ path: "/partner/organizations",
994
+ body: params,
995
+ methodOptions: options
996
+ });
997
+ }
998
+ getOrganization(id, options) {
999
+ return this.client.request({
1000
+ method: "GET",
1001
+ path: `/partner/organizations/${encodeURIComponent(id)}`,
1002
+ methodOptions: options
1003
+ });
1004
+ }
1005
+ updateOrganization(id, params, options) {
1006
+ return this.client.request({
1007
+ method: "PATCH",
1008
+ path: `/partner/organizations/${encodeURIComponent(id)}`,
1009
+ body: params,
1010
+ methodOptions: options
1011
+ });
1012
+ }
1013
+ resendOwnershipInvitation(id, params = {}, options) {
1014
+ return this.client.request({
1015
+ method: "POST",
1016
+ path: `/partner/organizations/${encodeURIComponent(id)}/ownership-invitations`,
1017
+ body: params,
1018
+ methodOptions: options
1019
+ });
1020
+ }
1021
+ suspendOrganization(id, options) {
1022
+ return this.client.request({
1023
+ method: "POST",
1024
+ path: `/partner/organizations/${encodeURIComponent(id)}/suspend`,
1025
+ methodOptions: options
1026
+ });
1027
+ }
1028
+ resumeOrganization(id, options) {
1029
+ return this.client.request({
1030
+ method: "POST",
1031
+ path: `/partner/organizations/${encodeURIComponent(id)}/resume`,
1032
+ methodOptions: options
1033
+ });
1034
+ }
1035
+ offboardOrganization(id, options) {
1036
+ return this.client.request({
1037
+ method: "DELETE",
1038
+ path: `/partner/organizations/${encodeURIComponent(id)}`,
1039
+ methodOptions: options
1040
+ });
1041
+ }
1042
+ usage(options) {
1043
+ return this.client.request({ method: "GET", path: "/partner/usage", methodOptions: options });
1044
+ }
1045
+ };
1046
+
981
1047
  // src/resources/status.ts
982
1048
  var Status = class extends ApiResource {
983
1049
  get(options) {
@@ -1160,7 +1226,7 @@ var Webhooks = class extends ApiResource {
1160
1226
  };
1161
1227
 
1162
1228
  // src/version.ts
1163
- var VERSION = "0.1.32";
1229
+ var VERSION = "0.1.33";
1164
1230
 
1165
1231
  // src/client.ts
1166
1232
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -1203,6 +1269,7 @@ var ShipMailClient = class {
1203
1269
  this.timeout = DEFAULT_TIMEOUT;
1204
1270
  this.fetchFn = globalThis.fetch;
1205
1271
  this.defaultHeaders = {};
1272
+ this.organizationId = void 0;
1206
1273
  } else {
1207
1274
  this.apiKey = config.apiKey;
1208
1275
  this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
@@ -1210,6 +1277,7 @@ var ShipMailClient = class {
1210
1277
  this.timeout = config.timeout ?? DEFAULT_TIMEOUT;
1211
1278
  this.fetchFn = config.fetch ?? globalThis.fetch;
1212
1279
  this.defaultHeaders = config.defaultHeaders ? { ...config.defaultHeaders } : {};
1280
+ this.organizationId = config.organizationId;
1213
1281
  }
1214
1282
  this.audiences = new Audiences(this);
1215
1283
  this.bookingPages = new BookingPages(this);
@@ -1218,6 +1286,7 @@ var ShipMailClient = class {
1218
1286
  this.mailboxes = new Mailboxes(this);
1219
1287
  this.messages = new Messages(this);
1220
1288
  this.newsletters = new Newsletters(this);
1289
+ this.partner = new Partner(this);
1221
1290
  this.suppressions = new Suppressions(this);
1222
1291
  this.threads = new Threads(this);
1223
1292
  this.webhooks = new Webhooks(this);
@@ -1258,6 +1327,10 @@ var ShipMailClient = class {
1258
1327
  if (methodOpts?.idempotencyKey) {
1259
1328
  headers["Idempotency-Key"] = methodOpts.idempotencyKey;
1260
1329
  }
1330
+ const targetOrganizationId = methodOpts?.organizationId ?? this.organizationId;
1331
+ if (targetOrganizationId) {
1332
+ headers["X-ShipMail-Organization-Id"] = targetOrganizationId;
1333
+ }
1261
1334
  let body = null;
1262
1335
  if (options.rawBody !== void 0) {
1263
1336
  headers["Content-Type"] = options.contentType ?? "application/octet-stream";
@@ -1314,6 +1387,9 @@ var ShipMailClient = class {
1314
1387
  }
1315
1388
  };
1316
1389
 
1390
+ // src/types/booking-page.ts
1391
+ var CONFERENCING_PROVIDER_IDS = ["zoom", "google_meet"];
1392
+
1317
1393
  // src/types/common.ts
1318
1394
  var WEBHOOK_EVENT_TYPES = [
1319
1395
  "message.received",
@@ -1396,6 +1472,7 @@ async function verifyWebhook(body, headers, secret, options) {
1396
1472
 
1397
1473
  exports.AuthenticationError = AuthenticationError;
1398
1474
  exports.AuthorizationError = AuthorizationError;
1475
+ exports.CONFERENCING_PROVIDER_IDS = CONFERENCING_PROVIDER_IDS;
1399
1476
  exports.ConflictError = ConflictError;
1400
1477
  exports.ConnectionError = ConnectionError;
1401
1478
  exports.DOMAIN_STATUSES = DOMAIN_STATUSES;