@zavudev/sdk 0.58.0 → 0.59.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/CHANGELOG.md +27 -1
- package/README.md +18 -0
- package/client.d.mts +2 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -0
- package/client.d.ts.map +1 -1
- package/client.js +2 -0
- package/client.js.map +1 -1
- package/client.mjs +2 -0
- package/client.mjs.map +1 -1
- package/package.json +21 -1
- package/src/client.ts +2 -0
- package/src/types.ts +8 -4
- package/src/v2/index.ts +4 -0
- package/src/v2/resources/agents/agents.ts +142 -0
- package/src/v2/resources/agents/channels.ts +66 -0
- package/src/v2/resources/agents/index.ts +18 -0
- package/src/v2/resources/agents.ts +3 -0
- package/src/v2/resources/campaigns/campaigns.ts +178 -0
- package/src/v2/resources/campaigns/index.ts +27 -0
- package/src/v2/resources/campaigns/recipients.ts +62 -0
- package/src/v2/resources/campaigns.ts +3 -0
- package/src/v2/resources/channels.ts +156 -0
- package/src/v2/resources/contacts.ts +112 -0
- package/src/v2/resources/conversations.ts +89 -0
- package/src/v2/resources/email-domains.ts +107 -0
- package/src/v2/resources/functions.ts +73 -0
- package/src/v2/resources/index.ts +138 -0
- package/src/v2/resources/messages.ts +129 -0
- package/src/v2/resources/numbers.ts +74 -0
- package/src/v2/resources/templates.ts +104 -0
- package/src/v2/resources/webhook.ts +102 -0
- package/src/v2/types.ts +2412 -0
- package/src/v2/v2.ts +315 -0
- package/src/v2.ts +3 -0
- package/src/version.ts +1 -1
- package/types.d.mts +8 -4
- package/types.d.mts.map +1 -1
- package/types.d.ts +8 -4
- package/types.d.ts.map +1 -1
- package/v2/index.d.mts +3 -0
- package/v2/index.d.mts.map +1 -0
- package/v2/index.d.ts +3 -0
- package/v2/index.d.ts.map +1 -0
- package/v2/index.js +9 -0
- package/v2/index.js.map +1 -0
- package/v2/index.mjs +4 -0
- package/v2/index.mjs.map +1 -0
- package/v2/resources/agents/agents.d.mts +81 -0
- package/v2/resources/agents/agents.d.mts.map +1 -0
- package/v2/resources/agents/agents.d.ts +81 -0
- package/v2/resources/agents/agents.d.ts.map +1 -0
- package/v2/resources/agents/agents.js +88 -0
- package/v2/resources/agents/agents.js.map +1 -0
- package/v2/resources/agents/agents.mjs +83 -0
- package/v2/resources/agents/agents.mjs.map +1 -0
- package/v2/resources/agents/channels.d.mts +39 -0
- package/v2/resources/agents/channels.d.mts.map +1 -0
- package/v2/resources/agents/channels.d.ts +39 -0
- package/v2/resources/agents/channels.d.ts.map +1 -0
- package/v2/resources/agents/channels.js +44 -0
- package/v2/resources/agents/channels.js.map +1 -0
- package/v2/resources/agents/channels.mjs +40 -0
- package/v2/resources/agents/channels.mjs.map +1 -0
- package/v2/resources/agents/index.d.mts +3 -0
- package/v2/resources/agents/index.d.mts.map +1 -0
- package/v2/resources/agents/index.d.ts +3 -0
- package/v2/resources/agents/index.d.ts.map +1 -0
- package/v2/resources/agents/index.js +9 -0
- package/v2/resources/agents/index.js.map +1 -0
- package/v2/resources/agents/index.mjs +4 -0
- package/v2/resources/agents/index.mjs.map +1 -0
- package/v2/resources/agents.d.mts +2 -0
- package/v2/resources/agents.d.mts.map +1 -0
- package/v2/resources/agents.d.ts +2 -0
- package/v2/resources/agents.d.ts.map +1 -0
- package/v2/resources/agents.js +6 -0
- package/v2/resources/agents.js.map +1 -0
- package/v2/resources/agents.mjs +3 -0
- package/v2/resources/agents.mjs.map +1 -0
- package/v2/resources/campaigns/campaigns.d.mts +100 -0
- package/v2/resources/campaigns/campaigns.d.mts.map +1 -0
- package/v2/resources/campaigns/campaigns.d.ts +100 -0
- package/v2/resources/campaigns/campaigns.d.ts.map +1 -0
- package/v2/resources/campaigns/campaigns.js +106 -0
- package/v2/resources/campaigns/campaigns.js.map +1 -0
- package/v2/resources/campaigns/campaigns.mjs +101 -0
- package/v2/resources/campaigns/campaigns.mjs.map +1 -0
- package/v2/resources/campaigns/index.d.mts +3 -0
- package/v2/resources/campaigns/index.d.mts.map +1 -0
- package/v2/resources/campaigns/index.d.ts +3 -0
- package/v2/resources/campaigns/index.d.ts.map +1 -0
- package/v2/resources/campaigns/index.js +9 -0
- package/v2/resources/campaigns/index.js.map +1 -0
- package/v2/resources/campaigns/index.mjs +4 -0
- package/v2/resources/campaigns/index.mjs.map +1 -0
- package/v2/resources/campaigns/recipients.d.mts +43 -0
- package/v2/resources/campaigns/recipients.d.mts.map +1 -0
- package/v2/resources/campaigns/recipients.d.ts +43 -0
- package/v2/resources/campaigns/recipients.d.ts.map +1 -0
- package/v2/resources/campaigns/recipients.js +41 -0
- package/v2/resources/campaigns/recipients.js.map +1 -0
- package/v2/resources/campaigns/recipients.mjs +37 -0
- package/v2/resources/campaigns/recipients.mjs.map +1 -0
- package/v2/resources/campaigns.d.mts +2 -0
- package/v2/resources/campaigns.d.mts.map +1 -0
- package/v2/resources/campaigns.d.ts +2 -0
- package/v2/resources/campaigns.d.ts.map +1 -0
- package/v2/resources/campaigns.js +6 -0
- package/v2/resources/campaigns.js.map +1 -0
- package/v2/resources/campaigns.mjs +3 -0
- package/v2/resources/campaigns.mjs.map +1 -0
- package/v2/resources/channels.d.mts +101 -0
- package/v2/resources/channels.d.mts.map +1 -0
- package/v2/resources/channels.d.ts +101 -0
- package/v2/resources/channels.d.ts.map +1 -0
- package/v2/resources/channels.js +107 -0
- package/v2/resources/channels.js.map +1 -0
- package/v2/resources/channels.mjs +103 -0
- package/v2/resources/channels.mjs.map +1 -0
- package/v2/resources/contacts.d.mts +62 -0
- package/v2/resources/contacts.d.mts.map +1 -0
- package/v2/resources/contacts.d.ts +62 -0
- package/v2/resources/contacts.d.ts.map +1 -0
- package/v2/resources/contacts.js +66 -0
- package/v2/resources/contacts.js.map +1 -0
- package/v2/resources/contacts.mjs +62 -0
- package/v2/resources/contacts.mjs.map +1 -0
- package/v2/resources/conversations.d.mts +51 -0
- package/v2/resources/conversations.d.mts.map +1 -0
- package/v2/resources/conversations.d.ts +51 -0
- package/v2/resources/conversations.d.ts.map +1 -0
- package/v2/resources/conversations.js +55 -0
- package/v2/resources/conversations.js.map +1 -0
- package/v2/resources/conversations.mjs +51 -0
- package/v2/resources/conversations.mjs.map +1 -0
- package/v2/resources/email-domains.d.mts +72 -0
- package/v2/resources/email-domains.d.mts.map +1 -0
- package/v2/resources/email-domains.d.ts +72 -0
- package/v2/resources/email-domains.d.ts.map +1 -0
- package/v2/resources/email-domains.js +80 -0
- package/v2/resources/email-domains.js.map +1 -0
- package/v2/resources/email-domains.mjs +76 -0
- package/v2/resources/email-domains.mjs.map +1 -0
- package/v2/resources/functions.d.mts +41 -0
- package/v2/resources/functions.d.mts.map +1 -0
- package/v2/resources/functions.d.ts +41 -0
- package/v2/resources/functions.d.ts.map +1 -0
- package/v2/resources/functions.js +41 -0
- package/v2/resources/functions.js.map +1 -0
- package/v2/resources/functions.mjs +37 -0
- package/v2/resources/functions.mjs.map +1 -0
- package/v2/resources/index.d.mts +12 -0
- package/v2/resources/index.d.mts.map +1 -0
- package/v2/resources/index.d.ts +12 -0
- package/v2/resources/index.d.ts.map +1 -0
- package/v2/resources/index.js +27 -0
- package/v2/resources/index.js.map +1 -0
- package/v2/resources/index.mjs +13 -0
- package/v2/resources/index.mjs.map +1 -0
- package/v2/resources/messages.d.mts +82 -0
- package/v2/resources/messages.d.mts.map +1 -0
- package/v2/resources/messages.d.ts +82 -0
- package/v2/resources/messages.d.ts.map +1 -0
- package/v2/resources/messages.js +74 -0
- package/v2/resources/messages.js.map +1 -0
- package/v2/resources/messages.mjs +70 -0
- package/v2/resources/messages.mjs.map +1 -0
- package/v2/resources/numbers.d.mts +46 -0
- package/v2/resources/numbers.d.mts.map +1 -0
- package/v2/resources/numbers.d.ts +46 -0
- package/v2/resources/numbers.d.ts.map +1 -0
- package/v2/resources/numbers.js +41 -0
- package/v2/resources/numbers.js.map +1 -0
- package/v2/resources/numbers.mjs +37 -0
- package/v2/resources/numbers.mjs.map +1 -0
- package/v2/resources/templates.d.mts +56 -0
- package/v2/resources/templates.d.mts.map +1 -0
- package/v2/resources/templates.d.ts +56 -0
- package/v2/resources/templates.d.ts.map +1 -0
- package/v2/resources/templates.js +61 -0
- package/v2/resources/templates.js.map +1 -0
- package/v2/resources/templates.mjs +57 -0
- package/v2/resources/templates.mjs.map +1 -0
- package/v2/resources/webhook.d.mts +67 -0
- package/v2/resources/webhook.d.mts.map +1 -0
- package/v2/resources/webhook.d.ts +67 -0
- package/v2/resources/webhook.d.ts.map +1 -0
- package/v2/resources/webhook.js +70 -0
- package/v2/resources/webhook.js.map +1 -0
- package/v2/resources/webhook.mjs +66 -0
- package/v2/resources/webhook.mjs.map +1 -0
- package/v2/types.d.mts +2171 -0
- package/v2/types.d.mts.map +1 -0
- package/v2/types.d.ts +2171 -0
- package/v2/types.d.ts.map +1 -0
- package/v2/types.js +4 -0
- package/v2/types.js.map +1 -0
- package/v2/types.mjs +3 -0
- package/v2/types.mjs.map +1 -0
- package/v2/v2.d.mts +40 -0
- package/v2/v2.d.mts.map +1 -0
- package/v2/v2.d.ts +40 -0
- package/v2/v2.d.ts.map +1 -0
- package/v2/v2.js +47 -0
- package/v2/v2.js.map +1 -0
- package/v2/v2.mjs +42 -0
- package/v2/v2.mjs.map +1 -0
- package/v2.d.mts +2 -0
- package/v2.d.mts.map +1 -0
- package/v2.d.ts +2 -0
- package/v2.d.ts.map +1 -0
- package/v2.js +6 -0
- package/v2.js.map +1 -0
- package/v2.mjs +3 -0
- package/v2.mjs.map +1 -0
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../../../core/api-promise.js";
|
|
3
|
+
import { Cursor, PagePromise } from "../../../core/pagination.js";
|
|
4
|
+
import { RequestOptions } from "../../../internal/request-options.js";
|
|
5
|
+
import type * as T from "../../types.js";
|
|
6
|
+
import * as RecipientsAPI from "./recipients.js";
|
|
7
|
+
import { Recipients, type RecipientAddParams, type RecipientAddResponse, type BroadcastContactInput, type BroadcastContactsAddResponse } from "./recipients.js";
|
|
8
|
+
export declare class Campaigns extends APIResource {
|
|
9
|
+
recipients: RecipientsAPI.Recipients;
|
|
10
|
+
/**
|
|
11
|
+
* List campaigns
|
|
12
|
+
*
|
|
13
|
+
* Campaigns of this project, newest first, as `GET /v1/broadcasts`, each with
|
|
14
|
+
* `from` instead of `senderId`. Cursor pagination: pass `nextCursor` back as
|
|
15
|
+
* `cursor`.
|
|
16
|
+
*
|
|
17
|
+
* `GET /v2/campaigns`
|
|
18
|
+
*/
|
|
19
|
+
list(query?: CampaignListParams | null | undefined, options?: RequestOptions): PagePromise<BroadcastsCursor, Broadcast>;
|
|
20
|
+
/**
|
|
21
|
+
* Create a campaign
|
|
22
|
+
*
|
|
23
|
+
* A campaign is a /v1 broadcast; the id works on `/v1/broadcasts/{broadcastId}`.
|
|
24
|
+
* Runs `POST /v1/broadcasts` with the sender resolved from `from`. A repeated
|
|
25
|
+
* `idempotencyKey` answers `409 conflict` with the original in `details.campaign`.
|
|
26
|
+
* A `channel` the resolved sender does not carry (`smart`: no channel at all) is
|
|
27
|
+
* refused at creation with `409 no_channel`, as on `POST /v2/messages`, rather
|
|
28
|
+
* than created and failed at send. `from` with a `channel` it does not carry (a
|
|
29
|
+
* `sms` campaign `from: "sms_oneway"`) is that same `409 no_channel`, in the words
|
|
30
|
+
* `POST /v2/messages` uses (`details.connected`, and `sms` vs `sms_oneway` told
|
|
31
|
+
* apart); `channel` only picks between senders that share an address, it never
|
|
32
|
+
* makes an existing address `404`.
|
|
33
|
+
*
|
|
34
|
+
* `POST /v2/campaigns`
|
|
35
|
+
*/
|
|
36
|
+
create(body: CampaignCreateParams, options?: RequestOptions): APIPromise<CampaignCreateResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Get a campaign
|
|
39
|
+
*
|
|
40
|
+
* `GET /v2/campaigns/{campaignId}`
|
|
41
|
+
*/
|
|
42
|
+
retrieve(campaignID: string, options?: RequestOptions): APIPromise<CampaignRetrieveResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Delete a draft campaign
|
|
45
|
+
*
|
|
46
|
+
* Deletes a campaign that is still a `draft`, as `DELETE
|
|
47
|
+
* /v1/broadcasts/{broadcastId}`. Any other status is refused with `409
|
|
48
|
+
* invalid_status` (`details.status`): a campaign that was sent or cancelled is
|
|
49
|
+
* kept as the record of what went out, and one still in review, scheduled or
|
|
50
|
+
* sending is cancelled with `POST /v2/campaigns/{campaignId}/cancel`
|
|
51
|
+
* (`details.recommendation`). /v1 refuses the same with a `400`.
|
|
52
|
+
*
|
|
53
|
+
* `DELETE /v2/campaigns/{campaignId}`
|
|
54
|
+
*/
|
|
55
|
+
delete(campaignID: string, options?: RequestOptions): APIPromise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Send or schedule a campaign
|
|
58
|
+
*
|
|
59
|
+
* Same review rules as `POST /v1/broadcasts/{broadcastId}/send`: a WhatsApp
|
|
60
|
+
* campaign on an approved template starts directly, email starts once automated
|
|
61
|
+
* review passes, other channels wait for a person. Omit `scheduledAt` to send now.
|
|
62
|
+
*
|
|
63
|
+
* `POST /v2/campaigns/{campaignId}/send`
|
|
64
|
+
*/
|
|
65
|
+
send(campaignID: string, body?: CampaignSendParams | null | undefined, options?: RequestOptions): APIPromise<CampaignSendResponse>;
|
|
66
|
+
/**
|
|
67
|
+
* Get campaign progress
|
|
68
|
+
*
|
|
69
|
+
* `GET /v2/campaigns/{campaignId}/progress`
|
|
70
|
+
*/
|
|
71
|
+
progress(campaignID: string, options?: RequestOptions): APIPromise<CampaignProgressResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* Cancel a campaign
|
|
74
|
+
*
|
|
75
|
+
* As `POST /v1/broadcasts/{broadcastId}/cancel`. Recipients not yet sent are
|
|
76
|
+
* skipped; messages already queued may still be delivered.
|
|
77
|
+
*
|
|
78
|
+
* `POST /v2/campaigns/{campaignId}/cancel`
|
|
79
|
+
*/
|
|
80
|
+
cancel(campaignID: string, options?: RequestOptions): APIPromise<CampaignCancelResponse>;
|
|
81
|
+
}
|
|
82
|
+
export type CampaignListParams = T.CampaignsListParams;
|
|
83
|
+
export type Broadcast = T.Broadcast;
|
|
84
|
+
export type BroadcastsCursor = Cursor<T.Broadcast>;
|
|
85
|
+
export type BroadcastChannel = T.BroadcastChannel;
|
|
86
|
+
export type BroadcastContent = T.BroadcastContent;
|
|
87
|
+
export type BroadcastMessageType = T.BroadcastMessageType;
|
|
88
|
+
export type BroadcastStatus = T.BroadcastStatus;
|
|
89
|
+
export type CampaignCreateParams = T.CampaignsCreateParams;
|
|
90
|
+
export type CampaignCreateResponse = T.CreateCampaignV2Response;
|
|
91
|
+
export type CampaignRetrieveResponse = T.GetCampaignV2Response;
|
|
92
|
+
export type CampaignSendParams = T.CampaignsSendParams;
|
|
93
|
+
export type CampaignSendResponse = T.SendCampaignV2Response;
|
|
94
|
+
export type CampaignProgressResponse = T.BroadcastProgress;
|
|
95
|
+
export type BroadcastProgress = T.BroadcastProgress;
|
|
96
|
+
export type CampaignCancelResponse = T.CancelCampaignV2Response;
|
|
97
|
+
export declare namespace Campaigns {
|
|
98
|
+
export { type Broadcast as Broadcast, type BroadcastChannel as BroadcastChannel, type BroadcastContent as BroadcastContent, type BroadcastMessageType as BroadcastMessageType, type BroadcastProgress as BroadcastProgress, type BroadcastStatus as BroadcastStatus, type BroadcastsCursor as BroadcastsCursor, type CampaignCancelResponse as CampaignCancelResponse, type CampaignCreateParams as CampaignCreateParams, type CampaignCreateResponse as CampaignCreateResponse, type CampaignListParams as CampaignListParams, type CampaignProgressResponse as CampaignProgressResponse, type CampaignRetrieveResponse as CampaignRetrieveResponse, type CampaignSendParams as CampaignSendParams, type CampaignSendResponse as CampaignSendResponse, Recipients as Recipients, type RecipientAddParams as RecipientAddParams, type RecipientAddResponse as RecipientAddResponse, type BroadcastContactInput as BroadcastContactInput, type BroadcastContactsAddResponse as BroadcastContactsAddResponse, };
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=campaigns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/campaigns.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Campaigns = void 0;
|
|
5
|
+
const tslib_1 = require("../../../internal/tslib.js");
|
|
6
|
+
const resource_1 = require("../../../core/resource.js");
|
|
7
|
+
const pagination_1 = require("../../../core/pagination.js");
|
|
8
|
+
const headers_1 = require("../../../internal/headers.js");
|
|
9
|
+
const path_1 = require("../../../internal/utils/path.js");
|
|
10
|
+
const RecipientsAPI = tslib_1.__importStar(require("./recipients.js"));
|
|
11
|
+
class Campaigns extends resource_1.APIResource {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.recipients = new RecipientsAPI.Recipients(this._client);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* List campaigns
|
|
18
|
+
*
|
|
19
|
+
* Campaigns of this project, newest first, as `GET /v1/broadcasts`, each with
|
|
20
|
+
* `from` instead of `senderId`. Cursor pagination: pass `nextCursor` back as
|
|
21
|
+
* `cursor`.
|
|
22
|
+
*
|
|
23
|
+
* `GET /v2/campaigns`
|
|
24
|
+
*/
|
|
25
|
+
list(query = {}, options) {
|
|
26
|
+
return this._client.getAPIList('/v2/campaigns', (pagination_1.Cursor), { query, ...options });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a campaign
|
|
30
|
+
*
|
|
31
|
+
* A campaign is a /v1 broadcast; the id works on `/v1/broadcasts/{broadcastId}`.
|
|
32
|
+
* Runs `POST /v1/broadcasts` with the sender resolved from `from`. A repeated
|
|
33
|
+
* `idempotencyKey` answers `409 conflict` with the original in `details.campaign`.
|
|
34
|
+
* A `channel` the resolved sender does not carry (`smart`: no channel at all) is
|
|
35
|
+
* refused at creation with `409 no_channel`, as on `POST /v2/messages`, rather
|
|
36
|
+
* than created and failed at send. `from` with a `channel` it does not carry (a
|
|
37
|
+
* `sms` campaign `from: "sms_oneway"`) is that same `409 no_channel`, in the words
|
|
38
|
+
* `POST /v2/messages` uses (`details.connected`, and `sms` vs `sms_oneway` told
|
|
39
|
+
* apart); `channel` only picks between senders that share an address, it never
|
|
40
|
+
* makes an existing address `404`.
|
|
41
|
+
*
|
|
42
|
+
* `POST /v2/campaigns`
|
|
43
|
+
*/
|
|
44
|
+
create(body, options) {
|
|
45
|
+
return this._client.post('/v2/campaigns', { body, ...options });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get a campaign
|
|
49
|
+
*
|
|
50
|
+
* `GET /v2/campaigns/{campaignId}`
|
|
51
|
+
*/
|
|
52
|
+
retrieve(campaignID, options) {
|
|
53
|
+
return this._client.get((0, path_1.path) `/v2/campaigns/${campaignID}`, options);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Delete a draft campaign
|
|
57
|
+
*
|
|
58
|
+
* Deletes a campaign that is still a `draft`, as `DELETE
|
|
59
|
+
* /v1/broadcasts/{broadcastId}`. Any other status is refused with `409
|
|
60
|
+
* invalid_status` (`details.status`): a campaign that was sent or cancelled is
|
|
61
|
+
* kept as the record of what went out, and one still in review, scheduled or
|
|
62
|
+
* sending is cancelled with `POST /v2/campaigns/{campaignId}/cancel`
|
|
63
|
+
* (`details.recommendation`). /v1 refuses the same with a `400`.
|
|
64
|
+
*
|
|
65
|
+
* `DELETE /v2/campaigns/{campaignId}`
|
|
66
|
+
*/
|
|
67
|
+
delete(campaignID, options) {
|
|
68
|
+
return this._client.delete((0, path_1.path) `/v2/campaigns/${campaignID}`, {
|
|
69
|
+
...options,
|
|
70
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Send or schedule a campaign
|
|
75
|
+
*
|
|
76
|
+
* Same review rules as `POST /v1/broadcasts/{broadcastId}/send`: a WhatsApp
|
|
77
|
+
* campaign on an approved template starts directly, email starts once automated
|
|
78
|
+
* review passes, other channels wait for a person. Omit `scheduledAt` to send now.
|
|
79
|
+
*
|
|
80
|
+
* `POST /v2/campaigns/{campaignId}/send`
|
|
81
|
+
*/
|
|
82
|
+
send(campaignID, body = {}, options) {
|
|
83
|
+
return this._client.post((0, path_1.path) `/v2/campaigns/${campaignID}/send`, { body, ...options });
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get campaign progress
|
|
87
|
+
*
|
|
88
|
+
* `GET /v2/campaigns/{campaignId}/progress`
|
|
89
|
+
*/
|
|
90
|
+
progress(campaignID, options) {
|
|
91
|
+
return this._client.get((0, path_1.path) `/v2/campaigns/${campaignID}/progress`, options);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Cancel a campaign
|
|
95
|
+
*
|
|
96
|
+
* As `POST /v1/broadcasts/{broadcastId}/cancel`. Recipients not yet sent are
|
|
97
|
+
* skipped; messages already queued may still be delivered.
|
|
98
|
+
*
|
|
99
|
+
* `POST /v2/campaigns/{campaignId}/cancel`
|
|
100
|
+
*/
|
|
101
|
+
cancel(campaignID, options) {
|
|
102
|
+
return this._client.post((0, path_1.path) `/v2/campaigns/${campaignID}/cancel`, options);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.Campaigns = Campaigns;
|
|
106
|
+
//# sourceMappingURL=campaigns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.js","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/campaigns.ts"],"names":[],"mappings":";AAAA,8GAA8G;;;;AAE9G,wDAAqD;AAErD,4DAA+D;AAC/D,0DAAyD;AAEzD,0DAAoD;AAEpD,uEAA8C;AAS9C,MAAa,SAAU,SAAQ,sBAAW;IAA1C;;QACE,eAAU,GAA6B,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAuGpF,CAAC;IArGC;;;;;;;;OAQG;IACH,IAAI,CACF,QAA+C,EAAE,EACjD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAA,mBAAiB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,IAA0B,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,UAAkB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,UAAkB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,EAAE,EAAE;YAC5D,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CACF,UAAkB,EAClB,OAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,UAAkB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,WAAW,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,UAAkB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC;CACF;AAxGD,8BAwGC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
|
|
2
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
3
|
+
import { Cursor } from "../../../core/pagination.mjs";
|
|
4
|
+
import { buildHeaders } from "../../../internal/headers.mjs";
|
|
5
|
+
import { path } from "../../../internal/utils/path.mjs";
|
|
6
|
+
import * as RecipientsAPI from "./recipients.mjs";
|
|
7
|
+
export class Campaigns extends APIResource {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.recipients = new RecipientsAPI.Recipients(this._client);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* List campaigns
|
|
14
|
+
*
|
|
15
|
+
* Campaigns of this project, newest first, as `GET /v1/broadcasts`, each with
|
|
16
|
+
* `from` instead of `senderId`. Cursor pagination: pass `nextCursor` back as
|
|
17
|
+
* `cursor`.
|
|
18
|
+
*
|
|
19
|
+
* `GET /v2/campaigns`
|
|
20
|
+
*/
|
|
21
|
+
list(query = {}, options) {
|
|
22
|
+
return this._client.getAPIList('/v2/campaigns', (Cursor), { query, ...options });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a campaign
|
|
26
|
+
*
|
|
27
|
+
* A campaign is a /v1 broadcast; the id works on `/v1/broadcasts/{broadcastId}`.
|
|
28
|
+
* Runs `POST /v1/broadcasts` with the sender resolved from `from`. A repeated
|
|
29
|
+
* `idempotencyKey` answers `409 conflict` with the original in `details.campaign`.
|
|
30
|
+
* A `channel` the resolved sender does not carry (`smart`: no channel at all) is
|
|
31
|
+
* refused at creation with `409 no_channel`, as on `POST /v2/messages`, rather
|
|
32
|
+
* than created and failed at send. `from` with a `channel` it does not carry (a
|
|
33
|
+
* `sms` campaign `from: "sms_oneway"`) is that same `409 no_channel`, in the words
|
|
34
|
+
* `POST /v2/messages` uses (`details.connected`, and `sms` vs `sms_oneway` told
|
|
35
|
+
* apart); `channel` only picks between senders that share an address, it never
|
|
36
|
+
* makes an existing address `404`.
|
|
37
|
+
*
|
|
38
|
+
* `POST /v2/campaigns`
|
|
39
|
+
*/
|
|
40
|
+
create(body, options) {
|
|
41
|
+
return this._client.post('/v2/campaigns', { body, ...options });
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get a campaign
|
|
45
|
+
*
|
|
46
|
+
* `GET /v2/campaigns/{campaignId}`
|
|
47
|
+
*/
|
|
48
|
+
retrieve(campaignID, options) {
|
|
49
|
+
return this._client.get(path `/v2/campaigns/${campaignID}`, options);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Delete a draft campaign
|
|
53
|
+
*
|
|
54
|
+
* Deletes a campaign that is still a `draft`, as `DELETE
|
|
55
|
+
* /v1/broadcasts/{broadcastId}`. Any other status is refused with `409
|
|
56
|
+
* invalid_status` (`details.status`): a campaign that was sent or cancelled is
|
|
57
|
+
* kept as the record of what went out, and one still in review, scheduled or
|
|
58
|
+
* sending is cancelled with `POST /v2/campaigns/{campaignId}/cancel`
|
|
59
|
+
* (`details.recommendation`). /v1 refuses the same with a `400`.
|
|
60
|
+
*
|
|
61
|
+
* `DELETE /v2/campaigns/{campaignId}`
|
|
62
|
+
*/
|
|
63
|
+
delete(campaignID, options) {
|
|
64
|
+
return this._client.delete(path `/v2/campaigns/${campaignID}`, {
|
|
65
|
+
...options,
|
|
66
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Send or schedule a campaign
|
|
71
|
+
*
|
|
72
|
+
* Same review rules as `POST /v1/broadcasts/{broadcastId}/send`: a WhatsApp
|
|
73
|
+
* campaign on an approved template starts directly, email starts once automated
|
|
74
|
+
* review passes, other channels wait for a person. Omit `scheduledAt` to send now.
|
|
75
|
+
*
|
|
76
|
+
* `POST /v2/campaigns/{campaignId}/send`
|
|
77
|
+
*/
|
|
78
|
+
send(campaignID, body = {}, options) {
|
|
79
|
+
return this._client.post(path `/v2/campaigns/${campaignID}/send`, { body, ...options });
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get campaign progress
|
|
83
|
+
*
|
|
84
|
+
* `GET /v2/campaigns/{campaignId}/progress`
|
|
85
|
+
*/
|
|
86
|
+
progress(campaignID, options) {
|
|
87
|
+
return this._client.get(path `/v2/campaigns/${campaignID}/progress`, options);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Cancel a campaign
|
|
91
|
+
*
|
|
92
|
+
* As `POST /v1/broadcasts/{broadcastId}/cancel`. Recipients not yet sent are
|
|
93
|
+
* skipped; messages already queued may still be delivered.
|
|
94
|
+
*
|
|
95
|
+
* `POST /v2/campaigns/{campaignId}/cancel`
|
|
96
|
+
*/
|
|
97
|
+
cancel(campaignID, options) {
|
|
98
|
+
return this._client.post(path `/v2/campaigns/${campaignID}/cancel`, options);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=campaigns.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.mjs","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/campaigns.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAE9G,OAAO,EAAE,WAAW,EAAE,mCAA+B;AAErD,OAAO,EAAE,MAAM,EAAe,qCAAiC;AAC/D,OAAO,EAAE,YAAY,EAAE,sCAAkC;AAEzD,OAAO,EAAE,IAAI,EAAE,yCAAqC;AAEpD,OAAO,KAAK,aAAa,yBAAqB;AAS9C,MAAM,OAAO,SAAU,SAAQ,WAAW;IAA1C;;QACE,eAAU,GAA6B,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAuGpF,CAAC;IArGC;;;;;;;;OAQG;IACH,IAAI,CACF,QAA+C,EAAE,EACjD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAA,MAAiB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,IAA0B,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,UAAkB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,iBAAiB,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,UAAkB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,iBAAiB,UAAU,EAAE,EAAE;YAC5D,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CACF,UAAkB,EAClB,OAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,UAAU,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,UAAkB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,iBAAiB,UAAU,WAAW,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,UAAkB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,UAAU,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC;CACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Campaigns, type CampaignListParams, type Broadcast, type BroadcastsCursor, type BroadcastChannel, type BroadcastContent, type BroadcastMessageType, type BroadcastStatus, type CampaignCreateParams, type CampaignCreateResponse, type CampaignRetrieveResponse, type CampaignSendParams, type CampaignSendResponse, type CampaignProgressResponse, type BroadcastProgress, type CampaignCancelResponse, } from "./campaigns.mjs";
|
|
2
|
+
export { Recipients, type RecipientAddParams, type RecipientAddResponse, type BroadcastContactInput, type BroadcastContactsAddResponse, } from "./recipients.mjs";
|
|
3
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC5B,wBAAoB;AACrB,OAAO,EACL,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,GAClC,yBAAqB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Campaigns, type CampaignListParams, type Broadcast, type BroadcastsCursor, type BroadcastChannel, type BroadcastContent, type BroadcastMessageType, type BroadcastStatus, type CampaignCreateParams, type CampaignCreateResponse, type CampaignRetrieveResponse, type CampaignSendParams, type CampaignSendResponse, type CampaignProgressResponse, type BroadcastProgress, type CampaignCancelResponse, } from "./campaigns.js";
|
|
2
|
+
export { Recipients, type RecipientAddParams, type RecipientAddResponse, type BroadcastContactInput, type BroadcastContactsAddResponse, } from "./recipients.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC5B,uBAAoB;AACrB,OAAO,EACL,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,GAClC,wBAAqB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Recipients = exports.Campaigns = void 0;
|
|
5
|
+
var campaigns_1 = require("./campaigns.js");
|
|
6
|
+
Object.defineProperty(exports, "Campaigns", { enumerable: true, get: function () { return campaigns_1.Campaigns; } });
|
|
7
|
+
var recipients_1 = require("./recipients.js");
|
|
8
|
+
Object.defineProperty(exports, "Recipients", { enumerable: true, get: function () { return recipients_1.Recipients; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/index.ts"],"names":[],"mappings":";AAAA,8GAA8G;;;AAE9G,4CAiBqB;AAhBnB,sGAAA,SAAS,OAAA;AAiBX,8CAMsB;AALpB,wGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/index.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAE9G,OAAO,EACL,SAAS,GAgBV,wBAAoB;AACrB,OAAO,EACL,UAAU,GAKX,yBAAqB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../../../core/api-promise.mjs";
|
|
3
|
+
import { RequestOptions } from "../../../internal/request-options.mjs";
|
|
4
|
+
import type * as T from "../../types.mjs";
|
|
5
|
+
export declare class Recipients extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Add recipients
|
|
8
|
+
*
|
|
9
|
+
* Up to 1,000 per call. Recipients are held to the rules `POST /v2/messages` holds
|
|
10
|
+
* `to` to. Validation happens in two steps with different outcomes:
|
|
11
|
+
*
|
|
12
|
+
* 1. **The request as a whole.** A phone number written with spaces, dashes, dots
|
|
13
|
+
* or parentheses after its `+` is read as the E.164 number first. Then a recipient
|
|
14
|
+
* that is not a phone number, email address, BSUID or chat id makes the whole
|
|
15
|
+
* request `400`, with `details.errors[].path` naming it (`["contacts", 2,
|
|
16
|
+
* "recipient"]`); so do 8-15 bare digits on an `sms`, `sms_oneway`, `whatsapp`,
|
|
17
|
+
* `voice` or `smart` campaign, with `details.errors[].suggestion` (`+<digits>`),
|
|
18
|
+
* as a send refuses them. Nothing is added.
|
|
19
|
+
* 2. **Each recipient against the campaign.** A well-formed recipient the campaign
|
|
20
|
+
* cannot reach is skipped and reported in `invalid` and `errors[{recipient,
|
|
21
|
+
* reason, code?}]`: `code: "unreachable_by_channel"` for an email address on a
|
|
22
|
+
* phone campaign or a phone number on an email campaign; `code:
|
|
23
|
+
* "ten_dlc_required"` for a US/Canadian (+1) number on an `sms` or `sms_oneway`
|
|
24
|
+
* campaign while this project has no approved 10DLC campaign (the send would
|
|
25
|
+
* refuse it, as `POST /v2/messages` answers `403 ten_dlc_required`). Repeats of a
|
|
26
|
+
* recipient already in the campaign or in the same call are skipped as
|
|
27
|
+
* `duplicates`. The others are added, and the call answers `201`.
|
|
28
|
+
*
|
|
29
|
+
* So `201` can mean some were not added: check `invalid`. A campaign that is not a
|
|
30
|
+
* draft answers `409 invalid_status`.
|
|
31
|
+
*
|
|
32
|
+
* `POST /v2/campaigns/{campaignId}/recipients`
|
|
33
|
+
*/
|
|
34
|
+
add(campaignID: string, body: RecipientAddParams, options?: RequestOptions): APIPromise<RecipientAddResponse>;
|
|
35
|
+
}
|
|
36
|
+
export type RecipientAddParams = T.CampaignsRecipientsAddParams;
|
|
37
|
+
export type RecipientAddResponse = T.BroadcastContactsAddResponse;
|
|
38
|
+
export type BroadcastContactInput = T.BroadcastContactInput;
|
|
39
|
+
export type BroadcastContactsAddResponse = T.BroadcastContactsAddResponse;
|
|
40
|
+
export declare namespace Recipients {
|
|
41
|
+
export { type BroadcastContactInput as BroadcastContactInput, type BroadcastContactsAddResponse as BroadcastContactsAddResponse, type RecipientAddParams as RecipientAddParams, type RecipientAddResponse as RecipientAddResponse, };
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=recipients.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipients.d.mts","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/recipients.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,mCAA+B;AACrD,OAAO,EAAE,UAAU,EAAE,sCAAkC;AACvD,OAAO,EAAE,cAAc,EAAE,8CAA0C;AAEnE,OAAO,KAAK,KAAK,CAAC,wBAAoB;AAEtC,qBAAa,UAAW,SAAQ,WAAW;IACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,GAAG,CACD,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;CAGpC;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,4BAA4B,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,4BAA4B,CAAC;AAElE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,qBAAqB,CAAC;AAE5D,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,4BAA4B,CAAC;AAE1E,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC;IAClC,OAAO,EACL,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../../../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../../../internal/request-options.js";
|
|
4
|
+
import type * as T from "../../types.js";
|
|
5
|
+
export declare class Recipients extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Add recipients
|
|
8
|
+
*
|
|
9
|
+
* Up to 1,000 per call. Recipients are held to the rules `POST /v2/messages` holds
|
|
10
|
+
* `to` to. Validation happens in two steps with different outcomes:
|
|
11
|
+
*
|
|
12
|
+
* 1. **The request as a whole.** A phone number written with spaces, dashes, dots
|
|
13
|
+
* or parentheses after its `+` is read as the E.164 number first. Then a recipient
|
|
14
|
+
* that is not a phone number, email address, BSUID or chat id makes the whole
|
|
15
|
+
* request `400`, with `details.errors[].path` naming it (`["contacts", 2,
|
|
16
|
+
* "recipient"]`); so do 8-15 bare digits on an `sms`, `sms_oneway`, `whatsapp`,
|
|
17
|
+
* `voice` or `smart` campaign, with `details.errors[].suggestion` (`+<digits>`),
|
|
18
|
+
* as a send refuses them. Nothing is added.
|
|
19
|
+
* 2. **Each recipient against the campaign.** A well-formed recipient the campaign
|
|
20
|
+
* cannot reach is skipped and reported in `invalid` and `errors[{recipient,
|
|
21
|
+
* reason, code?}]`: `code: "unreachable_by_channel"` for an email address on a
|
|
22
|
+
* phone campaign or a phone number on an email campaign; `code:
|
|
23
|
+
* "ten_dlc_required"` for a US/Canadian (+1) number on an `sms` or `sms_oneway`
|
|
24
|
+
* campaign while this project has no approved 10DLC campaign (the send would
|
|
25
|
+
* refuse it, as `POST /v2/messages` answers `403 ten_dlc_required`). Repeats of a
|
|
26
|
+
* recipient already in the campaign or in the same call are skipped as
|
|
27
|
+
* `duplicates`. The others are added, and the call answers `201`.
|
|
28
|
+
*
|
|
29
|
+
* So `201` can mean some were not added: check `invalid`. A campaign that is not a
|
|
30
|
+
* draft answers `409 invalid_status`.
|
|
31
|
+
*
|
|
32
|
+
* `POST /v2/campaigns/{campaignId}/recipients`
|
|
33
|
+
*/
|
|
34
|
+
add(campaignID: string, body: RecipientAddParams, options?: RequestOptions): APIPromise<RecipientAddResponse>;
|
|
35
|
+
}
|
|
36
|
+
export type RecipientAddParams = T.CampaignsRecipientsAddParams;
|
|
37
|
+
export type RecipientAddResponse = T.BroadcastContactsAddResponse;
|
|
38
|
+
export type BroadcastContactInput = T.BroadcastContactInput;
|
|
39
|
+
export type BroadcastContactsAddResponse = T.BroadcastContactsAddResponse;
|
|
40
|
+
export declare namespace Recipients {
|
|
41
|
+
export { type BroadcastContactInput as BroadcastContactInput, type BroadcastContactsAddResponse as BroadcastContactsAddResponse, type RecipientAddParams as RecipientAddParams, type RecipientAddResponse as RecipientAddResponse, };
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=recipients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipients.d.ts","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/recipients.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,kCAA+B;AACrD,OAAO,EAAE,UAAU,EAAE,qCAAkC;AACvD,OAAO,EAAE,cAAc,EAAE,6CAA0C;AAEnE,OAAO,KAAK,KAAK,CAAC,uBAAoB;AAEtC,qBAAa,UAAW,SAAQ,WAAW;IACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,GAAG,CACD,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;CAGpC;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,4BAA4B,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,4BAA4B,CAAC;AAElE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,qBAAqB,CAAC;AAE5D,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,4BAA4B,CAAC;AAE1E,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC;IAClC,OAAO,EACL,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Recipients = void 0;
|
|
5
|
+
const resource_1 = require("../../../core/resource.js");
|
|
6
|
+
const path_1 = require("../../../internal/utils/path.js");
|
|
7
|
+
class Recipients extends resource_1.APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Add recipients
|
|
10
|
+
*
|
|
11
|
+
* Up to 1,000 per call. Recipients are held to the rules `POST /v2/messages` holds
|
|
12
|
+
* `to` to. Validation happens in two steps with different outcomes:
|
|
13
|
+
*
|
|
14
|
+
* 1. **The request as a whole.** A phone number written with spaces, dashes, dots
|
|
15
|
+
* or parentheses after its `+` is read as the E.164 number first. Then a recipient
|
|
16
|
+
* that is not a phone number, email address, BSUID or chat id makes the whole
|
|
17
|
+
* request `400`, with `details.errors[].path` naming it (`["contacts", 2,
|
|
18
|
+
* "recipient"]`); so do 8-15 bare digits on an `sms`, `sms_oneway`, `whatsapp`,
|
|
19
|
+
* `voice` or `smart` campaign, with `details.errors[].suggestion` (`+<digits>`),
|
|
20
|
+
* as a send refuses them. Nothing is added.
|
|
21
|
+
* 2. **Each recipient against the campaign.** A well-formed recipient the campaign
|
|
22
|
+
* cannot reach is skipped and reported in `invalid` and `errors[{recipient,
|
|
23
|
+
* reason, code?}]`: `code: "unreachable_by_channel"` for an email address on a
|
|
24
|
+
* phone campaign or a phone number on an email campaign; `code:
|
|
25
|
+
* "ten_dlc_required"` for a US/Canadian (+1) number on an `sms` or `sms_oneway`
|
|
26
|
+
* campaign while this project has no approved 10DLC campaign (the send would
|
|
27
|
+
* refuse it, as `POST /v2/messages` answers `403 ten_dlc_required`). Repeats of a
|
|
28
|
+
* recipient already in the campaign or in the same call are skipped as
|
|
29
|
+
* `duplicates`. The others are added, and the call answers `201`.
|
|
30
|
+
*
|
|
31
|
+
* So `201` can mean some were not added: check `invalid`. A campaign that is not a
|
|
32
|
+
* draft answers `409 invalid_status`.
|
|
33
|
+
*
|
|
34
|
+
* `POST /v2/campaigns/{campaignId}/recipients`
|
|
35
|
+
*/
|
|
36
|
+
add(campaignID, body, options) {
|
|
37
|
+
return this._client.post((0, path_1.path) `/v2/campaigns/${campaignID}/recipients`, { body, ...options });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.Recipients = Recipients;
|
|
41
|
+
//# sourceMappingURL=recipients.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipients.js","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/recipients.ts"],"names":[],"mappings":";AAAA,8GAA8G;;;AAE9G,wDAAqD;AAGrD,0DAAoD;AAGpD,MAAa,UAAW,SAAQ,sBAAW;IACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,GAAG,CACD,UAAkB,EAClB,IAAwB,EACxB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;CACF;AApCD,gCAoCC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
|
|
2
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
3
|
+
import { path } from "../../../internal/utils/path.mjs";
|
|
4
|
+
export class Recipients extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Add recipients
|
|
7
|
+
*
|
|
8
|
+
* Up to 1,000 per call. Recipients are held to the rules `POST /v2/messages` holds
|
|
9
|
+
* `to` to. Validation happens in two steps with different outcomes:
|
|
10
|
+
*
|
|
11
|
+
* 1. **The request as a whole.** A phone number written with spaces, dashes, dots
|
|
12
|
+
* or parentheses after its `+` is read as the E.164 number first. Then a recipient
|
|
13
|
+
* that is not a phone number, email address, BSUID or chat id makes the whole
|
|
14
|
+
* request `400`, with `details.errors[].path` naming it (`["contacts", 2,
|
|
15
|
+
* "recipient"]`); so do 8-15 bare digits on an `sms`, `sms_oneway`, `whatsapp`,
|
|
16
|
+
* `voice` or `smart` campaign, with `details.errors[].suggestion` (`+<digits>`),
|
|
17
|
+
* as a send refuses them. Nothing is added.
|
|
18
|
+
* 2. **Each recipient against the campaign.** A well-formed recipient the campaign
|
|
19
|
+
* cannot reach is skipped and reported in `invalid` and `errors[{recipient,
|
|
20
|
+
* reason, code?}]`: `code: "unreachable_by_channel"` for an email address on a
|
|
21
|
+
* phone campaign or a phone number on an email campaign; `code:
|
|
22
|
+
* "ten_dlc_required"` for a US/Canadian (+1) number on an `sms` or `sms_oneway`
|
|
23
|
+
* campaign while this project has no approved 10DLC campaign (the send would
|
|
24
|
+
* refuse it, as `POST /v2/messages` answers `403 ten_dlc_required`). Repeats of a
|
|
25
|
+
* recipient already in the campaign or in the same call are skipped as
|
|
26
|
+
* `duplicates`. The others are added, and the call answers `201`.
|
|
27
|
+
*
|
|
28
|
+
* So `201` can mean some were not added: check `invalid`. A campaign that is not a
|
|
29
|
+
* draft answers `409 invalid_status`.
|
|
30
|
+
*
|
|
31
|
+
* `POST /v2/campaigns/{campaignId}/recipients`
|
|
32
|
+
*/
|
|
33
|
+
add(campaignID, body, options) {
|
|
34
|
+
return this._client.post(path `/v2/campaigns/${campaignID}/recipients`, { body, ...options });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=recipients.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipients.mjs","sourceRoot":"","sources":["../../../src/v2/resources/campaigns/recipients.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAE9G,OAAO,EAAE,WAAW,EAAE,mCAA+B;AAGrD,OAAO,EAAE,IAAI,EAAE,yCAAqC;AAGpD,MAAM,OAAO,UAAW,SAAQ,WAAW;IACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,GAAG,CACD,UAAkB,EAClB,IAAwB,EACxB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,UAAU,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.d.mts","sourceRoot":"","sources":["../../src/v2/resources/campaigns.ts"],"names":[],"mappings":"AAEA,sCAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../../src/v2/resources/campaigns.ts"],"names":[],"mappings":"AAEA,qCAAkC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const tslib_1 = require("../../internal/tslib.js");
|
|
5
|
+
tslib_1.__exportStar(require("./campaigns/index.js"), exports);
|
|
6
|
+
//# sourceMappingURL=campaigns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.js","sourceRoot":"","sources":["../../src/v2/resources/campaigns.ts"],"names":[],"mappings":";AAAA,8GAA8G;;;AAE9G,+DAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.mjs","sourceRoot":"","sources":["../../src/v2/resources/campaigns.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAE9G,sCAAkC"}
|