ab-ecosystem-cpass 0.1.0 → 1.0.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.
Files changed (97) hide show
  1. package/README.md +127 -25
  2. package/dist/client.d.ts +56 -1
  3. package/dist/client.js +76 -30
  4. package/dist/client.js.map +1 -1
  5. package/dist/http.d.ts +8 -0
  6. package/dist/http.js +10 -3
  7. package/dist/http.js.map +1 -1
  8. package/dist/index.d.ts +16 -1
  9. package/dist/index.js +35 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/resources/audience/contact-notes.d.ts +51 -0
  12. package/dist/resources/audience/contact-notes.js +70 -0
  13. package/dist/resources/audience/contact-notes.js.map +1 -0
  14. package/dist/resources/audience/contact-tags.d.ts +43 -0
  15. package/dist/resources/audience/contact-tags.js +60 -0
  16. package/dist/resources/audience/contact-tags.js.map +1 -0
  17. package/dist/resources/audience/contacts.d.ts +76 -0
  18. package/dist/resources/audience/contacts.js +103 -0
  19. package/dist/resources/audience/contacts.js.map +1 -0
  20. package/dist/resources/audience/crm-triggers.d.ts +67 -0
  21. package/dist/resources/audience/crm-triggers.js +86 -0
  22. package/dist/resources/audience/crm-triggers.js.map +1 -0
  23. package/dist/resources/audience/custom-fields.d.ts +54 -0
  24. package/dist/resources/audience/custom-fields.js +71 -0
  25. package/dist/resources/audience/custom-fields.js.map +1 -0
  26. package/dist/resources/audience/export-history.d.ts +52 -0
  27. package/dist/resources/audience/export-history.js +67 -0
  28. package/dist/resources/audience/export-history.js.map +1 -0
  29. package/dist/resources/audience/import-history.d.ts +51 -0
  30. package/dist/resources/audience/import-history.js +66 -0
  31. package/dist/resources/audience/import-history.js.map +1 -0
  32. package/dist/resources/audience/segments.d.ts +49 -0
  33. package/dist/resources/audience/segments.js +66 -0
  34. package/dist/resources/audience/segments.js.map +1 -0
  35. package/dist/resources/audience/webhooks.d.ts +68 -0
  36. package/dist/resources/audience/webhooks.js +83 -0
  37. package/dist/resources/audience/webhooks.js.map +1 -0
  38. package/dist/resources/channels/activity.d.ts +25 -0
  39. package/dist/resources/channels/activity.js +34 -0
  40. package/dist/resources/channels/activity.js.map +1 -0
  41. package/dist/resources/channels/billing.d.ts +46 -0
  42. package/dist/resources/channels/billing.js +59 -0
  43. package/dist/resources/channels/billing.js.map +1 -0
  44. package/dist/resources/channels/channels.d.ts +115 -0
  45. package/dist/resources/channels/channels.js +129 -0
  46. package/dist/resources/channels/channels.js.map +1 -0
  47. package/dist/resources/channels/templates.d.ts +90 -0
  48. package/dist/resources/channels/templates.js +109 -0
  49. package/dist/resources/channels/templates.js.map +1 -0
  50. package/dist/resources/channels/wallet.d.ts +25 -0
  51. package/dist/resources/channels/wallet.js +34 -0
  52. package/dist/resources/channels/wallet.js.map +1 -0
  53. package/dist/resources/channels/webhooks.d.ts +60 -0
  54. package/dist/resources/channels/webhooks.js +79 -0
  55. package/dist/resources/channels/webhooks.js.map +1 -0
  56. package/dist/resources/paths.d.ts +12 -0
  57. package/dist/resources/paths.js +17 -0
  58. package/dist/resources/paths.js.map +1 -0
  59. package/dist/types/audience.d.ts +512 -0
  60. package/dist/types/audience.js +3 -0
  61. package/dist/types/audience.js.map +1 -0
  62. package/dist/types/channels.d.ts +383 -0
  63. package/dist/types/channels.js +22 -0
  64. package/dist/types/channels.js.map +1 -0
  65. package/dist/types/common.d.ts +55 -0
  66. package/dist/types/common.js +8 -0
  67. package/dist/types/common.js.map +1 -0
  68. package/dist/types/contact-filter.d.ts +55 -0
  69. package/dist/types/contact-filter.js +11 -0
  70. package/dist/types/contact-filter.js.map +1 -0
  71. package/dist/types/index.d.ts +4 -0
  72. package/dist/types/index.js +21 -0
  73. package/dist/types/index.js.map +1 -0
  74. package/docs/audience/contact-notes.md +129 -0
  75. package/docs/audience/contact-tags.md +109 -0
  76. package/docs/audience/contacts.md +227 -0
  77. package/docs/audience/crm-triggers.md +240 -0
  78. package/docs/audience/custom-fields.md +174 -0
  79. package/docs/audience/exports.md +163 -0
  80. package/docs/audience/imports.md +161 -0
  81. package/docs/audience/segments.md +120 -0
  82. package/docs/audience/webhooks.md +167 -0
  83. package/docs/channels/activity.md +68 -0
  84. package/docs/channels/billing.md +112 -0
  85. package/docs/channels/channel-props.md +290 -0
  86. package/docs/channels/channels.md +199 -0
  87. package/docs/channels/templates.md +224 -0
  88. package/docs/channels/wallet.md +67 -0
  89. package/docs/channels/webhooks.md +152 -0
  90. package/docs/contact-filter.md +157 -0
  91. package/package.json +7 -3
  92. package/dist/resources/channels.d.ts +0 -10
  93. package/dist/resources/channels.js +0 -19
  94. package/dist/resources/channels.js.map +0 -1
  95. package/dist/types.d.ts +0 -70
  96. package/dist/types.js +0 -7
  97. package/dist/types.js.map +0 -1
