@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.
Files changed (196) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +11 -11
  3. package/client.d.mts +23 -14
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +23 -14
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +2 -2
  9. package/client.mjs.map +1 -1
  10. package/internal/to-file.d.mts +1 -1
  11. package/internal/to-file.d.ts +1 -1
  12. package/internal/to-file.js +1 -1
  13. package/internal/to-file.mjs +1 -1
  14. package/internal/tslib.js +6 -6
  15. package/package.json +1 -1
  16. package/resources/audiences.d.mts +27 -46
  17. package/resources/audiences.d.mts.map +1 -1
  18. package/resources/audiences.d.ts +27 -46
  19. package/resources/audiences.d.ts.map +1 -1
  20. package/resources/audit-events.d.mts +3 -7
  21. package/resources/audit-events.d.mts.map +1 -1
  22. package/resources/audit-events.d.ts +3 -7
  23. package/resources/audit-events.d.ts.map +1 -1
  24. package/resources/auth.d.mts +2 -2
  25. package/resources/auth.d.mts.map +1 -1
  26. package/resources/auth.d.ts +2 -2
  27. package/resources/auth.d.ts.map +1 -1
  28. package/resources/automations/automations.d.mts +2 -253
  29. package/resources/automations/automations.d.mts.map +1 -1
  30. package/resources/automations/automations.d.ts +2 -253
  31. package/resources/automations/automations.d.ts.map +1 -1
  32. package/resources/automations/automations.js +0 -42
  33. package/resources/automations/automations.js.map +1 -1
  34. package/resources/automations/automations.mjs +0 -42
  35. package/resources/automations/automations.mjs.map +1 -1
  36. package/resources/automations/index.d.mts +2 -2
  37. package/resources/automations/index.d.mts.map +1 -1
  38. package/resources/automations/index.d.ts +2 -2
  39. package/resources/automations/index.d.ts.map +1 -1
  40. package/resources/automations/index.js.map +1 -1
  41. package/resources/automations/index.mjs +1 -1
  42. package/resources/automations/index.mjs.map +1 -1
  43. package/resources/automations/invoke.d.mts +124 -9
  44. package/resources/automations/invoke.d.mts.map +1 -1
  45. package/resources/automations/invoke.d.ts +124 -9
  46. package/resources/automations/invoke.d.ts.map +1 -1
  47. package/resources/automations/invoke.js +45 -0
  48. package/resources/automations/invoke.js.map +1 -1
  49. package/resources/automations/invoke.mjs +45 -0
  50. package/resources/automations/invoke.mjs.map +1 -1
  51. package/resources/brands.d.mts +74 -50
  52. package/resources/brands.d.mts.map +1 -1
  53. package/resources/brands.d.ts +74 -50
  54. package/resources/brands.d.ts.map +1 -1
  55. package/resources/brands.js.map +1 -1
  56. package/resources/brands.mjs.map +1 -1
  57. package/resources/bulk.d.mts +38 -89
  58. package/resources/bulk.d.mts.map +1 -1
  59. package/resources/bulk.d.ts +38 -89
  60. package/resources/bulk.d.ts.map +1 -1
  61. package/resources/inbound.d.mts +1 -1
  62. package/resources/inbound.d.ts +1 -1
  63. package/resources/index.d.mts +8 -7
  64. package/resources/index.d.mts.map +1 -1
  65. package/resources/index.d.ts +8 -7
  66. package/resources/index.d.ts.map +1 -1
  67. package/resources/index.js +2 -0
  68. package/resources/index.js.map +1 -1
  69. package/resources/index.mjs +2 -1
  70. package/resources/index.mjs.map +1 -1
  71. package/resources/lists/index.d.mts +2 -2
  72. package/resources/lists/index.d.mts.map +1 -1
  73. package/resources/lists/index.d.ts +2 -2
  74. package/resources/lists/index.d.ts.map +1 -1
  75. package/resources/lists/index.js.map +1 -1
  76. package/resources/lists/index.mjs +1 -1
  77. package/resources/lists/index.mjs.map +1 -1
  78. package/resources/lists/lists.d.mts +9 -7
  79. package/resources/lists/lists.d.mts.map +1 -1
  80. package/resources/lists/lists.d.ts +9 -7
  81. package/resources/lists/lists.d.ts.map +1 -1
  82. package/resources/lists/lists.js +7 -2
  83. package/resources/lists/lists.js.map +1 -1
  84. package/resources/lists/lists.mjs +7 -2
  85. package/resources/lists/lists.mjs.map +1 -1
  86. package/resources/lists/subscriptions.d.mts +9 -34
  87. package/resources/lists/subscriptions.d.mts.map +1 -1
  88. package/resources/lists/subscriptions.d.ts +9 -34
  89. package/resources/lists/subscriptions.d.ts.map +1 -1
  90. package/resources/messages.d.mts +6 -6
  91. package/resources/messages.d.mts.map +1 -1
  92. package/resources/messages.d.ts +6 -6
  93. package/resources/messages.d.ts.map +1 -1
  94. package/resources/messages.js +1 -1
  95. package/resources/messages.js.map +1 -1
  96. package/resources/messages.mjs +1 -1
  97. package/resources/messages.mjs.map +1 -1
  98. package/resources/notifications/index.d.mts +1 -1
  99. package/resources/notifications/index.d.mts.map +1 -1
  100. package/resources/notifications/index.d.ts +1 -1
  101. package/resources/notifications/index.d.ts.map +1 -1
  102. package/resources/notifications/index.js.map +1 -1
  103. package/resources/notifications/index.mjs.map +1 -1
  104. package/resources/notifications/notifications.d.mts +3 -8
  105. package/resources/notifications/notifications.d.mts.map +1 -1
  106. package/resources/notifications/notifications.d.ts +3 -8
  107. package/resources/notifications/notifications.d.ts.map +1 -1
  108. package/resources/notifications/notifications.js.map +1 -1
  109. package/resources/notifications/notifications.mjs.map +1 -1
  110. package/resources/send.d.mts +249 -701
  111. package/resources/send.d.mts.map +1 -1
  112. package/resources/send.d.ts +249 -701
  113. package/resources/send.d.ts.map +1 -1
  114. package/resources/send.js +12 -1
  115. package/resources/send.js.map +1 -1
  116. package/resources/send.mjs +12 -1
  117. package/resources/send.mjs.map +1 -1
  118. package/resources/shared.d.mts +42 -0
  119. package/resources/shared.d.mts.map +1 -0
  120. package/resources/shared.d.ts +42 -0
  121. package/resources/shared.d.ts.map +1 -0
  122. package/resources/shared.js +4 -0
  123. package/resources/shared.js.map +1 -0
  124. package/resources/shared.mjs +3 -0
  125. package/resources/shared.mjs.map +1 -0
  126. package/resources/tenants/index.d.mts +1 -0
  127. package/resources/tenants/index.d.mts.map +1 -1
  128. package/resources/tenants/index.d.ts +1 -0
  129. package/resources/tenants/index.d.ts.map +1 -1
  130. package/resources/tenants/index.js +3 -1
  131. package/resources/tenants/index.js.map +1 -1
  132. package/resources/tenants/index.mjs +1 -0
  133. package/resources/tenants/index.mjs.map +1 -1
  134. package/resources/tenants/templates.d.mts +122 -0
  135. package/resources/tenants/templates.d.mts.map +1 -0
  136. package/resources/tenants/templates.d.ts +122 -0
  137. package/resources/tenants/templates.d.ts.map +1 -0
  138. package/resources/tenants/templates.js +38 -0
  139. package/resources/tenants/templates.js.map +1 -0
  140. package/resources/tenants/templates.mjs +34 -0
  141. package/resources/tenants/templates.mjs.map +1 -0
  142. package/resources/tenants/tenants.d.mts +4 -0
  143. package/resources/tenants/tenants.d.mts.map +1 -1
  144. package/resources/tenants/tenants.d.ts +4 -0
  145. package/resources/tenants/tenants.d.ts.map +1 -1
  146. package/resources/tenants/tenants.js +4 -0
  147. package/resources/tenants/tenants.js.map +1 -1
  148. package/resources/tenants/tenants.mjs +4 -0
  149. package/resources/tenants/tenants.mjs.map +1 -1
  150. package/resources/users/index.d.mts +1 -1
  151. package/resources/users/index.d.mts.map +1 -1
  152. package/resources/users/index.d.ts +1 -1
  153. package/resources/users/index.d.ts.map +1 -1
  154. package/resources/users/tokens.d.mts +22 -23
  155. package/resources/users/tokens.d.mts.map +1 -1
  156. package/resources/users/tokens.d.ts +22 -23
  157. package/resources/users/tokens.d.ts.map +1 -1
  158. package/resources/users/tokens.js +14 -15
  159. package/resources/users/tokens.js.map +1 -1
  160. package/resources/users/tokens.mjs +14 -15
  161. package/resources/users/tokens.mjs.map +1 -1
  162. package/resources/users/users.d.mts +2 -2
  163. package/resources/users/users.d.mts.map +1 -1
  164. package/resources/users/users.d.ts +2 -2
  165. package/resources/users/users.d.ts.map +1 -1
  166. package/src/client.ts +48 -38
  167. package/src/internal/to-file.ts +1 -1
  168. package/src/resources/audiences.ts +43 -82
  169. package/src/resources/audit-events.ts +5 -11
  170. package/src/resources/auth.ts +2 -16
  171. package/src/resources/automations/automations.ts +4 -340
  172. package/src/resources/automations/index.ts +3 -8
  173. package/src/resources/automations/invoke.ts +163 -13
  174. package/src/resources/brands.ts +117 -51
  175. package/src/resources/bulk.ts +31 -104
  176. package/src/resources/inbound.ts +1 -1
  177. package/src/resources/index.ts +17 -19
  178. package/src/resources/lists/index.ts +9 -1
  179. package/src/resources/lists/lists.ts +15 -5
  180. package/src/resources/lists/subscriptions.ts +12 -45
  181. package/src/resources/messages.ts +8 -5
  182. package/src/resources/notifications/index.ts +0 -2
  183. package/src/resources/notifications/notifications.ts +2 -12
  184. package/src/resources/send.ts +254 -853
  185. package/src/resources/shared.ts +61 -0
  186. package/src/resources/tenants/index.ts +8 -0
  187. package/src/resources/tenants/templates.ts +165 -0
  188. package/src/resources/tenants/tenants.ts +21 -0
  189. package/src/resources/users/index.ts +2 -2
  190. package/src/resources/users/tokens.ts +33 -34
  191. package/src/resources/users/users.ts +4 -4
  192. package/src/version.ts +1 -1
  193. package/version.d.mts +1 -1
  194. package/version.d.ts +1 -1
  195. package/version.js +1 -1
  196. 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;OAEf,KAAK,SAAS;OACd,EAIL,MAAM,GAEP;OAGM,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,WAAY,SAAQ,WAAW;IAA5C;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAmDhE,CAAC;IAjDC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAAW,CACT,IAAiC,EACjC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAED;;;;;;;;OAQG;IACH,gBAAgB,CACd,UAAkB,EAClB,IAAsC,EACtC,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;AAqRD,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC"}
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, type AutomationInvokeAdHocParams, type AutomationInvokeByTemplateParams, } from "./automations.mjs";
2
- export { Invoke, type AutomationInvokeParams, type AutomationInvokeResponse, type AutomationStep, type MergeAlgorithm, } from "./invoke.mjs";
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,EACL,WAAW,EACX,KAAK,2BAA2B,EAChC,KAAK,gCAAgC,GACtC;OACM,EACL,MAAM,EACN,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB"}
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, type AutomationInvokeAdHocParams, type AutomationInvokeByTemplateParams, } from "./automations.js";
2
- export { Invoke, type AutomationInvokeParams, type AutomationInvokeResponse, type AutomationStep, type MergeAlgorithm, } from "./invoke.js";
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,EACL,WAAW,EACX,KAAK,2BAA2B,EAChC,KAAK,gCAAgC,GACtC;OACM,EACL,MAAM,EACN,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB"}
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,gDAIuB;AAHrB,0GAAA,WAAW,OAAA;AAIb,sCAMkB;AALhB,gGAAA,MAAM,OAAA"}
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,4 +1,4 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- export { Automations, } from "./automations.mjs";
2
+ export { Automations } from "./automations.mjs";
3
3
  export { Invoke, } from "./invoke.mjs";
