@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,261 +1,14 @@
|
|
|
1
1
|
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
-
import * as SendAPI from "../send.mjs";
|
|
3
2
|
import * as InvokeAPI from "./invoke.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { APIPromise } from "../../core/api-promise.mjs";
|
|
6
|
-
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
3
|
+
import { Invoke, InvokeInvokeAdHocParams, InvokeInvokeByTemplateParams } from "./invoke.mjs";
|
|
7
4
|
export declare class Automations extends APIResource {
|
|
8
5
|
invoke: InvokeAPI.Invoke;
|
|
9
|
-
/**
|
|
10
|
-
* Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a
|
|
11
|
-
* series of automation steps. For information about what steps are available,
|
|
12
|
-
* checkout the ad hoc automation guide
|
|
13
|
-
* [here](https://www.courier.com/docs/automations/steps/).
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* const automationInvokeResponse =
|
|
18
|
-
* await client.automations.invokeAdHoc({
|
|
19
|
-
* automation: {
|
|
20
|
-
* cancelation_token: 'delay-send--user-yes--abc-123',
|
|
21
|
-
* steps: [
|
|
22
|
-
* { action: 'delay', until: '20240408T080910.123' },
|
|
23
|
-
* {
|
|
24
|
-
* action: 'send',
|
|
25
|
-
* template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0',
|
|
26
|
-
* },
|
|
27
|
-
* ],
|
|
28
|
-
* },
|
|
29
|
-
* data: { name: 'Foo' },
|
|
30
|
-
* profile: { tenant_id: 'abc-123' },
|
|
31
|
-
* recipient: 'user-yes',
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
invokeAdHoc(body: AutomationInvokeAdHocParams, options?: RequestOptions): APIPromise<InvokeAPI.AutomationInvokeResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* Invoke an automation run from an automation template.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* const automationInvokeResponse =
|
|
42
|
-
* await client.automations.invokeByTemplate('templateId');
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
invokeByTemplate(templateID: string, body: AutomationInvokeByTemplateParams, options?: RequestOptions): APIPromise<InvokeAPI.AutomationInvokeResponse>;
|
|
46
6
|
}
|
|
47
|
-
export interface
|
|
48
|
-
|
|
49
|
-
brand?: string | null;
|
|
50
|
-
data?: {
|
|
51
|
-
[key: string]: unknown;
|
|
52
|
-
} | null;
|
|
53
|
-
profile?: unknown;
|
|
54
|
-
recipient?: string | null;
|
|
55
|
-
template?: string | null;
|
|
56
|
-
}
|
|
57
|
-
export declare namespace AutomationInvokeAdHocParams {
|
|
58
|
-
interface Automation {
|
|
59
|
-
steps: Array<Automation.AutomationAddToDigestStep | Automation.AutomationAddToBatchStep | Automation.AutomationThrottleStep | Automation.AutomationCancelStep | Automation.AutomationDelayStep | Automation.AutomationFetchDataStep | Automation.AutomationInvokeStep | Automation.AutomationSendStep | Automation.AutomationV2SendStep | Automation.AutomationSendListStep | Automation.AutomationUpdateProfileStep>;
|
|
60
|
-
cancelation_token?: string | null;
|
|
61
|
-
}
|
|
62
|
-
namespace Automation {
|
|
63
|
-
interface AutomationAddToDigestStep extends InvokeAPI.AutomationStep {
|
|
64
|
-
action: 'add-to-digest';
|
|
65
|
-
/**
|
|
66
|
-
* The subscription topic that has digests enabled
|
|
67
|
-
*/
|
|
68
|
-
subscription_topic_id: string;
|
|
69
|
-
}
|
|
70
|
-
interface AutomationAddToBatchStep extends InvokeAPI.AutomationStep {
|
|
71
|
-
action: 'add-to-batch';
|
|
72
|
-
/**
|
|
73
|
-
* Defines the maximum wait time before the batch should be released. Must be less
|
|
74
|
-
* than wait period. Maximum of 60 days. Specified as an
|
|
75
|
-
* [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations)
|
|
76
|
-
*/
|
|
77
|
-
max_wait_period: string;
|
|
78
|
-
/**
|
|
79
|
-
* Defines what items should be retained and passed along to the next steps when
|
|
80
|
-
* the batch is released
|
|
81
|
-
*/
|
|
82
|
-
retain: AutomationAddToBatchStep.Retain;
|
|
83
|
-
/**
|
|
84
|
-
* Defines the period of inactivity before the batch is released. Specified as an
|
|
85
|
-
* [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations)
|
|
86
|
-
*/
|
|
87
|
-
wait_period: string;
|
|
88
|
-
batch_id?: string | null;
|
|
89
|
-
/**
|
|
90
|
-
* If using scope=dynamic, provide the key or a reference (e.g.,
|
|
91
|
-
* refs.data.batch_key)
|
|
92
|
-
*/
|
|
93
|
-
batch_key?: string | null;
|
|
94
|
-
/**
|
|
95
|
-
* Defines the field of the data object the batch is set to when complete. Defaults
|
|
96
|
-
* to `batch`
|
|
97
|
-
*/
|
|
98
|
-
category_key?: string | null;
|
|
99
|
-
/**
|
|
100
|
-
* If specified, the batch will release as soon as this number is reached
|
|
101
|
-
*/
|
|
102
|
-
max_items?: string | number | null;
|
|
103
|
-
/**
|
|
104
|
-
* Determine the scope of the batching. If user, chosen in this order: recipient,
|
|
105
|
-
* profile.user_id, data.user_id, data.userId. If dynamic, then specify where the
|
|
106
|
-
* batch_key or a reference to the batch_key
|
|
107
|
-
*/
|
|
108
|
-
scope?: 'user' | 'global' | 'dynamic' | null;
|
|
109
|
-
}
|
|
110
|
-
namespace AutomationAddToBatchStep {
|
|
111
|
-
/**
|
|
112
|
-
* Defines what items should be retained and passed along to the next steps when
|
|
113
|
-
* the batch is released
|
|
114
|
-
*/
|
|
115
|
-
interface Retain {
|
|
116
|
-
/**
|
|
117
|
-
* The number of records to keep in batch. Default is 10 and only configurable by
|
|
118
|
-
* requesting from support. When configurable minimum is 2 and maximum is 100.
|
|
119
|
-
*/
|
|
120
|
-
count: number;
|
|
121
|
-
/**
|
|
122
|
-
* Keep N number of notifications based on the type. First/Last N based on
|
|
123
|
-
* notification received. highest/lowest based on a scoring key providing in the
|
|
124
|
-
* data accessed by sort_key
|
|
125
|
-
*/
|
|
126
|
-
type: 'first' | 'last' | 'highest' | 'lowest';
|
|
127
|
-
/**
|
|
128
|
-
* Defines the data value data[sort_key] that is used to sort the stored items.
|
|
129
|
-
* Required when type is set to highest or lowest.
|
|
130
|
-
*/
|
|
131
|
-
sort_key?: string | null;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
interface AutomationThrottleStep extends InvokeAPI.AutomationStep {
|
|
135
|
-
action: 'throttle';
|
|
136
|
-
/**
|
|
137
|
-
* Maximum number of allowed notifications in that timeframe
|
|
138
|
-
*/
|
|
139
|
-
max_allowed: number;
|
|
140
|
-
on_throttle: AutomationThrottleStep.OnThrottle;
|
|
141
|
-
/**
|
|
142
|
-
* Defines the throttle period which corresponds to the max_allowed. Specified as
|
|
143
|
-
* an ISO 8601 duration, https://en.wikipedia.org/wiki/ISO_8601#Durations
|
|
144
|
-
*/
|
|
145
|
-
period: string;
|
|
146
|
-
scope: 'user' | 'global' | 'dynamic';
|
|
147
|
-
/**
|
|
148
|
-
* Value must be true
|
|
149
|
-
*/
|
|
150
|
-
should_alert: boolean;
|
|
151
|
-
/**
|
|
152
|
-
* If using scope=dynamic, provide the reference (e.g., refs.data.throttle_key) to
|
|
153
|
-
* the how the throttle should be identified
|
|
154
|
-
*/
|
|
155
|
-
throttle_key?: string | null;
|
|
156
|
-
}
|
|
157
|
-
namespace AutomationThrottleStep {
|
|
158
|
-
interface OnThrottle {
|
|
159
|
-
/**
|
|
160
|
-
* The node to go to if the request is throttled
|
|
161
|
-
*/
|
|
162
|
-
$node_id: string;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
interface AutomationCancelStep extends InvokeAPI.AutomationStep {
|
|
166
|
-
action: 'cancel';
|
|
167
|
-
cancelation_token?: string | null;
|
|
168
|
-
}
|
|
169
|
-
interface AutomationDelayStep extends InvokeAPI.AutomationStep {
|
|
170
|
-
action: 'delay';
|
|
171
|
-
/**
|
|
172
|
-
* The [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) string
|
|
173
|
-
* for how long to delay for
|
|
174
|
-
*/
|
|
175
|
-
duration?: string | null;
|
|
176
|
-
/**
|
|
177
|
-
* The ISO 8601 timestamp for when the delay should end
|
|
178
|
-
*/
|
|
179
|
-
until?: string | null;
|
|
180
|
-
}
|
|
181
|
-
interface AutomationFetchDataStep extends InvokeAPI.AutomationStep {
|
|
182
|
-
action: 'fetch-data';
|
|
183
|
-
merge_strategy: InvokeAPI.MergeAlgorithm;
|
|
184
|
-
webhook: AutomationFetchDataStep.Webhook;
|
|
185
|
-
idempotency_expiry?: string | null;
|
|
186
|
-
idempotency_key?: string | null;
|
|
187
|
-
}
|
|
188
|
-
namespace AutomationFetchDataStep {
|
|
189
|
-
interface Webhook {
|
|
190
|
-
method: 'GET' | 'POST';
|
|
191
|
-
url: string;
|
|
192
|
-
body?: {
|
|
193
|
-
[key: string]: unknown;
|
|
194
|
-
} | null;
|
|
195
|
-
headers?: {
|
|
196
|
-
[key: string]: unknown;
|
|
197
|
-
} | null;
|
|
198
|
-
params?: {
|
|
199
|
-
[key: string]: unknown;
|
|
200
|
-
} | null;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
interface AutomationInvokeStep extends InvokeAPI.AutomationStep {
|
|
204
|
-
action: 'invoke';
|
|
205
|
-
template: string;
|
|
206
|
-
}
|
|
207
|
-
interface AutomationSendStep extends InvokeAPI.AutomationStep {
|
|
208
|
-
action: 'send';
|
|
209
|
-
brand?: string | null;
|
|
210
|
-
data?: {
|
|
211
|
-
[key: string]: unknown;
|
|
212
|
-
} | null;
|
|
213
|
-
override?: {
|
|
214
|
-
[key: string]: unknown;
|
|
215
|
-
} | null;
|
|
216
|
-
profile?: unknown;
|
|
217
|
-
recipient?: string | null;
|
|
218
|
-
template?: string | null;
|
|
219
|
-
}
|
|
220
|
-
interface AutomationV2SendStep extends InvokeAPI.AutomationStep {
|
|
221
|
-
action: 'send';
|
|
222
|
-
/**
|
|
223
|
-
* Describes the content of the message in a way that will work for email, push,
|
|
224
|
-
* chat, or any channel.
|
|
225
|
-
*/
|
|
226
|
-
message: SendAPI.Message;
|
|
227
|
-
}
|
|
228
|
-
interface AutomationSendListStep extends InvokeAPI.AutomationStep {
|
|
229
|
-
action: 'send-list';
|
|
230
|
-
list: string;
|
|
231
|
-
brand?: string | null;
|
|
232
|
-
data?: {
|
|
233
|
-
[key: string]: unknown;
|
|
234
|
-
} | null;
|
|
235
|
-
override?: {
|
|
236
|
-
[key: string]: unknown;
|
|
237
|
-
} | null;
|
|
238
|
-
template?: string | null;
|
|
239
|
-
}
|
|
240
|
-
interface AutomationUpdateProfileStep {
|
|
241
|
-
action: 'update-profile';
|
|
242
|
-
merge: InvokeAPI.MergeAlgorithm;
|
|
243
|
-
profile: unknown;
|
|
244
|
-
recipient_id: string;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
export interface AutomationInvokeByTemplateParams {
|
|
249
|
-
brand?: string | null;
|
|
250
|
-
data?: {
|
|
251
|
-
[key: string]: unknown;
|
|
252
|
-
} | null;
|
|
253
|
-
profile?: unknown;
|
|
254
|
-
recipient?: string | null;
|
|
255
|
-
template?: string | null;
|
|
7
|
+
export interface AutomationInvokeResponse {
|
|
8
|
+
runId: string;
|
|
256
9
|
}
|
|
257
10
|
export declare namespace Automations {
|
|
258
|
-
export { type
|
|
259
|
-
export { Invoke as Invoke, type
|
|
11
|
+
export { type AutomationInvokeResponse as AutomationInvokeResponse };
|
|
12
|
+
export { Invoke as Invoke, type InvokeInvokeAdHocParams as InvokeInvokeAdHocParams, type InvokeInvokeByTemplateParams as InvokeInvokeByTemplateParams, };
|
|
260
13
|
}
|
|
261
14
|
//# sourceMappingURL=automations.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automations.d.mts","sourceRoot":"","sources":["../../src/resources/automations/automations.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,
|
|
1
|
+
{"version":3,"file":"automations.d.mts","sourceRoot":"","sources":["../../src/resources/automations/automations.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,SAAS;OACd,EAAE,MAAM,EAAE,uBAAuB,EAAE,4BAA4B,EAAE;AAExE,qBAAa,WAAY,SAAQ,WAAW;IAC1C,MAAM,EAAE,SAAS,CAAC,MAAM,CAAsC;CAC/D;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAID,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EAAE,KAAK,wBAAwB,IAAI,wBAAwB,EAAE,CAAC;IAErE,OAAO,EACL,MAAM,IAAI,MAAM,EAChB,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,4BAA4B,IAAI,4BAA4B,GAClE,CAAC;CACH"}
|
|
@@ -1,261 +1,14 @@
|
|
|
1
1
|
import { APIResource } from "../../core/resource.js";
|
|
2
|
-
import * as SendAPI from "../send.js";
|
|
3
2
|
import * as InvokeAPI from "./invoke.js";
|
|
4
|
-
import {
|
|
5
|
-
import { APIPromise } from "../../core/api-promise.js";
|
|
6
|
-
import { RequestOptions } from "../../internal/request-options.js";
|
|
3
|
+
import { Invoke, InvokeInvokeAdHocParams, InvokeInvokeByTemplateParams } from "./invoke.js";
|
|
7
4
|
export declare class Automations extends APIResource {
|
|
8
5
|
invoke: InvokeAPI.Invoke;
|
|
9
|
-
/**
|
|
10
|
-
* Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a
|
|
11
|
-
* series of automation steps. For information about what steps are available,
|
|
12
|
-
* checkout the ad hoc automation guide
|
|
13
|
-
* [here](https://www.courier.com/docs/automations/steps/).
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* const automationInvokeResponse =
|
|
18
|
-
* await client.automations.invokeAdHoc({
|
|
19
|
-
* automation: {
|
|
20
|
-
* cancelation_token: 'delay-send--user-yes--abc-123',
|
|
21
|
-
* steps: [
|
|
22
|
-
* { action: 'delay', until: '20240408T080910.123' },
|
|
23
|
-
* {
|
|
24
|
-
* action: 'send',
|
|
25
|
-
* template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0',
|
|
26
|
-
* },
|
|
27
|
-
* ],
|
|
28
|
-
* },
|
|
29
|
-
* data: { name: 'Foo' },
|
|
30
|
-
* profile: { tenant_id: 'abc-123' },
|
|
31
|
-
* recipient: 'user-yes',
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
invokeAdHoc(body: AutomationInvokeAdHocParams, options?: RequestOptions): APIPromise<InvokeAPI.AutomationInvokeResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* Invoke an automation run from an automation template.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* const automationInvokeResponse =
|
|
42
|
-
* await client.automations.invokeByTemplate('templateId');
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
invokeByTemplate(templateID: string, body: AutomationInvokeByTemplateParams, options?: RequestOptions): APIPromise<InvokeAPI.AutomationInvokeResponse>;
|
|
46
6
|
}
|
|
47
|
-
export interface
|
|
48
|
-
|
|
49
|
-
brand?: string | null;
|
|
50
|
-
data?: {
|
|
51
|
-
[key: string]: unknown;
|
|
52
|
-
} | null;
|
|
53
|
-
profile?: unknown;
|
|
54
|
-
recipient?: string | null;
|
|
55
|
-
template?: string | null;
|
|
56
|
-
}
|
|
57
|
-
export declare namespace AutomationInvokeAdHocParams {
|
|
58
|
-
interface Automation {
|
|
59
|
-
steps: Array<Automation.AutomationAddToDigestStep | Automation.AutomationAddToBatchStep | Automation.AutomationThrottleStep | Automation.AutomationCancelStep | Automation.AutomationDelayStep | Automation.AutomationFetchDataStep | Automation.AutomationInvokeStep | Automation.AutomationSendStep | Automation.AutomationV2SendStep | Automation.AutomationSendListStep | Automation.AutomationUpdateProfileStep>;
|
|
60
|
-
cancelation_token?: string | null;
|
|
61
|
-
}
|
|
62
|
-
namespace Automation {
|
|
63
|
-
interface AutomationAddToDigestStep extends InvokeAPI.AutomationStep {
|
|
64
|
-
action: 'add-to-digest';
|
|
65
|
-
/**
|
|
66
|
-
* The subscription topic that has digests enabled
|
|
67
|
-
*/
|
|
68
|
-
subscription_topic_id: string;
|
|
69
|
-
}
|
|
70
|
-
interface AutomationAddToBatchStep extends InvokeAPI.AutomationStep {
|
|
71
|
-
action: 'add-to-batch';
|
|
72
|
-
/**
|
|
73
|
-
* Defines the maximum wait time before the batch should be released. Must be less
|
|
74
|
-
* than wait period. Maximum of 60 days. Specified as an
|
|
75
|
-
* [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations)
|
|
76
|
-
*/
|
|
77
|
-
max_wait_period: string;
|
|
78
|
-
/**
|
|
79
|
-
* Defines what items should be retained and passed along to the next steps when
|
|
80
|
-
* the batch is released
|
|
81
|
-
*/
|
|
82
|
-
retain: AutomationAddToBatchStep.Retain;
|
|
83
|
-
/**
|
|
84
|
-
* Defines the period of inactivity before the batch is released. Specified as an
|
|
85
|
-
* [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations)
|
|
86
|
-
*/
|
|
87
|
-
wait_period: string;
|
|
88
|
-
batch_id?: string | null;
|
|
89
|
-
/**
|
|
90
|
-
* If using scope=dynamic, provide the key or a reference (e.g.,
|
|
91
|
-
* refs.data.batch_key)
|
|
92
|
-
*/
|
|
93
|
-
batch_key?: string | null;
|
|
94
|
-
/**
|
|
95
|
-
* Defines the field of the data object the batch is set to when complete. Defaults
|
|
96
|
-
* to `batch`
|
|
97
|
-
*/
|
|
98
|
-
category_key?: string | null;
|
|
99
|
-
/**
|
|
100
|
-
* If specified, the batch will release as soon as this number is reached
|
|
101
|
-
*/
|
|
102
|
-
max_items?: string | number | null;
|
|
103
|
-
/**
|
|
104
|
-
* Determine the scope of the batching. If user, chosen in this order: recipient,
|
|
105
|
-
* profile.user_id, data.user_id, data.userId. If dynamic, then specify where the
|
|
106
|
-
* batch_key or a reference to the batch_key
|
|
107
|
-
*/
|
|
108
|
-
scope?: 'user' | 'global' | 'dynamic' | null;
|
|
109
|
-
}
|
|
110
|
-
namespace AutomationAddToBatchStep {
|
|
111
|
-
/**
|
|
112
|
-
* Defines what items should be retained and passed along to the next steps when
|
|
113
|
-
* the batch is released
|
|
114
|
-
*/
|
|
115
|
-
interface Retain {
|
|
116
|
-
/**
|
|
117
|
-
* The number of records to keep in batch. Default is 10 and only configurable by
|
|
118
|
-
* requesting from support. When configurable minimum is 2 and maximum is 100.
|
|
119
|
-
*/
|
|
120
|
-
count: number;
|
|
121
|
-
/**
|
|
122
|
-
* Keep N number of notifications based on the type. First/Last N based on
|
|
123
|
-
* notification received. highest/lowest based on a scoring key providing in the
|
|
124
|
-
* data accessed by sort_key
|
|
125
|
-
*/
|
|
126
|
-
type: 'first' | 'last' | 'highest' | 'lowest';
|
|
127
|
-
/**
|
|
128
|
-
* Defines the data value data[sort_key] that is used to sort the stored items.
|
|
129
|
-
* Required when type is set to highest or lowest.
|
|
130
|
-
*/
|
|
131
|
-
sort_key?: string | null;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
interface AutomationThrottleStep extends InvokeAPI.AutomationStep {
|
|
135
|
-
action: 'throttle';
|
|
136
|
-
/**
|
|
137
|
-
* Maximum number of allowed notifications in that timeframe
|
|
138
|
-
*/
|
|
139
|
-
max_allowed: number;
|
|
140
|
-
on_throttle: AutomationThrottleStep.OnThrottle;
|
|
141
|
-
/**
|
|
142
|
-
* Defines the throttle period which corresponds to the max_allowed. Specified as
|
|
143
|
-
* an ISO 8601 duration, https://en.wikipedia.org/wiki/ISO_8601#Durations
|
|
144
|
-
*/
|
|
145
|
-
period: string;
|
|
146
|
-
scope: 'user' | 'global' | 'dynamic';
|
|
147
|
-
/**
|
|
148
|
-
* Value must be true
|
|
149
|
-
*/
|
|
150
|
-
should_alert: boolean;
|
|
151
|
-
/**
|
|
152
|
-
* If using scope=dynamic, provide the reference (e.g., refs.data.throttle_key) to
|
|
153
|
-
* the how the throttle should be identified
|
|
154
|
-
*/
|
|
155
|
-
throttle_key?: string | null;
|
|
156
|
-
}
|
|
157
|
-
namespace AutomationThrottleStep {
|
|
158
|
-
interface OnThrottle {
|
|
159
|
-
/**
|
|
160
|
-
* The node to go to if the request is throttled
|
|
161
|
-
*/
|
|
162
|
-
$node_id: string;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
interface AutomationCancelStep extends InvokeAPI.AutomationStep {
|
|
166
|
-
action: 'cancel';
|
|
167
|
-
cancelation_token?: string | null;
|
|
168
|
-
}
|
|
169
|
-
interface AutomationDelayStep extends InvokeAPI.AutomationStep {
|
|
170
|
-
action: 'delay';
|
|
171
|
-
/**
|
|
172
|
-
* The [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) string
|
|
173
|
-
* for how long to delay for
|
|
174
|
-
*/
|
|
175
|
-
duration?: string | null;
|
|
176
|
-
/**
|
|
177
|
-
* The ISO 8601 timestamp for when the delay should end
|
|
178
|
-
*/
|
|
179
|
-
until?: string | null;
|
|
180
|
-
}
|
|
181
|
-
interface AutomationFetchDataStep extends InvokeAPI.AutomationStep {
|
|
182
|
-
action: 'fetch-data';
|
|
183
|
-
merge_strategy: InvokeAPI.MergeAlgorithm;
|
|
184
|
-
webhook: AutomationFetchDataStep.Webhook;
|
|
185
|
-
idempotency_expiry?: string | null;
|
|
186
|
-
idempotency_key?: string | null;
|
|
187
|
-
}
|
|
188
|
-
namespace AutomationFetchDataStep {
|
|
189
|
-
interface Webhook {
|
|
190
|
-
method: 'GET' | 'POST';
|
|
191
|
-
url: string;
|
|
192
|
-
body?: {
|
|
193
|
-
[key: string]: unknown;
|
|
194
|
-
} | null;
|
|
195
|
-
headers?: {
|
|
196
|
-
[key: string]: unknown;
|
|
197
|
-
} | null;
|
|
198
|
-
params?: {
|
|
199
|
-
[key: string]: unknown;
|
|
200
|
-
} | null;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
interface AutomationInvokeStep extends InvokeAPI.AutomationStep {
|
|
204
|
-
action: 'invoke';
|
|
205
|
-
template: string;
|
|
206
|
-
}
|
|
207
|
-
interface AutomationSendStep extends InvokeAPI.AutomationStep {
|
|
208
|
-
action: 'send';
|
|
209
|
-
brand?: string | null;
|
|
210
|
-
data?: {
|
|
211
|
-
[key: string]: unknown;
|
|
212
|
-
} | null;
|
|
213
|
-
override?: {
|
|
214
|
-
[key: string]: unknown;
|
|
215
|
-
} | null;
|
|
216
|
-
profile?: unknown;
|
|
217
|
-
recipient?: string | null;
|
|
218
|
-
template?: string | null;
|
|
219
|
-
}
|
|
220
|
-
interface AutomationV2SendStep extends InvokeAPI.AutomationStep {
|
|
221
|
-
action: 'send';
|
|
222
|
-
/**
|
|
223
|
-
* Describes the content of the message in a way that will work for email, push,
|
|
224
|
-
* chat, or any channel.
|
|
225
|
-
*/
|
|
226
|
-
message: SendAPI.Message;
|
|
227
|
-
}
|
|
228
|
-
interface AutomationSendListStep extends InvokeAPI.AutomationStep {
|
|
229
|
-
action: 'send-list';
|
|
230
|
-
list: string;
|
|
231
|
-
brand?: string | null;
|
|
232
|
-
data?: {
|
|
233
|
-
[key: string]: unknown;
|
|
234
|
-
} | null;
|
|
235
|
-
override?: {
|
|
236
|
-
[key: string]: unknown;
|
|
237
|
-
} | null;
|
|
238
|
-
template?: string | null;
|
|
239
|
-
}
|
|
240
|
-
interface AutomationUpdateProfileStep {
|
|
241
|
-
action: 'update-profile';
|
|
242
|
-
merge: InvokeAPI.MergeAlgorithm;
|
|
243
|
-
profile: unknown;
|
|
244
|
-
recipient_id: string;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
export interface AutomationInvokeByTemplateParams {
|
|
249
|
-
brand?: string | null;
|
|
250
|
-
data?: {
|
|
251
|
-
[key: string]: unknown;
|
|
252
|
-
} | null;
|
|
253
|
-
profile?: unknown;
|
|
254
|
-
recipient?: string | null;
|
|
255
|
-
template?: string | null;
|
|
7
|
+
export interface AutomationInvokeResponse {
|
|
8
|
+
runId: string;
|
|
256
9
|
}
|
|
257
10
|
export declare namespace Automations {
|
|
258
|
-
export { type
|
|
259
|
-
export { Invoke as Invoke, type
|
|
11
|
+
export { type AutomationInvokeResponse as AutomationInvokeResponse };
|
|
12
|
+
export { Invoke as Invoke, type InvokeInvokeAdHocParams as InvokeInvokeAdHocParams, type InvokeInvokeByTemplateParams as InvokeInvokeByTemplateParams, };
|
|
260
13
|
}
|
|
261
14
|
//# sourceMappingURL=automations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automations.d.ts","sourceRoot":"","sources":["../../src/resources/automations/automations.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,
|
|
1
|
+
{"version":3,"file":"automations.d.ts","sourceRoot":"","sources":["../../src/resources/automations/automations.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,SAAS;OACd,EAAE,MAAM,EAAE,uBAAuB,EAAE,4BAA4B,EAAE;AAExE,qBAAa,WAAY,SAAQ,WAAW;IAC1C,MAAM,EAAE,SAAS,CAAC,MAAM,CAAsC;CAC/D;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAID,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EAAE,KAAK,wBAAwB,IAAI,wBAAwB,EAAE,CAAC;IAErE,OAAO,EACL,MAAM,IAAI,MAAM,EAChB,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,4BAA4B,IAAI,4BAA4B,GAClE,CAAC;CACH"}
|
|
@@ -6,53 +6,11 @@ const tslib_1 = require("../../internal/tslib.js");
|
|
|
6
6
|
const resource_1 = require("../../core/resource.js");
|
|
7
7
|
const InvokeAPI = tslib_1.__importStar(require("./invoke.js"));
|
|
8
8
|
const invoke_1 = require("./invoke.js");
|
|
9
|
-
const path_1 = require("../../internal/utils/path.js");
|
|
10
9
|
class Automations extends resource_1.APIResource {
|
|
11
10
|
constructor() {
|
|
12
11
|
super(...arguments);
|
|
13
12
|
this.invoke = new InvokeAPI.Invoke(this._client);
|
|
14
13
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a
|
|
17
|
-
* series of automation steps. For information about what steps are available,
|
|
18
|
-
* checkout the ad hoc automation guide
|
|
19
|
-
* [here](https://www.courier.com/docs/automations/steps/).
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* const automationInvokeResponse =
|
|
24
|
-
* await client.automations.invokeAdHoc({
|
|
25
|
-
* automation: {
|
|
26
|
-
* cancelation_token: 'delay-send--user-yes--abc-123',
|
|
27
|
-
* steps: [
|
|
28
|
-
* { action: 'delay', until: '20240408T080910.123' },
|
|
29
|
-
* {
|
|
30
|
-
* action: 'send',
|
|
31
|
-
* template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0',
|
|
32
|
-
* },
|
|
33
|
-
* ],
|
|
34
|
-
* },
|
|
35
|
-
* data: { name: 'Foo' },
|
|
36
|
-
* profile: { tenant_id: 'abc-123' },
|
|
37
|
-
* recipient: 'user-yes',
|
|
38
|
-
* });
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
invokeAdHoc(body, options) {
|
|
42
|
-
return this._client.post('/automations/invoke', { body, ...options });
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Invoke an automation run from an automation template.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```ts
|
|
49
|
-
* const automationInvokeResponse =
|
|
50
|
-
* await client.automations.invokeByTemplate('templateId');
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
invokeByTemplate(templateID, body, options) {
|
|
54
|
-
return this._client.post((0, path_1.path) `/automations/${templateID}/invoke`, { body, ...options });
|
|
55
|
-
}
|
|
56
14
|
}
|
|
57
15
|
exports.Automations = Automations;
|
|
58
16
|
Automations.Invoke = invoke_1.Invoke;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automations.js","sourceRoot":"","sources":["../../src/resources/automations/automations.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;
|
|
1
|
+
{"version":3,"file":"automations.js","sourceRoot":"","sources":["../../src/resources/automations/automations.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,+DAAsC;AACtC,wCAAyF;AAEzF,MAAa,WAAY,SAAQ,sBAAW;IAA5C;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;CAAA;AAFD,kCAEC;AAMD,WAAW,CAAC,MAAM,GAAG,eAAM,CAAC"}
|