@trycourier/courier 6.7.0-alpha3 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +14 -8
  3. package/client.d.mts +35 -16
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +35 -16
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +1 -1
  9. package/client.mjs.map +1 -1
  10. package/package.json +2 -2
  11. package/resources/audiences.d.mts +4 -7
  12. package/resources/audiences.d.mts.map +1 -1
  13. package/resources/audiences.d.ts +4 -7
  14. package/resources/audiences.d.ts.map +1 -1
  15. package/resources/audiences.js.map +1 -1
  16. package/resources/audiences.mjs.map +1 -1
  17. package/resources/audit-events.d.mts +2 -2
  18. package/resources/audit-events.d.mts.map +1 -1
  19. package/resources/audit-events.d.ts +2 -2
  20. package/resources/audit-events.d.ts.map +1 -1
  21. package/resources/automations/automations.d.mts +6 -2
  22. package/resources/automations/automations.d.mts.map +1 -1
  23. package/resources/automations/automations.d.ts +6 -2
  24. package/resources/automations/automations.d.ts.map +1 -1
  25. package/resources/automations/automations.js.map +1 -1
  26. package/resources/automations/automations.mjs +1 -1
  27. package/resources/automations/automations.mjs.map +1 -1
  28. package/resources/automations/index.d.mts +2 -2
  29. package/resources/automations/index.d.mts.map +1 -1
  30. package/resources/automations/index.d.ts +2 -2
  31. package/resources/automations/index.d.ts.map +1 -1
  32. package/resources/automations/index.js.map +1 -1
  33. package/resources/automations/index.mjs +1 -1
  34. package/resources/automations/index.mjs.map +1 -1
  35. package/resources/automations/invoke.d.mts +4 -6
  36. package/resources/automations/invoke.d.mts.map +1 -1
  37. package/resources/automations/invoke.d.ts +4 -6
  38. package/resources/automations/invoke.d.ts.map +1 -1
  39. package/resources/automations/invoke.js.map +1 -1
  40. package/resources/automations/invoke.mjs.map +1 -1
  41. package/resources/brands.d.mts +2 -2
  42. package/resources/brands.d.mts.map +1 -1
  43. package/resources/brands.d.ts +2 -2
  44. package/resources/brands.d.ts.map +1 -1
  45. package/resources/bulk.d.mts +5 -45
  46. package/resources/bulk.d.mts.map +1 -1
  47. package/resources/bulk.d.ts +5 -45
  48. package/resources/bulk.d.ts.map +1 -1
  49. package/resources/bulk.js.map +1 -1
  50. package/resources/bulk.mjs.map +1 -1
  51. package/resources/index.d.mts +8 -8
  52. package/resources/index.d.mts.map +1 -1
  53. package/resources/index.d.ts +8 -8
  54. package/resources/index.d.ts.map +1 -1
  55. package/resources/index.js.map +1 -1
  56. package/resources/index.mjs +1 -1
  57. package/resources/index.mjs.map +1 -1
  58. package/resources/lists/index.d.mts +2 -2
  59. package/resources/lists/index.d.mts.map +1 -1
  60. package/resources/lists/index.d.ts +2 -2
  61. package/resources/lists/index.d.ts.map +1 -1
  62. package/resources/lists/index.js.map +1 -1
  63. package/resources/lists/index.mjs.map +1 -1
  64. package/resources/lists/lists.d.mts +13 -9
  65. package/resources/lists/lists.d.mts.map +1 -1
  66. package/resources/lists/lists.d.ts +13 -9
  67. package/resources/lists/lists.d.ts.map +1 -1
  68. package/resources/lists/lists.js.map +1 -1
  69. package/resources/lists/lists.mjs.map +1 -1
  70. package/resources/lists/subscriptions.d.mts +7 -26
  71. package/resources/lists/subscriptions.d.mts.map +1 -1
  72. package/resources/lists/subscriptions.d.ts +7 -26
  73. package/resources/lists/subscriptions.d.ts.map +1 -1
  74. package/resources/lists/subscriptions.js.map +1 -1
  75. package/resources/lists/subscriptions.mjs.map +1 -1
  76. package/resources/messages.d.mts +2 -2
  77. package/resources/messages.d.mts.map +1 -1
  78. package/resources/messages.d.ts +2 -2
  79. package/resources/messages.d.ts.map +1 -1
  80. package/resources/notifications/checks.d.mts +5 -12
  81. package/resources/notifications/checks.d.mts.map +1 -1
  82. package/resources/notifications/checks.d.ts +5 -12
  83. package/resources/notifications/checks.d.ts.map +1 -1
  84. package/resources/notifications/checks.js.map +1 -1
  85. package/resources/notifications/checks.mjs.map +1 -1
  86. package/resources/notifications/index.d.mts +2 -2
  87. package/resources/notifications/index.d.mts.map +1 -1
  88. package/resources/notifications/index.d.ts +2 -2
  89. package/resources/notifications/index.d.ts.map +1 -1
  90. package/resources/notifications/index.js.map +1 -1
  91. package/resources/notifications/index.mjs.map +1 -1
  92. package/resources/notifications/notifications.d.mts +12 -5
  93. package/resources/notifications/notifications.d.mts.map +1 -1
  94. package/resources/notifications/notifications.d.ts +12 -5
  95. package/resources/notifications/notifications.d.ts.map +1 -1
  96. package/resources/notifications/notifications.js.map +1 -1
  97. package/resources/notifications/notifications.mjs.map +1 -1
  98. package/resources/profiles/index.d.mts +1 -1
  99. package/resources/profiles/index.d.mts.map +1 -1
  100. package/resources/profiles/index.d.ts +1 -1
  101. package/resources/profiles/index.d.ts.map +1 -1
  102. package/resources/profiles/index.js.map +1 -1
  103. package/resources/profiles/index.mjs.map +1 -1
  104. package/resources/profiles/lists.d.mts +5 -11
  105. package/resources/profiles/lists.d.mts.map +1 -1
  106. package/resources/profiles/lists.d.ts +5 -11
  107. package/resources/profiles/lists.d.ts.map +1 -1
  108. package/resources/profiles/profiles.d.mts +7 -3
  109. package/resources/profiles/profiles.d.mts.map +1 -1
  110. package/resources/profiles/profiles.d.ts +7 -3
  111. package/resources/profiles/profiles.d.ts.map +1 -1
  112. package/resources/profiles/profiles.js.map +1 -1
  113. package/resources/profiles/profiles.mjs.map +1 -1
  114. package/resources/send.d.mts +9 -175
  115. package/resources/send.d.mts.map +1 -1
  116. package/resources/send.d.ts +9 -175
  117. package/resources/send.d.ts.map +1 -1
  118. package/resources/send.js +2 -2
  119. package/resources/send.js.map +1 -1
  120. package/resources/send.mjs +2 -2
  121. package/resources/send.mjs.map +1 -1
  122. package/resources/shared.d.mts +215 -4
  123. package/resources/shared.d.mts.map +1 -1
  124. package/resources/shared.d.ts +215 -4
  125. package/resources/shared.d.ts.map +1 -1
  126. package/resources/tenants/index.d.mts +3 -2
  127. package/resources/tenants/index.d.mts.map +1 -1
  128. package/resources/tenants/index.d.ts +3 -2
  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/preferences/index.d.mts +3 -0
  135. package/resources/tenants/preferences/index.d.mts.map +1 -0
  136. package/resources/tenants/preferences/index.d.ts +3 -0
  137. package/resources/tenants/preferences/index.d.ts.map +1 -0
  138. package/resources/tenants/{default-preferences → preferences}/index.js +3 -3
  139. package/resources/tenants/preferences/index.js.map +1 -0
  140. package/resources/tenants/preferences/index.mjs +4 -0
  141. package/resources/tenants/preferences/index.mjs.map +1 -0
  142. package/resources/tenants/{default-preferences → preferences}/items.d.mts +12 -29
  143. package/resources/tenants/preferences/items.d.mts.map +1 -0
  144. package/resources/tenants/{default-preferences → preferences}/items.d.ts +12 -29
  145. package/resources/tenants/preferences/items.d.ts.map +1 -0
  146. package/resources/tenants/{default-preferences → preferences}/items.js +9 -13
  147. package/resources/tenants/preferences/items.js.map +1 -0
  148. package/resources/tenants/{default-preferences → preferences}/items.mjs +9 -13
  149. package/resources/tenants/preferences/items.mjs.map +1 -0
  150. package/resources/tenants/preferences/preferences.d.mts +10 -0
  151. package/resources/tenants/preferences/preferences.d.mts.map +1 -0
  152. package/resources/tenants/preferences/preferences.d.ts +10 -0
  153. package/resources/tenants/preferences/preferences.d.ts.map +1 -0
  154. package/resources/tenants/{default-preferences/default-preferences.js → preferences/preferences.js} +5 -5
  155. package/resources/tenants/preferences/preferences.js.map +1 -0
  156. package/resources/tenants/{default-preferences/default-preferences.mjs → preferences/preferences.mjs} +4 -4
  157. package/resources/tenants/preferences/preferences.mjs.map +1 -0
  158. package/resources/tenants/preferences.d.mts +2 -0
  159. package/resources/tenants/preferences.d.mts.map +1 -0
  160. package/resources/tenants/preferences.d.ts +2 -0
  161. package/resources/tenants/preferences.d.ts.map +1 -0
  162. package/resources/tenants/{default-preferences.js → preferences.js} +2 -2
  163. package/resources/tenants/preferences.js.map +1 -0
  164. package/resources/tenants/preferences.mjs +3 -0
  165. package/resources/tenants/preferences.mjs.map +1 -0
  166. package/resources/tenants/templates.d.mts +4 -35
  167. package/resources/tenants/templates.d.mts.map +1 -1
  168. package/resources/tenants/templates.d.ts +4 -35
  169. package/resources/tenants/templates.d.ts.map +1 -1
  170. package/resources/tenants/templates.js.map +1 -1
  171. package/resources/tenants/templates.mjs.map +1 -1
  172. package/resources/tenants/tenants.d.mts +64 -9
  173. package/resources/tenants/tenants.d.mts.map +1 -1
  174. package/resources/tenants/tenants.d.ts +64 -9
  175. package/resources/tenants/tenants.d.ts.map +1 -1
  176. package/resources/tenants/tenants.js +4 -2
  177. package/resources/tenants/tenants.js.map +1 -1
  178. package/resources/tenants/tenants.mjs +5 -3
  179. package/resources/tenants/tenants.mjs.map +1 -1
  180. package/resources/users/index.d.mts +2 -2
  181. package/resources/users/index.d.mts.map +1 -1
  182. package/resources/users/index.d.ts +2 -2
  183. package/resources/users/index.d.ts.map +1 -1
  184. package/resources/users/index.js.map +1 -1
  185. package/resources/users/index.mjs.map +1 -1
  186. package/resources/users/preferences.d.mts +8 -11
  187. package/resources/users/preferences.d.mts.map +1 -1
  188. package/resources/users/preferences.d.ts +8 -11
  189. package/resources/users/preferences.d.ts.map +1 -1
  190. package/resources/users/preferences.js.map +1 -1
  191. package/resources/users/preferences.mjs.map +1 -1
  192. package/resources/users/tenants.d.mts +4 -21
  193. package/resources/users/tenants.d.mts.map +1 -1
  194. package/resources/users/tenants.d.ts +4 -21
  195. package/resources/users/tenants.d.ts.map +1 -1
  196. package/resources/users/tenants.js.map +1 -1
  197. package/resources/users/tenants.mjs.map +1 -1
  198. package/resources/users/tokens.d.mts +18 -17
  199. package/resources/users/tokens.d.mts.map +1 -1
  200. package/resources/users/tokens.d.ts +18 -17
  201. package/resources/users/tokens.d.ts.map +1 -1
  202. package/resources/users/tokens.js +1 -0
  203. package/resources/users/tokens.js.map +1 -1
  204. package/resources/users/tokens.mjs +1 -0
  205. package/resources/users/tokens.mjs.map +1 -1
  206. package/resources/users/users.d.mts +4 -4
  207. package/resources/users/users.d.mts.map +1 -1
  208. package/resources/users/users.d.ts +4 -4
  209. package/resources/users/users.d.ts.map +1 -1
  210. package/resources/users/users.js.map +1 -1
  211. package/resources/users/users.mjs.map +1 -1
  212. package/src/client.ts +38 -23
  213. package/src/resources/audiences.ts +3 -9
  214. package/src/resources/audit-events.ts +2 -2
  215. package/src/resources/automations/automations.ts +7 -7
  216. package/src/resources/automations/index.ts +2 -7
  217. package/src/resources/automations/invoke.ts +6 -7
  218. package/src/resources/brands.ts +2 -2
  219. package/src/resources/bulk.ts +4 -51
  220. package/src/resources/index.ts +10 -14
  221. package/src/resources/lists/index.ts +2 -4
  222. package/src/resources/lists/lists.ts +14 -13
  223. package/src/resources/lists/subscriptions.ts +6 -31
  224. package/src/resources/messages.ts +2 -2
  225. package/src/resources/notifications/checks.ts +4 -17
  226. package/src/resources/notifications/index.ts +2 -2
  227. package/src/resources/notifications/notifications.ts +15 -6
  228. package/src/resources/profiles/index.ts +1 -0
  229. package/src/resources/profiles/lists.ts +5 -13
  230. package/src/resources/profiles/profiles.ts +9 -2
  231. package/src/resources/send.ts +9 -216
  232. package/src/resources/shared.ts +258 -4
  233. package/src/resources/tenants/index.ts +4 -2
  234. package/src/resources/tenants/preferences/index.ts +4 -0
  235. package/src/resources/tenants/{default-preferences → preferences}/items.ts +12 -38
  236. package/src/resources/tenants/{default-preferences/default-preferences.ts → preferences/preferences.ts} +4 -12
  237. package/src/resources/tenants/{default-preferences.ts → preferences.ts} +1 -1
  238. package/src/resources/tenants/templates.ts +3 -44
  239. package/src/resources/tenants/tenants.ts +77 -18
  240. package/src/resources/users/index.ts +0 -2
  241. package/src/resources/users/preferences.ts +7 -12
  242. package/src/resources/users/tenants.ts +3 -23
  243. package/src/resources/users/tokens.ts +19 -18
  244. package/src/resources/users/users.ts +0 -4
  245. package/src/version.ts +1 -1
  246. package/version.d.mts +1 -1
  247. package/version.d.mts.map +1 -1
  248. package/version.d.ts +1 -1
  249. package/version.d.ts.map +1 -1
  250. package/version.js +1 -1
  251. package/version.js.map +1 -1
  252. package/version.mjs +1 -1
  253. package/version.mjs.map +1 -1
  254. package/resources/tenants/default-preferences/default-preferences.d.mts +0 -10
  255. package/resources/tenants/default-preferences/default-preferences.d.mts.map +0 -1
  256. package/resources/tenants/default-preferences/default-preferences.d.ts +0 -10
  257. package/resources/tenants/default-preferences/default-preferences.d.ts.map +0 -1
  258. package/resources/tenants/default-preferences/default-preferences.js.map +0 -1
  259. package/resources/tenants/default-preferences/default-preferences.mjs.map +0 -1
  260. package/resources/tenants/default-preferences/index.d.mts +0 -3
  261. package/resources/tenants/default-preferences/index.d.mts.map +0 -1
  262. package/resources/tenants/default-preferences/index.d.ts +0 -3
  263. package/resources/tenants/default-preferences/index.d.ts.map +0 -1
  264. package/resources/tenants/default-preferences/index.js.map +0 -1
  265. package/resources/tenants/default-preferences/index.mjs +0 -4
  266. package/resources/tenants/default-preferences/index.mjs.map +0 -1
  267. package/resources/tenants/default-preferences/items.d.mts.map +0 -1
  268. package/resources/tenants/default-preferences/items.d.ts.map +0 -1
  269. package/resources/tenants/default-preferences/items.js.map +0 -1
  270. package/resources/tenants/default-preferences/items.mjs.map +0 -1
  271. package/resources/tenants/default-preferences.d.mts +0 -2
  272. package/resources/tenants/default-preferences.d.mts.map +0 -1
  273. package/resources/tenants/default-preferences.d.ts +0 -2
  274. package/resources/tenants/default-preferences.d.ts.map +0 -1
  275. package/resources/tenants/default-preferences.js.map +0 -1
  276. package/resources/tenants/default-preferences.mjs +0 -3
  277. package/resources/tenants/default-preferences.mjs.map +0 -1
  278. package/src/resources/tenants/default-preferences/index.ts +0 -10