4
4
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/automations/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,WAAW,GAGZ;OACM,EACL,MAAM,GAKP"}
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 AutomationInvokeParams {
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?: unknown;
55
+ profile?: {
56
+ [key: string]: unknown;
57
+ } | null;
10
58
  recipient?: string | null;
11
59
  template?: string | null;
12
60
  }
13
- export interface AutomationInvokeResponse {
14
- runId: string;
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 AutomationStep {
17
- if?: string | null;
18
- ref?: string | null;
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 AutomationInvokeParams as AutomationInvokeParams, type AutomationInvokeResponse as AutomationInvokeResponse, type AutomationStep as AutomationStep, type MergeAlgorithm as MergeAlgorithm, };
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;AAEtB,qBAAa,MAAO,SAAQ,WAAW;CAAG;AAE1C,MAAM,WAAW,sBAAsB;IACrC,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,OAAO,CAAC;IAElB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CA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AAE,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,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"}
@@ -1,24 +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 AutomationInvokeParams {
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?: unknown;
55
+ profile?: {
56
+ [key: string]: unknown;
57
+ } | null;
10
58
  recipient?: string | null;
11
59
  template?: string | null;
12
60
  }
13
- export interface AutomationInvokeResponse {
14
- runId: string;
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 AutomationStep {
17
- if?: string | null;
18
- ref?: string | null;
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 AutomationInvokeParams as AutomationInvokeParams, type AutomationInvokeResponse as AutomationInvokeResponse, type AutomationStep as AutomationStep, type MergeAlgorithm as MergeAlgorithm, };
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;AAEtB,qBAAa,MAAO,SAAQ,WAAW;CAAG;AAE1C,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB,IAAI,CAAC,EAAE;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AE,QAAQ,CAAC;YAEjB,QAAQ,EAAE,MAAM,CAAC;SAClB;KACF;CACF;AAED,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB,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,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;AAElD,MAAa,MAAO,SAAQ,sBAAW;CAAG;AAA1C,wBAA0C"}
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;AAEtB,MAAM,OAAO,MAAO,SAAQ,WAAW;CAAG"}
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"}
@@ -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
- * The version identifier for the brand
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?: BrandSettings.Colors | null;
60
- email?: BrandSettings.Email | null;
61
- inapp?: unknown;
62
- }
63
- export declare namespace BrandSettings {
64
- interface Colors {
65
- primary?: string | null;
66
- secondary?: string | null;
67
- tertiary?: string | null;
68
- }
69
- interface Email {
70
- footer: unknown;
71
- header: unknown;
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: Array<BrandSnippets.Item>;
75
+ items?: Array<BrandSnippet> | null;
76
76
  }
77
- export declare namespace BrandSnippets {
78
- interface Item {
79
- format: 'handlebars';
80
- name: string;
81
- value: string;
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