@polymorfa/sdk 0.1.0-dev.20260923101121 → 0.1.0-dev.20260923115248
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 +141 -59
- package/dist/calls/diagnostics.d.ts +1 -1
- package/dist/calls/diagnostics.js +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -0
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +3 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/messaging/campaigns.d.ts +19 -2
- package/dist/messaging/campaigns.d.ts.map +1 -1
- package/dist/messaging/campaigns.js +45 -3
- package/dist/messaging/campaigns.js.map +1 -1
- package/dist/messaging/types.d.ts +77 -0
- package/dist/messaging/types.d.ts.map +1 -1
- package/dist/messaging/types.js.map +1 -1
- package/dist/platform/audiences.d.ts +21 -2
- package/dist/platform/audiences.d.ts.map +1 -1
- package/dist/platform/audiences.js +52 -1
- package/dist/platform/audiences.js.map +1 -1
- package/dist/platform/call-retention.d.ts +86 -0
- package/dist/platform/call-retention.d.ts.map +1 -0
- package/dist/platform/call-retention.js +62 -0
- package/dist/platform/call-retention.js.map +1 -0
- package/dist/platform/campaigns.d.ts +29 -8
- package/dist/platform/campaigns.d.ts.map +1 -1
- package/dist/platform/campaigns.js +76 -13
- package/dist/platform/campaigns.js.map +1 -1
- package/dist/platform/opt-outs.d.ts +5 -1
- package/dist/platform/opt-outs.d.ts.map +1 -1
- package/dist/platform/opt-outs.js +18 -0
- package/dist/platform/opt-outs.js.map +1 -1
- package/dist/platform/types.d.ts +161 -0
- package/dist/platform/types.d.ts.map +1 -1
- package/dist/transport/idempotency.d.ts +10 -0
- package/dist/transport/idempotency.d.ts.map +1 -1
- package/dist/transport/idempotency.js +14 -0
- package/dist/transport/idempotency.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/webhooks/events.d.ts +21 -1
- package/dist/webhooks/events.d.ts.map +1 -1
- package/dist/webhooks/events.js +2 -0
- package/dist/webhooks/events.js.map +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HttpTransport } from "../transport/http.js";
|
|
2
|
+
import { withoutAutomaticRetry } from "../transport/idempotency.js";
|
|
2
3
|
export class AudiencesResource {
|
|
3
4
|
transport;
|
|
4
5
|
constructor(transport) {
|
|
@@ -11,8 +12,55 @@ export class AudiencesResource {
|
|
|
11
12
|
...options,
|
|
12
13
|
});
|
|
13
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Create an audience from inline `members`, or from an uploaded spreadsheet
|
|
17
|
+
* with `fileId` and `mapping`. The result carries the import counts and up
|
|
18
|
+
* to 20 rejected rows.
|
|
19
|
+
*/
|
|
14
20
|
create(body, options = {}) {
|
|
15
|
-
return this.
|
|
21
|
+
return this.transport.request({
|
|
22
|
+
method: "POST",
|
|
23
|
+
path: "/platform/audiences",
|
|
24
|
+
body,
|
|
25
|
+
...options,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Append up to 1,000 members to an existing audience.
|
|
30
|
+
*
|
|
31
|
+
* The API declares no idempotent replay for this append, so by default the
|
|
32
|
+
* SDK sends it once and does not retry it. Setting both `maxNetworkRetries`
|
|
33
|
+
* and `idempotencyKey` on the request re-enables retries, and a retry can be
|
|
34
|
+
* processed as a new append. After a lost response, list the members before
|
|
35
|
+
* appending again.
|
|
36
|
+
*/
|
|
37
|
+
addMembers(listId, body, options = {}) {
|
|
38
|
+
return this.transport.request({
|
|
39
|
+
method: "POST",
|
|
40
|
+
path: membersPath(listId),
|
|
41
|
+
body,
|
|
42
|
+
...withoutAutomaticRetry(options),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** One cursor page of an audience's members. */
|
|
46
|
+
listMembers(listId, params = {}, options = {}) {
|
|
47
|
+
return this.transport.request({
|
|
48
|
+
method: "GET",
|
|
49
|
+
path: membersPath(listId),
|
|
50
|
+
query: {
|
|
51
|
+
...(params.cursor === undefined ? {} : { cursor: params.cursor }),
|
|
52
|
+
...(params.limit === undefined ? {} : { limit: params.limit }),
|
|
53
|
+
},
|
|
54
|
+
...options,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/** Remove one member by phone number. */
|
|
58
|
+
deleteMember(listId, phone, options = {}) {
|
|
59
|
+
return this.transport.request({
|
|
60
|
+
method: "DELETE",
|
|
61
|
+
path: `${membersPath(listId)}/${encodeURIComponent(phone)}`,
|
|
62
|
+
...options,
|
|
63
|
+
});
|
|
16
64
|
}
|
|
17
65
|
retrieve(listId, options = {}) {
|
|
18
66
|
return this.transport.request({
|
|
@@ -43,4 +91,7 @@ export class AudiencesResource {
|
|
|
43
91
|
function audiencePath(listId) {
|
|
44
92
|
return `/platform/audiences/${encodeURIComponent(listId)}`;
|
|
45
93
|
}
|
|
94
|
+
function membersPath(listId) {
|
|
95
|
+
return `${audiencePath(listId)}/members`;
|
|
96
|
+
}
|
|
46
97
|
//# sourceMappingURL=audiences.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audiences.js","sourceRoot":"","sources":["../../src/platform/audiences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"audiences.js","sourceRoot":"","sources":["../../src/platform/audiences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAgBpE,MAAM,OAAO,iBA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E,CAAC;AAC7D,CAAC;AAED,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { HttpTransport } from "../transport/http.js";
|
|
2
|
+
import { type ClientCredential, type SharedClientOptions } from "../credentials.js";
|
|
3
|
+
import type { ApiResponse, RequestOptions } from "../transport/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* How long Polymorfa keeps a team's call data: `short` (7 days), `standard`
|
|
6
|
+
* (30 days), `extended` (90 days, the default), `compliance` (365 days), or
|
|
7
|
+
* `custom` (the number of days in `retentionDays`).
|
|
8
|
+
*/
|
|
9
|
+
export type CallRetentionPolicy = "short" | "standard" | "extended" | "compliance" | "custom";
|
|
10
|
+
/** A team's call data retention. */
|
|
11
|
+
export interface CallRetention {
|
|
12
|
+
readonly policy: CallRetentionPolicy;
|
|
13
|
+
/**
|
|
14
|
+
* Days Polymorfa keeps the team's call data, from 1 to 2555. Deletion of
|
|
15
|
+
* older call data starts on a date Polymorfa announces; until then the
|
|
16
|
+
* setting records a choice and nothing is deleted. Defaults to 90.
|
|
17
|
+
*/
|
|
18
|
+
readonly retentionDays: number;
|
|
19
|
+
/**
|
|
20
|
+
* The call data the period applies to, such as `call_records`,
|
|
21
|
+
* `call_events`, and `client_reports`. New kinds of call data are added to
|
|
22
|
+
* this list and follow the same period.
|
|
23
|
+
*/
|
|
24
|
+
readonly appliesTo: readonly string[];
|
|
25
|
+
/** Increases on every change; 0 while the team uses the default. */
|
|
26
|
+
readonly revision: number;
|
|
27
|
+
/** When the setting last changed, or `null` while the team uses the default. */
|
|
28
|
+
readonly updatedAt: string | null;
|
|
29
|
+
}
|
|
30
|
+
interface UpdateCallRetentionFields {
|
|
31
|
+
/**
|
|
32
|
+
* Apply the update only if the setting still has this `revision` (0 for a
|
|
33
|
+
* team on the default). Otherwise the update fails with `state_conflict`.
|
|
34
|
+
* Omit it to apply the update without a revision check (last write wins).
|
|
35
|
+
*/
|
|
36
|
+
readonly expectedRevision?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A new call data retention. `custom` requires `retentionDays`; a named
|
|
40
|
+
* policy sets its own period, so `retentionDays` is optional there.
|
|
41
|
+
*/
|
|
42
|
+
export type UpdateCallRetentionRequest = (UpdateCallRetentionFields & {
|
|
43
|
+
/** Keep call data for the number of days in `retentionDays`. */
|
|
44
|
+
readonly policy: "custom";
|
|
45
|
+
/** A whole number of days from 1 to 2555. */
|
|
46
|
+
readonly retentionDays: number;
|
|
47
|
+
}) | (UpdateCallRetentionFields & {
|
|
48
|
+
/** A named policy sets its own period. */
|
|
49
|
+
readonly policy: Exclude<CallRetentionPolicy, "custom">;
|
|
50
|
+
/**
|
|
51
|
+
* Omit it or send exactly that policy's period; any other value fails
|
|
52
|
+
* with `invalid_parameter`.
|
|
53
|
+
*/
|
|
54
|
+
readonly retentionDays?: number;
|
|
55
|
+
});
|
|
56
|
+
/** A team-wide retention request does not need a project ID, even for a project token. */
|
|
57
|
+
export interface TeamCallRetentionClientOptions extends SharedClientOptions {
|
|
58
|
+
readonly credential: ClientCredential;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates only the team-wide call retention resource. Use this entrypoint
|
|
62
|
+
* when a project token has no project ID; project-scoped Client methods still
|
|
63
|
+
* require an explicit project ID.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createTeamCallRetentionClient(options: TeamCallRetentionClientOptions): CallRetentionResource;
|
|
66
|
+
/**
|
|
67
|
+
* The team's call data retention. It is one setting per team: project clients
|
|
68
|
+
* read the same value as their team. Changing it requires a team API key.
|
|
69
|
+
*/
|
|
70
|
+
export declare class CallRetentionResource {
|
|
71
|
+
private readonly transport;
|
|
72
|
+
constructor(transport: HttpTransport);
|
|
73
|
+
/** Returns the saved setting, or the default when the team never saved one. */
|
|
74
|
+
retrieve(options?: RequestOptions): Promise<ApiResponse<CallRetention>>;
|
|
75
|
+
/**
|
|
76
|
+
* Replaces the team's call data retention. Requires a team API key; project
|
|
77
|
+
* tokens receive `PolymorfaAuthorizationError`.
|
|
78
|
+
*
|
|
79
|
+
* Once deletion runs, a shorter period also applies to call data already
|
|
80
|
+
* stored, and deleted data cannot be recovered. Until Polymorfa announces
|
|
81
|
+
* that deletion has started, saving a period deletes nothing.
|
|
82
|
+
*/
|
|
83
|
+
update(input: UpdateCallRetentionRequest, options?: RequestOptions): Promise<ApiResponse<CallRetention>>;
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=call-retention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-retention.d.ts","sourceRoot":"","sources":["../../src/platform/call-retention.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGzE;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC7B,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE9D,oCAAoC;AACpC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,UAAU,yBAAyB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAClC,CAAC,yBAAyB,GAAG;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,6CAA6C;IAC7C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,CAAC,GACF,CAAC,yBAAyB,GAAG;IAC3B,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IACxD;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC,CAAC;AAIP,0FAA0F;AAC1F,MAAM,WAAW,8BAA+B,SAAQ,mBAAmB;IACzE,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;CACvC;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,8BAA8B,GACtC,qBAAqB,CAevB;AAED;;;GAGG;AACH,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAU3E;;;;;;;OAOG;IACH,MAAM,CACJ,KAAK,EAAE,0BAA0B,EACjC,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;CAUvC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { HttpTransport } from "../transport/http.js";
|
|
2
|
+
import { assertServerRuntime, validateClientCredential, } from "../credentials.js";
|
|
3
|
+
import { unwrapResponse } from "./response.js";
|
|
4
|
+
const PATH = "/platform/call-retention";
|
|
5
|
+
/**
|
|
6
|
+
* Creates only the team-wide call retention resource. Use this entrypoint
|
|
7
|
+
* when a project token has no project ID; project-scoped Client methods still
|
|
8
|
+
* require an explicit project ID.
|
|
9
|
+
*/
|
|
10
|
+
export function createTeamCallRetentionClient(options) {
|
|
11
|
+
const credential = validateClientCredential(options.credential);
|
|
12
|
+
assertServerRuntime();
|
|
13
|
+
return new CallRetentionResource(new HttpTransport({
|
|
14
|
+
baseUrl: options.baseUrl ?? "https://api.polymorfa.com",
|
|
15
|
+
authorization: `Bearer ${credential.value}`,
|
|
16
|
+
timeoutMs: options.timeoutMs ?? 30_000,
|
|
17
|
+
maxNetworkRetries: options.maxNetworkRetries ?? 2,
|
|
18
|
+
...(options.apiVersion === undefined
|
|
19
|
+
? {}
|
|
20
|
+
: { apiVersion: options.apiVersion }),
|
|
21
|
+
...(options.fetch === undefined ? {} : { fetch: options.fetch }),
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The team's call data retention. It is one setting per team: project clients
|
|
26
|
+
* read the same value as their team. Changing it requires a team API key.
|
|
27
|
+
*/
|
|
28
|
+
export class CallRetentionResource {
|
|
29
|
+
transport;
|
|
30
|
+
constructor(transport) {
|
|
31
|
+
this.transport = transport;
|
|
32
|
+
}
|
|
33
|
+
/** Returns the saved setting, or the default when the team never saved one. */
|
|
34
|
+
retrieve(options = {}) {
|
|
35
|
+
return this.transport
|
|
36
|
+
.request({
|
|
37
|
+
method: "GET",
|
|
38
|
+
path: PATH,
|
|
39
|
+
...options,
|
|
40
|
+
})
|
|
41
|
+
.then(unwrapResponse);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Replaces the team's call data retention. Requires a team API key; project
|
|
45
|
+
* tokens receive `PolymorfaAuthorizationError`.
|
|
46
|
+
*
|
|
47
|
+
* Once deletion runs, a shorter period also applies to call data already
|
|
48
|
+
* stored, and deleted data cannot be recovered. Until Polymorfa announces
|
|
49
|
+
* that deletion has started, saving a period deletes nothing.
|
|
50
|
+
*/
|
|
51
|
+
update(input, options = {}) {
|
|
52
|
+
return this.transport
|
|
53
|
+
.request({
|
|
54
|
+
method: "PUT",
|
|
55
|
+
path: PATH,
|
|
56
|
+
body: input,
|
|
57
|
+
...options,
|
|
58
|
+
})
|
|
59
|
+
.then(unwrapResponse);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=call-retention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-retention.js","sourceRoot":"","sources":["../../src/platform/call-retention.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GAGzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAqB,cAAc,EAAE,MAAM,eAAe,CAAC;AA6DlE,MAAM,IAAI,GAAG,0BAA0B,CAAC;AAOxC;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAuC;IAEvC,MAAM,UAAU,GAAG,wBAAwB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAChE,mBAAmB,EAAE,CAAC;IACtB,OAAO,IAAI,qBAAqB,CAC9B,IAAI,aAAa,CAAC;QAChB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,2BAA2B;QACvD,aAAa,EAAE,UAAU,UAAU,CAAC,KAAK,EAAE;QAC3C,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,MAAM;QACtC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,CAAC;QACjD,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS;YAClC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;QACvC,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;KACjE,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IACH;IAA7B,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAG,CAAC;IAEzD,+EAA+E;IAC/E,QAAQ,CAAC,UAA0B,EAAE;QACnC,OAAO,IAAI,CAAC,SAAS;aAClB,OAAO,CAA8B;YACpC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,GAAG,OAAO;SACX,CAAC;aACD,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1B,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CACJ,KAAiC,EACjC,UAA0B,EAAE;QAE5B,OAAO,IAAI,CAAC,SAAS;aAClB,OAAO,CAA8B;YACpC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,KAAK;YACX,GAAG,OAAO;SACX,CAAC;aACD,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { HttpTransport } from "../transport/http.js";
|
|
2
2
|
import type { ApiResponse, RequestOptions } from "../transport/types.js";
|
|
3
|
-
import type { DataEnvelope, ListCampaignsParams, PlatformPayload } from "./types.js";
|
|
3
|
+
import type { AddPlatformCampaignRecipientsRequest, AddPlatformCampaignRecipientsResult, CreatePlatformCampaignRequest, DataEnvelope, ListCampaignsParams, ListPlatformCampaignRecipientsParams, PlatformCampaignParams, PlatformCampaignRecipientsEnvelope, PlatformPayload, UpdatePlatformCampaignRequest } from "./types.js";
|
|
4
4
|
type CampaignResponse = Promise<ApiResponse<DataEnvelope<PlatformPayload>>>;
|
|
5
5
|
export declare class CampaignsResource {
|
|
6
6
|
private readonly transport;
|
|
7
7
|
constructor(transport: HttpTransport);
|
|
8
8
|
list(params: ListCampaignsParams, options?: RequestOptions): CampaignResponse;
|
|
9
|
-
create(body
|
|
10
|
-
retrieve(campaignId: string, options?: RequestOptions): CampaignResponse;
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
create(body: CreatePlatformCampaignRequest, options?: RequestOptions): CampaignResponse;
|
|
10
|
+
retrieve(campaignId: string, params: PlatformCampaignParams, options?: RequestOptions): CampaignResponse;
|
|
11
|
+
/**
|
|
12
|
+
* Change a campaign. `recipientListId` points an unlaunched draft at another
|
|
13
|
+
* audience, or detaches it with null; the API refuses the change once the
|
|
14
|
+
* campaign has launched or its audience has been copied into recipients.
|
|
15
|
+
*/
|
|
16
|
+
update(campaignId: string, body: UpdatePlatformCampaignRequest | undefined, params: PlatformCampaignParams, options?: RequestOptions): CampaignResponse;
|
|
17
|
+
delete(campaignId: string, params: PlatformCampaignParams, options?: RequestOptions): CampaignResponse;
|
|
13
18
|
launch(campaignId: string, body?: PlatformPayload, options?: RequestOptions): CampaignResponse;
|
|
14
19
|
pause(campaignId: string, body?: PlatformPayload, options?: RequestOptions): CampaignResponse;
|
|
15
20
|
resume(campaignId: string, body?: PlatformPayload, options?: RequestOptions): CampaignResponse;
|
|
@@ -17,9 +22,25 @@ export declare class CampaignsResource {
|
|
|
17
22
|
archive(campaignId: string, body?: PlatformPayload, options?: RequestOptions): CampaignResponse;
|
|
18
23
|
duplicate(campaignId: string, body?: PlatformPayload, options?: RequestOptions): CampaignResponse;
|
|
19
24
|
requeue(campaignId: string, body?: PlatformPayload, options?: RequestOptions): CampaignResponse;
|
|
20
|
-
analytics(campaignId: string, options?: RequestOptions): CampaignResponse;
|
|
21
|
-
events(campaignId: string, options?: RequestOptions): CampaignResponse;
|
|
22
|
-
|
|
25
|
+
analytics(campaignId: string, params: PlatformCampaignParams, options?: RequestOptions): CampaignResponse;
|
|
26
|
+
events(campaignId: string, params: PlatformCampaignParams, options?: RequestOptions): CampaignResponse;
|
|
27
|
+
/**
|
|
28
|
+
* One cursor page of a campaign's recipients in queue order.
|
|
29
|
+
*
|
|
30
|
+
* This replaces the earlier bare array: the response is now
|
|
31
|
+
* `{ data, page }`, and each recipient carries its own delivery timestamps.
|
|
32
|
+
*/
|
|
33
|
+
recipients(campaignId: string, params: ListPlatformCampaignRecipientsParams, options?: RequestOptions): Promise<ApiResponse<PlatformCampaignRecipientsEnvelope>>;
|
|
34
|
+
/**
|
|
35
|
+
* Add up to 1,000 recipients to a campaign that has not started sending.
|
|
36
|
+
*
|
|
37
|
+
* The API declares no idempotent replay for this append, so by default the
|
|
38
|
+
* SDK sends it once and does not retry it. Setting both `maxNetworkRetries`
|
|
39
|
+
* and `idempotencyKey` on the request re-enables retries, and a retry can be
|
|
40
|
+
* processed as a new append. After a lost response, list the recipients before
|
|
41
|
+
* appending again.
|
|
42
|
+
*/
|
|
43
|
+
addRecipients(campaignId: string, body: AddPlatformCampaignRecipientsRequest, options?: RequestOptions): Promise<ApiResponse<DataEnvelope<AddPlatformCampaignRecipientsResult>>>;
|
|
23
44
|
private action;
|
|
24
45
|
private read;
|
|
25
46
|
private write;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../../src/platform/campaigns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../../src/platform/campaigns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAKrD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EACV,oCAAoC,EACpC,mCAAmC,EACnC,6BAA6B,EAC7B,YAAY,EACZ,mBAAmB,EACnB,oCAAoC,EACpC,sBAAsB,EACtB,kCAAkC,EAClC,eAAe,EACf,6BAA6B,EAC9B,MAAM,YAAY,CAAC;AAEpB,KAAK,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;AAK5E,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAA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e,EACtB,OAAO,GAAE,cAAmB,GAC3B,gBAAgB;IAInB,SAAS,CACP,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,GAAE,cAAmB,GAC3B,gBAAgB;IAInB,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,GAAE,cAAmB,GAC3B,gBAAgB;IAInB;;;;;OAKG;IACH,UAAU,CACR,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,oCAAoC,EAC5C,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,kCAAkC,CAAC,CAAC;IAc3D;;;;;;;;OAQG;IACH,aAAa,CACX,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,oCAAoC,EAC1C,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAS1E,OAAO,CAAC,MAAM;IAmBd,OAAO,CAAC,IAAI;IAcZ,OAAO,CAAC,KAAK;CAad"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HttpTransport } from "../transport/http.js";
|
|
2
|
+
import { withIdempotencyKey, withoutAutomaticRetry, } from "../transport/idempotency.js";
|
|
2
3
|
export class CampaignsResource {
|
|
3
4
|
transport;
|
|
4
5
|
constructor(transport) {
|
|
@@ -18,22 +19,40 @@ export class CampaignsResource {
|
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
create(body, options = {}) {
|
|
21
|
-
return this.
|
|
22
|
+
return this.transport.request({
|
|
23
|
+
method: "POST",
|
|
24
|
+
path: "/platform/campaigns",
|
|
25
|
+
body,
|
|
26
|
+
...options,
|
|
27
|
+
});
|
|
22
28
|
}
|
|
23
|
-
retrieve(campaignId, options = {}) {
|
|
29
|
+
retrieve(campaignId, params, options = {}) {
|
|
24
30
|
return this.transport.request({
|
|
25
31
|
method: "GET",
|
|
26
32
|
path: campaignPath(campaignId),
|
|
33
|
+
query: campaignQuery(params),
|
|
27
34
|
...options,
|
|
28
35
|
});
|
|
29
36
|
}
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Change a campaign. `recipientListId` points an unlaunched draft at another
|
|
39
|
+
* audience, or detaches it with null; the API refuses the change once the
|
|
40
|
+
* campaign has launched or its audience has been copied into recipients.
|
|
41
|
+
*/
|
|
42
|
+
update(campaignId, body, params, options = {}) {
|
|
43
|
+
return this.transport.request({
|
|
44
|
+
method: "PATCH",
|
|
45
|
+
path: campaignPath(campaignId),
|
|
46
|
+
query: campaignQuery(params),
|
|
47
|
+
...(body === undefined ? {} : { body }),
|
|
48
|
+
...options,
|
|
49
|
+
});
|
|
32
50
|
}
|
|
33
|
-
delete(campaignId, options = {}) {
|
|
51
|
+
delete(campaignId, params, options = {}) {
|
|
34
52
|
return this.transport.request({
|
|
35
53
|
method: "DELETE",
|
|
36
54
|
path: campaignPath(campaignId),
|
|
55
|
+
query: campaignQuery(params),
|
|
37
56
|
...options,
|
|
38
57
|
});
|
|
39
58
|
}
|
|
@@ -58,22 +77,60 @@ export class CampaignsResource {
|
|
|
58
77
|
requeue(campaignId, body, options = {}) {
|
|
59
78
|
return this.action(campaignId, "requeue", body, options);
|
|
60
79
|
}
|
|
61
|
-
analytics(campaignId, options = {}) {
|
|
62
|
-
return this.read(campaignId, "analytics", options);
|
|
80
|
+
analytics(campaignId, params, options = {}) {
|
|
81
|
+
return this.read(campaignId, "analytics", params, options);
|
|
63
82
|
}
|
|
64
|
-
events(campaignId, options = {}) {
|
|
65
|
-
return this.read(campaignId, "events", options);
|
|
83
|
+
events(campaignId, params, options = {}) {
|
|
84
|
+
return this.read(campaignId, "events", params, options);
|
|
66
85
|
}
|
|
67
|
-
|
|
68
|
-
|
|
86
|
+
/**
|
|
87
|
+
* One cursor page of a campaign's recipients in queue order.
|
|
88
|
+
*
|
|
89
|
+
* This replaces the earlier bare array: the response is now
|
|
90
|
+
* `{ data, page }`, and each recipient carries its own delivery timestamps.
|
|
91
|
+
*/
|
|
92
|
+
recipients(campaignId, params, options = {}) {
|
|
93
|
+
return this.transport.request({
|
|
94
|
+
method: "GET",
|
|
95
|
+
path: recipientsPath(campaignId),
|
|
96
|
+
query: {
|
|
97
|
+
projectId: params.projectId,
|
|
98
|
+
...(params.status === undefined ? {} : { status: params.status }),
|
|
99
|
+
...(params.cursor === undefined ? {} : { cursor: params.cursor }),
|
|
100
|
+
...(params.limit === undefined ? {} : { limit: params.limit }),
|
|
101
|
+
},
|
|
102
|
+
...options,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Add up to 1,000 recipients to a campaign that has not started sending.
|
|
107
|
+
*
|
|
108
|
+
* The API declares no idempotent replay for this append, so by default the
|
|
109
|
+
* SDK sends it once and does not retry it. Setting both `maxNetworkRetries`
|
|
110
|
+
* and `idempotencyKey` on the request re-enables retries, and a retry can be
|
|
111
|
+
* processed as a new append. After a lost response, list the recipients before
|
|
112
|
+
* appending again.
|
|
113
|
+
*/
|
|
114
|
+
addRecipients(campaignId, body, options = {}) {
|
|
115
|
+
return this.transport.request({
|
|
116
|
+
method: "POST",
|
|
117
|
+
path: recipientsPath(campaignId),
|
|
118
|
+
body,
|
|
119
|
+
...withoutAutomaticRetry(options),
|
|
120
|
+
});
|
|
69
121
|
}
|
|
70
122
|
action(campaignId, action, body, options) {
|
|
71
|
-
|
|
123
|
+
const retryable = action === "launch" ||
|
|
124
|
+
action === "pause" ||
|
|
125
|
+
action === "resume" ||
|
|
126
|
+
action === "stop";
|
|
127
|
+
return this.write("POST", `${campaignPath(campaignId)}/${action}`, body, retryable ? withIdempotencyKey(options) : options);
|
|
72
128
|
}
|
|
73
|
-
read(campaignId, resource, options) {
|
|
129
|
+
read(campaignId, resource, params, options) {
|
|
74
130
|
return this.transport.request({
|
|
75
131
|
method: "GET",
|
|
76
132
|
path: `${campaignPath(campaignId)}/${resource}`,
|
|
133
|
+
query: campaignQuery(params),
|
|
77
134
|
...options,
|
|
78
135
|
});
|
|
79
136
|
}
|
|
@@ -89,4 +146,10 @@ export class CampaignsResource {
|
|
|
89
146
|
function campaignPath(campaignId) {
|
|
90
147
|
return `/platform/campaigns/${encodeURIComponent(campaignId)}`;
|
|
91
148
|
}
|
|
149
|
+
function campaignQuery(params) {
|
|
150
|
+
return { projectId: params.projectId };
|
|
151
|
+
}
|
|
152
|
+
function recipientsPath(campaignId) {
|
|
153
|
+
return `${campaignPath(campaignId)}/recipients`;
|
|
154
|
+
}
|
|
92
155
|
//# sourceMappingURL=campaigns.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"campaigns.js","sourceRoot":"","sources":["../../src/platform/campaigns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"campaigns.js","sourceRoot":"","sources":["../../src/platform/campaigns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AAoBrC,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAG,CAAC;IAEzD,IAAI,CACF,MAA2B,EAC3B,UAA0B,EAAE;QAE5B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB;YAC3B,KAAK,EAAE;gBACL,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,GAAG,CAAC,MAAM,CAAC,WAAW,KAAK,SAAS;oBAClC,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;aACzC;YACD,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CACJ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transport/types.js";
|
|
3
|
-
import type { DataEnvelope, PlatformPayload } from "./types.js";
|
|
3
|
+
import type { DataEnvelope, OptOutSettings, PlatformPayload, UpdateOptOutSettingsRequest } from "./types.js";
|
|
4
4
|
type OptOutResponse = Promise<ApiResponse<DataEnvelope<PlatformPayload>>>;
|
|
5
5
|
export declare class OptOutsResource {
|
|
6
6
|
private readonly transport;
|
|
@@ -8,6 +8,10 @@ export declare class OptOutsResource {
|
|
|
8
8
|
list(options?: RequestOptions): OptOutResponse;
|
|
9
9
|
create(body?: PlatformPayload, options?: RequestOptions): OptOutResponse;
|
|
10
10
|
createBatch(body?: PlatformPayload, options?: RequestOptions): OptOutResponse;
|
|
11
|
+
/** Read the organization's STOP/START keyword capture settings. */
|
|
12
|
+
getSettings(options?: RequestOptions): Promise<ApiResponse<DataEnvelope<OptOutSettings>>>;
|
|
13
|
+
/** Replace the keyword capture settings. Every field is required. */
|
|
14
|
+
updateSettings(body: UpdateOptOutSettingsRequest, options?: RequestOptions): Promise<ApiResponse<DataEnvelope<OptOutSettings>>>;
|
|
11
15
|
delete(phone: string, options?: RequestOptions): OptOutResponse;
|
|
12
16
|
private write;
|
|
13
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opt-outs.d.ts","sourceRoot":"","sources":["../../src/platform/opt-outs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"opt-outs.d.ts","sourceRoot":"","sources":["../../src/platform/opt-outs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAEpB,KAAK,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;AAI1E,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD,IAAI,CAAC,OAAO,GAAE,cAAmB,GAAG,cAAc;IAQlD,MAAM,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,OAAO,GAAE,cAAmB,GAAG,cAAc;IAI5E,WAAW,CACT,IAAI,CAAC,EAAE,eAAe,EACtB,OAAO,GAAE,cAAmB,GAC3B,cAAc;IAIjB,mEAAmE;IACnE,WAAW,CACT,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC;IAQrD,qEAAqE;IACrE,cAAc,CACZ,IAAI,EAAE,2BAA2B,EACjC,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC;IASrD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,cAAc;IAQnE,OAAO,CAAC,KAAK;CAYd"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HttpTransport } from "../transport/http.js";
|
|
2
|
+
const SETTINGS_PATH = "/platform/optouts/settings";
|
|
2
3
|
export class OptOutsResource {
|
|
3
4
|
transport;
|
|
4
5
|
constructor(transport) {
|
|
@@ -17,6 +18,23 @@ export class OptOutsResource {
|
|
|
17
18
|
createBatch(body, options = {}) {
|
|
18
19
|
return this.write("/platform/optouts/batch", body, options);
|
|
19
20
|
}
|
|
21
|
+
/** Read the organization's STOP/START keyword capture settings. */
|
|
22
|
+
getSettings(options = {}) {
|
|
23
|
+
return this.transport.request({
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: SETTINGS_PATH,
|
|
26
|
+
...options,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** Replace the keyword capture settings. Every field is required. */
|
|
30
|
+
updateSettings(body, options = {}) {
|
|
31
|
+
return this.transport.request({
|
|
32
|
+
method: "PUT",
|
|
33
|
+
path: SETTINGS_PATH,
|
|
34
|
+
body,
|
|
35
|
+
...options,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
20
38
|
delete(phone, options = {}) {
|
|
21
39
|
return this.transport.request({
|
|
22
40
|
method: "DELETE",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opt-outs.js","sourceRoot":"","sources":["../../src/platform/opt-outs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"opt-outs.js","sourceRoot":"","sources":["../../src/platform/opt-outs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAWrD,MAAM,aAAa,GAAG,4BAA4B,CAAC;AAEnD,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAG,CAAC;IAEzD,IAAI,CAAC,UAA0B,EAAE;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,mBAAmB;YACzB,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,IAAsB,EAAE,UAA0B,EAAE;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,WAAW,CACT,IAAsB,EACtB,UAA0B,EAAE;QAE5B,OAAO,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED,mEAAmE;IACnE,WAAW,CACT,UAA0B,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