@@ -1,12 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
- import * as AudiencesAPI from '../audiences';
4
+ import * as Shared from '../shared';
5
5
  import * as SubscriptionsAPI from './subscriptions';
6
6
  import {
7
- NotificationPreferenceDetails,
8
- PutSubscriptionsRecipient,
9
- RecipientPreferences,
10
7
  SubscriptionAddParams,
11
8
  SubscriptionListParams,
12
9
  SubscriptionListResponse,
@@ -26,7 +23,7 @@ export class Lists extends APIResource {
26
23
  /**
27
24
  * Returns a list based on the list ID provided.
28
25
  */
29
- retrieve(listID: string, options?: RequestOptions): APIPromise<List> {
26
+ retrieve(listID: string, options?: RequestOptions): APIPromise<SubscriptionList> {
30
27
  return this._client.get(path`/lists/${listID}`, options);
31
28
  }
32
29
 
@@ -73,7 +70,13 @@ export class Lists extends APIResource {
73
70
  }
74
71
  }
75
72
 
76
- export interface List {
73
+ export interface PutSubscriptionsRecipient {
74
+ recipientId: string;
75
+
76
+ preferences?: Shared.RecipientPreferences | null;
77
+ }
78
+
79
+ export interface SubscriptionList {
77
80
  id: string;
78
81
 
79
82
  name: string;
@@ -84,15 +87,15 @@ export interface List {
84
87
  }
85
88
 
86
89
  export interface ListListResponse {
87
- items: Array<List>;
90
+ items: Array<SubscriptionList>;
88
91
 
89
- paging: AudiencesAPI.Paging;
92
+ paging: Shared.Paging;
90
93
  }
91
94
 
92
95
  export interface ListUpdateParams {
93
96
  name: string;
94
97
 
95
- preferences?: SubscriptionsAPI.RecipientPreferences | null;
98
+ preferences?: Shared.RecipientPreferences | null;
96
99
  }
97
100
 
98
101
  export interface ListListParams {
@@ -116,7 +119,8 @@ Lists.Subscriptions = Subscriptions;
116
119
 
117
120
  export declare namespace Lists {
118
121
  export {
119
- type List as List,
122
+ type PutSubscriptionsRecipient as PutSubscriptionsRecipient,
123
+ type SubscriptionList as SubscriptionList,
120
124
  type ListListResponse as ListListResponse,
121
125
  type ListUpdateParams as ListUpdateParams,
122
126
  type ListListParams as ListListParams,
@@ -125,9 +129,6 @@ export declare namespace Lists {
125
129
 
126
130
  export {
127
131
  Subscriptions as Subscriptions,
128
- type NotificationPreferenceDetails as NotificationPreferenceDetails,
129
- type PutSubscriptionsRecipient as PutSubscriptionsRecipient,
130
- type RecipientPreferences as RecipientPreferences,
131
132
  type SubscriptionListResponse as SubscriptionListResponse,
132
133
  type SubscriptionListParams as SubscriptionListParams,
133
134
  type SubscriptionAddParams as SubscriptionAddParams,
@@ -1,10 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
- import * as SubscriptionsAPI from './subscriptions';
5
- import * as AudiencesAPI from '../audiences';
6
4
  import * as Shared from '../shared';
7
- import * as PreferencesAPI from '../users/preferences';
5
+ import * as ListsAPI from './lists';
8
6
  import { APIPromise } from '../../core/api-promise';
9
7
  import { buildHeaders } from '../../internal/headers';
10
8
  import { RequestOptions } from '../../internal/request-options';
@@ -79,30 +77,10 @@ export class Subscriptions extends APIResource {
79
77
  }
80
78
  }
81
79
 
82
- export interface NotificationPreferenceDetails {
83
- status: PreferencesAPI.PreferenceStatus;
84
-
85
- channel_preferences?: Array<Shared.ChannelPreference> | null;
86
-
87
- rules?: Array<Shared.Rule> | null;
88
- }
89
-
90
- export interface PutSubscriptionsRecipient {
91
- recipientId: string;
92
-
93
- preferences?: RecipientPreferences | null;
94
- }
95
-
96
- export interface RecipientPreferences {
97
- categories?: { [key: string]: NotificationPreferenceDetails } | null;
98
-
99
- notifications?: { [key: string]: NotificationPreferenceDetails } | null;
100
- }
101
-
102
80
  export interface SubscriptionListResponse {
103
81
  items: Array<SubscriptionListResponse.Item>;
104
82
 
105
- paging: AudiencesAPI.Paging;
83
+ paging: Shared.Paging;
106
84
  }
107
85
 
108
86
  export namespace SubscriptionListResponse {
@@ -111,7 +89,7 @@ export namespace SubscriptionListResponse {
111
89
 
112
90
  created?: string | null;
113
91
 
114
- preferences?: SubscriptionsAPI.RecipientPreferences | null;
92
+ preferences?: Shared.RecipientPreferences | null;
115
93
  }
116
94
  }
117
95
 
@@ -123,11 +101,11 @@ export interface SubscriptionListParams {
123
101
  }
124
102
 
125
103
  export interface SubscriptionAddParams {
126
- recipients: Array<PutSubscriptionsRecipient>;
104
+ recipients: Array<ListsAPI.PutSubscriptionsRecipient>;
127
105
  }
128
106
 
129
107
  export interface SubscriptionSubscribeParams {
130
- recipients: Array<PutSubscriptionsRecipient>;
108
+ recipients: Array<ListsAPI.PutSubscriptionsRecipient>;
131
109
  }
132
110
 
133
111
  export interface SubscriptionSubscribeUserParams {
@@ -139,7 +117,7 @@ export interface SubscriptionSubscribeUserParams {
139
117
  /**
140
118
  * Body param:
141
119
  */
142
- preferences?: RecipientPreferences | null;
120
+ preferences?: Shared.RecipientPreferences | null;
143
121
  }
144
122
 
145
123
  export interface SubscriptionUnsubscribeUserParams {
@@ -151,9 +129,6 @@ export interface SubscriptionUnsubscribeUserParams {
151
129
 
152
130
  export declare namespace Subscriptions {
153
131
  export {
154
- type NotificationPreferenceDetails as NotificationPreferenceDetails,
155
- type PutSubscriptionsRecipient as PutSubscriptionsRecipient,
156
- type RecipientPreferences as RecipientPreferences,
157
132
  type SubscriptionListResponse as SubscriptionListResponse,
158
133
  type SubscriptionListParams as SubscriptionListParams,
159
134
  type SubscriptionAddParams as SubscriptionAddParams,
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
- import * as AudiencesAPI from './audiences';
4
+ import * as Shared from './shared';
5
5
  import { APIPromise } from '../core/api-promise';
6
6
  import { RequestOptions } from '../internal/request-options';
7
7
  import { path } from '../internal/utils/path';
@@ -155,7 +155,7 @@ export interface MessageListResponse {
155
155
  /**
156
156
  * Paging information for the result set.
157
157
  */
158
- paging: AudiencesAPI.Paging;
158
+ paging: Shared.Paging;
159
159
 
160
160
  /**
161
161
  * An array of messages with their details.
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
+ import * as NotificationsAPI from './notifications';
4
5
  import { APIPromise } from '../../core/api-promise';
5
6
  import { buildHeaders } from '../../internal/headers';
6
7
  import { RequestOptions } from '../../internal/request-options';
@@ -34,24 +35,12 @@ export class Checks extends APIResource {
34
35
  }
35
36
  }
36
37
 
37
- export interface BaseCheck {
38
- id: string;
39
-
40
- status: 'RESOLVED' | 'FAILED' | 'PENDING';
41
-
42
- type: 'custom';
43
- }
44
-
45
- export interface Check extends BaseCheck {
46
- updated: number;
47
- }
48
-
49
38
  export interface CheckUpdateResponse {
50
- checks: Array<Check>;
39
+ checks: Array<NotificationsAPI.Check>;
51
40
  }
52
41
 
53
42
  export interface CheckListResponse {
54
- checks: Array<Check>;
43
+ checks: Array<NotificationsAPI.Check>;
55
44
  }
56
45
 
57
46
  export interface CheckUpdateParams {
@@ -63,7 +52,7 @@ export interface CheckUpdateParams {
63
52
  /**
64
53
  * Body param:
65
54
  */
66
- checks: Array<BaseCheck>;
55
+ checks: Array<NotificationsAPI.BaseCheck>;
67
56
  }
68
57
 
69
58
  export interface CheckListParams {
@@ -76,8 +65,6 @@ export interface CheckDeleteParams {
76
65
 
77
66
  export declare namespace Checks {
78
67
  export {
79
- type BaseCheck as BaseCheck,
80
- type Check as Check,
81
68
  type CheckUpdateResponse as CheckUpdateResponse,
82
69
  type CheckListResponse as CheckListResponse,
83
70
  type CheckUpdateParams as CheckUpdateParams,
@@ -2,8 +2,6 @@
2
2
 
3
3
  export {
4
4
  Checks,
5
- type BaseCheck,
6
- type Check,
7
5
  type CheckUpdateResponse,
8
6
  type CheckListResponse,
9
7
  type CheckUpdateParams,
@@ -13,6 +11,8 @@ export {
13
11
  export { Draft } from './draft';
14
12
  export {
15
13
  Notifications,
14
+ type BaseCheck,
15
+ type Check,
16
16
  type NotificationGetContent,
17
17
  type NotificationListResponse,
18
18
  type NotificationListParams,
@@ -1,12 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
- import * as AudiencesAPI from '../audiences';
5
4
  import * as Shared from '../shared';
6
5
  import * as ChecksAPI from './checks';
7
6
  import {
8
- BaseCheck,
9
- Check,
10
7
  CheckDeleteParams,
11
8
  CheckListParams,
12
9
  CheckListResponse,
@@ -36,6 +33,18 @@ export class Notifications extends APIResource {
36
33
  }
37
34
  }
38
35
 
36
+ export interface BaseCheck {
37
+ id: string;
38
+
39
+ status: 'RESOLVED' | 'FAILED' | 'PENDING';
40
+
41
+ type: 'custom';
42
+ }
43
+
44
+ export interface Check extends BaseCheck {
45
+ updated: number;
46
+ }
47
+
39
48
  export interface NotificationGetContent {
40
49
  blocks?: Array<NotificationGetContent.Block> | null;
41
50
 
@@ -103,7 +112,7 @@ export namespace NotificationGetContent {
103
112
  }
104
113
 
105
114
  export interface NotificationListResponse {
106
- paging: AudiencesAPI.Paging;
115
+ paging: Shared.Paging;
107
116
 
108
117
  results: Array<NotificationListResponse.Result>;
109
118
  }
@@ -156,6 +165,8 @@ Notifications.Checks = Checks;
156
165
 
157
166
  export declare namespace Notifications {
158
167
  export {
168
+ type BaseCheck as BaseCheck,
169
+ type Check as Check,
159
170
  type NotificationGetContent as NotificationGetContent,
160
171
  type NotificationListResponse as NotificationListResponse,
161
172
  type NotificationListParams as NotificationListParams,
@@ -165,8 +176,6 @@ export declare namespace Notifications {
165
176
 
166
177
  export {
167
178
  Checks as Checks,
168
- type BaseCheck as BaseCheck,
169
- type Check as Check,
170
179
  type CheckUpdateResponse as CheckUpdateResponse,
171
180
  type CheckListResponse as CheckListResponse,
172
181
  type CheckUpdateParams as CheckUpdateParams,
@@ -10,6 +10,7 @@ export {
10
10
  } from './lists';
11
11
  export {
12
12
  Profiles,
13
+ type SubscribeToListsRequestItem,
13
14
  type ProfileCreateResponse,
14
15
  type ProfileRetrieveResponse,
15
16
  type ProfileReplaceResponse,
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
- import * as AudiencesAPI from '../audiences';
5
- import * as SubscriptionsAPI from '../lists/subscriptions';
4
+ import * as Shared from '../shared';
5
+ import * as ProfilesAPI from './profiles';
6
6
  import { APIPromise } from '../../core/api-promise';
7
7
  import { RequestOptions } from '../../internal/request-options';
8
8
  import { path } from '../../internal/utils/path';
@@ -40,7 +40,7 @@ export class Lists extends APIResource {
40
40
  }
41
41
 
42
42
  export interface ListRetrieveResponse {
43
- paging: AudiencesAPI.Paging;
43
+ paging: Shared.Paging;
44
44
 
45
45
  /**
46
46
  * An array of lists
@@ -69,7 +69,7 @@ export namespace ListRetrieveResponse {
69
69
  */
70
70
  updated: string;
71
71
 
72
- preferences?: SubscriptionsAPI.RecipientPreferences | null;
72
+ preferences?: Shared.RecipientPreferences | null;
73
73
  }
74
74
  }
75
75
 
@@ -89,15 +89,7 @@ export interface ListRetrieveParams {
89
89
  }
90
90
 
91
91
  export interface ListSubscribeParams {
92
- lists: Array<ListSubscribeParams.List>;
93
- }
94
-
95
- export namespace ListSubscribeParams {
96
- export interface List {
97
- listId: string;
98
-
99
- preferences?: SubscriptionsAPI.RecipientPreferences | null;
100
- }
92
+ lists: Array<ProfilesAPI.SubscribeToListsRequestItem>;
101
93
  }
102
94
 
103
95
  export declare namespace Lists {
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
- import * as SubscriptionsAPI from '../lists/subscriptions';
4
+ import * as Shared from '../shared';
5
5
  import * as ListsAPI from './lists';
6
6
  import {
7
7
  ListDeleteResponse,
@@ -75,6 +75,12 @@ export class Profiles extends APIResource {
75
75
  }
76
76
  }
77
77
 
78
+ export interface SubscribeToListsRequestItem {
79
+ listId: string;
80
+
81
+ preferences?: Shared.RecipientPreferences | null;
82
+ }
83
+
78
84
  export interface ProfileCreateResponse {
79
85
  status: 'SUCCESS';
80
86
  }
@@ -82,7 +88,7 @@ export interface ProfileCreateResponse {
82
88
  export interface ProfileRetrieveResponse {
83
89
  profile: { [key: string]: unknown };
84
90
 
85
- preferences?: SubscriptionsAPI.RecipientPreferences | null;
91
+ preferences?: Shared.RecipientPreferences | null;
86
92
  }
87
93
 
88
94
  export interface ProfileReplaceResponse {
@@ -127,6 +133,7 @@ Profiles.Lists = Lists;
127
133
 
128
134
  export declare namespace Profiles {
129
135
  export {
136
+ type SubscribeToListsRequestItem as SubscribeToListsRequestItem,
130
137
  type ProfileCreateResponse as ProfileCreateResponse,
131
138
  type ProfileRetrieveResponse as ProfileRetrieveResponse,
132
139
  type ProfileReplaceResponse as ProfileReplaceResponse,
@@ -1,16 +1,13 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
- import * as SendAPI from './send';
5
- import * as BulkAPI from './bulk';
6
4
  import * as Shared from './shared';
7
- import * as TemplatesAPI from './tenants/templates';
8
5
  import { APIPromise } from '../core/api-promise';
9
6
  import { RequestOptions } from '../internal/request-options';
10
7
 
11
8
  export class Send extends APIResource {
12
9
  /**
13
- * Use the send API to send a message to one or more recipients.
10
+ * Send a message to one or more recipients.
14
11
  *
15
12
  * @example
16
13
  * ```ts
@@ -18,7 +15,7 @@ export class Send extends APIResource {
18
15
  * message: {
19
16
  * to: { user_id: 'example_user' },
20
17
  * template: 'template_id',
21
- * data: { name: 'Example Name' },
18
+ * data: { foo: 'bar' },
22
19
  * },
23
20
  * });
24
21
  * ```
@@ -28,199 +25,6 @@ export class Send extends APIResource {
28
25
  }
29
26
  }
30
27
 
31
- /**
32
- * The channel element allows a notification to be customized based on which
33
- * channel it is sent through. For example, you may want to display a detailed
34
- * message when the notification is sent through email, and a more concise message
35
- * in a push notification. Channel elements are only valid as top-level elements;
36
- * you cannot nest channel elements. If there is a channel element specified at the
37
- * top-level of the document, all sibling elements must be channel elements. Note:
38
- * As an alternative, most elements support a `channel` property. Which allows you
39
- * to selectively display an individual element on a per channel basis. See the
40
- * [control flow docs](https://www.courier.com/docs/platform/content/elemental/control-flow/)
41
- * for more details.
42
- */
43
- export interface ElementalChannelNode extends Shared.ElementalBaseNode {
44
- /**
45
- * The channel the contents of this element should be applied to. Can be `email`,
46
- * `push`, `direct_message`, `sms` or a provider such as slack
47
- */
48
- channel: string;
49
-
50
- /**
51
- * Raw data to apply to the channel. If `elements` has not been specified, `raw` is
52
- * `required`.
53
- */
54
- raw?: { [key: string]: unknown } | null;
55
- }
56
-
57
- /**
58
- * The channel element allows a notification to be customized based on which
59
- * channel it is sent through. For example, you may want to display a detailed
60
- * message when the notification is sent through email, and a more concise message
61
- * in a push notification. Channel elements are only valid as top-level elements;
62
- * you cannot nest channel elements. If there is a channel element specified at the
63
- * top-level of the document, all sibling elements must be channel elements. Note:
64
- * As an alternative, most elements support a `channel` property. Which allows you
65
- * to selectively display an individual element on a per channel basis. See the
66
- * [control flow docs](https://www.courier.com/docs/platform/content/elemental/control-flow/)
67
- * for more details.
68
- */
69
- export type ElementalNode =
70
- | ElementalNode.UnionMember0
71
- | ElementalNode.UnionMember1
72
- | ElementalNode.UnionMember2
73
- | ElementalNode.UnionMember3
74
- | ElementalNode.UnionMember4
75
- | ElementalNode.UnionMember5
76
- | ElementalNode.UnionMember6;
77
-
78
- export namespace ElementalNode {
79
- export interface UnionMember0 extends Shared.ElementalBaseNode {
80
- type?: 'text';
81
- }
82
-
83
- export interface UnionMember1 extends Shared.ElementalBaseNode {
84
- type?: 'meta';
85
- }
86
-
87
- /**
88
- * The channel element allows a notification to be customized based on which
89
- * channel it is sent through. For example, you may want to display a detailed
90
- * message when the notification is sent through email, and a more concise message
91
- * in a push notification. Channel elements are only valid as top-level elements;
92
- * you cannot nest channel elements. If there is a channel element specified at the
93
- * top-level of the document, all sibling elements must be channel elements. Note:
94
- * As an alternative, most elements support a `channel` property. Which allows you
95
- * to selectively display an individual element on a per channel basis. See the
96
- * [control flow docs](https://www.courier.com/docs/platform/content/elemental/control-flow/)
97
- * for more details.
98
- */
99
- export interface UnionMember2 extends SendAPI.ElementalChannelNode {
100
- type?: 'channel';
101
- }
102
-
103
- export interface UnionMember3 extends Shared.ElementalBaseNode {
104
- type?: 'image';
105
- }
106
-
107
- export interface UnionMember4 {
108
- /**
109
- * A unique id used to identify the action when it is executed.
110
- */
111
- action_id?: string | null;
112
-
113
- /**
114
- * The alignment of the action button. Defaults to "center".
115
- */
116
- align?: Shared.Alignment | null;
117
-
118
- /**
119
- * The background color of the action button.
120
- */
121
- background_color?: string | null;
122
-
123
- /**
124
- * The text content of the action shown to the user.
125
- */
126
- content?: string;
127
-
128
- /**
129
- * The target URL of the action.
130
- */
131
- href?: string;
132
-
133
- /**
134
- * Region specific content. See
135
- * [locales docs](https://www.courier.com/docs/platform/content/elemental/locales/)
136
- * for more details.
137
- */
138
- locales?: { [key: string]: UnionMember4.Locales } | null;
139
-
140
- /**
141
- * Defaults to `button`.
142
- */
143
- style?: 'button' | 'link' | null;
144
-
145
- type?: 'action';
146
- }
147
-
148
- export namespace UnionMember4 {
149
- export interface Locales {
150
- content: string;
151
- }
152
- }
153
-
154
- export interface UnionMember5 extends Shared.ElementalBaseNode {
155
- type?: 'divider';
156
- }
157
-
158
- export interface UnionMember6 extends Shared.ElementalBaseNode {
159
- type?: 'quote';
160
- }
161
- }
162
-
163
- export interface MessageContext {
164
- /**
165
- * Tenant id used to load brand/default preferences/context.
166
- */
167
- tenant_id?: string | null;
168
- }
169
-
170
- export interface Recipient {
171
- /**
172
- * Use `tenant_id` instead.
173
- */
174
- account_id?: string | null;
175
-
176
- /**
177
- * Context such as tenant_id to send the notification with.
178
- */
179
- context?: MessageContext | null;
180
-
181
- data?: { [key: string]: unknown } | null;
182
-
183
- email?: string | null;
184
-
185
- /**
186
- * The user's preferred ISO 639-1 language code.
187
- */
188
- locale?: string | null;
189
-
190
- phone_number?: string | null;
191
-
192
- preferences?: Recipient.Preferences | null;
193
-
194
- /**
195
- * Tenant id. Will load brand, default preferences and base context data.
196
- */
197
- tenant_id?: string | null;
198
-
199
- user_id?: string | null;
200
- }
201
-
202
- export namespace Recipient {
203
- export interface Preferences {
204
- notifications: { [key: string]: Shared.Preference };
205
-
206
- categories?: { [key: string]: Shared.Preference } | null;
207
-
208
- templateId?: string | null;
209
- }
210
- }
211
-
212
- export interface Utm {
213
- campaign?: string | null;
214
-
215
- content?: string | null;
216
-
217
- medium?: string | null;
218
-
219
- source?: string | null;
220
-
221
- term?: string | null;
222
- }
223
-
224
28
  export interface SendMessageResponse {
225
29
  /**
226
30
  * A successful call to `POST /send` returns a `202` status code along with a
@@ -257,9 +61,9 @@ export namespace SendMessageParams {
257
61
  * Describes content that will work for email, inbox, push, chat, or any channel
258
62
  * id.
259
63
  */
260
- content?: Shared.ElementalContentSugar | TemplatesAPI.ElementalContent;
64
+ content?: Shared.ElementalContentSugar | Shared.ElementalContent;
261
65
 
262
- context?: SendAPI.MessageContext | null;
66
+ context?: Shared.MessageContext | null;
263
67
 
264
68
  data?: { [key: string]: unknown } | null;
265
69
 
@@ -278,9 +82,6 @@ export namespace SendMessageParams {
278
82
  */
279
83
  routing?: Message.Routing | null;
280
84
 
281
- /**
282
- * The id of the template you want to send
283
- */
284
85
  template?: string | null;
285
86
 
286
87
  timeout?: Message.Timeout | null;
@@ -288,7 +89,7 @@ export namespace SendMessageParams {
288
89
  /**
289
90
  * The recipient or a list of recipients of the message
290
91
  */
291
- to?: BulkAPI.UserRecipient | Array<SendAPI.Recipient> | null;
92
+ to?: Shared.UserRecipient | Array<Shared.Recipient> | null;
292
93
  }
293
94
 
294
95
  export namespace Message {
@@ -325,7 +126,7 @@ export namespace SendMessageParams {
325
126
 
326
127
  export namespace Channels {
327
128
  export interface Metadata {
328
- utm?: SendAPI.Utm | null;
129
+ utm?: Shared.Utm | null;
329
130
  }
330
131
 
331
132
  export interface Timeouts {
@@ -366,7 +167,7 @@ export namespace SendMessageParams {
366
167
 
367
168
  trace_id?: string | null;
368
169
 
369
- utm?: SendAPI.Utm | null;
170
+ utm?: Shared.Utm | null;
370
171
  }
371
172
 
372
173
  export interface Preferences {
@@ -394,7 +195,7 @@ export namespace SendMessageParams {
394
195
 
395
196
  export namespace Providers {
396
197
  export interface Metadata {
397
- utm?: SendAPI.Utm | null;
198
+ utm?: Shared.Utm | null;
398
199
  }
399
200
  }
400
201
 
@@ -425,13 +226,5 @@ export namespace SendMessageParams {
425
226
  }
426
227
 
427
228
  export declare namespace Send {
428
- export {
429
- type ElementalChannelNode as ElementalChannelNode,
430
- type ElementalNode as ElementalNode,
431
- type MessageContext as MessageContext,
432
- type Recipient as Recipient,
433
- type Utm as Utm,
434
- type SendMessageResponse as SendMessageResponse,
435
- type SendMessageParams as SendMessageParams,
436
- };
229
+ export { type SendMessageResponse as SendMessageResponse, type SendMessageParams as SendMessageParams };
437
230
  }