@trycourier/courier 6.6.1-alpha0 → 6.7.0-alpha10
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 +124 -0
- package/README.md +11 -11
- package/client.d.mts +48 -20
- package/client.d.mts.map +1 -1
- package/client.d.ts +48 -20
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs +3 -3
- package/client.mjs.map +1 -1
- package/internal/to-file.d.mts +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.js +1 -1
- package/internal/to-file.mjs +1 -1
- package/internal/tslib.js +6 -6
- package/package.json +1 -1
- package/resources/audiences.d.mts +30 -52
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +30 -52
- package/resources/audiences.d.ts.map +1 -1
- package/resources/audiences.js.map +1 -1
- package/resources/audiences.mjs.map +1 -1
- package/resources/audit-events.d.mts +5 -9
- package/resources/audit-events.d.mts.map +1 -1
- package/resources/audit-events.d.ts +5 -9
- package/resources/audit-events.d.ts.map +1 -1
- package/resources/auth.d.mts +2 -2
- package/resources/auth.d.mts.map +1 -1
- package/resources/auth.d.ts +2 -2
- package/resources/auth.d.ts.map +1 -1
- package/resources/automations/automations.d.mts +5 -252
- package/resources/automations/automations.d.mts.map +1 -1
- package/resources/automations/automations.d.ts +5 -252
- package/resources/automations/automations.d.ts.map +1 -1
- package/resources/automations/automations.js +0 -42
- package/resources/automations/automations.js.map +1 -1
- package/resources/automations/automations.mjs +1 -43
- package/resources/automations/automations.mjs.map +1 -1
- package/resources/automations/index.d.mts +2 -2
- package/resources/automations/index.d.mts.map +1 -1
- package/resources/automations/index.d.ts +2 -2
- package/resources/automations/index.d.ts.map +1 -1
- package/resources/automations/index.js.map +1 -1
- package/resources/automations/index.mjs +2 -2
- package/resources/automations/index.mjs.map +1 -1
- package/resources/automations/invoke.d.mts +122 -9
- package/resources/automations/invoke.d.mts.map +1 -1
- package/resources/automations/invoke.d.ts +122 -9
- package/resources/automations/invoke.d.ts.map +1 -1
- package/resources/automations/invoke.js +45 -0
- package/resources/automations/invoke.js.map +1 -1
- package/resources/automations/invoke.mjs +45 -0
- package/resources/automations/invoke.mjs.map +1 -1
- package/resources/brands.d.mts +76 -52
- package/resources/brands.d.mts.map +1 -1
- package/resources/brands.d.ts +76 -52
- package/resources/brands.d.ts.map +1 -1
- package/resources/brands.js.map +1 -1
- package/resources/brands.mjs.map +1 -1
- package/resources/bulk.d.mts +36 -127
- package/resources/bulk.d.mts.map +1 -1
- package/resources/bulk.d.ts +36 -127
- package/resources/bulk.d.ts.map +1 -1
- package/resources/bulk.js.map +1 -1
- package/resources/bulk.mjs.map +1 -1
- package/resources/inbound.d.mts +1 -1
- package/resources/inbound.d.ts +1 -1
- package/resources/index.d.mts +11 -10
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +11 -10
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +2 -0
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -2
- package/resources/index.mjs.map +1 -1
- package/resources/lists/index.d.mts +2 -2
- package/resources/lists/index.d.mts.map +1 -1
- package/resources/lists/index.d.ts +2 -2
- package/resources/lists/index.d.ts.map +1 -1
- package/resources/lists/index.js.map +1 -1
- package/resources/lists/index.mjs +1 -1
- package/resources/lists/index.mjs.map +1 -1
- package/resources/lists/lists.d.mts +19 -13
- package/resources/lists/lists.d.mts.map +1 -1
- package/resources/lists/lists.d.ts +19 -13
- package/resources/lists/lists.d.ts.map +1 -1
- package/resources/lists/lists.js +7 -2
- package/resources/lists/lists.js.map +1 -1
- package/resources/lists/lists.mjs +7 -2
- package/resources/lists/lists.mjs.map +1 -1
- package/resources/lists/subscriptions.d.mts +8 -52
- package/resources/lists/subscriptions.d.mts.map +1 -1
- package/resources/lists/subscriptions.d.ts +8 -52
- package/resources/lists/subscriptions.d.ts.map +1 -1
- package/resources/lists/subscriptions.js.map +1 -1
- package/resources/lists/subscriptions.mjs.map +1 -1
- package/resources/messages.d.mts +8 -8
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +8 -8
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +1 -1
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +1 -1
- package/resources/messages.mjs.map +1 -1
- package/resources/notifications/checks.d.mts +5 -12
- package/resources/notifications/checks.d.mts.map +1 -1
- package/resources/notifications/checks.d.ts +5 -12
- package/resources/notifications/checks.d.ts.map +1 -1
- package/resources/notifications/checks.js.map +1 -1
- package/resources/notifications/checks.mjs.map +1 -1
- package/resources/notifications/index.d.mts +2 -2
- package/resources/notifications/index.d.mts.map +1 -1
- package/resources/notifications/index.d.ts +2 -2
- package/resources/notifications/index.d.ts.map +1 -1
- package/resources/notifications/index.js.map +1 -1
- package/resources/notifications/index.mjs.map +1 -1
- package/resources/notifications/notifications.d.mts +13 -11
- package/resources/notifications/notifications.d.mts.map +1 -1
- package/resources/notifications/notifications.d.ts +13 -11
- package/resources/notifications/notifications.d.ts.map +1 -1
- package/resources/notifications/notifications.js.map +1 -1
- package/resources/notifications/notifications.mjs.map +1 -1
- package/resources/profiles/index.d.mts +1 -1
- package/resources/profiles/index.d.mts.map +1 -1
- package/resources/profiles/index.d.ts +1 -1
- package/resources/profiles/index.d.ts.map +1 -1
- package/resources/profiles/index.js.map +1 -1
- package/resources/profiles/index.mjs.map +1 -1
- package/resources/profiles/lists.d.mts +5 -11
- package/resources/profiles/lists.d.mts.map +1 -1
- package/resources/profiles/lists.d.ts +5 -11
- package/resources/profiles/lists.d.ts.map +1 -1
- package/resources/profiles/profiles.d.mts +7 -3
- package/resources/profiles/profiles.d.mts.map +1 -1
- package/resources/profiles/profiles.d.ts +7 -3
- package/resources/profiles/profiles.d.ts.map +1 -1
- package/resources/profiles/profiles.js.map +1 -1
- package/resources/profiles/profiles.mjs.map +1 -1
- package/resources/send.d.mts +127 -745
- package/resources/send.d.mts.map +1 -1
- package/resources/send.d.ts +127 -745
- package/resources/send.d.ts.map +1 -1
- package/resources/send.js +12 -1
- package/resources/send.js.map +1 -1
- package/resources/send.mjs +12 -1
- package/resources/send.mjs.map +1 -1
- package/resources/shared.d.mts +245 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +245 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/{src/resources/tenants/default-preferences.ts → resources/shared.mjs} +2 -2
- package/resources/shared.mjs.map +1 -0
- package/resources/tenants/index.d.mts +3 -1
- package/resources/tenants/index.d.mts.map +1 -1
- package/resources/tenants/index.d.ts +3 -1
- package/resources/tenants/index.d.ts.map +1 -1
- package/resources/tenants/index.js +5 -1
- package/resources/tenants/index.js.map +1 -1
- package/resources/tenants/index.mjs +2 -0
- package/resources/tenants/index.mjs.map +1 -1
- package/resources/tenants/templates.d.mts +91 -0
- package/resources/tenants/templates.d.mts.map +1 -0
- package/resources/tenants/templates.d.ts +91 -0
- package/resources/tenants/templates.d.ts.map +1 -0
- package/resources/tenants/templates.js +38 -0
- package/resources/tenants/templates.js.map +1 -0
- package/resources/tenants/templates.mjs +34 -0
- package/resources/tenants/templates.mjs.map +1 -0
- package/resources/tenants/tenant-default-preferences/index.d.mts +3 -0
- package/resources/tenants/tenant-default-preferences/index.d.mts.map +1 -0
- package/resources/tenants/tenant-default-preferences/index.d.ts +3 -0
- package/resources/tenants/tenant-default-preferences/index.d.ts.map +1 -0
- package/resources/tenants/tenant-default-preferences/index.js +9 -0
- package/resources/tenants/tenant-default-preferences/index.js.map +1 -0
- package/resources/tenants/tenant-default-preferences/index.mjs +4 -0
- package/resources/tenants/tenant-default-preferences/index.mjs.map +1 -0
- package/resources/tenants/{default-preferences → tenant-default-preferences}/items.d.mts +5 -18
- package/resources/tenants/tenant-default-preferences/items.d.mts.map +1 -0
- package/resources/tenants/{default-preferences → tenant-default-preferences}/items.d.ts +5 -18
- package/resources/tenants/tenant-default-preferences/items.d.ts.map +1 -0
- package/resources/tenants/{default-preferences → tenant-default-preferences}/items.js +2 -2
- package/resources/tenants/tenant-default-preferences/items.js.map +1 -0
- package/resources/tenants/{default-preferences → tenant-default-preferences}/items.mjs +2 -2
- package/resources/tenants/tenant-default-preferences/items.mjs.map +1 -0
- package/resources/tenants/tenant-default-preferences/tenant-default-preferences.d.mts +10 -0
- package/resources/tenants/tenant-default-preferences/tenant-default-preferences.d.mts.map +1 -0
- package/resources/tenants/tenant-default-preferences/tenant-default-preferences.d.ts +10 -0
- package/resources/tenants/tenant-default-preferences/tenant-default-preferences.d.ts.map +1 -0
- package/resources/tenants/{default-preferences/default-preferences.js → tenant-default-preferences/tenant-default-preferences.js} +5 -5
- package/resources/tenants/tenant-default-preferences/tenant-default-preferences.js.map +1 -0
- package/resources/tenants/{default-preferences/default-preferences.mjs → tenant-default-preferences/tenant-default-preferences.mjs} +4 -4
- package/resources/tenants/tenant-default-preferences/tenant-default-preferences.mjs.map +1 -0
- package/resources/tenants/tenant-default-preferences.d.mts +2 -0
- package/resources/tenants/tenant-default-preferences.d.mts.map +1 -0
- package/resources/tenants/tenant-default-preferences.d.ts +2 -0
- package/resources/tenants/tenant-default-preferences.d.ts.map +1 -0
- package/resources/tenants/{default-preferences.js → tenant-default-preferences.js} +2 -2
- package/resources/tenants/tenant-default-preferences.js.map +1 -0
- package/resources/tenants/tenant-default-preferences.mjs +3 -0
- package/resources/tenants/tenant-default-preferences.mjs.map +1 -0
- package/resources/tenants/tenants.d.mts +66 -7
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +66 -7
- package/resources/tenants/tenants.d.ts.map +1 -1
- package/resources/tenants/tenants.js +8 -2
- package/resources/tenants/tenants.js.map +1 -1
- package/resources/tenants/tenants.mjs +8 -2
- package/resources/tenants/tenants.mjs.map +1 -1
- package/resources/users/index.d.mts +3 -3
- package/resources/users/index.d.mts.map +1 -1
- package/resources/users/index.d.ts +3 -3
- package/resources/users/index.d.ts.map +1 -1
- package/resources/users/index.js.map +1 -1
- package/resources/users/index.mjs.map +1 -1
- package/resources/users/preferences.d.mts +8 -11
- package/resources/users/preferences.d.mts.map +1 -1
- package/resources/users/preferences.d.ts +8 -11
- package/resources/users/preferences.d.ts.map +1 -1
- package/resources/users/preferences.js.map +1 -1
- package/resources/users/preferences.mjs.map +1 -1
- package/resources/users/tenants.d.mts +4 -21
- package/resources/users/tenants.d.mts.map +1 -1
- package/resources/users/tenants.d.ts +4 -21
- package/resources/users/tenants.d.ts.map +1 -1
- package/resources/users/tenants.js.map +1 -1
- package/resources/users/tenants.mjs.map +1 -1
- package/resources/users/tokens.d.mts +22 -23
- package/resources/users/tokens.d.mts.map +1 -1
- package/resources/users/tokens.d.ts +22 -23
- package/resources/users/tokens.d.ts.map +1 -1
- package/resources/users/tokens.js +14 -15
- package/resources/users/tokens.js.map +1 -1
- package/resources/users/tokens.mjs +14 -15
- package/resources/users/tokens.mjs.map +1 -1
- package/resources/users/users.d.mts +6 -6
- package/resources/users/users.d.mts.map +1 -1
- package/resources/users/users.d.ts +6 -6
- package/resources/users/users.d.ts.map +1 -1
- package/resources/users/users.js.map +1 -1
- package/resources/users/users.mjs.map +1 -1
- package/src/client.ts +81 -56
- package/src/internal/to-file.ts +1 -1
- package/src/resources/audiences.ts +45 -90
- package/src/resources/audit-events.ts +7 -13
- package/src/resources/auth.ts +2 -16
- package/src/resources/automations/automations.ts +6 -342
- package/src/resources/automations/index.ts +2 -12
- package/src/resources/automations/invoke.ts +163 -14
- package/src/resources/brands.ts +119 -53
- package/src/resources/bulk.ts +28 -148
- package/src/resources/inbound.ts +1 -1
- package/src/resources/index.ts +24 -30
- package/src/resources/lists/index.ts +9 -3
- package/src/resources/lists/lists.ts +27 -16
- package/src/resources/lists/subscriptions.ts +7 -65
- package/src/resources/messages.ts +10 -7
- package/src/resources/notifications/checks.ts +4 -17
- package/src/resources/notifications/index.ts +2 -4
- package/src/resources/notifications/notifications.ts +13 -14
- package/src/resources/profiles/index.ts +1 -0
- package/src/resources/profiles/lists.ts +5 -13
- package/src/resources/profiles/profiles.ts +9 -2
- package/src/resources/send.ts +122 -928
- package/src/resources/shared.ts +305 -0
- package/src/resources/tenants/index.ts +10 -0
- package/src/resources/tenants/templates.ts +124 -0
- package/src/resources/tenants/tenant-default-preferences/index.ts +4 -0
- package/src/resources/tenants/{default-preferences → tenant-default-preferences}/items.ts +5 -27
- package/src/resources/tenants/{default-preferences/default-preferences.ts → tenant-default-preferences/tenant-default-preferences.ts} +4 -12
- package/src/resources/tenants/tenant-default-preferences.ts +3 -0
- package/src/resources/tenants/tenants.ts +89 -8
- package/src/resources/users/index.ts +2 -4
- package/src/resources/users/preferences.ts +7 -12
- package/src/resources/users/tenants.ts +3 -23
- package/src/resources/users/tokens.ts +33 -34
- package/src/resources/users/users.ts +4 -8
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/tenants/default-preferences/default-preferences.d.mts +0 -10
- package/resources/tenants/default-preferences/default-preferences.d.mts.map +0 -1
- package/resources/tenants/default-preferences/default-preferences.d.ts +0 -10
- package/resources/tenants/default-preferences/default-preferences.d.ts.map +0 -1
- package/resources/tenants/default-preferences/default-preferences.js.map +0 -1
- package/resources/tenants/default-preferences/default-preferences.mjs.map +0 -1
- package/resources/tenants/default-preferences/index.d.mts +0 -3
- package/resources/tenants/default-preferences/index.d.mts.map +0 -1
- package/resources/tenants/default-preferences/index.d.ts +0 -3
- package/resources/tenants/default-preferences/index.d.ts.map +0 -1
- package/resources/tenants/default-preferences/index.js +0 -9
- package/resources/tenants/default-preferences/index.js.map +0 -1
- package/resources/tenants/default-preferences/index.mjs +0 -4
- package/resources/tenants/default-preferences/index.mjs.map +0 -1
- package/resources/tenants/default-preferences/items.d.mts.map +0 -1
- package/resources/tenants/default-preferences/items.d.ts.map +0 -1
- package/resources/tenants/default-preferences/items.js.map +0 -1
- package/resources/tenants/default-preferences/items.mjs.map +0 -1
- package/resources/tenants/default-preferences.d.mts +0 -2
- package/resources/tenants/default-preferences.d.mts.map +0 -1
- package/resources/tenants/default-preferences.d.ts +0 -2
- package/resources/tenants/default-preferences.d.ts.map +0 -1
- package/resources/tenants/default-preferences.js.map +0 -1
- package/resources/tenants/default-preferences.mjs +0 -3
- package/resources/tenants/default-preferences.mjs.map +0 -1
- package/src/resources/tenants/default-preferences/index.ts +0 -10
|
@@ -1,361 +1,25 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
|
-
import * as SendAPI from '../send';
|
|
5
4
|
import * as InvokeAPI from './invoke';
|
|
6
|
-
import {
|
|
7
|
-
AutomationInvokeParams,
|
|
8
|
-
AutomationInvokeResponse,
|
|
9
|
-
AutomationStep,
|
|
10
|
-
Invoke,
|
|
11
|
-
MergeAlgorithm,
|
|
12
|
-
} from './invoke';
|
|
13
|
-
import { APIPromise } from '../../core/api-promise';
|
|
14
|
-
import { RequestOptions } from '../../internal/request-options';
|
|
15
|
-
import { path } from '../../internal/utils/path';
|
|
5
|
+
import { Invoke, InvokeInvokeAdHocParams, InvokeInvokeByTemplateParams } from './invoke';
|
|
16
6
|
|
|
17
7
|
export class Automations extends APIResource {
|
|
18
8
|
invoke: InvokeAPI.Invoke = new InvokeAPI.Invoke(this._client);
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a
|
|
22
|
-
* series of automation steps. For information about what steps are available,
|
|
23
|
-
* checkout the ad hoc automation guide
|
|
24
|
-
* [here](https://www.courier.com/docs/automations/steps/).
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* const automationInvokeResponse =
|
|
29
|
-
* await client.automations.invokeAdHoc({
|
|
30
|
-
* automation: {
|
|
31
|
-
* cancelation_token: 'delay-send--user-yes--abc-123',
|
|
32
|
-
* steps: [
|
|
33
|
-
* { action: 'delay', until: '20240408T080910.123' },
|
|
34
|
-
* {
|
|
35
|
-
* action: 'send',
|
|
36
|
-
* template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0',
|
|
37
|
-
* },
|
|
38
|
-
* ],
|
|
39
|
-
* },
|
|
40
|
-
* data: { name: 'Foo' },
|
|
41
|
-
* profile: { tenant_id: 'abc-123' },
|
|
42
|
-
* recipient: 'user-yes',
|
|
43
|
-
* });
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
invokeAdHoc(
|
|
47
|
-
body: AutomationInvokeAdHocParams,
|
|
48
|
-
options?: RequestOptions,
|
|
49
|
-
): APIPromise<InvokeAPI.AutomationInvokeResponse> {
|
|
50
|
-
return this._client.post('/automations/invoke', { body, ...options });
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Invoke an automation run from an automation template.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* const automationInvokeResponse =
|
|
59
|
-
* await client.automations.invokeByTemplate('templateId');
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
invokeByTemplate(
|
|
63
|
-
templateID: string,
|
|
64
|
-
body: AutomationInvokeByTemplateParams,
|
|
65
|
-
options?: RequestOptions,
|
|
66
|
-
): APIPromise<InvokeAPI.AutomationInvokeResponse> {
|
|
67
|
-
return this._client.post(path`/automations/${templateID}/invoke`, { body, ...options });
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface AutomationInvokeAdHocParams {
|
|
72
|
-
automation: AutomationInvokeAdHocParams.Automation;
|
|
73
|
-
|
|
74
|
-
brand?: string | null;
|
|
75
|
-
|
|
76
|
-
data?: { [key: string]: unknown } | null;
|
|
77
|
-
|
|
78
|
-
profile?: unknown;
|
|
79
|
-
|
|
80
|
-
recipient?: string | null;
|
|
81
|
-
|
|
82
|
-
template?: string | null;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export namespace AutomationInvokeAdHocParams {
|
|
86
|
-
export interface Automation {
|
|
87
|
-
steps: Array<
|
|
88
|
-
| Automation.AutomationAddToDigestStep
|
|
89
|
-
| Automation.AutomationAddToBatchStep
|
|
90
|
-
| Automation.AutomationThrottleStep
|
|
91
|
-
| Automation.AutomationCancelStep
|
|
92
|
-
| Automation.AutomationDelayStep
|
|
93
|
-
| Automation.AutomationFetchDataStep
|
|
94
|
-
| Automation.AutomationInvokeStep
|
|
95
|
-
| Automation.AutomationSendStep
|
|
96
|
-
| Automation.AutomationV2SendStep
|
|
97
|
-
| Automation.AutomationSendListStep
|
|
98
|
-
| Automation.AutomationUpdateProfileStep
|
|
99
|
-
>;
|
|
100
|
-
|
|
101
|
-
cancelation_token?: string | null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export namespace Automation {
|
|
105
|
-
export interface AutomationAddToDigestStep extends InvokeAPI.AutomationStep {
|
|
106
|
-
action: 'add-to-digest';
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* The subscription topic that has digests enabled
|
|
110
|
-
*/
|
|
111
|
-
subscription_topic_id: string;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export interface AutomationAddToBatchStep extends InvokeAPI.AutomationStep {
|
|
115
|
-
action: 'add-to-batch';
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Defines the maximum wait time before the batch should be released. Must be less
|
|
119
|
-
* than wait period. Maximum of 60 days. Specified as an
|
|
120
|
-
* [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations)
|
|
121
|
-
*/
|
|
122
|
-
max_wait_period: string;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Defines what items should be retained and passed along to the next steps when
|
|
126
|
-
* the batch is released
|
|
127
|
-
*/
|
|
128
|
-
retain: AutomationAddToBatchStep.Retain;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Defines the period of inactivity before the batch is released. Specified as an
|
|
132
|
-
* [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations)
|
|
133
|
-
*/
|
|
134
|
-
wait_period: string;
|
|
135
|
-
|
|
136
|
-
batch_id?: string | null;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* If using scope=dynamic, provide the key or a reference (e.g.,
|
|
140
|
-
* refs.data.batch_key)
|
|
141
|
-
*/
|
|
142
|
-
batch_key?: string | null;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Defines the field of the data object the batch is set to when complete. Defaults
|
|
146
|
-
* to `batch`
|
|
147
|
-
*/
|
|
148
|
-
category_key?: string | null;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* If specified, the batch will release as soon as this number is reached
|
|
152
|
-
*/
|
|
153
|
-
max_items?: string | number | null;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Determine the scope of the batching. If user, chosen in this order: recipient,
|
|
157
|
-
* profile.user_id, data.user_id, data.userId. If dynamic, then specify where the
|
|
158
|
-
* batch_key or a reference to the batch_key
|
|
159
|
-
*/
|
|
160
|
-
scope?: 'user' | 'global' | 'dynamic' | null;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export namespace AutomationAddToBatchStep {
|
|
164
|
-
/**
|
|
165
|
-
* Defines what items should be retained and passed along to the next steps when
|
|
166
|
-
* the batch is released
|
|
167
|
-
*/
|
|
168
|
-
export interface Retain {
|
|
169
|
-
/**
|
|
170
|
-
* The number of records to keep in batch. Default is 10 and only configurable by
|
|
171
|
-
* requesting from support. When configurable minimum is 2 and maximum is 100.
|
|
172
|
-
*/
|
|
173
|
-
count: number;
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Keep N number of notifications based on the type. First/Last N based on
|
|
177
|
-
* notification received. highest/lowest based on a scoring key providing in the
|
|
178
|
-
* data accessed by sort_key
|
|
179
|
-
*/
|
|
180
|
-
type: 'first' | 'last' | 'highest' | 'lowest';
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Defines the data value data[sort_key] that is used to sort the stored items.
|
|
184
|
-
* Required when type is set to highest or lowest.
|
|
185
|
-
*/
|
|
186
|
-
sort_key?: string | null;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export interface AutomationThrottleStep extends InvokeAPI.AutomationStep {
|
|
191
|
-
action: 'throttle';
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Maximum number of allowed notifications in that timeframe
|
|
195
|
-
*/
|
|
196
|
-
max_allowed: number;
|
|
197
|
-
|
|
198
|
-
on_throttle: AutomationThrottleStep.OnThrottle;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Defines the throttle period which corresponds to the max_allowed. Specified as
|
|
202
|
-
* an ISO 8601 duration, https://en.wikipedia.org/wiki/ISO_8601#Durations
|
|
203
|
-
*/
|
|
204
|
-
period: string;
|
|
205
|
-
|
|
206
|
-
scope: 'user' | 'global' | 'dynamic';
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Value must be true
|
|
210
|
-
*/
|
|
211
|
-
should_alert: boolean;
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* If using scope=dynamic, provide the reference (e.g., refs.data.throttle_key) to
|
|
215
|
-
* the how the throttle should be identified
|
|
216
|
-
*/
|
|
217
|
-
throttle_key?: string | null;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export namespace AutomationThrottleStep {
|
|
221
|
-
export interface OnThrottle {
|
|
222
|
-
/**
|
|
223
|
-
* The node to go to if the request is throttled
|
|
224
|
-
*/
|
|
225
|
-
$node_id: string;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export interface AutomationCancelStep extends InvokeAPI.AutomationStep {
|
|
230
|
-
action: 'cancel';
|
|
231
|
-
|
|
232
|
-
cancelation_token?: string | null;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export interface AutomationDelayStep extends InvokeAPI.AutomationStep {
|
|
236
|
-
action: 'delay';
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* The [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) string
|
|
240
|
-
* for how long to delay for
|
|
241
|
-
*/
|
|
242
|
-
duration?: string | null;
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* The ISO 8601 timestamp for when the delay should end
|
|
246
|
-
*/
|
|
247
|
-
until?: string | null;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
export interface AutomationFetchDataStep extends InvokeAPI.AutomationStep {
|
|
251
|
-
action: 'fetch-data';
|
|
252
|
-
|
|
253
|
-
merge_strategy: InvokeAPI.MergeAlgorithm;
|
|
254
|
-
|
|
255
|
-
webhook: AutomationFetchDataStep.Webhook;
|
|
256
|
-
|
|
257
|
-
idempotency_expiry?: string | null;
|
|
258
|
-
|
|
259
|
-
idempotency_key?: string | null;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export namespace AutomationFetchDataStep {
|
|
263
|
-
export interface Webhook {
|
|
264
|
-
method: 'GET' | 'POST';
|
|
265
|
-
|
|
266
|
-
url: string;
|
|
267
|
-
|
|
268
|
-
body?: { [key: string]: unknown } | null;
|
|
269
|
-
|
|
270
|
-
headers?: { [key: string]: unknown } | null;
|
|
271
|
-
|
|
272
|
-
params?: { [key: string]: unknown } | null;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
export interface AutomationInvokeStep extends InvokeAPI.AutomationStep {
|
|
277
|
-
action: 'invoke';
|
|
278
|
-
|
|
279
|
-
template: string;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export interface AutomationSendStep extends InvokeAPI.AutomationStep {
|
|
283
|
-
action: 'send';
|
|
284
|
-
|
|
285
|
-
brand?: string | null;
|
|
286
|
-
|
|
287
|
-
data?: { [key: string]: unknown } | null;
|
|
288
|
-
|
|
289
|
-
override?: { [key: string]: unknown } | null;
|
|
290
|
-
|
|
291
|
-
profile?: unknown;
|
|
292
|
-
|
|
293
|
-
recipient?: string | null;
|
|
294
|
-
|
|
295
|
-
template?: string | null;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export interface AutomationV2SendStep extends InvokeAPI.AutomationStep {
|
|
299
|
-
action: 'send';
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Describes the content of the message in a way that will work for email, push,
|
|
303
|
-
* chat, or any channel.
|
|
304
|
-
*/
|
|
305
|
-
message: SendAPI.Message;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
export interface AutomationSendListStep extends InvokeAPI.AutomationStep {
|
|
309
|
-
action: 'send-list';
|
|
310
|
-
|
|
311
|
-
list: string;
|
|
312
|
-
|
|
313
|
-
brand?: string | null;
|
|
314
|
-
|
|
315
|
-
data?: { [key: string]: unknown } | null;
|
|
316
|
-
|
|
317
|
-
override?: { [key: string]: unknown } | null;
|
|
318
|
-
|
|
319
|
-
template?: string | null;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
export interface AutomationUpdateProfileStep {
|
|
323
|
-
action: 'update-profile';
|
|
324
|
-
|
|
325
|
-
merge: InvokeAPI.MergeAlgorithm;
|
|
326
|
-
|
|
327
|
-
profile: unknown;
|
|
328
|
-
|
|
329
|
-
recipient_id: string;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
9
|
}
|
|
333
10
|
|
|
334
|
-
export interface
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
data?: { [key: string]: unknown } | null;
|
|
338
|
-
|
|
339
|
-
profile?: unknown;
|
|
340
|
-
|
|
341
|
-
recipient?: string | null;
|
|
342
|
-
|
|
343
|
-
template?: string | null;
|
|
11
|
+
export interface AutomationInvokeResponse {
|
|
12
|
+
runId: string;
|
|
344
13
|
}
|
|
345
14
|
|
|
346
15
|
Automations.Invoke = Invoke;
|
|
347
16
|
|
|
348
17
|
export declare namespace Automations {
|
|
349
|
-
export {
|
|
350
|
-
type AutomationInvokeAdHocParams as AutomationInvokeAdHocParams,
|
|
351
|
-
type AutomationInvokeByTemplateParams as AutomationInvokeByTemplateParams,
|
|
352
|
-
};
|
|
18
|
+
export { type AutomationInvokeResponse as AutomationInvokeResponse };
|
|
353
19
|
|
|
354
20
|
export {
|
|
355
21
|
Invoke as Invoke,
|
|
356
|
-
type
|
|
357
|
-
type
|
|
358
|
-
type AutomationStep as AutomationStep,
|
|
359
|
-
type MergeAlgorithm as MergeAlgorithm,
|
|
22
|
+
type InvokeInvokeAdHocParams as InvokeInvokeAdHocParams,
|
|
23
|
+
type InvokeInvokeByTemplateParams as InvokeInvokeByTemplateParams,
|
|
360
24
|
};
|
|
361
25
|
}
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
type AutomationInvokeAdHocParams,
|
|
6
|
-
type AutomationInvokeByTemplateParams,
|
|
7
|
-
} from './automations';
|
|
8
|
-
export {
|
|
9
|
-
Invoke,
|
|
10
|
-
type AutomationInvokeParams,
|
|
11
|
-
type AutomationInvokeResponse,
|
|
12
|
-
type AutomationStep,
|
|
13
|
-
type MergeAlgorithm,
|
|
14
|
-
} from './invoke';
|
|
3
|
+
export { Automations, type AutomationInvokeResponse } from './automations';
|
|
4
|
+
export { Invoke, type InvokeInvokeAdHocParams, type InvokeInvokeByTemplateParams } from './invoke';
|
|
@@ -1,38 +1,187 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as AutomationsAPI from './automations';
|
|
5
|
+
import { APIPromise } from '../../core/api-promise';
|
|
6
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
7
|
+
import { path } from '../../internal/utils/path';
|
|
4
8
|
|
|
5
|
-
export class Invoke extends APIResource {
|
|
9
|
+
export class Invoke extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a
|
|
12
|
+
* series of automation steps. For information about what steps are available,
|
|
13
|
+
* checkout the ad hoc automation guide
|
|
14
|
+
* [here](https://www.courier.com/docs/automations/steps/).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const automationInvokeResponse =
|
|
19
|
+
* await client.automations.invoke.invokeAdHoc({
|
|
20
|
+
* automation: {
|
|
21
|
+
* cancelation_token: 'delay-send--user-yes--abc-123',
|
|
22
|
+
* steps: [
|
|
23
|
+
* { action: 'delay', until: '20240408T080910.123' },
|
|
24
|
+
* {
|
|
25
|
+
* action: 'send',
|
|
26
|
+
* template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0',
|
|
27
|
+
* },
|
|
28
|
+
* ],
|
|
29
|
+
* },
|
|
30
|
+
* data: { name: 'Foo' },
|
|
31
|
+
* profile: { tenant_id: 'abc-123' },
|
|
32
|
+
* recipient: 'user-yes',
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
invokeAdHoc(
|
|
37
|
+
body: InvokeInvokeAdHocParams,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<AutomationsAPI.AutomationInvokeResponse> {
|
|
40
|
+
return this._client.post('/automations/invoke', { body, ...options });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Invoke an automation run from an automation template.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const automationInvokeResponse =
|
|
49
|
+
* await client.automations.invoke.invokeByTemplate(
|
|
50
|
+
* 'templateId',
|
|
51
|
+
* { recipient: 'recipient' },
|
|
52
|
+
* );
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
invokeByTemplate(
|
|
56
|
+
templateID: string,
|
|
57
|
+
body: InvokeInvokeByTemplateParams,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): APIPromise<AutomationsAPI.AutomationInvokeResponse> {
|
|
60
|
+
return this._client.post(path`/automations/${templateID}/invoke`, { body, ...options });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface InvokeInvokeAdHocParams {
|
|
65
|
+
automation: InvokeInvokeAdHocParams.Automation;
|
|
6
66
|
|
|
7
|
-
export interface AutomationInvokeParams {
|
|
8
67
|
brand?: string | null;
|
|
9
68
|
|
|
10
69
|
data?: { [key: string]: unknown } | null;
|
|
11
70
|
|
|
12
|
-
profile?: unknown;
|
|
71
|
+
profile?: { [key: string]: unknown } | null;
|
|
13
72
|
|
|
14
73
|
recipient?: string | null;
|
|
15
74
|
|
|
16
75
|
template?: string | null;
|
|
17
76
|
}
|
|
18
77
|
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
78
|
+
export namespace InvokeInvokeAdHocParams {
|
|
79
|
+
export interface Automation {
|
|
80
|
+
steps: Array<
|
|
81
|
+
| Automation.AutomationDelayStep
|
|
82
|
+
| Automation.AutomationSendStep
|
|
83
|
+
| Automation.AutomationSendListStep
|
|
84
|
+
| Automation.AutomationUpdateProfileStep
|
|
85
|
+
| Automation.AutomationCancelStep
|
|
86
|
+
| Automation.AutomationFetchDataStep
|
|
87
|
+
| Automation.AutomationInvokeStep
|
|
88
|
+
>;
|
|
89
|
+
|
|
90
|
+
cancelation_token?: string | null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export namespace Automation {
|
|
94
|
+
export interface AutomationDelayStep {
|
|
95
|
+
action: 'delay';
|
|
96
|
+
|
|
97
|
+
duration?: string | null;
|
|
98
|
+
|
|
99
|
+
until?: string | null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface AutomationSendStep {
|
|
103
|
+
action: 'send';
|
|
104
|
+
|
|
105
|
+
brand?: string | null;
|
|
106
|
+
|
|
107
|
+
data?: { [key: string]: unknown } | null;
|
|
108
|
+
|
|
109
|
+
profile?: { [key: string]: unknown } | null;
|
|
110
|
+
|
|
111
|
+
recipient?: string | null;
|
|
112
|
+
|
|
113
|
+
template?: string | null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface AutomationSendListStep {
|
|
117
|
+
action: 'send-list';
|
|
118
|
+
|
|
119
|
+
list: string;
|
|
120
|
+
|
|
121
|
+
brand?: string | null;
|
|
122
|
+
|
|
123
|
+
data?: { [key: string]: unknown } | null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface AutomationUpdateProfileStep {
|
|
127
|
+
action: 'update-profile';
|
|
128
|
+
|
|
129
|
+
profile: { [key: string]: unknown };
|
|
22
130
|
|
|
23
|
-
|
|
24
|
-
if?: string | null;
|
|
131
|
+
merge?: 'none' | 'overwrite' | 'soft-merge' | 'replace' | null;
|
|
25
132
|
|
|
26
|
-
|
|
133
|
+
recipient_id?: string | null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface AutomationCancelStep {
|
|
137
|
+
action: 'cancel';
|
|
138
|
+
|
|
139
|
+
cancelation_token: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface AutomationFetchDataStep {
|
|
143
|
+
action: 'fetch-data';
|
|
144
|
+
|
|
145
|
+
webhook: AutomationFetchDataStep.Webhook;
|
|
146
|
+
|
|
147
|
+
merge_strategy?: 'replace' | 'overwrite' | 'soft-merge' | null;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export namespace AutomationFetchDataStep {
|
|
151
|
+
export interface Webhook {
|
|
152
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
153
|
+
|
|
154
|
+
url: string;
|
|
155
|
+
|
|
156
|
+
body?: string | null;
|
|
157
|
+
|
|
158
|
+
headers?: { [key: string]: string } | null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface AutomationInvokeStep {
|
|
163
|
+
action: 'invoke';
|
|
164
|
+
|
|
165
|
+
template: string;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
27
168
|
}
|
|
28
169
|
|
|
29
|
-
export
|
|
170
|
+
export interface InvokeInvokeByTemplateParams {
|
|
171
|
+
recipient: string | null;
|
|
172
|
+
|
|
173
|
+
brand?: string | null;
|
|
174
|
+
|
|
175
|
+
data?: { [key: string]: unknown } | null;
|
|
176
|
+
|
|
177
|
+
profile?: { [key: string]: unknown } | null;
|
|
178
|
+
|
|
179
|
+
template?: string | null;
|
|
180
|
+
}
|
|
30
181
|
|
|
31
182
|
export declare namespace Invoke {
|
|
32
183
|
export {
|
|
33
|
-
type
|
|
34
|
-
type
|
|
35
|
-
type AutomationStep as AutomationStep,
|
|
36
|
-
type MergeAlgorithm as MergeAlgorithm,
|
|
184
|
+
type InvokeInvokeAdHocParams as InvokeInvokeAdHocParams,
|
|
185
|
+
type InvokeInvokeByTemplateParams as InvokeInvokeByTemplateParams,
|
|
37
186
|
};
|
|
38
187
|
}
|