@trycourier/courier 7.8.0 → 7.10.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 (127) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/client.d.mts +16 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +16 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/index.d.mts +3 -1
  12. package/resources/index.d.mts.map +1 -1
  13. package/resources/index.d.ts +3 -1
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js +5 -1
  16. package/resources/index.js.map +1 -1
  17. package/resources/index.mjs +2 -0
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/notifications/checks.d.mts +35 -0
  20. package/resources/notifications/checks.d.mts.map +1 -1
  21. package/resources/notifications/checks.d.ts +35 -0
  22. package/resources/notifications/checks.d.ts.map +1 -1
  23. package/resources/notifications/checks.js +35 -0
  24. package/resources/notifications/checks.js.map +1 -1
  25. package/resources/notifications/checks.mjs +35 -0
  26. package/resources/notifications/checks.mjs.map +1 -1
  27. package/resources/notifications/index.d.mts +1 -2
  28. package/resources/notifications/index.d.mts.map +1 -1
  29. package/resources/notifications/index.d.ts +1 -2
  30. package/resources/notifications/index.d.ts.map +1 -1
  31. package/resources/notifications/index.js +1 -3
  32. package/resources/notifications/index.js.map +1 -1
  33. package/resources/notifications/index.mjs +0 -1
  34. package/resources/notifications/index.mjs.map +1 -1
  35. package/resources/notifications/notifications.d.mts +667 -11
  36. package/resources/notifications/notifications.d.mts.map +1 -1
  37. package/resources/notifications/notifications.d.ts +667 -11
  38. package/resources/notifications/notifications.d.ts.map +1 -1
  39. package/resources/notifications/notifications.js +191 -6
  40. package/resources/notifications/notifications.js.map +1 -1
  41. package/resources/notifications/notifications.mjs +191 -6
  42. package/resources/notifications/notifications.mjs.map +1 -1
  43. package/resources/providers/catalog.d.mts +40 -0
  44. package/resources/providers/catalog.d.mts.map +1 -0
  45. package/resources/providers/catalog.d.ts +40 -0
  46. package/resources/providers/catalog.d.ts.map +1 -0
  47. package/resources/providers/catalog.js +18 -0
  48. package/resources/providers/catalog.js.map +1 -0
  49. package/resources/providers/catalog.mjs +14 -0
  50. package/resources/providers/catalog.mjs.map +1 -0
  51. package/resources/providers/index.d.mts +3 -0
  52. package/resources/providers/index.d.mts.map +1 -0
  53. package/resources/providers/index.d.ts +3 -0
  54. package/resources/providers/index.d.ts.map +1 -0
  55. package/resources/providers/index.js +9 -0
  56. package/resources/providers/index.js.map +1 -0
  57. package/resources/providers/index.mjs +4 -0
  58. package/resources/providers/index.mjs.map +1 -0
  59. package/resources/providers/providers.d.mts +182 -0
  60. package/resources/providers/providers.d.mts.map +1 -0
  61. package/resources/providers/providers.d.ts +182 -0
  62. package/resources/providers/providers.d.ts.map +1 -0
  63. package/resources/providers/providers.js +57 -0
  64. package/resources/providers/providers.js.map +1 -0
  65. package/resources/providers/providers.mjs +52 -0
  66. package/resources/providers/providers.mjs.map +1 -0
  67. package/resources/providers.d.mts +2 -0
  68. package/resources/providers.d.mts.map +1 -0
  69. package/resources/providers.d.ts +2 -0
  70. package/resources/providers.d.ts.map +1 -0
  71. package/resources/providers.js +6 -0
  72. package/resources/providers.js.map +1 -0
  73. package/resources/providers.mjs +3 -0
  74. package/resources/providers.mjs.map +1 -0
  75. package/resources/routing-strategies.d.mts +333 -0
  76. package/resources/routing-strategies.d.mts.map +1 -0
  77. package/resources/routing-strategies.d.ts +333 -0
  78. package/resources/routing-strategies.d.ts.map +1 -0
  79. package/resources/routing-strategies.js +107 -0
  80. package/resources/routing-strategies.js.map +1 -0
  81. package/resources/routing-strategies.mjs +103 -0
  82. package/resources/routing-strategies.mjs.map +1 -0
  83. package/resources/send.d.mts +2 -60
  84. package/resources/send.d.mts.map +1 -1
  85. package/resources/send.d.ts +2 -60
  86. package/resources/send.d.ts.map +1 -1
  87. package/resources/shared.d.mts +60 -1
  88. package/resources/shared.d.mts.map +1 -1
  89. package/resources/shared.d.ts +60 -1
  90. package/resources/shared.d.ts.map +1 -1
  91. package/resources/tenants/tenants.d.mts +2 -62
  92. package/resources/tenants/tenants.d.mts.map +1 -1
  93. package/resources/tenants/tenants.d.ts +2 -62
  94. package/resources/tenants/tenants.d.ts.map +1 -1
  95. package/resources/tenants/tenants.js.map +1 -1
  96. package/resources/tenants/tenants.mjs.map +1 -1
  97. package/src/client.ts +112 -0
  98. package/src/resources/index.ts +49 -0
  99. package/src/resources/notifications/checks.ts +35 -0
  100. package/src/resources/notifications/index.ts +26 -1
  101. package/src/resources/notifications/notifications.ts +858 -13
  102. package/src/resources/providers/catalog.ts +53 -0
  103. package/src/resources/providers/index.ts +12 -0
  104. package/src/resources/providers/providers.ts +240 -0
  105. package/src/resources/providers.ts +3 -0
  106. package/src/resources/routing-strategies.ts +436 -0
  107. package/src/resources/send.ts +2 -67
  108. package/src/resources/shared.ts +71 -1
  109. package/src/resources/tenants/tenants.ts +2 -69
  110. package/src/version.ts +1 -1
  111. package/version.d.mts +1 -1
  112. package/version.d.mts.map +1 -1
  113. package/version.d.ts +1 -1
  114. package/version.d.ts.map +1 -1
  115. package/version.js +1 -1
  116. package/version.js.map +1 -1
  117. package/version.mjs +1 -1
  118. package/version.mjs.map +1 -1
  119. package/resources/notifications/draft.d.mts +0 -8
  120. package/resources/notifications/draft.d.mts.map +0 -1
  121. package/resources/notifications/draft.d.ts +0 -8
  122. package/resources/notifications/draft.d.ts.map +0 -1
  123. package/resources/notifications/draft.js +0 -13
  124. package/resources/notifications/draft.js.map +0 -1
  125. package/resources/notifications/draft.mjs +0 -9
  126. package/resources/notifications/draft.mjs.map +0 -1
  127. package/src/resources/notifications/draft.ts +0 -13
