@outseta/api-client 0.1.1 → 0.2.1

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 (75) hide show
  1. package/README.md +6 -8
  2. package/dist/index.js +23 -19
  3. package/package.json +3 -6
  4. package/src/__tests__/accounts-crud.integration.test.ts +41 -39
  5. package/src/__tests__/client.test.ts +3 -3
  6. package/src/__tests__/people.integration.test.ts +28 -32
  7. package/src/__tests__/setup.ts +5 -6
  8. package/src/__tests__/support.integration.test.ts +28 -35
  9. package/src/client.ts +55 -24
  10. package/src/generated/activity/activity.ts +335 -0
  11. package/src/generated/billing/billing.ts +1006 -0
  12. package/src/generated/crm/crm.ts +1143 -1
  13. package/src/generated/email/email.ts +798 -0
  14. package/src/generated/models/accountAddPersonToAccountBody.ts +227 -0
  15. package/src/generated/models/accountCancelAccountBody.ts +227 -0
  16. package/src/generated/models/accountCancelationAllOf.ts +2 -0
  17. package/src/generated/models/accountExtendTrialBody.ts +227 -0
  18. package/src/generated/models/accountStage.ts +2 -1
  19. package/src/generated/models/accountUpdateAccountBody.ts +227 -0
  20. package/src/generated/models/accountUpdateMembershipBody.ts +227 -0
  21. package/src/generated/models/activityAddCustomActivityBody.ts +227 -0
  22. package/src/generated/models/activityGetAllParams.ts +241 -0
  23. package/src/generated/models/articleGetAllArticlesParams.ts +228 -0
  24. package/src/generated/models/backGroundTaskType.ts +3 -1
  25. package/src/generated/models/broadcastCampaignAllOf.ts +4 -0
  26. package/src/generated/models/broadcastCampaignStatus.ts +2 -1
  27. package/src/generated/models/campaignAddBroadcastEmailBody.ts +227 -0
  28. package/src/generated/models/campaignSendTestCampaignEmailBody.ts +227 -0
  29. package/src/generated/models/campaignUpdateBroadcastEmailBody.ts +227 -0
  30. package/src/generated/models/cancelationStatus.ts +236 -0
  31. package/src/generated/models/caseAddCaseBody.ts +227 -0
  32. package/src/generated/models/caseAddCaseParams.ts +229 -0
  33. package/src/generated/models/crmSettingsAllOf.ts +2 -0
  34. package/src/generated/models/dealAddDealBody.ts +227 -0
  35. package/src/generated/models/dealGetAllDealsParams.ts +234 -0
  36. package/src/generated/models/dealUpdateDealBody.ts +227 -0
  37. package/src/generated/models/discountCouponAddDiscountCouponBody.ts +227 -0
  38. package/src/generated/models/dnsEntry.ts +2 -0
  39. package/src/generated/models/emailListAddSubscriptionBody.ts +227 -0
  40. package/src/generated/models/emailListGetAllSubscriptionsParams.ts +229 -0
  41. package/src/generated/models/extendSubscriptionOptions.ts +225 -0
  42. package/src/generated/models/index.ts +40 -0
  43. package/src/generated/models/invoiceAddInvoiceBody.ts +227 -0
  44. package/src/generated/models/invoiceAllOf.ts +8 -0
  45. package/src/generated/models/messageAllOf.ts +1 -0
  46. package/src/generated/models/paymentInformationSavePaymentInformationBody.ts +227 -0
  47. package/src/generated/models/personAddPersonBody.ts +227 -0
  48. package/src/generated/models/personAllOf.ts +3 -3
  49. package/src/generated/models/personForgotPasswordBody.ts +227 -0
  50. package/src/generated/models/personGetAllPeopleParams.ts +229 -0
  51. package/src/generated/models/personSetTemporaryPasswordBody.ts +227 -0
  52. package/src/generated/models/personUpdatePersonBody.ts +227 -0
  53. package/src/generated/models/qcountConfigSettingType.ts +3 -1
  54. package/src/generated/models/resendEmailsRequest.ts +226 -0
  55. package/src/generated/models/sendGridDomainAuthenticationAllOf.ts +1 -0
  56. package/src/generated/models/setupIntent.ts +2 -0
  57. package/src/generated/models/stripeCreditNoteAllOf.ts +9 -0
  58. package/src/generated/models/stripeInvoiceAllOf.ts +9 -0
  59. package/src/generated/models/stripePriceAllOf.ts +2 -0
  60. package/src/generated/models/stripeProductAllOf.ts +5 -0
  61. package/src/generated/models/stripeSubscriptionAllOf.ts +4 -0
  62. package/src/generated/models/subscriptionAddOnAddSubscriptionAddOnBody.ts +227 -0
  63. package/src/generated/models/subscriptionChangeSubscriptionBody.ts +227 -0
  64. package/src/generated/models/subscriptionChangeSubscriptionParams.ts +229 -0
  65. package/src/generated/models/subscriptionChangeSubscriptionPreviewBody.ts +227 -0
  66. package/src/generated/models/subscriptionChangeSubscriptionPreviewParams.ts +229 -0
  67. package/src/generated/models/subscriptionFirstTimeSubscriptionBody.ts +227 -0
  68. package/src/generated/models/subscriptionFirstTimeSubscriptionPreviewBody.ts +227 -0
  69. package/src/generated/models/subscriptionFirstTimeSubscriptionPreviewParams.ts +229 -0
  70. package/src/generated/models/subscriptionSetSubscriptionUpgradeRequiredBody.ts +227 -0
  71. package/src/generated/models/transactionsAddPaymentTransactionBody.ts +227 -0
  72. package/src/generated/models/usageAddUsageBody.ts +227 -0
  73. package/src/generated/support/support.ts +341 -1
  74. package/src/index.ts +7 -1
  75. package/src/generated/zod.ts +0 -191087