@@ -0,0 +1,52 @@
1
+ import type { CreateExportHistoryInput, ExportHistory, ListExportHistoryQuery, Paginated } from '../../types';
2
+ import type { HttpClient } from '../../http';
3
+ /**
4
+ * Export history: one row per bulk extract, moved by a worker through
5
+ * `pending -> processing -> completed | failed`.
6
+ *
7
+ * `config` says what to write out, in the same vocabulary the contact list
8
+ * speaks: a saved `segment`, an ad-hoc `filter`, or both -- sending both
9
+ * narrows the segment. `fields` picks the columns; empty means the worker's
10
+ * default set.
11
+ *
12
+ * When the run completes, `file` holds the storage key of the written file and
13
+ * `count` the number of rows in it.
14
+ */
15
+ export declare class Exports {
16
+ private readonly http;
17
+ constructor(http: HttpClient);
18
+ /**
19
+ * `GET /v1/audience/exports` -- offset paginated, newest first. `search`
20
+ * matches the title; `module` and `status` are quick filters.
21
+ *
22
+ * Scope: `contacts:read`.
23
+ */
24
+ list(query?: Partial<ListExportHistoryQuery>): Promise<Paginated<ExportHistory>>;
25
+ /**
26
+ * `GET /v1/audience/exports/:id` -- the row with its current `status`,
27
+ * `count` and, once finished, `file`. This is the progress endpoint; a failed
28
+ * run carries its reason in `error`.
29
+ *
30
+ * Scope: `contacts:read`.
31
+ */
32
+ get(id: string): Promise<ExportHistory>;
33
+ /**
34
+ * `POST /v1/audience/exports` -- **202**, not 201: the row exists, but no
35
+ * file has been written yet. The response is the row at `status: 'pending'`
36
+ * with `count: 0` and no `file`.
37
+ *
38
+ * Creating an export needs only a title: the default config exports every
39
+ * contact with the worker's default columns.
40
+ *
41
+ * Scope: `contacts:read` -- reading contacts out is a read, so an export can
42
+ * be started with read-only access.
43
+ */
44
+ create(input: CreateExportHistoryInput): Promise<ExportHistory>;
45
+ /**
46
+ * `DELETE /v1/audience/exports/:id` -- 204, no body. Removes the history row;
47
+ * a file already written to storage is not deleted with it.
48
+ *
49
+ * Scope: `contacts:write`.
50
+ */
51
+ delete(id: string): Promise<void>;
52
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Exports = void 0;
4
+ const paths_1 = require("../paths");
5
+ const BASE = `${paths_1.AUDIENCE}/exports`;
6
+ /**
7
+ * Export history: one row per bulk extract, moved by a worker through
8
+ * `pending -> processing -> completed | failed`.
9
+ *
10
+ * `config` says what to write out, in the same vocabulary the contact list
11
+ * speaks: a saved `segment`, an ad-hoc `filter`, or both -- sending both
12
+ * narrows the segment. `fields` picks the columns; empty means the worker's
13
+ * default set.
14
+ *
15
+ * When the run completes, `file` holds the storage key of the written file and
16
+ * `count` the number of rows in it.
17
+ */
18
+ class Exports {
19
+ http;
20
+ constructor(http) {
21
+ this.http = http;
22
+ }
23
+ /**
24
+ * `GET /v1/audience/exports` -- offset paginated, newest first. `search`
25
+ * matches the title; `module` and `status` are quick filters.
26
+ *
27
+ * Scope: `contacts:read`.
28
+ */
29
+ list(query = {}) {
30
+ return this.http.request('GET', BASE, { query });
31
+ }
32
+ /**
33
+ * `GET /v1/audience/exports/:id` -- the row with its current `status`,
34
+ * `count` and, once finished, `file`. This is the progress endpoint; a failed
35
+ * run carries its reason in `error`.
36
+ *
37
+ * Scope: `contacts:read`.
38
+ */
39
+ get(id) {
40
+ return this.http.request('GET', `${BASE}/${(0, paths_1.seg)(id)}`);
41
+ }
42
+ /**
43
+ * `POST /v1/audience/exports` -- **202**, not 201: the row exists, but no
44
+ * file has been written yet. The response is the row at `status: 'pending'`
45
+ * with `count: 0` and no `file`.
46
+ *
47
+ * Creating an export needs only a title: the default config exports every
48
+ * contact with the worker's default columns.
49
+ *
50
+ * Scope: `contacts:read` -- reading contacts out is a read, so an export can
51
+ * be started with read-only access.
52
+ */
53
+ create(input) {
54
+ return this.http.request('POST', BASE, { body: input });
55
+ }
56
+ /**
57
+ * `DELETE /v1/audience/exports/:id` -- 204, no body. Removes the history row;
58
+ * a file already written to storage is not deleted with it.
59
+ *
60
+ * Scope: `contacts:write`.
61
+ */
62
+ delete(id) {
63
+ return this.http.request('DELETE', `${BASE}/${(0, paths_1.seg)(id)}`);
64
+ }
65
+ }
66
+ exports.Exports = Exports;
67
+ //# sourceMappingURL=export-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-history.js","sourceRoot":"","sources":["../../../src/resources/audience/export-history.ts"],"names":[],"mappings":";;;AAOA,oCAAyC;AAEzC,MAAM,IAAI,GAAG,GAAG,gBAAQ,UAAU,CAAC;AAEnC;;;;;;;;;;;GAWG;AACH,MAAa,OAAO;IACW;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;;OAKG;IACH,IAAI,CAAC,QAAyC,EAAE;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA2B,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAgB,KAAK,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAA+B;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAgB,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAO,QAAQ,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AAhDD,0BAgDC"}
@@ -0,0 +1,51 @@
1
+ import type { CreateImportHistoryInput, ImportHistory, ListImportHistoryQuery, Paginated } from '../../types';
2
+ import type { HttpClient } from '../../http';
3
+ /**
4
+ * Import history: one row per bulk load of contacts, and the record a worker
5
+ * moves through `pending -> processing -> completed | failed`.
6
+ *
7
+ * Creating a row queues the work; the file itself is uploaded out of band and
8
+ * named here by its storage key. `statistics` fills in as the worker walks the
9
+ * file, so poll `get` to follow a run.
10
+ *
11
+ * The module is `contact` or `datastore` -- these rows are not contact-only,
12
+ * which is why the route is `/imports` rather than `/contact-imports`.
13
+ */
14
+ export declare class Imports {
15
+ private readonly http;
16
+ constructor(http: HttpClient);
17
+ /**
18
+ * `GET /v1/audience/imports` -- offset paginated, newest first. `search`
19
+ * matches the title; `module` and `status` are quick filters.
20
+ *
21
+ * Scope: `contacts:read`.
22
+ */
23
+ list(query?: Partial<ListImportHistoryQuery>): Promise<Paginated<ImportHistory>>;
24
+ /**
25
+ * `GET /v1/audience/imports/:id` -- the row with its current `status` and
26
+ * `statistics`. This is the progress endpoint.
27
+ *
28
+ * Scope: `contacts:read`.
29
+ */
30
+ get(id: string): Promise<ImportHistory>;
31
+ /**
32
+ * `POST /v1/audience/imports` -- **202**, not 201: the row exists, but
33
+ * nothing has been read out of the file yet. The response is the row at
34
+ * `status: 'pending'` with every counter at zero.
35
+ *
36
+ * `config.mapping` maps column headers to contact fields, and
37
+ * `config.duplicateStrategy` decides what a row matching an existing contact
38
+ * does. Unknown keys in `config` and `extra` are stored and handed back
39
+ * untouched.
40
+ *
41
+ * Scope: `contacts:write`.
42
+ */
43
+ create(input: CreateImportHistoryInput): Promise<ImportHistory>;
44
+ /**
45
+ * `DELETE /v1/audience/imports/:id` -- 204, no body. Removes the history row.
46
+ * Contacts the import already created are not touched.
47
+ *
48
+ * Scope: `contacts:write`.
49
+ */
50
+ delete(id: string): Promise<void>;
51
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Imports = void 0;
4
+ const paths_1 = require("../paths");
5
+ const BASE = `${paths_1.AUDIENCE}/imports`;
6
+ /**
7
+ * Import history: one row per bulk load of contacts, and the record a worker
8
+ * moves through `pending -> processing -> completed | failed`.
9
+ *
10
+ * Creating a row queues the work; the file itself is uploaded out of band and
11
+ * named here by its storage key. `statistics` fills in as the worker walks the
12
+ * file, so poll `get` to follow a run.
13
+ *
14
+ * The module is `contact` or `datastore` -- these rows are not contact-only,
15
+ * which is why the route is `/imports` rather than `/contact-imports`.
16
+ */
17
+ class Imports {
18
+ http;
19
+ constructor(http) {
20
+ this.http = http;
21
+ }
22
+ /**
23
+ * `GET /v1/audience/imports` -- offset paginated, newest first. `search`
24
+ * matches the title; `module` and `status` are quick filters.
25
+ *
26
+ * Scope: `contacts:read`.
27
+ */
28
+ list(query = {}) {
29
+ return this.http.request('GET', BASE, { query });
30
+ }
31
+ /**
32
+ * `GET /v1/audience/imports/:id` -- the row with its current `status` and
33
+ * `statistics`. This is the progress endpoint.
34
+ *
35
+ * Scope: `contacts:read`.
36
+ */
37
+ get(id) {
38
+ return this.http.request('GET', `${BASE}/${(0, paths_1.seg)(id)}`);
39
+ }
40
+ /**
41
+ * `POST /v1/audience/imports` -- **202**, not 201: the row exists, but
42
+ * nothing has been read out of the file yet. The response is the row at
43
+ * `status: 'pending'` with every counter at zero.
44
+ *
45
+ * `config.mapping` maps column headers to contact fields, and
46
+ * `config.duplicateStrategy` decides what a row matching an existing contact
47
+ * does. Unknown keys in `config` and `extra` are stored and handed back
48
+ * untouched.
49
+ *
50
+ * Scope: `contacts:write`.
51
+ */
52
+ create(input) {
53
+ return this.http.request('POST', BASE, { body: input });
54
+ }
55
+ /**
56
+ * `DELETE /v1/audience/imports/:id` -- 204, no body. Removes the history row.
57
+ * Contacts the import already created are not touched.
58
+ *
59
+ * Scope: `contacts:write`.
60
+ */
61
+ delete(id) {
62
+ return this.http.request('DELETE', `${BASE}/${(0, paths_1.seg)(id)}`);
63
+ }
64
+ }
65
+ exports.Imports = Imports;
66
+ //# sourceMappingURL=import-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-history.js","sourceRoot":"","sources":["../../../src/resources/audience/import-history.ts"],"names":[],"mappings":";;;AAOA,oCAAyC;AAEzC,MAAM,IAAI,GAAG,GAAG,gBAAQ,UAAU,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,MAAa,OAAO;IACW;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;;OAKG;IACH,IAAI,CAAC,QAAyC,EAAE;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA2B,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAgB,KAAK,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAA+B;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAgB,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAO,QAAQ,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AAhDD,0BAgDC"}
@@ -0,0 +1,49 @@
1
+ import type { CreateSegmentInput, ListSegmentsQuery, Paginated, Segment, UpdateSegmentInput } from '../../types';
2
+ import type { HttpClient } from '../../http';
3
+ /**
4
+ * Segments: a saved contact filter under a name.
5
+ *
6
+ * Nothing is materialised -- a segment holds no contact ids. It covers whatever
7
+ * its conditions match at the moment it is next run, whether that is
8
+ * `contacts.list({ segment })`, an export, or a campaign.
9
+ */
10
+ export declare class Segments {
11
+ private readonly http;
12
+ constructor(http: HttpClient);
13
+ /**
14
+ * `GET /v1/audience/segments` -- offset paginated. `search` matches the
15
+ * segment name and description.
16
+ *
17
+ * Scope: `segments:read`.
18
+ */
19
+ list(query?: Partial<ListSegmentsQuery>): Promise<Paginated<Segment>>;
20
+ /**
21
+ * `GET /v1/audience/segments/:id`.
22
+ *
23
+ * Scope: `segments:read`.
24
+ */
25
+ get(id: string): Promise<Segment>;
26
+ /**
27
+ * `POST /v1/audience/segments` -- 201 with the created segment.
28
+ *
29
+ * The filter is validated on write rather than when first run, so a segment
30
+ * that stores cannot fail later for a condition that never parsed.
31
+ *
32
+ * Scope: `segments:write`.
33
+ */
34
+ create(input: CreateSegmentInput): Promise<Segment>;
35
+ /**
36
+ * `PATCH /v1/audience/segments/:id` -- a partial update. Sending `filter`
37
+ * replaces the whole condition list; there is no per-condition edit.
38
+ *
39
+ * Scope: `segments:write`.
40
+ */
41
+ update(id: string, input: UpdateSegmentInput): Promise<Segment>;
42
+ /**
43
+ * `DELETE /v1/audience/segments/:id` -- 204, no body. Contacts are untouched:
44
+ * a segment never owned them.
45
+ *
46
+ * Scope: `segments:write`.
47
+ */
48
+ delete(id: string): Promise<void>;
49
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Segments = void 0;
4
+ const paths_1 = require("../paths");
5
+ const BASE = `${paths_1.AUDIENCE}/segments`;
6
+ /**
7
+ * Segments: a saved contact filter under a name.
8
+ *
9
+ * Nothing is materialised -- a segment holds no contact ids. It covers whatever
10
+ * its conditions match at the moment it is next run, whether that is
11
+ * `contacts.list({ segment })`, an export, or a campaign.
12
+ */
13
+ class Segments {
14
+ http;
15
+ constructor(http) {
16
+ this.http = http;
17
+ }
18
+ /**
19
+ * `GET /v1/audience/segments` -- offset paginated. `search` matches the
20
+ * segment name and description.
21
+ *
22
+ * Scope: `segments:read`.
23
+ */
24
+ list(query = {}) {
25
+ return this.http.request('GET', BASE, { query });
26
+ }
27
+ /**
28
+ * `GET /v1/audience/segments/:id`.
29
+ *
30
+ * Scope: `segments:read`.
31
+ */
32
+ get(id) {
33
+ return this.http.request('GET', `${BASE}/${(0, paths_1.seg)(id)}`);
34
+ }
35
+ /**
36
+ * `POST /v1/audience/segments` -- 201 with the created segment.
37
+ *
38
+ * The filter is validated on write rather than when first run, so a segment
39
+ * that stores cannot fail later for a condition that never parsed.
40
+ *
41
+ * Scope: `segments:write`.
42
+ */
43
+ create(input) {
44
+ return this.http.request('POST', BASE, { body: input });
45
+ }
46
+ /**
47
+ * `PATCH /v1/audience/segments/:id` -- a partial update. Sending `filter`
48
+ * replaces the whole condition list; there is no per-condition edit.
49
+ *
50
+ * Scope: `segments:write`.
51
+ */
52
+ update(id, input) {
53
+ return this.http.request('PATCH', `${BASE}/${(0, paths_1.seg)(id)}`, { body: input });
54
+ }
55
+ /**
56
+ * `DELETE /v1/audience/segments/:id` -- 204, no body. Contacts are untouched:
57
+ * a segment never owned them.
58
+ *
59
+ * Scope: `segments:write`.
60
+ */
61
+ delete(id) {
62
+ return this.http.request('DELETE', `${BASE}/${(0, paths_1.seg)(id)}`);
63
+ }
64
+ }
65
+ exports.Segments = Segments;
66
+ //# sourceMappingURL=segments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segments.js","sourceRoot":"","sources":["../../../src/resources/audience/segments.ts"],"names":[],"mappings":";;;AAQA,oCAAyC;AAEzC,MAAM,IAAI,GAAG,GAAG,gBAAQ,WAAW,CAAC;AAEpC;;;;;;GAMG;AACH,MAAa,QAAQ;IACU;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;;OAKG;IACH,IAAI,CAAC,QAAoC,EAAE;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAqB,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAU,KAAK,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,KAAyB;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAU,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,EAAU,EAAE,KAAyB;QAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAU,OAAO,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAO,QAAQ,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AArDD,4BAqDC"}
@@ -0,0 +1,68 @@
1
+ import type { CreateWebhookInput, ListWebhooksQuery, Page, UpdateWebhookInput, Webhook } from '../../types';
2
+ import type { HttpClient } from '../../http';
3
+ /**
4
+ * Audience webhooks: HTTPS endpoints the platform POSTs contact events to.
5
+ *
6
+ * Distinct from `crm.crmTriggers`, which fires a single configured request per
7
+ * rule, and from `crm.channelWebhooks`, which carries message traffic. This one
8
+ * is a plain subscription to `contact.created`, `contact.updated` and
9
+ * `contact.deleted`, delivered as a `WebhookEnvelope`.
10
+ *
11
+ * Deliveries are signed. The body arrives with `x-crm-timestamp` and
12
+ * `x-crm-signature: v1=<hex>`, where the digest is
13
+ * `HMAC-SHA256(secret, "<timestamp>.<raw body>")`. Compare against the raw
14
+ * bytes, before any JSON parsing.
15
+ *
16
+ * Unlike the rest of the audience module, these rows are scoped by tenant
17
+ * rather than by the calling user.
18
+ */
19
+ export declare class Webhooks {
20
+ private readonly http;
21
+ constructor(http: HttpClient);
22
+ /**
23
+ * `GET /v1/audience/webhooks` -- cursor paginated; page with `cursor` from
24
+ * the previous response's `nextCursor`.
25
+ *
26
+ * `enabled` is accepted by the contract but not yet applied by the service:
27
+ * the list comes back unfiltered. Filter client-side until that lands.
28
+ *
29
+ * Scope: `webhooks:read`.
30
+ */
31
+ list(query?: Partial<ListWebhooksQuery>): Promise<Page<Webhook>>;
32
+ /**
33
+ * `GET /v1/audience/webhooks/:id`. The signing secret is never returned here
34
+ * -- it is shown once, by `create`.
35
+ *
36
+ * Scope: `webhooks:read`.
37
+ */
38
+ get(id: string): Promise<Webhook>;
39
+ /**
40
+ * `POST /v1/audience/webhooks` -- 201 with the created webhook **plus its
41
+ * `secret`**. This is the only response that carries the secret; store it
42
+ * when you get it.
43
+ *
44
+ * The URL has to be public https: a non-https URL, or a hostname resolving
45
+ * to a loopback, link-local or private address, is rejected with
46
+ * 422 `invalid_webhook_url`.
47
+ *
48
+ * Scope: `webhooks:write`.
49
+ */
50
+ create(input: CreateWebhookInput): Promise<Webhook & {
51
+ secret: string;
52
+ }>;
53
+ /**
54
+ * `PATCH /v1/audience/webhooks/:id` -- a partial update. A new `url` is
55
+ * checked the same way as on create; `events` replaces the subscription list.
56
+ * The secret does not change, and cannot be rotated through this route.
57
+ *
58
+ * Scope: `webhooks:write`.
59
+ */
60
+ update(id: string, input: UpdateWebhookInput): Promise<Webhook>;
61
+ /**
62
+ * `DELETE /v1/audience/webhooks/:id` -- 204, no body. Delivery stops
63
+ * immediately; queued attempts are dropped.
64
+ *
65
+ * Scope: `webhooks:write`.
66
+ */
67
+ delete(id: string): Promise<void>;
68
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Webhooks = void 0;
4
+ const paths_1 = require("../paths");
5
+ const BASE = `${paths_1.AUDIENCE}/webhooks`;
6
+ /**
7
+ * Audience webhooks: HTTPS endpoints the platform POSTs contact events to.
8
+ *
9
+ * Distinct from `crm.crmTriggers`, which fires a single configured request per
10
+ * rule, and from `crm.channelWebhooks`, which carries message traffic. This one
11
+ * is a plain subscription to `contact.created`, `contact.updated` and
12
+ * `contact.deleted`, delivered as a `WebhookEnvelope`.
13
+ *
14
+ * Deliveries are signed. The body arrives with `x-crm-timestamp` and
15
+ * `x-crm-signature: v1=<hex>`, where the digest is
16
+ * `HMAC-SHA256(secret, "<timestamp>.<raw body>")`. Compare against the raw
17
+ * bytes, before any JSON parsing.
18
+ *
19
+ * Unlike the rest of the audience module, these rows are scoped by tenant
20
+ * rather than by the calling user.
21
+ */
22
+ class Webhooks {
23
+ http;
24
+ constructor(http) {
25
+ this.http = http;
26
+ }
27
+ /**
28
+ * `GET /v1/audience/webhooks` -- cursor paginated; page with `cursor` from
29
+ * the previous response's `nextCursor`.
30
+ *
31
+ * `enabled` is accepted by the contract but not yet applied by the service:
32
+ * the list comes back unfiltered. Filter client-side until that lands.
33
+ *
34
+ * Scope: `webhooks:read`.
35
+ */
36
+ list(query = {}) {
37
+ return this.http.request('GET', BASE, { query });
38
+ }
39
+ /**
40
+ * `GET /v1/audience/webhooks/:id`. The signing secret is never returned here
41
+ * -- it is shown once, by `create`.
42
+ *
43
+ * Scope: `webhooks:read`.
44
+ */
45
+ get(id) {
46
+ return this.http.request('GET', `${BASE}/${(0, paths_1.seg)(id)}`);
47
+ }
48
+ /**
49
+ * `POST /v1/audience/webhooks` -- 201 with the created webhook **plus its
50
+ * `secret`**. This is the only response that carries the secret; store it
51
+ * when you get it.
52
+ *
53
+ * The URL has to be public https: a non-https URL, or a hostname resolving
54
+ * to a loopback, link-local or private address, is rejected with
55
+ * 422 `invalid_webhook_url`.
56
+ *
57
+ * Scope: `webhooks:write`.
58
+ */
59
+ create(input) {
60
+ return this.http.request('POST', BASE, { body: input });
61
+ }
62
+ /**
63
+ * `PATCH /v1/audience/webhooks/:id` -- a partial update. A new `url` is
64
+ * checked the same way as on create; `events` replaces the subscription list.
65
+ * The secret does not change, and cannot be rotated through this route.
66
+ *
67
+ * Scope: `webhooks:write`.
68
+ */
69
+ update(id, input) {
70
+ return this.http.request('PATCH', `${BASE}/${(0, paths_1.seg)(id)}`, { body: input });
71
+ }
72
+ /**
73
+ * `DELETE /v1/audience/webhooks/:id` -- 204, no body. Delivery stops
74
+ * immediately; queued attempts are dropped.
75
+ *
76
+ * Scope: `webhooks:write`.
77
+ */
78
+ delete(id) {
79
+ return this.http.request('DELETE', `${BASE}/${(0, paths_1.seg)(id)}`);
80
+ }
81
+ }
82
+ exports.Webhooks = Webhooks;
83
+ //# sourceMappingURL=webhooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../../src/resources/audience/webhooks.ts"],"names":[],"mappings":";;;AAQA,oCAAyC;AAEzC,MAAM,IAAI,GAAG,GAAG,gBAAQ,WAAW,CAAC;AAEpC;;;;;;;;;;;;;;;GAeG;AACH,MAAa,QAAQ;IACU;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;;;;;OAQG;IACH,IAAI,CAAC,QAAoC,EAAE;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAgB,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAU,KAAK,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAyB;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA+B,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,EAAU,EAAE,KAAyB;QAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAU,OAAO,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAO,QAAQ,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AA7DD,4BA6DC"}
@@ -0,0 +1,25 @@
1
+ import type { ActivityLog, ListActivityLogsQuery, Paginated } from '../../types';
2
+ import type { HttpClient } from '../../http';
3
+ /**
4
+ * Channel activity feed: what happened to a channel and who did it -- the
5
+ * owner, the agency, or the platform itself.
6
+ *
7
+ * Read-only, and written by the services as they work. Wallet movements share
8
+ * the feed with ordinary activity, so `type: 'activity'` is the filter for
9
+ * "everything except money".
10
+ */
11
+ export declare class Activity {
12
+ private readonly http;
13
+ constructor(http: HttpClient);
14
+ /**
15
+ * `GET /v1/channels/:channelId/logs` -- offset paginated, newest first.
16
+ *
17
+ * `search` matches the event name and the message. `type`, `source` and
18
+ * `event` are quick filters, where `event` is an exact machine name such as
19
+ * `template.approved`. `range` restricts to a window in unix seconds, where
20
+ * `0` on either end means no bound.
21
+ *
22
+ * Scope: `channels:read`.
23
+ */
24
+ list(channelId: string, query?: Partial<ListActivityLogsQuery>): Promise<Paginated<ActivityLog>>;
25
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Activity = void 0;
4
+ const paths_1 = require("../paths");
5
+ const base = (channelId) => `${paths_1.CHANNELS}/${(0, paths_1.seg)(channelId)}/logs`;
6
+ /**
7
+ * Channel activity feed: what happened to a channel and who did it -- the
8
+ * owner, the agency, or the platform itself.
9
+ *
10
+ * Read-only, and written by the services as they work. Wallet movements share
11
+ * the feed with ordinary activity, so `type: 'activity'` is the filter for
12
+ * "everything except money".
13
+ */
14
+ class Activity {
15
+ http;
16
+ constructor(http) {
17
+ this.http = http;
18
+ }
19
+ /**
20
+ * `GET /v1/channels/:channelId/logs` -- offset paginated, newest first.
21
+ *
22
+ * `search` matches the event name and the message. `type`, `source` and
23
+ * `event` are quick filters, where `event` is an exact machine name such as
24
+ * `template.approved`. `range` restricts to a window in unix seconds, where
25
+ * `0` on either end means no bound.
26
+ *
27
+ * Scope: `channels:read`.
28
+ */
29
+ list(channelId, query = {}) {
30
+ return this.http.request('GET', base(channelId), { query });
31
+ }
32
+ }
33
+ exports.Activity = Activity;
34
+ //# sourceMappingURL=activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.js","sourceRoot":"","sources":["../../../src/resources/channels/activity.ts"],"names":[],"mappings":";;;AAEA,oCAAyC;AAEzC,MAAM,IAAI,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,GAAG,gBAAQ,IAAI,IAAA,WAAG,EAAC,SAAS,CAAC,OAAO,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAa,QAAQ;IACU;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;;;;;;OASG;IACH,IAAI,CAAC,SAAiB,EAAE,QAAwC,EAAE;QAChE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAyB,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,CAAC;CACF;AAhBD,4BAgBC"}
@@ -0,0 +1,46 @@
1
+ import type { BillingLog, BillingStats, ListBillingLogsQuery, Paginated } from '../../types';
2
+ import type { HttpClient } from '../../http';
3
+ /**
4
+ * Conversation billing: what each conversation on a channel cost.
5
+ *
6
+ * The endpoint answers in two shapes off one route. Without `stat` it pages
7
+ * through individual charges; with `stat` it returns aggregates instead, which
8
+ * is why `list` and `stats` are separate methods here.
9
+ *
10
+ * Pass `'all'` as the channel id to read across every channel the caller owns.
11
+ * `summary` then totals by currency; on a single channel it totals by message
12
+ * category.
13
+ */
14
+ export declare class Billing {
15
+ private readonly http;
16
+ constructor(http: HttpClient);
17
+ /**
18
+ * `GET /v1/channels/:channelId/conversations` -- offset paginated, one row
19
+ * per billed conversation.
20
+ *
21
+ * `search` matches the recipient identifier and the provider detail in
22
+ * `meta`: recipient, category, country and message id. `range` restricts to
23
+ * a window in unix seconds, where `0` on either end means no bound.
24
+ * `template`, `country` and `campaign` take arrays and are serialised to
25
+ * JSON by the SDK.
26
+ *
27
+ * `channelId` may be `'all'`.
28
+ *
29
+ * Scope: `channels:read`.
30
+ */
31
+ list(channelId: string, query?: Partial<Omit<ListBillingLogsQuery, 'stat'>>): Promise<Paginated<BillingLog>>;
32
+ /**
33
+ * `GET /v1/channels/:channelId/conversations?stat=...` -- the same filters,
34
+ * aggregated instead of paged. Returns `{ data, stat }`, where each row is
35
+ * `{ group, totalRecords, totalDeductionAmount }`.
36
+ *
37
+ * `group` is what the totals are cut by: currency for `summary` across all
38
+ * channels, message category for `summary` on one channel, and the calendar
39
+ * date for `day_wise`.
40
+ *
41
+ * Pagination does not apply -- every group is returned.
42
+ *
43
+ * Scope: `channels:read`.
44
+ */
45
+ stats(channelId: string, stat?: NonNullable<ListBillingLogsQuery['stat']>, query?: Partial<Omit<ListBillingLogsQuery, 'stat'>>): Promise<BillingStats>;
46
+ }