@@ -0,0 +1,53 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as Shared from '../shared';
5
+ import * as ProvidersAPI from './providers';
6
+ import { APIPromise } from '../../core/api-promise';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+
9
+ export class Catalog extends APIResource {
10
+ /**
11
+ * Returns the catalog of available provider types with their display names,
12
+ * descriptions, and configuration schema fields (snake_case, with `type` and
13
+ * `required`). Providers with no configurable schema return only `provider`,
14
+ * `name`, and `description`.
15
+ */
16
+ list(
17
+ query: CatalogListParams | null | undefined = {},
18
+ options?: RequestOptions,
19
+ ): APIPromise<CatalogListResponse> {
20
+ return this._client.get('/providers/catalog', { query, ...options });
21
+ }
22
+ }
23
+
24
+ /**
25
+ * Paginated list of available provider types with their configuration schemas.
26
+ */
27
+ export interface CatalogListResponse {
28
+ paging: Shared.Paging;
29
+
30
+ results: Array<ProvidersAPI.ProvidersCatalogEntry>;
31
+ }
32
+
33
+ export interface CatalogListParams {
34
+ /**
35
+ * Exact match (case-insensitive) against the provider channel taxonomy (e.g.
36
+ * `email`, `sms`, `push`).
37
+ */
38
+ channel?: string;
39
+
40
+ /**
41
+ * Comma-separated provider keys to filter by (e.g. `sendgrid,twilio`).
42
+ */
43
+ keys?: string;
44
+
45
+ /**
46
+ * Case-insensitive substring match against the provider display name.
47
+ */
48
+ name?: string;
49
+ }
50
+
51
+ export declare namespace Catalog {
52
+ export { type CatalogListResponse as CatalogListResponse, type CatalogListParams as CatalogListParams };
53
+ }
@@ -0,0 +1,12 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { Catalog, type CatalogListResponse, type CatalogListParams } from './catalog';
4
+ export {
5
+ Providers,
6
+ type Provider,
7
+ type ProvidersCatalogEntry,
8
+ type ProviderListResponse,
9
+ type ProviderCreateParams,
10
+ type ProviderUpdateParams,
11
+ type ProviderListParams,
12
+ } from './providers';
@@ -0,0 +1,240 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as Shared from '../shared';
5
+ import * as CatalogAPI from './catalog';
6
+ import { Catalog, CatalogListParams, CatalogListResponse } from './catalog';
7
+ import { APIPromise } from '../../core/api-promise';
8
+ import { buildHeaders } from '../../internal/headers';
9
+ import { RequestOptions } from '../../internal/request-options';
10
+ import { path } from '../../internal/utils/path';
11
+
12
+ export class Providers extends APIResource {
13
+ catalog: CatalogAPI.Catalog = new CatalogAPI.Catalog(this._client);
14
+
15
+ /**
16
+ * Create a new provider configuration. The `provider` field must be a known
17
+ * Courier provider key (see catalog).
18
+ */
19
+ create(body: ProviderCreateParams, options?: RequestOptions): APIPromise<Provider> {
20
+ return this._client.post('/providers', { body, ...options });
21
+ }
22
+
23
+ /**
24
+ * Fetch a single provider configuration by ID.
25
+ */
26
+ retrieve(id: string, options?: RequestOptions): APIPromise<Provider> {
27
+ return this._client.get(path`/providers/${id}`, options);
28
+ }
29
+
30
+ /**
31
+ * Update an existing provider configuration. The `provider` key is required. All
32
+ * other fields are optional — omitted fields are cleared from the stored
33
+ * configuration (this is a full replacement, not a partial merge).
34
+ */
35
+ update(id: string, body: ProviderUpdateParams, options?: RequestOptions): APIPromise<Provider> {
36
+ return this._client.post(path`/providers/${id}`, { body, ...options });
37
+ }
38
+
39
+ /**
40
+ * List configured provider integrations for the current workspace. Supports
41
+ * cursor-based pagination.
42
+ */
43
+ list(
44
+ query: ProviderListParams | null | undefined = {},
45
+ options?: RequestOptions,
46
+ ): APIPromise<ProviderListResponse> {
47
+ return this._client.get('/providers', { query, ...options });
48
+ }
49
+
50
+ /**
51
+ * Delete a provider configuration. Returns 409 if the provider is still referenced
52
+ * by routing or notifications.
53
+ */
54
+ delete(id: string, options?: RequestOptions): APIPromise<void> {
55
+ return this._client.delete(path`/providers/${id}`, {
56
+ ...options,
57
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
58
+ });
59
+ }
60
+ }
61
+
62
+ /**
63
+ * A configured provider in the workspace.
64
+ */
65
+ export interface Provider {
66
+ /**
67
+ * A unique identifier for the provider configuration.
68
+ */
69
+ id: string;
70
+
71
+ /**
72
+ * Unix timestamp (ms) of when the provider was created.
73
+ */
74
+ created: number;
75
+
76
+ /**
77
+ * The provider key (e.g. "sendgrid", "twilio", "slack").
78
+ */
79
+ provider: string;
80
+
81
+ /**
82
+ * Provider-specific settings (snake_case keys on the wire).
83
+ */
84
+ settings: { [key: string]: unknown };
85
+
86
+ /**
87
+ * Display title. Defaults to "Default Configuration" when not explicitly set.
88
+ */
89
+ title: string;
90
+
91
+ /**
92
+ * Optional alias for this configuration.
93
+ */
94
+ alias?: string;
95
+
96
+ /**
97
+ * Unix timestamp (ms) of when the provider was last updated.
98
+ */
99
+ updated?: number | null;
100
+ }
101
+
102
+ /**
103
+ * A provider type from the catalog. Contains the key, display name, description,
104
+ * and a `settings` object describing configuration schema fields.
105
+ */
106
+ export interface ProvidersCatalogEntry {
107
+ /**
108
+ * Courier taxonomy channel (e.g. email, push, sms, direct_message, inbox,
109
+ * webhook).
110
+ */
111
+ channel: string;
112
+
113
+ /**
114
+ * Short description of the provider.
115
+ */
116
+ description: string;
117
+
118
+ /**
119
+ * Human-readable display name.
120
+ */
121
+ name: string;
122
+
123
+ /**
124
+ * The provider key (e.g. "sendgrid", "twilio").
125
+ */
126
+ provider: string;
127
+
128
+ /**
129
+ * Map of setting field names (snake_case) to their schema descriptors. Each
130
+ * descriptor has `type` and `required`. Empty when the provider has no
131
+ * configurable schema.
132
+ */
133
+ settings: { [key: string]: ProvidersCatalogEntry.Settings };
134
+ }
135
+
136
+ export namespace ProvidersCatalogEntry {
137
+ /**
138
+ * Describes a single configuration field in the provider catalog.
139
+ */
140
+ export interface Settings {
141
+ /**
142
+ * Whether this field is required when configuring the provider.
143
+ */
144
+ required: boolean;
145
+
146
+ /**
147
+ * The field's data type (e.g. "string", "boolean", "enum").
148
+ */
149
+ type: string;
150
+
151
+ /**
152
+ * Allowed values when `type` is "enum".
153
+ */
154
+ values?: Array<string>;
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Paginated list of provider configurations.
160
+ */
161
+ export interface ProviderListResponse {
162
+ paging: Shared.Paging;
163
+
164
+ results: Array<Provider>;
165
+ }
166
+
167
+ export interface ProviderCreateParams {
168
+ /**
169
+ * The provider key identifying the type (e.g. "sendgrid", "twilio"). Must be a
170
+ * known Courier provider — see the catalog endpoint for valid keys.
171
+ */
172
+ provider: string;
173
+
174
+ /**
175
+ * Optional alias for this configuration.
176
+ */
177
+ alias?: string;
178
+
179
+ /**
180
+ * Provider-specific settings (snake_case keys). Defaults to an empty object when
181
+ * omitted. Use the catalog endpoint to discover required fields for a given
182
+ * provider — omitting a required field returns a 400 validation error.
183
+ */
184
+ settings?: { [key: string]: unknown };
185
+
186
+ /**
187
+ * Optional display title. Omit to use "Default Configuration".
188
+ */
189
+ title?: string;
190
+ }
191
+
192
+ export interface ProviderUpdateParams {
193
+ /**
194
+ * The provider key identifying the type.
195
+ */
196
+ provider: string;
197
+
198
+ /**
199
+ * Updated alias. Omit to clear.
200
+ */
201
+ alias?: string;
202
+
203
+ /**
204
+ * Provider-specific settings (snake_case keys). Replaces the full settings object
205
+ * — omitted settings fields are removed. Use the catalog endpoint to check
206
+ * required fields.
207
+ */
208
+ settings?: { [key: string]: unknown };
209
+
210
+ /**
211
+ * Updated display title.
212
+ */
213
+ title?: string;
214
+ }
215
+
216
+ export interface ProviderListParams {
217
+ /**
218
+ * Opaque cursor for fetching the next page.
219
+ */
220
+ cursor?: string;
221
+ }
222
+
223
+ Providers.Catalog = Catalog;
224
+
225
+ export declare namespace Providers {
226
+ export {
227
+ type Provider as Provider,
228
+ type ProvidersCatalogEntry as ProvidersCatalogEntry,
229
+ type ProviderListResponse as ProviderListResponse,
230
+ type ProviderCreateParams as ProviderCreateParams,
231
+ type ProviderUpdateParams as ProviderUpdateParams,
232
+ type ProviderListParams as ProviderListParams,
233
+ };
234
+
235
+ export {
236
+ Catalog as Catalog,
237
+ type CatalogListResponse as CatalogListResponse,
238
+ type CatalogListParams as CatalogListParams,
239
+ };
240
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './providers/index';