@@ -0,0 +1,798 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * Generated by orval v7.21.0 🍺
4
+ * Do not edit manually.
5
+ * Outseta API
6
+ * # Outseta REST API
7
+
8
+ The Outseta REST API enables you to perform a variety of powerful tasks such as creating and updating people, accounts, subscriptions, and invoices. Outseta uses standard HTTP protocols within a compliant architecture that is simple to integrate. You can use the API both on the client or the server side; see the authentication section below for each scenario.
9
+
10
+ **Base URL:** `https://{your-domain}.outseta.com/api/v1/`
11
+
12
+ ## API Guidelines
13
+
14
+ 1. The API will only respond to secured communication done over **HTTPS**. HTTP requests will be sent a `301` redirect to the corresponding HTTPS resource.
15
+ 2. Responses are sent in **JSON** format. In case the API request results in an error, it is represented by an `"error": {}` key in the JSON response.
16
+ 3. The request method (verb) determines the nature of the action: **GET** fetches data, **POST** creates new records, **PUT** updates existing records.
17
+ 4. The API responds with appropriate **HTTP status codes** for all requests.
18
+ 5. Use `donotlog=1` as a query parameter on any API call where you don't want the action to be logged in the activity log.
19
+
20
+ ## Authentication
21
+
22
+ All API requests require authentication via one of two methods:
23
+
24
+ ### Server-Side (API Keys)
25
+
26
+ Use API keys for server-to-server integrations. Create keys at **Settings > Integrations > API Keys**. Make sure to record the secret key when you create it.
27
+
28
+ ```
29
+ Authorization: Outseta {api_key}:{api_secret}
30
+ ```
31
+
32
+ **Example:**
33
+ ```
34
+ Authorization: Outseta ce08fd5a-e1ee-4472-9c5f-b7575d8369b2:74fc1d2242a4eb7336d34b0e40cfbc5f
35
+ ```
36
+
37
+ > **Warning:** Never expose API keys in client-side code. The API key and secret combined give full access to all data in your account.
38
+
39
+ ### Client-Side (Bearer Token)
40
+
41
+ Do **not** use API keys on the client side — they can be easily copied. Instead, obtain a JWT access token by calling the `POST /tokens` endpoint from the server side with your credentials, then use it on the client:
42
+
43
+ ```
44
+ Authorization: bearer {access_token}
45
+ ```
46
+
47
+ Tokens are JWTs containing claims such as `PersonUid`, `AccountUid`, and subscription details. Tokens expire after approximately one year.
48
+
49
+ Verify tokens server-side using Outseta's [JWKS endpoint](https://{your-domain}.outseta.com/.well-known/jwks.json).
50
+
51
+ ## Field Selection
52
+
53
+ When you make an API request, you'll automatically get all the basic information from the main object and its immediate child objects. Referenced objects beyond the first level are returned as `null`.
54
+
55
+ Change this behavior using the `fields` query parameter:
56
+
57
+ - **Go deeper** — Request fields lower down in the object tree: `?fields=CurrentSubscription.Plan.*`
58
+ - **Go lighter** — Request only the essentials for faster performance: `?fields=Uid,Name`
59
+ - **Combination** — `?fields=Uid,Name,CurrentSubscription.Plan.Uid`
60
+ - **Wildcard** — Use `*` to get all fields in an object: `?fields=*` or `?fields=CurrentSubscription.Plan.*`
61
+
62
+ > **Tip:** When expanding nested paths, include `*` and intermediate path segments (e.g., `PersonAccount.*`) to preserve root-level and intermediate fields.
63
+
64
+ **Examples:**
65
+
66
+ ```
67
+ # Get the current subscription plan UID for an account
68
+ GET /crm/accounts/{uid}?fields=CurrentSubscription.Plan.Uid
69
+
70
+ # Get the account UID and plan UID for a list of accounts
71
+ GET /crm/accounts?fields=Uid,CurrentSubscription.Plan.Uid
72
+
73
+ # Get the full plan object for an account's current subscription
74
+ GET /crm/accounts/{uid}?fields=CurrentSubscription.Plan.*
75
+
76
+ # Get a person with their account and subscription info
77
+ GET /crm/people/{uid}?fields=Uid,PersonAccount.Account.CurrentSubscription.Plan.Uid
78
+ ```
79
+
80
+ If your request includes fields from a child object you will be limited to retrieving **25 items** per page. The maximum for requests not expanding child object fields is **100 items**.
81
+
82
+ ## Pagination
83
+
84
+ List endpoints return paginated results with a `metadata` object and an `items` array:
85
+
86
+ ```json
87
+ {
88
+ "metadata": {
89
+ "limit": 25,
90
+ "offset": 0,
91
+ "total": 142
92
+ },
93
+ "items": [ ... ]
94
+ }
95
+ ```
96
+
97
+ | Parameter | Type | Default | Description |
98
+ |-----------|------|---------|-------------|
99
+ | `offset` | integer | `0` | Page number (zero-based) |
100
+ | `limit` | integer | `25` | Maximum number of records per page |
101
+
102
+ **Examples:**
103
+ ```
104
+ ?offset=0&limit=20 # returns results 1-20
105
+ ?offset=1&limit=20 # returns results 21-40
106
+ ```
107
+
108
+ ## Sorting
109
+
110
+ Sort results using the `orderBy` parameter with a property name and direction:
111
+
112
+ ```
113
+ ?orderBy=PropertyName+DESC
114
+ ```
115
+
116
+ ## Filtering
117
+
118
+ Filter results by passing entity properties as query parameters.
119
+
120
+ ### Basic Filtering
121
+
122
+ Filter on any field using the field name as a query parameter:
123
+
124
+ ```
125
+ GET /crm/people?Email=john@example.com
126
+ GET /crm/accounts?AccountStage=2
127
+ ```
128
+
129
+ ### Wildcard Matching
130
+
131
+ | Pattern | Match Type | Example |
132
+ |---------|-----------|---------|
133
+ | `*value` | Ends with | `?Email=*@example.com` |
134
+ | `value*` | Starts with | `?Name=Acme*` |
135
+ | `*value*` | Contains | `?Name=*corp*` |
136
+
137
+ ### Comparison Operators
138
+
139
+ For advanced filtering, append comparison operators to field names:
140
+
141
+ | Operator | Description | Example |
142
+ |----------|-------------|---------|
143
+ | `__gt` | Greater than | `Created__gt=2024-01-01` |
144
+ | `__gte` | Greater than or equal | `Amount__gte=100` |
145
+ | `__lt` | Less than | `Created__lt=2024-12-31` |
146
+ | `__lte` | Less than or equal | `Amount__lte=500` |
147
+ | `__ne` | Not equal | `Status__ne=Active` |
148
+ | `__isnull` | Is null (true/false) | `ProfileImageS3Url__isnull=true` |
149
+
150
+ **Examples:**
151
+
152
+ ```
153
+ # Date filtering
154
+ GET /crm/accounts?Created__gt=2024-01-01
155
+ GET /billing/subscriptions?EndDate__lt=2024-08-01
156
+
157
+ # Numeric filtering
158
+ GET /billing/invoices?Amount__gte=1000
159
+
160
+ # Null value filtering
161
+ GET /crm/people?ProfileImageS3Url__isnull=true
162
+
163
+ # Multiple filters combined with field selection
164
+ GET /billing/subscriptions?StartDate__gte=2024-01-01&Rate__lt=100&DiscountCode__isnull=false&fields=Uid,Amount,StartDate,DiscountCode,Plan.Name
165
+ ```
166
+
167
+ ## Account Billing Stages
168
+
169
+ Account stages reflect the financial standing of each account and are not directly editable — they change automatically based on subscription activity.
170
+
171
+ | Value | Stage | Description |
172
+ |-------|-------|-------------|
173
+ | `2` | Trialing | Currently on a free trial or free plan |
174
+ | `3` | Subscribing | Active paid subscription (contributes to MRR) |
175
+ | `4` | Canceling | Customer has indicated intent to cancel |
176
+ | `5` | Expired | Subscription has ended after cancellation |
177
+ | `6` | Trial Expired | Free trial ended without conversion to paid |
178
+
179
+ Filter by stage: `GET /crm/accounts?AccountStage=3` returns all actively subscribing accounts.
180
+
181
+ ## Webhooks
182
+
183
+ Use **Activity Notifications** to receive real-time callbacks when events occur in Outseta. Configure webhooks at **Settings > Notifications**.
184
+
185
+ Common events include:
186
+ - `Person Created` / `Person Updated`
187
+ - `Account Created` / `Account Updated`
188
+ - `Subscription Created` / `Subscription Updated`
189
+
190
+ Always verify webhook signatures using the SHA256 secret provided in the Outseta dashboard.
191
+
192
+ ## Error Responses
193
+
194
+ | Status Code | Description |
195
+ |-------------|-------------|
196
+ | `200` | Success |
197
+ | `301` | Redirect — HTTP requests are redirected to HTTPS |
198
+ | `400` | Bad request — invalid parameters or Uid format |
199
+ | `401` | Unauthorized — missing or invalid authentication |
200
+ | `404` | Entity not found |
201
+ | `4XX` / `5XX` | Client or server error |
202
+
203
+ Validation errors return a JSON body with `ErrorMessage` and `PropertyName` fields:
204
+
205
+ ```json
206
+ {
207
+ "ErrorMessage": "Invalid company email",
208
+ "PropertyName": "Email"
209
+ }
210
+ ```
211
+
212
+ ## Rate Limits
213
+
214
+ Requests authorized by an API Key should not exceed **4 requests/second**.
215
+
216
+ ## Support
217
+
218
+ For help regarding the Outseta API please email [support@outseta.com](mailto:support@outseta.com).
219
+
220
+ * OpenAPI spec version: v1
221
+ */
222
+ import type {
223
+ BroadcastCampaign,
224
+ CampaignAddBroadcastEmailBody,
225
+ CampaignSendTestCampaignEmailBody,
226
+ CampaignUpdateBroadcastEmailBody,
227
+ EmailListAddSubscriptionBody,
228
+ EmailListGetAllSubscriptionsParams,
229
+ EmailListPerson
230
+ } from '.././models';
231
+
232
+ import { customFetch } from '../../client';
233
+
234
+ /**
235
+ * @summary Retrieves all non-archived broadcast campaigns.
236
+ */
237
+ export type campaignGetAllBroadcastEmailsResponse200 = {
238
+ data: BroadcastCampaign[]
239
+ status: 200
240
+ }
241
+
242
+ export type campaignGetAllBroadcastEmailsResponse401 = {
243
+ data: void
244
+ status: 401
245
+ }
246
+
247
+ export type campaignGetAllBroadcastEmailsResponseSuccess = (campaignGetAllBroadcastEmailsResponse200) & {
248
+ headers: Headers;
249
+ };
250
+ export type campaignGetAllBroadcastEmailsResponseError = (campaignGetAllBroadcastEmailsResponse401) & {
251
+ headers: Headers;
252
+ };
253
+
254
+ export type campaignGetAllBroadcastEmailsResponse = (campaignGetAllBroadcastEmailsResponseSuccess | campaignGetAllBroadcastEmailsResponseError)
255
+
256
+ export const getCampaignGetAllBroadcastEmailsUrl = () => {
257
+
258
+
259
+
260
+
261
+ return `/api/v1/email/campaigns/broadcasts`
262
+ }
263
+
264
+ export const campaignGetAllBroadcastEmails = async ( options?: RequestInit): Promise<campaignGetAllBroadcastEmailsResponse> => {
265
+
266
+ return customFetch<campaignGetAllBroadcastEmailsResponse>(getCampaignGetAllBroadcastEmailsUrl(),
267
+ {
268
+ ...options,
269
+ method: 'GET'
270
+
271
+
272
+ }
273
+ );}
274
+
275
+
276
+ /**
277
+ * @summary Creates a new broadcast campaign. To copy an existing broadcast, retrieve it and pass its
278
+ data as the request body — the Uid, SendDateTime, and message counts are automatically reset.
279
+ Recipients can be specified using EmailListUids and SegmentUids instead of populating
280
+ RecipientData directly. If both are provided, they are merged.
281
+ */
282
+ export type campaignAddBroadcastEmailResponse200 = {
283
+ data: BroadcastCampaign
284
+ status: 200
285
+ }
286
+
287
+ export type campaignAddBroadcastEmailResponse401 = {
288
+ data: void
289
+ status: 401
290
+ }
291
+
292
+ export type campaignAddBroadcastEmailResponseSuccess = (campaignAddBroadcastEmailResponse200) & {
293
+ headers: Headers;
294
+ };
295
+ export type campaignAddBroadcastEmailResponseError = (campaignAddBroadcastEmailResponse401) & {
296
+ headers: Headers;
297
+ };
298
+
299
+ export type campaignAddBroadcastEmailResponse = (campaignAddBroadcastEmailResponseSuccess | campaignAddBroadcastEmailResponseError)
300
+
301
+ export const getCampaignAddBroadcastEmailUrl = () => {
302
+
303
+
304
+
305
+
306
+ return `/api/v1/email/campaigns/broadcasts`
307
+ }
308
+
309
+ export const campaignAddBroadcastEmail = async (campaignAddBroadcastEmailBody: CampaignAddBroadcastEmailBody, options?: RequestInit): Promise<campaignAddBroadcastEmailResponse> => {
310
+
311
+ return customFetch<campaignAddBroadcastEmailResponse>(getCampaignAddBroadcastEmailUrl(),
312
+ {
313
+ ...options,
314
+ method: 'POST',
315
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
316
+ body: JSON.stringify(
317
+ campaignAddBroadcastEmailBody,)
318
+ }
319
+ );}
320
+
321
+
322
+ /**
323
+ * @summary Retrieves a single broadcast campaign by its Uid.
324
+ */
325
+ export type campaignGetBroadcastEmailResponse200 = {
326
+ data: BroadcastCampaign
327
+ status: 200
328
+ }
329
+
330
+ export type campaignGetBroadcastEmailResponse400 = {
331
+ data: void
332
+ status: 400
333
+ }
334
+
335
+ export type campaignGetBroadcastEmailResponse401 = {
336
+ data: void
337
+ status: 401
338
+ }
339
+
340
+ export type campaignGetBroadcastEmailResponse404 = {
341
+ data: void
342
+ status: 404
343
+ }
344
+
345
+ export type campaignGetBroadcastEmailResponseSuccess = (campaignGetBroadcastEmailResponse200) & {
346
+ headers: Headers;
347
+ };
348
+ export type campaignGetBroadcastEmailResponseError = (campaignGetBroadcastEmailResponse400 | campaignGetBroadcastEmailResponse401 | campaignGetBroadcastEmailResponse404) & {
349
+ headers: Headers;
350
+ };
351
+
352
+ export type campaignGetBroadcastEmailResponse = (campaignGetBroadcastEmailResponseSuccess | campaignGetBroadcastEmailResponseError)
353
+
354
+ export const getCampaignGetBroadcastEmailUrl = (broadcastCampaignUid: string | null,) => {
355
+
356
+
357
+
358
+
359
+ return `/api/v1/email/campaigns/broadcasts/${broadcastCampaignUid}`
360
+ }
361
+
362
+ export const campaignGetBroadcastEmail = async (broadcastCampaignUid: string | null, options?: RequestInit): Promise<campaignGetBroadcastEmailResponse> => {
363
+
364
+ return customFetch<campaignGetBroadcastEmailResponse>(getCampaignGetBroadcastEmailUrl(broadcastCampaignUid),
365
+ {
366
+ ...options,
367
+ method: 'GET'
368
+
369
+
370
+ }
371
+ );}
372
+
373
+
374
+ /**
375
+ * @summary Updates a broadcast campaign. Setting SendDateTime to a future date schedules the broadcast
376
+ for sending and its status changes to Pending. Clearing SendDateTime unschedules the broadcast.
377
+ Recipients can be specified using EmailListUids and SegmentUids instead of populating
378
+ RecipientData directly. If both are provided, they are merged.
379
+ */
380
+ export type campaignUpdateBroadcastEmailResponse200 = {
381
+ data: BroadcastCampaign
382
+ status: 200
383
+ }
384
+
385
+ export type campaignUpdateBroadcastEmailResponse400 = {
386
+ data: void
387
+ status: 400
388
+ }
389
+
390
+ export type campaignUpdateBroadcastEmailResponse401 = {
391
+ data: void
392
+ status: 401
393
+ }
394
+
395
+ export type campaignUpdateBroadcastEmailResponse404 = {
396
+ data: void
397
+ status: 404
398
+ }
399
+
400
+ export type campaignUpdateBroadcastEmailResponseSuccess = (campaignUpdateBroadcastEmailResponse200) & {
401
+ headers: Headers;
402
+ };
403
+ export type campaignUpdateBroadcastEmailResponseError = (campaignUpdateBroadcastEmailResponse400 | campaignUpdateBroadcastEmailResponse401 | campaignUpdateBroadcastEmailResponse404) & {
404
+ headers: Headers;
405
+ };
406
+
407
+ export type campaignUpdateBroadcastEmailResponse = (campaignUpdateBroadcastEmailResponseSuccess | campaignUpdateBroadcastEmailResponseError)
408
+
409
+ export const getCampaignUpdateBroadcastEmailUrl = (broadcastCampaignUid: string | null,) => {
410
+
411
+
412
+
413
+
414
+ return `/api/v1/email/campaigns/broadcasts/${broadcastCampaignUid}`
415
+ }
416
+
417
+ export const campaignUpdateBroadcastEmail = async (broadcastCampaignUid: string | null,
418
+ campaignUpdateBroadcastEmailBody: CampaignUpdateBroadcastEmailBody, options?: RequestInit): Promise<campaignUpdateBroadcastEmailResponse> => {
419
+
420
+ return customFetch<campaignUpdateBroadcastEmailResponse>(getCampaignUpdateBroadcastEmailUrl(broadcastCampaignUid),
421
+ {
422
+ ...options,
423
+ method: 'PUT',
424
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
425
+ body: JSON.stringify(
426
+ campaignUpdateBroadcastEmailBody,)
427
+ }
428
+ );}
429
+
430
+
431
+ /**
432
+ * @summary Deletes a broadcast campaign. Only campaigns in Draft or Pending status can be deleted.
433
+ Campaigns that have been processed should be archived instead.
434
+ */
435
+ export type campaignDeleteBroadcastCampaignResponse200 = {
436
+ data: Blob
437
+ status: 200
438
+ }
439
+
440
+ export type campaignDeleteBroadcastCampaignResponse400 = {
441
+ data: void
442
+ status: 400
443
+ }
444
+
445
+ export type campaignDeleteBroadcastCampaignResponse401 = {
446
+ data: void
447
+ status: 401
448
+ }
449
+
450
+ export type campaignDeleteBroadcastCampaignResponse404 = {
451
+ data: void
452
+ status: 404
453
+ }
454
+
455
+ export type campaignDeleteBroadcastCampaignResponseSuccess = (campaignDeleteBroadcastCampaignResponse200) & {
456
+ headers: Headers;
457
+ };
458
+ export type campaignDeleteBroadcastCampaignResponseError = (campaignDeleteBroadcastCampaignResponse400 | campaignDeleteBroadcastCampaignResponse401 | campaignDeleteBroadcastCampaignResponse404) & {
459
+ headers: Headers;
460
+ };
461
+
462
+ export type campaignDeleteBroadcastCampaignResponse = (campaignDeleteBroadcastCampaignResponseSuccess | campaignDeleteBroadcastCampaignResponseError)
463
+
464
+ export const getCampaignDeleteBroadcastCampaignUrl = (broadcastCampaignUid: string | null,) => {
465
+
466
+
467
+
468
+
469
+ return `/api/v1/email/campaigns/broadcasts/${broadcastCampaignUid}`
470
+ }
471
+
472
+ export const campaignDeleteBroadcastCampaign = async (broadcastCampaignUid: string | null, options?: RequestInit): Promise<campaignDeleteBroadcastCampaignResponse> => {
473
+
474
+ return customFetch<campaignDeleteBroadcastCampaignResponse>(getCampaignDeleteBroadcastCampaignUrl(broadcastCampaignUid),
475
+ {
476
+ ...options,
477
+ method: 'DELETE'
478
+
479
+
480
+ }
481
+ );}
482
+
483
+
484
+ /**
485
+ * @summary Unschedules a pending broadcast campaign, reverting its status to Draft.
486
+ */
487
+ export type campaignUnscheduleBroadcastEmailResponse200 = {
488
+ data: BroadcastCampaign
489
+ status: 200
490
+ }
491
+
492
+ export type campaignUnscheduleBroadcastEmailResponse400 = {
493
+ data: void
494
+ status: 400
495
+ }
496
+
497
+ export type campaignUnscheduleBroadcastEmailResponse401 = {
498
+ data: void
499
+ status: 401
500
+ }
501
+
502
+ export type campaignUnscheduleBroadcastEmailResponse404 = {
503
+ data: void
504
+ status: 404
505
+ }
506
+
507
+ export type campaignUnscheduleBroadcastEmailResponseSuccess = (campaignUnscheduleBroadcastEmailResponse200) & {
508
+ headers: Headers;
509
+ };
510
+ export type campaignUnscheduleBroadcastEmailResponseError = (campaignUnscheduleBroadcastEmailResponse400 | campaignUnscheduleBroadcastEmailResponse401 | campaignUnscheduleBroadcastEmailResponse404) & {
511
+ headers: Headers;
512
+ };
513
+
514
+ export type campaignUnscheduleBroadcastEmailResponse = (campaignUnscheduleBroadcastEmailResponseSuccess | campaignUnscheduleBroadcastEmailResponseError)
515
+
516
+ export const getCampaignUnscheduleBroadcastEmailUrl = (broadcastCampaignUid: string | null,) => {
517
+
518
+
519
+
520
+
521
+ return `/api/v1/email/campaigns/broadcasts/${broadcastCampaignUid}/unschedule`
522
+ }
523
+
524
+ export const campaignUnscheduleBroadcastEmail = async (broadcastCampaignUid: string | null, options?: RequestInit): Promise<campaignUnscheduleBroadcastEmailResponse> => {
525
+
526
+ return customFetch<campaignUnscheduleBroadcastEmailResponse>(getCampaignUnscheduleBroadcastEmailUrl(broadcastCampaignUid),
527
+ {
528
+ ...options,
529
+ method: 'POST'
530
+
531
+
532
+ }
533
+ );}
534
+
535
+
536
+ /**
537
+ * @summary Archives a broadcast campaign. Archived campaigns are excluded from the default list results.
538
+ */
539
+ export type campaignArchiveBroadcastCampaignResponse200 = {
540
+ data: Blob
541
+ status: 200
542
+ }
543
+
544
+ export type campaignArchiveBroadcastCampaignResponse400 = {
545
+ data: void
546
+ status: 400
547
+ }
548
+
549
+ export type campaignArchiveBroadcastCampaignResponse401 = {
550
+ data: void
551
+ status: 401
552
+ }
553
+
554
+ export type campaignArchiveBroadcastCampaignResponse404 = {
555
+ data: void
556
+ status: 404
557
+ }
558
+
559
+ export type campaignArchiveBroadcastCampaignResponseSuccess = (campaignArchiveBroadcastCampaignResponse200) & {
560
+ headers: Headers;
561
+ };
562
+ export type campaignArchiveBroadcastCampaignResponseError = (campaignArchiveBroadcastCampaignResponse400 | campaignArchiveBroadcastCampaignResponse401 | campaignArchiveBroadcastCampaignResponse404) & {
563
+ headers: Headers;
564
+ };
565
+
566
+ export type campaignArchiveBroadcastCampaignResponse = (campaignArchiveBroadcastCampaignResponseSuccess | campaignArchiveBroadcastCampaignResponseError)
567
+
568
+ export const getCampaignArchiveBroadcastCampaignUrl = (broadcastCampaignUid: string | null,) => {
569
+
570
+
571
+
572
+
573
+ return `/api/v1/email/campaigns/broadcasts/${broadcastCampaignUid}/archive`
574
+ }
575
+
576
+ export const campaignArchiveBroadcastCampaign = async (broadcastCampaignUid: string | null, options?: RequestInit): Promise<campaignArchiveBroadcastCampaignResponse> => {
577
+
578
+ return customFetch<campaignArchiveBroadcastCampaignResponse>(getCampaignArchiveBroadcastCampaignUrl(broadcastCampaignUid),
579
+ {
580
+ ...options,
581
+ method: 'POST'
582
+
583
+
584
+ }
585
+ );}
586
+
587
+
588
+ /**
589
+ * @summary Sends a test email for a broadcast campaign to the logged-in user and optionally to additional
590
+ recipients. Additional recipients are specified as a list of person Uids and must belong to the
591
+ same account as the logged-in user.
592
+ */
593
+ export type campaignSendTestCampaignEmailResponse200 = {
594
+ data: Blob
595
+ status: 200
596
+ }
597
+
598
+ export type campaignSendTestCampaignEmailResponse401 = {
599
+ data: void
600
+ status: 401
601
+ }
602
+
603
+ export type campaignSendTestCampaignEmailResponseSuccess = (campaignSendTestCampaignEmailResponse200) & {
604
+ headers: Headers;
605
+ };
606
+ export type campaignSendTestCampaignEmailResponseError = (campaignSendTestCampaignEmailResponse401) & {
607
+ headers: Headers;
608
+ };
609
+
610
+ export type campaignSendTestCampaignEmailResponse = (campaignSendTestCampaignEmailResponseSuccess | campaignSendTestCampaignEmailResponseError)
611
+
612
+ export const getCampaignSendTestCampaignEmailUrl = () => {
613
+
614
+
615
+
616
+
617
+ return `/api/v1/email/campaigns/broadcasts/sendtestemail`
618
+ }
619
+
620
+ export const campaignSendTestCampaignEmail = async (campaignSendTestCampaignEmailBody: CampaignSendTestCampaignEmailBody, options?: RequestInit): Promise<campaignSendTestCampaignEmailResponse> => {
621
+
622
+ return customFetch<campaignSendTestCampaignEmailResponse>(getCampaignSendTestCampaignEmailUrl(),
623
+ {
624
+ ...options,
625
+ method: 'POST',
626
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
627
+ body: JSON.stringify(
628
+ campaignSendTestCampaignEmailBody,)
629
+ }
630
+ );}
631
+
632
+
633
+ /**
634
+ * @summary Retrieves all the people subscribing to an email list.
635
+ */
636
+ export type emailListGetAllSubscriptionsResponse200 = {
637
+ data: EmailListPerson[]
638
+ status: 200
639
+ }
640
+
641
+ export type emailListGetAllSubscriptionsResponse400 = {
642
+ data: void
643
+ status: 400
644
+ }
645
+
646
+ export type emailListGetAllSubscriptionsResponse401 = {
647
+ data: void
648
+ status: 401
649
+ }
650
+
651
+ export type emailListGetAllSubscriptionsResponseSuccess = (emailListGetAllSubscriptionsResponse200) & {
652
+ headers: Headers;
653
+ };
654
+ export type emailListGetAllSubscriptionsResponseError = (emailListGetAllSubscriptionsResponse400 | emailListGetAllSubscriptionsResponse401) & {
655
+ headers: Headers;
656
+ };
657
+
658
+ export type emailListGetAllSubscriptionsResponse = (emailListGetAllSubscriptionsResponseSuccess | emailListGetAllSubscriptionsResponseError)
659
+
660
+ export const getEmailListGetAllSubscriptionsUrl = (emailListUid: string | null,
661
+ params?: EmailListGetAllSubscriptionsParams,) => {
662
+ const normalizedParams = new URLSearchParams();
663
+
664
+ Object.entries(params || {}).forEach(([key, value]) => {
665
+
666
+ if (value !== undefined) {
667
+ normalizedParams.append(key, value === null ? 'null' : value.toString())
668
+ }
669
+ });
670
+
671
+ const stringifiedParams = normalizedParams.toString();
672
+
673
+ return stringifiedParams.length > 0 ? `/api/v1/email/lists/${emailListUid}/subscriptions?${stringifiedParams}` : `/api/v1/email/lists/${emailListUid}/subscriptions`
674
+ }
675
+
676
+ export const emailListGetAllSubscriptions = async (emailListUid: string | null,
677
+ params?: EmailListGetAllSubscriptionsParams, options?: RequestInit): Promise<emailListGetAllSubscriptionsResponse> => {
678
+
679
+ return customFetch<emailListGetAllSubscriptionsResponse>(getEmailListGetAllSubscriptionsUrl(emailListUid,params),
680
+ {
681
+ ...options,
682
+ method: 'GET'
683
+
684
+
685
+ }
686
+ );}
687
+
688
+
689
+ /**
690
+ * @summary Subscribe a person to an email list. To subscribe a new person, pass a Person object with an
691
+ Email address. To subscribe an existing person, pass a Person object with a Uid. The
692
+ SendWelcomeEmail property determines if the person is sent a welcome email and defaults to false.
693
+ */
694
+ export type emailListAddSubscriptionResponse200 = {
695
+ data: EmailListPerson
696
+ status: 200
697
+ }
698
+
699
+ export type emailListAddSubscriptionResponse400 = {
700
+ data: void
701
+ status: 400
702
+ }
703
+
704
+ export type emailListAddSubscriptionResponse401 = {
705
+ data: void
706
+ status: 401
707
+ }
708
+
709
+ export type emailListAddSubscriptionResponse404 = {
710
+ data: void
711
+ status: 404
712
+ }
713
+
714
+ export type emailListAddSubscriptionResponseSuccess = (emailListAddSubscriptionResponse200) & {
715
+ headers: Headers;
716
+ };
717
+ export type emailListAddSubscriptionResponseError = (emailListAddSubscriptionResponse400 | emailListAddSubscriptionResponse401 | emailListAddSubscriptionResponse404) & {
718
+ headers: Headers;
719
+ };
720
+
721
+ export type emailListAddSubscriptionResponse = (emailListAddSubscriptionResponseSuccess | emailListAddSubscriptionResponseError)
722
+
723
+ export const getEmailListAddSubscriptionUrl = (emailListUid: string | null,) => {
724
+
725
+
726
+
727
+
728
+ return `/api/v1/email/lists/${emailListUid}/subscriptions`
729
+ }
730
+
731
+ export const emailListAddSubscription = async (emailListUid: string | null,
732
+ emailListAddSubscriptionBody: EmailListAddSubscriptionBody, options?: RequestInit): Promise<emailListAddSubscriptionResponse> => {
733
+
734
+ return customFetch<emailListAddSubscriptionResponse>(getEmailListAddSubscriptionUrl(emailListUid),
735
+ {
736
+ ...options,
737
+ method: 'POST',
738
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
739
+ body: JSON.stringify(
740
+ emailListAddSubscriptionBody,)
741
+ }
742
+ );}
743
+
744
+
745
+ /**
746
+ * @summary Remove a subscriber from an email list.
747
+ */
748
+ export type emailListDeleteSubscriptionResponse200 = {
749
+ data: Blob
750
+ status: 200
751
+ }
752
+
753
+ export type emailListDeleteSubscriptionResponse400 = {
754
+ data: void
755
+ status: 400
756
+ }
757
+
758
+ export type emailListDeleteSubscriptionResponse401 = {
759
+ data: void
760
+ status: 401
761
+ }
762
+
763
+ export type emailListDeleteSubscriptionResponse404 = {
764
+ data: void
765
+ status: 404
766
+ }
767
+
768
+ export type emailListDeleteSubscriptionResponseSuccess = (emailListDeleteSubscriptionResponse200) & {
769
+ headers: Headers;
770
+ };
771
+ export type emailListDeleteSubscriptionResponseError = (emailListDeleteSubscriptionResponse400 | emailListDeleteSubscriptionResponse401 | emailListDeleteSubscriptionResponse404) & {
772
+ headers: Headers;
773
+ };
774
+
775
+ export type emailListDeleteSubscriptionResponse = (emailListDeleteSubscriptionResponseSuccess | emailListDeleteSubscriptionResponseError)
776
+
777
+ export const getEmailListDeleteSubscriptionUrl = (emailListUid: string | null,
778
+ subscriptionUid: string | null,) => {
779
+
780
+
781
+
782
+
783
+ return `/api/v1/email/lists/${emailListUid}/subscriptions/${subscriptionUid}`
784
+ }
785
+
786
+ export const emailListDeleteSubscription = async (emailListUid: string | null,
787
+ subscriptionUid: string | null, options?: RequestInit): Promise<emailListDeleteSubscriptionResponse> => {
788
+
789
+ return customFetch<emailListDeleteSubscriptionResponse>(getEmailListDeleteSubscriptionUrl(emailListUid,subscriptionUid),
790
+ {
791
+ ...options,
792
+ method: 'DELETE'
793
+
794
+
795
+ }
796
+ );}
797
+
798
+