@myapihq/sdk 2.23.1 → 2.23.3

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/email.d.ts CHANGED
@@ -64,10 +64,23 @@ export interface VerifyJob {
64
64
  }
65
65
  export declare function verifyBulk(apiKey: string, orgId: string, emails: string[], catchAll?: boolean): Promise<VerifyJob>;
66
66
  export declare function getVerifyJob(apiKey: string, orgId: string, jobId: string): Promise<VerifyJob>;
67
- export declare function createMailbox(apiKey: string, domain: string, username: string, displayName?: string): Promise<{
68
- address: string;
67
+ /** What POST /email/mailboxes/create actually returns.
68
+ *
69
+ * The address comes back as `mailbox`, not `address` — it always has. The SDK
70
+ * declared `address`, the CLI had a fallback that derived it from the inputs,
71
+ * and because that fallback is right by luck the mismatch never surfaced.
72
+ * Anyone who trusted the old type got `undefined` with no type error.
73
+ */
74
+ export interface CreatedMailbox {
75
+ mailbox: string;
76
+ status: string;
69
77
  created_at: string;
70
- }>;
78
+ /** Present when something is configured but incomplete — today, a missing
79
+ * CAN-SPAM mailing address, which makes sending fail later rather than now.
80
+ * Surface it; it names the route that clears it. */
81
+ warning?: string;
82
+ }
83
+ export declare function createMailbox(apiKey: string, domain: string, username: string, displayName?: string): Promise<CreatedMailbox>;
71
84
  export declare function deleteMailbox(apiKey: string, address: string): Promise<void>;
72
85
  export declare function mailServerResync(apiKey: string, orgId: string, domain: string): Promise<{
73
86
  ok: boolean;
@@ -171,7 +184,8 @@ export interface CampaignListSource {
171
184
  }
172
185
  export interface CreateCampaignInput {
173
186
  name: string;
174
- template_id: string;
187
+ /** Null once the template it was built from has been deleted — the campaign and its send log survive that. */
188
+ template_id: string | null;
175
189
  from_address: string;
176
190
  source_kind: CampaignSourceKind;
177
191
  source_ref?: CampaignCRMQuery | CampaignListSource;
@@ -227,5 +241,15 @@ export declare function startCampaign(apiKey: string, orgId: string, id: string)
227
241
  export declare function pauseCampaign(apiKey: string, orgId: string, id: string): Promise<Campaign>;
228
242
  export declare function resumeCampaign(apiKey: string, orgId: string, id: string): Promise<Campaign>;
229
243
  export declare function cancelCampaign(apiKey: string, orgId: string, id: string): Promise<Campaign>;
244
+ /**
245
+ * Removes the campaign and its recipient rows. Messages already sent stay in
246
+ * the send log — deleting a campaign must not erase the record that mail went
247
+ * out. Refuses (409 CAMPAIGN_ACTIVE) while it is still sending.
248
+ */
249
+ export declare function deleteCampaign(apiKey: string, orgId: string, id: string): Promise<{
250
+ deleted: boolean;
251
+ id: string;
252
+ note?: string;
253
+ }>;
230
254
  export declare function listCampaignRecipients(apiKey: string, orgId: string, id: string, state?: string): Promise<CampaignRecipient[]>;
231
255
  export declare function getCampaignStats(apiKey: string, orgId: string, id: string): Promise<CampaignStats>;
package/dist/email.js CHANGED
@@ -39,6 +39,7 @@ exports.startCampaign = startCampaign;
39
39
  exports.pauseCampaign = pauseCampaign;
40
40
  exports.resumeCampaign = resumeCampaign;
41
41
  exports.cancelCampaign = cancelCampaign;
42
+ exports.deleteCampaign = deleteCampaign;
42
43
  exports.listCampaignRecipients = listCampaignRecipients;
43
44
  exports.getCampaignStats = getCampaignStats;
44
45
  const client_1 = require("./client");
@@ -82,6 +83,7 @@ exports.EXPOSES = [
82
83
  'POST /email/orgs/{org_id}/campaigns',
83
84
  'GET /email/orgs/{org_id}/campaigns',
84
85
  'GET /email/orgs/{org_id}/campaigns/{campaign_id}',
86
+ 'DELETE /email/orgs/{org_id}/campaigns/{campaign_id}',
85
87
  'PATCH /email/orgs/{org_id}/campaigns/{campaign_id}',
86
88
  'POST /email/orgs/{org_id}/campaigns/{campaign_id}/resolve',
87
89
  'POST /email/orgs/{org_id}/campaigns/{campaign_id}/start',
@@ -107,7 +109,6 @@ async function verifyBulk(apiKey, orgId, emails, catchAll) {
107
109
  async function getVerifyJob(apiKey, orgId, jobId) {
108
110
  return (0, client_1.request)('GET', `${config_1.EMAIL_BASE}/email/orgs/${encodeURIComponent(orgId)}/verify-jobs/${encodeURIComponent(jobId)}`, apiKey);
109
111
  }
110
- // ── Mailbox ops (account-scoped) ─────────────────────────────────────────────
111
112
  async function createMailbox(apiKey, domain, username, displayName) {
112
113
  return (0, client_1.request)('POST', `${config_1.EMAIL_BASE}/email/mailboxes/create`, apiKey, { domain, username, display_name: displayName });
113
114
  }
@@ -255,6 +256,14 @@ async function resumeCampaign(apiKey, orgId, id) {
255
256
  async function cancelCampaign(apiKey, orgId, id) {
256
257
  return (0, client_1.request)('POST', `${campaignUrl(orgId, id)}/cancel`, apiKey);
257
258
  }
259
+ /**
260
+ * Removes the campaign and its recipient rows. Messages already sent stay in
261
+ * the send log — deleting a campaign must not erase the record that mail went
262
+ * out. Refuses (409 CAMPAIGN_ACTIVE) while it is still sending.
263
+ */
264
+ async function deleteCampaign(apiKey, orgId, id) {
265
+ return (0, client_1.request)('DELETE', campaignUrl(orgId, id), apiKey);
266
+ }
258
267
  async function listCampaignRecipients(apiKey, orgId, id, state) {
259
268
  const url = state
260
269
  ? `${campaignUrl(orgId, id)}/recipients?state=${encodeURIComponent(state)}`
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.23.1";
1
+ export declare const SDK_VERSION = "2.23.3";
package/dist/version.js CHANGED
@@ -8,4 +8,4 @@ exports.SDK_VERSION = void 0;
8
8
  // Why a constant and not a package.json read: the SDK runs inside edge
9
9
  // functions (Cloudflare Workers), so it must not import node:fs. A literal
10
10
  // is the only version source that works in every runtime we ship to.
11
- exports.SDK_VERSION = '2.23.1';
11
+ exports.SDK_VERSION = '2.23.3';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@myapihq/sdk",
3
3
  "license": "Apache-2.0",
4
- "version": "2.23.1",
4
+ "version": "2.23.3",
5
5
  "description": "TypeScript SDK for the MyAPI ecosystem",
6
6
  "repository": {
7
7
  "type": "git",