@trycourier/courier 6.6.1-alpha0 → 6.7.0-alpha3
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 +59 -0
- package/README.md +11 -11
- package/client.d.mts +23 -14
- package/client.d.mts.map +1 -1
- package/client.d.ts +23 -14
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs +2 -2
- 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 +27 -46
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +27 -46
- package/resources/audiences.d.ts.map +1 -1
- package/resources/audit-events.d.mts +3 -7
- package/resources/audit-events.d.mts.map +1 -1
- package/resources/audit-events.d.ts +3 -7
- 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 +2 -253
- package/resources/automations/automations.d.mts.map +1 -1
- package/resources/automations/automations.d.ts +2 -253
- 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 +0 -42
- 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 +1 -1
- package/resources/automations/index.mjs.map +1 -1
- package/resources/automations/invoke.d.mts +124 -9
- package/resources/automations/invoke.d.mts.map +1 -1
- package/resources/automations/invoke.d.ts +124 -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 +74 -50
- package/resources/brands.d.mts.map +1 -1
- package/resources/brands.d.ts +74 -50
- 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 +38 -89
- package/resources/bulk.d.mts.map +1 -1
- package/resources/bulk.d.ts +38 -89
- package/resources/bulk.d.ts.map +1 -1
- package/resources/inbound.d.mts +1 -1
- package/resources/inbound.d.ts +1 -1
- package/resources/index.d.mts +8 -7
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +8 -7
- 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 +2 -1
- 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 +9 -7
- package/resources/lists/lists.d.mts.map +1 -1
- package/resources/lists/lists.d.ts +9 -7
- 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 +9 -34
- package/resources/lists/subscriptions.d.mts.map +1 -1
- package/resources/lists/subscriptions.d.ts +9 -34
- package/resources/lists/subscriptions.d.ts.map +1 -1
- package/resources/messages.d.mts +6 -6
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +6 -6
- 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/index.d.mts +1 -1
- package/resources/notifications/index.d.mts.map +1 -1
- package/resources/notifications/index.d.ts +1 -1
- 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 +3 -8
- package/resources/notifications/notifications.d.mts.map +1 -1
- package/resources/notifications/notifications.d.ts +3 -8
- 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/send.d.mts +249 -701
- package/resources/send.d.mts.map +1 -1
- package/resources/send.d.ts +249 -701
- 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 +42 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +42 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/tenants/index.d.mts +1 -0
- package/resources/tenants/index.d.mts.map +1 -1
- package/resources/tenants/index.d.ts +1 -0
- package/resources/tenants/index.d.ts.map +1 -1
- package/resources/tenants/index.js +3 -1
- package/resources/tenants/index.js.map +1 -1
- package/resources/tenants/index.mjs +1 -0
- package/resources/tenants/index.mjs.map +1 -1
- package/resources/tenants/templates.d.mts +122 -0
- package/resources/tenants/templates.d.mts.map +1 -0
- package/resources/tenants/templates.d.ts +122 -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/tenants.d.mts +4 -0
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +4 -0
- package/resources/tenants/tenants.d.ts.map +1 -1
- package/resources/tenants/tenants.js +4 -0
- package/resources/tenants/tenants.js.map +1 -1
- package/resources/tenants/tenants.mjs +4 -0
- package/resources/tenants/tenants.mjs.map +1 -1
- package/resources/users/index.d.mts +1 -1
- package/resources/users/index.d.mts.map +1 -1
- package/resources/users/index.d.ts +1 -1
- package/resources/users/index.d.ts.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 +2 -2
- package/resources/users/users.d.mts.map +1 -1
- package/resources/users/users.d.ts +2 -2
- package/resources/users/users.d.ts.map +1 -1
- package/src/client.ts +48 -38
- package/src/internal/to-file.ts +1 -1
- package/src/resources/audiences.ts +43 -82
- package/src/resources/audit-events.ts +5 -11
- package/src/resources/auth.ts +2 -16
- package/src/resources/automations/automations.ts +4 -340
- package/src/resources/automations/index.ts +3 -8
- package/src/resources/automations/invoke.ts +163 -13
- package/src/resources/brands.ts +117 -51
- package/src/resources/bulk.ts +31 -104
- package/src/resources/inbound.ts +1 -1
- package/src/resources/index.ts +17 -19
- package/src/resources/lists/index.ts +9 -1
- package/src/resources/lists/lists.ts +15 -5
- package/src/resources/lists/subscriptions.ts +12 -45
- package/src/resources/messages.ts +8 -5
- package/src/resources/notifications/index.ts +0 -2
- package/src/resources/notifications/notifications.ts +2 -12
- package/src/resources/send.ts +254 -853
- package/src/resources/shared.ts +61 -0
- package/src/resources/tenants/index.ts +8 -0
- package/src/resources/tenants/templates.ts +165 -0
- package/src/resources/tenants/tenants.ts +21 -0
- package/src/resources/users/index.ts +2 -2
- package/src/resources/users/tokens.ts +33 -34
- package/src/resources/users/users.ts +4 -4
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automations.mjs","sourceRoot":"","sources":["../../src/resources/automations/automations.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"automations.mjs","sourceRoot":"","sources":["../../src/resources/automations/automations.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,SAAS;OACd,EAEL,MAAM,GAGP;AAED,MAAM,OAAO,WAAY,SAAQ,WAAW;IAA5C;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;CAAA;AAED,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Automations
|
|
2
|
-
export { Invoke, type
|
|
1
|
+
export { Automations } from "./automations.mjs";
|
|
2
|
+
export { Invoke, type AutomationInvokeResponse, type InvokeInvokeAdHocParams, type InvokeInvokeByTemplateParams, } from "./invoke.mjs";
|
|
3
3
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/automations/index.ts"],"names":[],"mappings":"OAEO,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/automations/index.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EACL,MAAM,EACN,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,GAClC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Automations
|
|
2
|
-
export { Invoke, type
|
|
1
|
+
export { Automations } from "./automations.js";
|
|
2
|
+
export { Invoke, type AutomationInvokeResponse, type InvokeInvokeAdHocParams, type InvokeInvokeByTemplateParams, } from "./invoke.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/automations/index.ts"],"names":[],"mappings":"OAEO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/automations/index.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EACL,MAAM,EACN,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,GAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/automations/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/automations/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,sCAKkB;AAJhB,gGAAA,MAAM,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/automations/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/automations/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EACL,MAAM,GAIP"}
|
|
@@ -1,24 +1,139 @@
|
|
|
1
1
|
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../../core/api-promise.mjs";
|
|
3
|
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
2
4
|
export declare class Invoke extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a
|
|
7
|
+
* series of automation steps. For information about what steps are available,
|
|
8
|
+
* checkout the ad hoc automation guide
|
|
9
|
+
* [here](https://www.courier.com/docs/automations/steps/).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const automationInvokeResponse =
|
|
14
|
+
* await client.automations.invoke.invokeAdHoc({
|
|
15
|
+
* automation: {
|
|
16
|
+
* cancelation_token: 'delay-send--user-yes--abc-123',
|
|
17
|
+
* steps: [
|
|
18
|
+
* { action: 'delay', until: '20240408T080910.123' },
|
|
19
|
+
* {
|
|
20
|
+
* action: 'send',
|
|
21
|
+
* template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0',
|
|
22
|
+
* },
|
|
23
|
+
* ],
|
|
24
|
+
* },
|
|
25
|
+
* data: { name: 'Foo' },
|
|
26
|
+
* profile: { tenant_id: 'abc-123' },
|
|
27
|
+
* recipient: 'user-yes',
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
invokeAdHoc(body: InvokeInvokeAdHocParams, options?: RequestOptions): APIPromise<AutomationInvokeResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Invoke an automation run from an automation template.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const automationInvokeResponse =
|
|
38
|
+
* await client.automations.invoke.invokeByTemplate(
|
|
39
|
+
* 'templateId',
|
|
40
|
+
* { recipient: 'recipient' },
|
|
41
|
+
* );
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
invokeByTemplate(templateID: string, body: InvokeInvokeByTemplateParams, options?: RequestOptions): APIPromise<AutomationInvokeResponse>;
|
|
3
45
|
}
|
|
4
|
-
export interface
|
|
46
|
+
export interface AutomationInvokeResponse {
|
|
47
|
+
runId: string;
|
|
48
|
+
}
|
|
49
|
+
export interface InvokeInvokeAdHocParams {
|
|
50
|
+
automation: InvokeInvokeAdHocParams.Automation;
|
|
5
51
|
brand?: string | null;
|
|
6
52
|
data?: {
|
|
7
53
|
[key: string]: unknown;
|
|
8
54
|
} | null;
|
|
9
|
-
profile?:
|
|
55
|
+
profile?: {
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
} | null;
|
|
10
58
|
recipient?: string | null;
|
|
11
59
|
template?: string | null;
|
|
12
60
|
}
|
|
13
|
-
export
|
|
14
|
-
|
|
61
|
+
export declare namespace InvokeInvokeAdHocParams {
|
|
62
|
+
interface Automation {
|
|
63
|
+
steps: Array<Automation.AutomationDelayStep | Automation.AutomationSendStep | Automation.AutomationSendListStep | Automation.AutomationUpdateProfileStep | Automation.AutomationCancelStep | Automation.AutomationFetchDataStep | Automation.AutomationInvokeStep>;
|
|
64
|
+
cancelation_token?: string | null;
|
|
65
|
+
}
|
|
66
|
+
namespace Automation {
|
|
67
|
+
interface AutomationDelayStep {
|
|
68
|
+
action: 'delay';
|
|
69
|
+
duration?: string | null;
|
|
70
|
+
until?: string | null;
|
|
71
|
+
}
|
|
72
|
+
interface AutomationSendStep {
|
|
73
|
+
action: 'send';
|
|
74
|
+
brand?: string | null;
|
|
75
|
+
data?: {
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
} | null;
|
|
78
|
+
profile?: {
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
} | null;
|
|
81
|
+
recipient?: string | null;
|
|
82
|
+
template?: string | null;
|
|
83
|
+
}
|
|
84
|
+
interface AutomationSendListStep {
|
|
85
|
+
action: 'send-list';
|
|
86
|
+
list: string;
|
|
87
|
+
brand?: string | null;
|
|
88
|
+
data?: {
|
|
89
|
+
[key: string]: unknown;
|
|
90
|
+
} | null;
|
|
91
|
+
}
|
|
92
|
+
interface AutomationUpdateProfileStep {
|
|
93
|
+
action: 'update-profile';
|
|
94
|
+
profile: {
|
|
95
|
+
[key: string]: unknown;
|
|
96
|
+
};
|
|
97
|
+
merge?: 'none' | 'overwrite' | 'soft-merge' | 'replace' | null;
|
|
98
|
+
recipient_id?: string | null;
|
|
99
|
+
}
|
|
100
|
+
interface AutomationCancelStep {
|
|
101
|
+
action: 'cancel';
|
|
102
|
+
cancelation_token: string;
|
|
103
|
+
}
|
|
104
|
+
interface AutomationFetchDataStep {
|
|
105
|
+
action: 'fetch-data';
|
|
106
|
+
webhook: AutomationFetchDataStep.Webhook;
|
|
107
|
+
merge_strategy?: 'replace' | 'overwrite' | 'soft-merge' | null;
|
|
108
|
+
}
|
|
109
|
+
namespace AutomationFetchDataStep {
|
|
110
|
+
interface Webhook {
|
|
111
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
112
|
+
url: string;
|
|
113
|
+
body?: string | null;
|
|
114
|
+
headers?: {
|
|
115
|
+
[key: string]: string;
|
|
116
|
+
} | null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
interface AutomationInvokeStep {
|
|
120
|
+
action: 'invoke';
|
|
121
|
+
template: string;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
15
124
|
}
|
|
16
|
-
export interface
|
|
17
|
-
|
|
18
|
-
|
|
125
|
+
export interface InvokeInvokeByTemplateParams {
|
|
126
|
+
recipient: string | null;
|
|
127
|
+
brand?: string | null;
|
|
128
|
+
data?: {
|
|
129
|
+
[key: string]: unknown;
|
|
130
|
+
} | null;
|
|
131
|
+
profile?: {
|
|
132
|
+
[key: string]: unknown;
|
|
133
|
+
} | null;
|
|
134
|
+
template?: string | null;
|
|
19
135
|
}
|
|
20
|
-
export type MergeAlgorithm = 'replace' | 'none' | 'overwrite' | 'soft-merge';
|
|
21
136
|
export declare namespace Invoke {
|
|
22
|
-
export { type
|
|
137
|
+
export { type AutomationInvokeResponse as AutomationInvokeResponse, type InvokeInvokeAdHocParams as InvokeInvokeAdHocParams, type InvokeInvokeByTemplateParams as InvokeInvokeByTemplateParams, };
|
|
23
138
|
}
|
|
24
139
|
//# sourceMappingURL=invoke.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.d.mts","sourceRoot":"","sources":["../../src/resources/automations/invoke.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"invoke.d.mts","sourceRoot":"","sources":["../../src/resources/automations/invoke.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAAW,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;IAI1G;;;;;;;;;;;OAWG;IACH,gBAAgB,CACd,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;CAGxC;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,uBAAuB,CAAC,UAAU,CAAC;IAE/C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB,IAAI,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAEzC,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAE5C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,yBAAiB,uBAAuB,CAAC;IACvC,UAAiB,UAAU;QACzB,KAAK,EAAE,KAAK,CACR,UAAU,CAAC,mBAAmB,GAC9B,UAAU,CAAC,kBAAkB,GAC7B,UAAU,CAAC,sBAAsB,GACjC,UAAU,CAAC,2BAA2B,GACtC,UAAU,CAAC,oBAAoB,GAC/B,U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1,139 @@
|
|
|
1
1
|
import { APIResource } from "../../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../../internal/request-options.js";
|
|
2
4
|
export declare class Invoke extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a
|
|
7
|
+
* series of automation steps. For information about what steps are available,
|
|
8
|
+
* checkout the ad hoc automation guide
|
|
9
|
+
* [here](https://www.courier.com/docs/automations/steps/).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const automationInvokeResponse =
|
|
14
|
+
* await client.automations.invoke.invokeAdHoc({
|
|
15
|
+
* automation: {
|
|
16
|
+
* cancelation_token: 'delay-send--user-yes--abc-123',
|
|
17
|
+
* steps: [
|
|
18
|
+
* { action: 'delay', until: '20240408T080910.123' },
|
|
19
|
+
* {
|
|
20
|
+
* action: 'send',
|
|
21
|
+
* template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0',
|
|
22
|
+
* },
|
|
23
|
+
* ],
|
|
24
|
+
* },
|
|
25
|
+
* data: { name: 'Foo' },
|
|
26
|
+
* profile: { tenant_id: 'abc-123' },
|
|
27
|
+
* recipient: 'user-yes',
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
invokeAdHoc(body: InvokeInvokeAdHocParams, options?: RequestOptions): APIPromise<AutomationInvokeResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Invoke an automation run from an automation template.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const automationInvokeResponse =
|
|
38
|
+
* await client.automations.invoke.invokeByTemplate(
|
|
39
|
+
* 'templateId',
|
|
40
|
+
* { recipient: 'recipient' },
|
|
41
|
+
* );
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
invokeByTemplate(templateID: string, body: InvokeInvokeByTemplateParams, options?: RequestOptions): APIPromise<AutomationInvokeResponse>;
|
|
3
45
|
}
|
|
4
|
-
export interface
|
|
46
|
+
export interface AutomationInvokeResponse {
|
|
47
|
+
runId: string;
|
|
48
|
+
}
|
|
49
|
+
export interface InvokeInvokeAdHocParams {
|
|
50
|
+
automation: InvokeInvokeAdHocParams.Automation;
|
|
5
51
|
brand?: string | null;
|
|
6
52
|
data?: {
|
|
7
53
|
[key: string]: unknown;
|
|
8
54
|
} | null;
|
|
9
|
-
profile?:
|
|
55
|
+
profile?: {
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
} | null;
|
|
10
58
|
recipient?: string | null;
|
|
11
59
|
template?: string | null;
|
|
12
60
|
}
|
|
13
|
-
export
|
|
14
|
-
|
|
61
|
+
export declare namespace InvokeInvokeAdHocParams {
|
|
62
|
+
interface Automation {
|
|
63
|
+
steps: Array<Automation.AutomationDelayStep | Automation.AutomationSendStep | Automation.AutomationSendListStep | Automation.AutomationUpdateProfileStep | Automation.AutomationCancelStep | Automation.AutomationFetchDataStep | Automation.AutomationInvokeStep>;
|
|
64
|
+
cancelation_token?: string | null;
|
|
65
|
+
}
|
|
66
|
+
namespace Automation {
|
|
67
|
+
interface AutomationDelayStep {
|
|
68
|
+
action: 'delay';
|
|
69
|
+
duration?: string | null;
|
|
70
|
+
until?: string | null;
|
|
71
|
+
}
|
|
72
|
+
interface AutomationSendStep {
|
|
73
|
+
action: 'send';
|
|
74
|
+
brand?: string | null;
|
|
75
|
+
data?: {
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
} | null;
|
|
78
|
+
profile?: {
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
} | null;
|
|
81
|
+
recipient?: string | null;
|
|
82
|
+
template?: string | null;
|
|
83
|
+
}
|
|
84
|
+
interface AutomationSendListStep {
|
|
85
|
+
action: 'send-list';
|
|
86
|
+
list: string;
|
|
87
|
+
brand?: string | null;
|
|
88
|
+
data?: {
|
|
89
|
+
[key: string]: unknown;
|
|
90
|
+
} | null;
|
|
91
|
+
}
|
|
92
|
+
interface AutomationUpdateProfileStep {
|
|
93
|
+
action: 'update-profile';
|
|
94
|
+
profile: {
|
|
95
|
+
[key: string]: unknown;
|
|
96
|
+
};
|
|
97
|
+
merge?: 'none' | 'overwrite' | 'soft-merge' | 'replace' | null;
|
|
98
|
+
recipient_id?: string | null;
|
|
99
|
+
}
|
|
100
|
+
interface AutomationCancelStep {
|
|
101
|
+
action: 'cancel';
|
|
102
|
+
cancelation_token: string;
|
|
103
|
+
}
|
|
104
|
+
interface AutomationFetchDataStep {
|
|
105
|
+
action: 'fetch-data';
|
|
106
|
+
webhook: AutomationFetchDataStep.Webhook;
|
|
107
|
+
merge_strategy?: 'replace' | 'overwrite' | 'soft-merge' | null;
|
|
108
|
+
}
|
|
109
|
+
namespace AutomationFetchDataStep {
|
|
110
|
+
interface Webhook {
|
|
111
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
112
|
+
url: string;
|
|
113
|
+
body?: string | null;
|
|
114
|
+
headers?: {
|
|
115
|
+
[key: string]: string;
|
|
116
|
+
} | null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
interface AutomationInvokeStep {
|
|
120
|
+
action: 'invoke';
|
|
121
|
+
template: string;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
15
124
|
}
|
|
16
|
-
export interface
|
|
17
|
-
|
|
18
|
-
|
|
125
|
+
export interface InvokeInvokeByTemplateParams {
|
|
126
|
+
recipient: string | null;
|
|
127
|
+
brand?: string | null;
|
|
128
|
+
data?: {
|
|
129
|
+
[key: string]: unknown;
|
|
130
|
+
} | null;
|
|
131
|
+
profile?: {
|
|
132
|
+
[key: string]: unknown;
|
|
133
|
+
} | null;
|
|
134
|
+
template?: string | null;
|
|
19
135
|
}
|
|
20
|
-
export type MergeAlgorithm = 'replace' | 'none' | 'overwrite' | 'soft-merge';
|
|
21
136
|
export declare namespace Invoke {
|
|
22
|
-
export { type
|
|
137
|
+
export { type AutomationInvokeResponse as AutomationInvokeResponse, type InvokeInvokeAdHocParams as InvokeInvokeAdHocParams, type InvokeInvokeByTemplateParams as InvokeInvokeByTemplateParams, };
|
|
23
138
|
}
|
|
24
139
|
//# sourceMappingURL=invoke.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../src/resources/automations/invoke.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../src/resources/automations/invoke.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAAW,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;IAI1G;;;;;;;;;;;OAWG;IACH,gBAAgB,CACd,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;CAGxC;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,uBAAuB,CAAC,UAAU,CAAC;IAE/C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB,IAAI,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAEzC,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAE5C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B,QAAQ,CAAC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;IAE5C,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,4BAA4B,IAAI,4BAA4B,GAClE,CAAC;CACH"}
|
|
@@ -3,7 +3,52 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Invoke = void 0;
|
|
5
5
|
const resource_1 = require("../../core/resource.js");
|
|
6
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
6
7
|
class Invoke extends resource_1.APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a
|
|
10
|
+
* series of automation steps. For information about what steps are available,
|
|
11
|
+
* checkout the ad hoc automation guide
|
|
12
|
+
* [here](https://www.courier.com/docs/automations/steps/).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const automationInvokeResponse =
|
|
17
|
+
* await client.automations.invoke.invokeAdHoc({
|
|
18
|
+
* automation: {
|
|
19
|
+
* cancelation_token: 'delay-send--user-yes--abc-123',
|
|
20
|
+
* steps: [
|
|
21
|
+
* { action: 'delay', until: '20240408T080910.123' },
|
|
22
|
+
* {
|
|
23
|
+
* action: 'send',
|
|
24
|
+
* template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0',
|
|
25
|
+
* },
|
|
26
|
+
* ],
|
|
27
|
+
* },
|
|
28
|
+
* data: { name: 'Foo' },
|
|
29
|
+
* profile: { tenant_id: 'abc-123' },
|
|
30
|
+
* recipient: 'user-yes',
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
invokeAdHoc(body, options) {
|
|
35
|
+
return this._client.post('/automations/invoke', { body, ...options });
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Invoke an automation run from an automation template.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const automationInvokeResponse =
|
|
43
|
+
* await client.automations.invoke.invokeByTemplate(
|
|
44
|
+
* 'templateId',
|
|
45
|
+
* { recipient: 'recipient' },
|
|
46
|
+
* );
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
invokeByTemplate(templateID, body, options) {
|
|
50
|
+
return this._client.post((0, path_1.path) `/automations/${templateID}/invoke`, { body, ...options });
|
|
51
|
+
}
|
|
7
52
|
}
|
|
8
53
|
exports.Invoke = Invoke;
|
|
9
54
|
//# sourceMappingURL=invoke.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.js","sourceRoot":"","sources":["../../src/resources/automations/invoke.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;
|
|
1
|
+
{"version":3,"file":"invoke.js","sourceRoot":"","sources":["../../src/resources/automations/invoke.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,uDAAiD;AAEjD,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAAW,CAAC,IAA6B,EAAE,OAAwB;QACjE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,gBAAgB,CACd,UAAkB,EAClB,IAAkC,EAClC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,gBAAgB,UAAU,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;CACF;AAlDD,wBAkDC"}
|
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
3
4
|
export class Invoke extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a
|
|
7
|
+
* series of automation steps. For information about what steps are available,
|
|
8
|
+
* checkout the ad hoc automation guide
|
|
9
|
+
* [here](https://www.courier.com/docs/automations/steps/).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const automationInvokeResponse =
|
|
14
|
+
* await client.automations.invoke.invokeAdHoc({
|
|
15
|
+
* automation: {
|
|
16
|
+
* cancelation_token: 'delay-send--user-yes--abc-123',
|
|
17
|
+
* steps: [
|
|
18
|
+
* { action: 'delay', until: '20240408T080910.123' },
|
|
19
|
+
* {
|
|
20
|
+
* action: 'send',
|
|
21
|
+
* template: '64TP5HKPFTM8VTK1Y75SJDQX9JK0',
|
|
22
|
+
* },
|
|
23
|
+
* ],
|
|
24
|
+
* },
|
|
25
|
+
* data: { name: 'Foo' },
|
|
26
|
+
* profile: { tenant_id: 'abc-123' },
|
|
27
|
+
* recipient: 'user-yes',
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
invokeAdHoc(body, options) {
|
|
32
|
+
return this._client.post('/automations/invoke', { body, ...options });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Invoke an automation run from an automation template.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const automationInvokeResponse =
|
|
40
|
+
* await client.automations.invoke.invokeByTemplate(
|
|
41
|
+
* 'templateId',
|
|
42
|
+
* { recipient: 'recipient' },
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
invokeByTemplate(templateID, body, options) {
|
|
47
|
+
return this._client.post(path `/automations/${templateID}/invoke`, { body, ...options });
|
|
48
|
+
}
|
|
4
49
|
}
|
|
5
50
|
//# sourceMappingURL=invoke.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.mjs","sourceRoot":"","sources":["../../src/resources/automations/invoke.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"invoke.mjs","sourceRoot":"","sources":["../../src/resources/automations/invoke.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAAW,CAAC,IAA6B,EAAE,OAAwB;QACjE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,gBAAgB,CACd,UAAkB,EAClB,IAAkC,EAClC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,gBAAgB,UAAU,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;CACF"}
|
package/resources/brands.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import * as BrandsAPI from "./brands.mjs";
|
|
2
3
|
import * as AudiencesAPI from "./audiences.mjs";
|
|
3
4
|
import { APIPromise } from "../core/api-promise.mjs";
|
|
4
5
|
import { RequestOptions } from "../internal/request-options.mjs";
|
|
@@ -25,73 +26,96 @@ export declare class Brands extends APIResource {
|
|
|
25
26
|
delete(brandID: string, options?: RequestOptions): APIPromise<void>;
|
|
26
27
|
}
|
|
27
28
|
export interface Brand {
|
|
28
|
-
|
|
29
|
-
* The date/time of when the brand was created. Represented in milliseconds since
|
|
30
|
-
* Unix epoch.
|
|
31
|
-
*/
|
|
29
|
+
id: string;
|
|
32
30
|
created: number;
|
|
33
|
-
/**
|
|
34
|
-
* Brand name
|
|
35
|
-
*/
|
|
36
31
|
name: string;
|
|
37
|
-
/**
|
|
38
|
-
* The date/time of when the brand was published. Represented in milliseconds since
|
|
39
|
-
* Unix epoch.
|
|
40
|
-
*/
|
|
41
|
-
published: number;
|
|
42
|
-
settings: BrandSettings;
|
|
43
|
-
/**
|
|
44
|
-
* The date/time of when the brand was updated. Represented in milliseconds since
|
|
45
|
-
* Unix epoch.
|
|
46
|
-
*/
|
|
47
32
|
updated: number;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*/
|
|
51
|
-
version: string;
|
|
52
|
-
/**
|
|
53
|
-
* Brand Identifier
|
|
54
|
-
*/
|
|
55
|
-
id?: string | null;
|
|
33
|
+
published?: number | null;
|
|
34
|
+
settings?: BrandSettings | null;
|
|
56
35
|
snippets?: BrandSnippets | null;
|
|
36
|
+
version?: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface BrandColors {
|
|
39
|
+
primary?: string;
|
|
40
|
+
secondary?: string;
|
|
41
|
+
[k: string]: string | undefined;
|
|
57
42
|
}
|
|
58
43
|
export interface BrandSettings {
|
|
59
|
-
colors?:
|
|
60
|
-
email?:
|
|
61
|
-
inapp?:
|
|
62
|
-
}
|
|
63
|
-
export
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
44
|
+
colors?: BrandColors | null;
|
|
45
|
+
email?: BrandSettingsEmail | null;
|
|
46
|
+
inapp?: BrandSettingsInApp | null;
|
|
47
|
+
}
|
|
48
|
+
export interface BrandSettingsEmail {
|
|
49
|
+
footer?: EmailFooter | null;
|
|
50
|
+
head?: EmailHead | null;
|
|
51
|
+
header?: EmailHeader | null;
|
|
52
|
+
templateOverride?: BrandSettingsEmail.TemplateOverride | null;
|
|
53
|
+
}
|
|
54
|
+
export declare namespace BrandSettingsEmail {
|
|
55
|
+
interface TemplateOverride extends BrandsAPI.BrandTemplate {
|
|
56
|
+
mjml: BrandsAPI.BrandTemplate;
|
|
57
|
+
footerBackgroundColor?: string | null;
|
|
58
|
+
footerFullWidth?: boolean | null;
|
|
72
59
|
}
|
|
73
60
|
}
|
|
61
|
+
export interface BrandSettingsInApp {
|
|
62
|
+
colors: BrandColors;
|
|
63
|
+
icons: Icons;
|
|
64
|
+
widgetBackground: WidgetBackground;
|
|
65
|
+
borderRadius?: string | null;
|
|
66
|
+
disableMessageIcon?: boolean | null;
|
|
67
|
+
fontFamily?: string | null;
|
|
68
|
+
placement?: 'top' | 'bottom' | 'left' | 'right' | null;
|
|
69
|
+
}
|
|
70
|
+
export interface BrandSnippet {
|
|
71
|
+
name: string;
|
|
72
|
+
value: string;
|
|
73
|
+
}
|
|
74
74
|
export interface BrandSnippets {
|
|
75
|
-
items
|
|
75
|
+
items?: Array<BrandSnippet> | null;
|
|
76
76
|
}
|
|
77
|
-
export
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
export interface BrandTemplate {
|
|
78
|
+
enabled: boolean;
|
|
79
|
+
backgroundColor?: string | null;
|
|
80
|
+
blocksBackgroundColor?: string | null;
|
|
81
|
+
footer?: string | null;
|
|
82
|
+
head?: string | null;
|
|
83
|
+
header?: string | null;
|
|
84
|
+
width?: string | null;
|
|
85
|
+
}
|
|
86
|
+
export interface EmailFooter {
|
|
87
|
+
content?: string | null;
|
|
88
|
+
inheritDefault?: boolean | null;
|
|
89
|
+
}
|
|
90
|
+
export interface EmailHead {
|
|
91
|
+
inheritDefault: boolean;
|
|
92
|
+
content?: string | null;
|
|
93
|
+
}
|
|
94
|
+
export interface EmailHeader {
|
|
95
|
+
logo: Logo;
|
|
96
|
+
barColor?: string | null;
|
|
97
|
+
inheritDefault?: boolean | null;
|
|
98
|
+
}
|
|
99
|
+
export interface Icons {
|
|
100
|
+
bell?: string | null;
|
|
101
|
+
message?: string | null;
|
|
102
|
+
}
|
|
103
|
+
export interface Logo {
|
|
104
|
+
href?: string | null;
|
|
105
|
+
image?: string | null;
|
|
106
|
+
}
|
|
107
|
+
export interface WidgetBackground {
|
|
108
|
+
bottomColor?: string | null;
|
|
109
|
+
topColor?: string | null;
|
|
83
110
|
}
|
|
84
111
|
export interface BrandListResponse {
|
|
85
112
|
paging: AudiencesAPI.Paging;
|
|
86
113
|
results: Array<Brand>;
|
|
87
114
|
}
|
|
88
115
|
export interface BrandCreateParams {
|
|
89
|
-
/**
|
|
90
|
-
* The name of the brand.
|
|
91
|
-
*/
|
|
92
116
|
name: string;
|
|
93
|
-
settings: BrandSettings;
|
|
94
117
|
id?: string | null;
|
|
118
|
+
settings?: BrandSettings | null;
|
|
95
119
|
snippets?: BrandSnippets | null;
|
|
96
120
|
}
|
|
97
121
|
export interface BrandUpdateParams {
|
|
@@ -109,6 +133,6 @@ export interface BrandListParams {
|
|
|
109
133
|
cursor?: string | null;
|
|
110
134
|
}
|
|
111
135
|
export declare namespace Brands {
|
|
112
|
-
export { type Brand as Brand, type BrandSettings as BrandSettings, type BrandSnippets as BrandSnippets, type BrandListResponse as BrandListResponse, type BrandCreateParams as BrandCreateParams, type BrandUpdateParams as BrandUpdateParams, type BrandListParams as BrandListParams, };
|
|
136
|
+
export { type Brand as Brand, type BrandColors as BrandColors, type BrandSettings as BrandSettings, type BrandSettingsEmail as BrandSettingsEmail, type BrandSettingsInApp as BrandSettingsInApp, type BrandSnippet as BrandSnippet, type BrandSnippets as BrandSnippets, type BrandTemplate as BrandTemplate, type EmailFooter as EmailFooter, type EmailHead as EmailHead, type EmailHeader as EmailHeader, type Icons as Icons, type Logo as Logo, type WidgetBackground as WidgetBackground, type BrandListResponse as BrandListResponse, type BrandCreateParams as BrandCreateParams, type BrandUpdateParams as BrandUpdateParams, type BrandListParams as BrandListParams, };
|
|
113
137
|
}
|
|
114
138
|
//# sourceMappingURL=brands.d.mts.map
|