@outseta/api-client 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -382,10 +382,12 @@ var dealDeleteDeal = async (dealUid, options) => {
382
382
  var getRegistrationRegisterAccountUrl = () => {
383
383
  return `/api/v1/crm/registrations`;
384
384
  };
385
- var registrationRegisterAccount = async (options) => {
385
+ var registrationRegisterAccount = async (account, options) => {
386
386
  return customFetch(getRegistrationRegisterAccountUrl(), {
387
387
  ...options,
388
- method: "POST"
388
+ method: "POST",
389
+ headers: { "Content-Type": "application/json", ...options?.headers },
390
+ body: JSON.stringify(account)
389
391
  });
390
392
  };
391
393
  var getAccountGetAllAccountsUrl = (params) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outseta/api-client",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Generated API client for the Outseta REST API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -7,6 +7,33 @@ import type {
7
7
 
8
8
  import { customFetch } from '../../client';
9
9
 
10
+ // https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
11
+ type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <
12
+ T,
13
+ >() => T extends Y ? 1 : 2
14
+ ? A
15
+ : B;
16
+
17
+ type WritableKeys<T> = {
18
+ [P in keyof T]-?: IfEquals<
19
+ { [Q in P]: T[P] },
20
+ { -readonly [Q in P]: T[P] },
21
+ P
22
+ >;
23
+ }[keyof T];
24
+
25
+ type UnionToIntersection<U> =
26
+ (U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;
27
+ type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;
28
+
29
+ type Writable<T> = Pick<T, WritableKeys<T>>;
30
+ type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
31
+ [P in keyof Writable<T>]: T[P] extends object
32
+ ? NonReadonly<NonNullable<T[P]>>
33
+ : T[P];
34
+ } : DistributeReadOnlyOverUnions<T>;
35
+
36
+
10
37
  /**
11
38
  * One or multiple parameters can be defined to filter the results.
12
39
  ActivityType=[100,101] where ActivityUpdated = 100 and AcccountUpdated = 101.
@@ -103,7 +130,7 @@ export const getActivityAddCustomActivityUrl = () => {
103
130
  return `/api/v1/activities/customactivity`
104
131
  }
105
132
 
106
- export const activityAddCustomActivity = async (activityAddCustomActivityBody: ActivityAddCustomActivityBody, options?: RequestInit): Promise<activityAddCustomActivityResponse> => {
133
+ export const activityAddCustomActivity = async (activityAddCustomActivityBody: NonReadonly<ActivityAddCustomActivityBody>, options?: RequestInit): Promise<activityAddCustomActivityResponse> => {
107
134
 
108
135
  return customFetch<activityAddCustomActivityResponse>(getActivityAddCustomActivityUrl(),
109
136
  {
@@ -27,6 +27,33 @@ import type {
27
27
 
28
28
  import { customFetch } from '../../client';
29
29
 
30
+ // https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
31
+ type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <
32
+ T,
33
+ >() => T extends Y ? 1 : 2
34
+ ? A
35
+ : B;
36
+
37
+ type WritableKeys<T> = {
38
+ [P in keyof T]-?: IfEquals<
39
+ { [Q in P]: T[P] },
40
+ { -readonly [Q in P]: T[P] },
41
+ P
42
+ >;
43
+ }[keyof T];
44
+
45
+ type UnionToIntersection<U> =
46
+ (U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;
47
+ type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;
48
+
49
+ type Writable<T> = Pick<T, WritableKeys<T>>;
50
+ type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
51
+ [P in keyof Writable<T>]: T[P] extends object
52
+ ? NonReadonly<NonNullable<T[P]>>
53
+ : T[P];
54
+ } : DistributeReadOnlyOverUnions<T>;
55
+
56
+
30
57
  /**
31
58
  * Only one of AmountOff or PercentOff should be set.
32
59
  Duration values: 1 = Forever, 2 = Once, 3 = Repeating (DurationInMonths must be set).
@@ -59,7 +86,7 @@ export const getDiscountCouponAddDiscountCouponUrl = () => {
59
86
  return `/api/v1/billing/discountcoupons`
60
87
  }
61
88
 
62
- export const discountCouponAddDiscountCoupon = async (discountCouponAddDiscountCouponBody: DiscountCouponAddDiscountCouponBody, options?: RequestInit): Promise<discountCouponAddDiscountCouponResponse> => {
89
+ export const discountCouponAddDiscountCoupon = async (discountCouponAddDiscountCouponBody: NonReadonly<DiscountCouponAddDiscountCouponBody>, options?: RequestInit): Promise<discountCouponAddDiscountCouponResponse> => {
63
90
 
64
91
  return customFetch<discountCouponAddDiscountCouponResponse>(getDiscountCouponAddDiscountCouponUrl(),
65
92
  {
@@ -102,7 +129,7 @@ export const getUsageAddUsageUrl = () => {
102
129
  return `/api/v1/billing/usage`
103
130
  }
104
131
 
105
- export const usageAddUsage = async (usageAddUsageBody: UsageAddUsageBody, options?: RequestInit): Promise<usageAddUsageResponse> => {
132
+ export const usageAddUsage = async (usageAddUsageBody: NonReadonly<UsageAddUsageBody>, options?: RequestInit): Promise<usageAddUsageResponse> => {
106
133
 
107
134
  return customFetch<usageAddUsageResponse>(getUsageAddUsageUrl(),
108
135
  {
@@ -196,7 +223,7 @@ export const getTransactionsAddPaymentTransactionUrl = () => {
196
223
  return `/api/v1/billing/transactions/payment`
197
224
  }
198
225
 
199
- export const transactionsAddPaymentTransaction = async (transactionsAddPaymentTransactionBody: TransactionsAddPaymentTransactionBody, options?: RequestInit): Promise<transactionsAddPaymentTransactionResponse> => {
226
+ export const transactionsAddPaymentTransaction = async (transactionsAddPaymentTransactionBody: NonReadonly<TransactionsAddPaymentTransactionBody>, options?: RequestInit): Promise<transactionsAddPaymentTransactionResponse> => {
200
227
 
201
228
  return customFetch<transactionsAddPaymentTransactionResponse>(getTransactionsAddPaymentTransactionUrl(),
202
229
  {
@@ -239,7 +266,7 @@ export const getPaymentInformationSavePaymentInformationUrl = () => {
239
266
  return `/api/v1/billing/paymentinformation`
240
267
  }
241
268
 
242
- export const paymentInformationSavePaymentInformation = async (paymentInformationSavePaymentInformationBody: PaymentInformationSavePaymentInformationBody, options?: RequestInit): Promise<paymentInformationSavePaymentInformationResponse> => {
269
+ export const paymentInformationSavePaymentInformation = async (paymentInformationSavePaymentInformationBody: NonReadonly<PaymentInformationSavePaymentInformationBody>, options?: RequestInit): Promise<paymentInformationSavePaymentInformationResponse> => {
243
270
 
244
271
  return customFetch<paymentInformationSavePaymentInformationResponse>(getPaymentInformationSavePaymentInformationUrl(),
245
272
  {
@@ -282,7 +309,7 @@ export const getSubscriptionAddOnAddSubscriptionAddOnUrl = () => {
282
309
  return `/api/v1/billing/subscriptionaddons`
283
310
  }
284
311
 
285
- export const subscriptionAddOnAddSubscriptionAddOn = async (subscriptionAddOnAddSubscriptionAddOnBody: SubscriptionAddOnAddSubscriptionAddOnBody, options?: RequestInit): Promise<subscriptionAddOnAddSubscriptionAddOnResponse> => {
312
+ export const subscriptionAddOnAddSubscriptionAddOn = async (subscriptionAddOnAddSubscriptionAddOnBody: NonReadonly<SubscriptionAddOnAddSubscriptionAddOnBody>, options?: RequestInit): Promise<subscriptionAddOnAddSubscriptionAddOnResponse> => {
286
313
 
287
314
  return customFetch<subscriptionAddOnAddSubscriptionAddOnResponse>(getSubscriptionAddOnAddSubscriptionAddOnUrl(),
288
315
  {
@@ -370,7 +397,7 @@ export const getInvoiceAddInvoiceUrl = () => {
370
397
  return `/api/v1/billing/invoices`
371
398
  }
372
399
 
373
- export const invoiceAddInvoice = async (invoiceAddInvoiceBody: InvoiceAddInvoiceBody, options?: RequestInit): Promise<invoiceAddInvoiceResponse> => {
400
+ export const invoiceAddInvoice = async (invoiceAddInvoiceBody: NonReadonly<InvoiceAddInvoiceBody>, options?: RequestInit): Promise<invoiceAddInvoiceResponse> => {
374
401
 
375
402
  return customFetch<invoiceAddInvoiceResponse>(getInvoiceAddInvoiceUrl(),
376
403
  {
@@ -479,7 +506,7 @@ export const getInvoiceUpdateInvoiceUrl = (invoiceUid: string | null,) => {
479
506
  }
480
507
 
481
508
  export const invoiceUpdateInvoice = async (invoiceUid: string | null,
482
- invoiceUpdateInvoiceBody: InvoiceUpdateInvoiceBody, options?: RequestInit): Promise<invoiceUpdateInvoiceResponse> => {
509
+ invoiceUpdateInvoiceBody: NonReadonly<InvoiceUpdateInvoiceBody>, options?: RequestInit): Promise<invoiceUpdateInvoiceResponse> => {
483
510
 
484
511
  return customFetch<invoiceUpdateInvoiceResponse>(getInvoiceUpdateInvoiceUrl(invoiceUid),
485
512
  {
@@ -855,7 +882,7 @@ export const getSubscriptionSetSubscriptionUpgradeRequiredUrl = (subscriptionUid
855
882
  }
856
883
 
857
884
  export const subscriptionSetSubscriptionUpgradeRequired = async (subscriptionUid: string | null,
858
- subscriptionSetSubscriptionUpgradeRequiredBody: SubscriptionSetSubscriptionUpgradeRequiredBody, options?: RequestInit): Promise<subscriptionSetSubscriptionUpgradeRequiredResponse> => {
885
+ subscriptionSetSubscriptionUpgradeRequiredBody: NonReadonly<SubscriptionSetSubscriptionUpgradeRequiredBody>, options?: RequestInit): Promise<subscriptionSetSubscriptionUpgradeRequiredResponse> => {
859
886
 
860
887
  return customFetch<subscriptionSetSubscriptionUpgradeRequiredResponse>(getSubscriptionSetSubscriptionUpgradeRequiredUrl(subscriptionUid),
861
888
  {
@@ -902,7 +929,7 @@ export const getSubscriptionFirstTimeSubscriptionPreviewUrl = (params?: Subscrip
902
929
  return stringifiedParams.length > 0 ? `/api/v1/billing/subscriptions/compute-charge-summary?${stringifiedParams}` : `/api/v1/billing/subscriptions/compute-charge-summary`
903
930
  }
904
931
 
905
- export const subscriptionFirstTimeSubscriptionPreview = async (subscriptionFirstTimeSubscriptionPreviewBody: SubscriptionFirstTimeSubscriptionPreviewBody,
932
+ export const subscriptionFirstTimeSubscriptionPreview = async (subscriptionFirstTimeSubscriptionPreviewBody: NonReadonly<SubscriptionFirstTimeSubscriptionPreviewBody>,
906
933
  params?: SubscriptionFirstTimeSubscriptionPreviewParams, options?: RequestInit): Promise<subscriptionFirstTimeSubscriptionPreviewResponse> => {
907
934
 
908
935
  return customFetch<subscriptionFirstTimeSubscriptionPreviewResponse>(getSubscriptionFirstTimeSubscriptionPreviewUrl(params),
@@ -947,7 +974,7 @@ export const getSubscriptionFirstTimeSubscriptionUrl = () => {
947
974
  return `/api/v1/billing/subscriptions/firsttimesubscription`
948
975
  }
949
976
 
950
- export const subscriptionFirstTimeSubscription = async (subscriptionFirstTimeSubscriptionBody: SubscriptionFirstTimeSubscriptionBody, options?: RequestInit): Promise<subscriptionFirstTimeSubscriptionResponse> => {
977
+ export const subscriptionFirstTimeSubscription = async (subscriptionFirstTimeSubscriptionBody: NonReadonly<SubscriptionFirstTimeSubscriptionBody>, options?: RequestInit): Promise<subscriptionFirstTimeSubscriptionResponse> => {
951
978
 
952
979
  return customFetch<subscriptionFirstTimeSubscriptionResponse>(getSubscriptionFirstTimeSubscriptionUrl(),
953
980
  {
@@ -1011,7 +1038,7 @@ export const getSubscriptionChangeSubscriptionPreviewUrl = (subscriptionUid: str
1011
1038
  }
1012
1039
 
1013
1040
  export const subscriptionChangeSubscriptionPreview = async (subscriptionUid: string | null,
1014
- subscriptionChangeSubscriptionPreviewBody: SubscriptionChangeSubscriptionPreviewBody,
1041
+ subscriptionChangeSubscriptionPreviewBody: NonReadonly<SubscriptionChangeSubscriptionPreviewBody>,
1015
1042
  params?: SubscriptionChangeSubscriptionPreviewParams, options?: RequestInit): Promise<subscriptionChangeSubscriptionPreviewResponse> => {
1016
1043
 
1017
1044
  return customFetch<subscriptionChangeSubscriptionPreviewResponse>(getSubscriptionChangeSubscriptionPreviewUrl(subscriptionUid,params),
@@ -1075,7 +1102,7 @@ export const getSubscriptionChangeSubscriptionUrl = (subscriptionUid: string | n
1075
1102
  }
1076
1103
 
1077
1104
  export const subscriptionChangeSubscription = async (subscriptionUid: string | null,
1078
- subscriptionChangeSubscriptionBody: SubscriptionChangeSubscriptionBody,
1105
+ subscriptionChangeSubscriptionBody: NonReadonly<SubscriptionChangeSubscriptionBody>,
1079
1106
  params?: SubscriptionChangeSubscriptionParams, options?: RequestInit): Promise<subscriptionChangeSubscriptionResponse> => {
1080
1107
 
1081
1108
  return customFetch<subscriptionChangeSubscriptionResponse>(getSubscriptionChangeSubscriptionUrl(subscriptionUid,params),
@@ -24,6 +24,33 @@ import type {
24
24
 
25
25
  import { customFetch } from '../../client';
26
26
 
27
+ // https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
28
+ type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <
29
+ T,
30
+ >() => T extends Y ? 1 : 2
31
+ ? A
32
+ : B;
33
+
34
+ type WritableKeys<T> = {
35
+ [P in keyof T]-?: IfEquals<
36
+ { [Q in P]: T[P] },
37
+ { -readonly [Q in P]: T[P] },
38
+ P
39
+ >;
40
+ }[keyof T];
41
+
42
+ type UnionToIntersection<U> =
43
+ (U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;
44
+ type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;
45
+
46
+ type Writable<T> = Pick<T, WritableKeys<T>>;
47
+ type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
48
+ [P in keyof Writable<T>]: T[P] extends object
49
+ ? NonReadonly<NonNullable<T[P]>>
50
+ : T[P];
51
+ } : DistributeReadOnlyOverUnions<T>;
52
+
53
+
27
54
  /**
28
55
  * @summary Retrieves all the deals associated with your account.
29
56
  */
@@ -108,7 +135,7 @@ export const getDealAddDealUrl = () => {
108
135
  return `/api/v1/crm/deals`
109
136
  }
110
137
 
111
- export const dealAddDeal = async (dealAddDealBody: DealAddDealBody, options?: RequestInit): Promise<dealAddDealResponse> => {
138
+ export const dealAddDeal = async (dealAddDealBody: NonReadonly<DealAddDealBody>, options?: RequestInit): Promise<dealAddDealResponse> => {
112
139
 
113
140
  return customFetch<dealAddDealResponse>(getDealAddDealUrl(),
114
141
  {
@@ -214,7 +241,7 @@ export const getDealUpdateDealUrl = (dealUid: string | null,) => {
214
241
  }
215
242
 
216
243
  export const dealUpdateDeal = async (dealUid: string | null,
217
- dealUpdateDealBody: DealUpdateDealBody, options?: RequestInit): Promise<dealUpdateDealResponse> => {
244
+ dealUpdateDealBody: NonReadonly<DealUpdateDealBody>, options?: RequestInit): Promise<dealUpdateDealResponse> => {
218
245
 
219
246
  return customFetch<dealUpdateDealResponse>(getDealUpdateDealUrl(dealUid),
220
247
  {
@@ -308,14 +335,15 @@ export const getRegistrationRegisterAccountUrl = () => {
308
335
  return `/api/v1/crm/registrations`
309
336
  }
310
337
 
311
- export const registrationRegisterAccount = async ( options?: RequestInit): Promise<registrationRegisterAccountResponse> => {
338
+ export const registrationRegisterAccount = async (account: NonReadonly<Account>, options?: RequestInit): Promise<registrationRegisterAccountResponse> => {
312
339
 
313
340
  return customFetch<registrationRegisterAccountResponse>(getRegistrationRegisterAccountUrl(),
314
341
  {
315
342
  ...options,
316
- method: 'POST'
317
-
318
-
343
+ method: 'POST',
344
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
345
+ body: JSON.stringify(
346
+ account,)
319
347
  }
320
348
  );}
321
349
 
@@ -413,7 +441,7 @@ export const getAccountAddAccountUrl = (params?: AccountAddAccountParams,) => {
413
441
  return stringifiedParams.length > 0 ? `/api/v1/crm/accounts?${stringifiedParams}` : `/api/v1/crm/accounts`
414
442
  }
415
443
 
416
- export const accountAddAccount = async (accountAddAccountBody: AccountAddAccountBody,
444
+ export const accountAddAccount = async (accountAddAccountBody: NonReadonly<AccountAddAccountBody>,
417
445
  params?: AccountAddAccountParams, options?: RequestInit): Promise<accountAddAccountResponse> => {
418
446
 
419
447
  return customFetch<accountAddAccountResponse>(getAccountAddAccountUrl(params),
@@ -575,7 +603,7 @@ export const getAccountUpdateAccountUrl = (accountUid: string | null,) => {
575
603
  }
576
604
 
577
605
  export const accountUpdateAccount = async (accountUid: string | null,
578
- accountUpdateAccountBody: AccountUpdateAccountBody, options?: RequestInit): Promise<accountUpdateAccountResponse> => {
606
+ accountUpdateAccountBody: NonReadonly<AccountUpdateAccountBody>, options?: RequestInit): Promise<accountUpdateAccountResponse> => {
579
607
 
580
608
  return customFetch<accountUpdateAccountResponse>(getAccountUpdateAccountUrl(accountUid),
581
609
  {
@@ -629,7 +657,7 @@ export const getAccountAddPersonToAccountUrl = (accountUid: string | null,) => {
629
657
  }
630
658
 
631
659
  export const accountAddPersonToAccount = async (accountUid: string | null,
632
- accountAddPersonToAccountBody: AccountAddPersonToAccountBody, options?: RequestInit): Promise<accountAddPersonToAccountResponse> => {
660
+ accountAddPersonToAccountBody: NonReadonly<AccountAddPersonToAccountBody>, options?: RequestInit): Promise<accountAddPersonToAccountResponse> => {
633
661
 
634
662
  return customFetch<accountAddPersonToAccountResponse>(getAccountAddPersonToAccountUrl(accountUid),
635
663
  {
@@ -685,7 +713,7 @@ export const getAccountUpdateMembershipUrl = (accountUid: string | null,
685
713
 
686
714
  export const accountUpdateMembership = async (accountUid: string | null,
687
715
  membershipUid: string | null,
688
- accountUpdateMembershipBody: AccountUpdateMembershipBody, options?: RequestInit): Promise<accountUpdateMembershipResponse> => {
716
+ accountUpdateMembershipBody: NonReadonly<AccountUpdateMembershipBody>, options?: RequestInit): Promise<accountUpdateMembershipResponse> => {
689
717
 
690
718
  return customFetch<accountUpdateMembershipResponse>(getAccountUpdateMembershipUrl(accountUid,membershipUid),
691
719
  {
@@ -796,7 +824,7 @@ export const getAccountCancelAccountUrl = (accountUid: string | null,) => {
796
824
  }
797
825
 
798
826
  export const accountCancelAccount = async (accountUid: string | null,
799
- accountCancelAccountBody: AccountCancelAccountBody, options?: RequestInit): Promise<accountCancelAccountResponse> => {
827
+ accountCancelAccountBody: NonReadonly<AccountCancelAccountBody>, options?: RequestInit): Promise<accountCancelAccountResponse> => {
800
828
 
801
829
  return customFetch<accountCancelAccountResponse>(getAccountCancelAccountUrl(accountUid),
802
830
  {
@@ -1049,7 +1077,7 @@ export const getPersonAddPersonUrl = () => {
1049
1077
  return `/api/v1/crm/people`
1050
1078
  }
1051
1079
 
1052
- export const personAddPerson = async (personAddPersonBody: PersonAddPersonBody, options?: RequestInit): Promise<personAddPersonResponse> => {
1080
+ export const personAddPerson = async (personAddPersonBody: NonReadonly<PersonAddPersonBody>, options?: RequestInit): Promise<personAddPersonResponse> => {
1053
1081
 
1054
1082
  return customFetch<personAddPersonResponse>(getPersonAddPersonUrl(),
1055
1083
  {
@@ -1158,7 +1186,7 @@ export const getPersonUpdatePersonUrl = (personUid: string | null,) => {
1158
1186
  }
1159
1187
 
1160
1188
  export const personUpdatePerson = async (personUid: string | null,
1161
- personUpdatePersonBody: PersonUpdatePersonBody, options?: RequestInit): Promise<personUpdatePersonResponse> => {
1189
+ personUpdatePersonBody: NonReadonly<PersonUpdatePersonBody>, options?: RequestInit): Promise<personUpdatePersonResponse> => {
1162
1190
 
1163
1191
  return customFetch<personUpdatePersonResponse>(getPersonUpdatePersonUrl(personUid),
1164
1192
  {
@@ -1358,7 +1386,7 @@ export const getPersonForgotPasswordUrl = () => {
1358
1386
  return `/api/v1/crm/people/forgotPassword`
1359
1387
  }
1360
1388
 
1361
- export const personForgotPassword = async (personForgotPasswordBody: PersonForgotPasswordBody, options?: RequestInit): Promise<personForgotPasswordResponse> => {
1389
+ export const personForgotPassword = async (personForgotPasswordBody: NonReadonly<PersonForgotPasswordBody>, options?: RequestInit): Promise<personForgotPasswordResponse> => {
1362
1390
 
1363
1391
  return customFetch<personForgotPasswordResponse>(getPersonForgotPasswordUrl(),
1364
1392
  {
@@ -11,6 +11,33 @@ import type {
11
11
 
12
12
  import { customFetch } from '../../client';
13
13
 
14
+ // https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
15
+ type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <
16
+ T,
17
+ >() => T extends Y ? 1 : 2
18
+ ? A
19
+ : B;
20
+
21
+ type WritableKeys<T> = {
22
+ [P in keyof T]-?: IfEquals<
23
+ { [Q in P]: T[P] },
24
+ { -readonly [Q in P]: T[P] },
25
+ P
26
+ >;
27
+ }[keyof T];
28
+
29
+ type UnionToIntersection<U> =
30
+ (U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;
31
+ type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;
32
+
33
+ type Writable<T> = Pick<T, WritableKeys<T>>;
34
+ type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
35
+ [P in keyof Writable<T>]: T[P] extends object
36
+ ? NonReadonly<NonNullable<T[P]>>
37
+ : T[P];
38
+ } : DistributeReadOnlyOverUnions<T>;
39
+
40
+
14
41
  /**
15
42
  * @summary Retrieves all non-archived broadcast campaigns.
16
43
  */
@@ -87,7 +114,7 @@ export const getCampaignAddBroadcastEmailUrl = () => {
87
114
  return `/api/v1/email/campaigns/broadcasts`
88
115
  }
89
116
 
90
- export const campaignAddBroadcastEmail = async (campaignAddBroadcastEmailBody: CampaignAddBroadcastEmailBody, options?: RequestInit): Promise<campaignAddBroadcastEmailResponse> => {
117
+ export const campaignAddBroadcastEmail = async (campaignAddBroadcastEmailBody: NonReadonly<CampaignAddBroadcastEmailBody>, options?: RequestInit): Promise<campaignAddBroadcastEmailResponse> => {
91
118
 
92
119
  return customFetch<campaignAddBroadcastEmailResponse>(getCampaignAddBroadcastEmailUrl(),
93
120
  {
@@ -197,7 +224,7 @@ export const getCampaignUpdateBroadcastEmailUrl = (broadcastCampaignUid: string
197
224
  }
198
225
 
199
226
  export const campaignUpdateBroadcastEmail = async (broadcastCampaignUid: string | null,
200
- campaignUpdateBroadcastEmailBody: CampaignUpdateBroadcastEmailBody, options?: RequestInit): Promise<campaignUpdateBroadcastEmailResponse> => {
227
+ campaignUpdateBroadcastEmailBody: NonReadonly<CampaignUpdateBroadcastEmailBody>, options?: RequestInit): Promise<campaignUpdateBroadcastEmailResponse> => {
201
228
 
202
229
  return customFetch<campaignUpdateBroadcastEmailResponse>(getCampaignUpdateBroadcastEmailUrl(broadcastCampaignUid),
203
230
  {
@@ -514,7 +541,7 @@ export const getEmailListAddSubscriptionUrl = (emailListUid: string | null,) =>
514
541
  }
515
542
 
516
543
  export const emailListAddSubscription = async (emailListUid: string | null,
517
- emailListAddSubscriptionBody: EmailListAddSubscriptionBody, options?: RequestInit): Promise<emailListAddSubscriptionResponse> => {
544
+ emailListAddSubscriptionBody: NonReadonly<EmailListAddSubscriptionBody>, options?: RequestInit): Promise<emailListAddSubscriptionResponse> => {
518
545
 
519
546
  return customFetch<emailListAddSubscriptionResponse>(getEmailListAddSubscriptionUrl(emailListUid),
520
547
  {
@@ -9,7 +9,7 @@ export interface AbstractBean {
9
9
  /** @nullable */
10
10
  _objectType?: string | null;
11
11
  /** @minLength 1 */
12
- Created: string;
12
+ readonly Created: string;
13
13
  /** @minLength 1 */
14
- Updated: string;
14
+ readonly Updated: string;
15
15
  }
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthGetTokenParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthResendTwoFactorParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthSwitchTwoFactorMechanismParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthVerifyTwoFactorRecoveryParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type AuthVerifyTwoFactorTokenParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -99,6 +99,11 @@ export * from './article';
99
99
  export * from './articleAllOf';
100
100
  export * from './articleAllOfCategory';
101
101
  export * from './articleGetAllArticlesParams';
102
+ export * from './authGetTokenParams';
103
+ export * from './authResendTwoFactorParams';
104
+ export * from './authSwitchTwoFactorMechanismParams';
105
+ export * from './authVerifyTwoFactorRecoveryParams';
106
+ export * from './authVerifyTwoFactorTokenParams';
102
107
  export * from './backGroundTaskType';
103
108
  export * from './billSettings';
104
109
  export * from './billSettingsAllOf';
@@ -464,6 +469,11 @@ export * from './taxRateAllOf';
464
469
  export * from './template';
465
470
  export * from './templateAllOf';
466
471
  export * from './temporaryPasswordModel';
472
+ export * from './tokenPayload';
473
+ export * from './tokenTwoFactorEnrollmentBeginEmailParams';
474
+ export * from './tokenTwoFactorEnrollmentBeginTotpParams';
475
+ export * from './tokenTwoFactorEnrollmentConfirmEmailParams';
476
+ export * from './tokenTwoFactorEnrollmentConfirmTotpParams';
467
477
  export * from './transaction';
468
478
  export * from './transactionAllOf';
469
479
  export * from './transactionAllOfAccount';
@@ -471,6 +481,9 @@ export * from './transactionAllOfInvoice';
471
481
  export * from './transactionsAddPaymentTransactionBody';
472
482
  export * from './translation';
473
483
  export * from './translationAllOf';
484
+ export * from './twoFactorChallengePayload';
485
+ export * from './twoFactorEnrollmentConfirmationPayload';
486
+ export * from './twoFactorTotpEnrollmentPayload';
474
487
  export * from './usage';
475
488
  export * from './usageAddUsageBody';
476
489
  export * from './usageAllOf';
@@ -7,8 +7,27 @@ export type SendGridDomainAuthenticationAllOf = {
7
7
  * @maxLength 250
8
8
  */
9
9
  DomainName: string;
10
+ /**
11
+ * @maxLength 100
12
+ * @nullable
13
+ */
14
+ SendGridSubuser?: string | null;
10
15
  IsValid?: boolean;
11
16
  IsBrandedLinksDisabled?: boolean;
17
+ IsLinkTrackingDnsValid?: boolean;
18
+ /**
19
+ * @maxLength 100
20
+ * @nullable
21
+ */
22
+ CloudflareCustomHostnameId?: string | null;
23
+ /**
24
+ * @maxLength 50
25
+ * @nullable
26
+ */
27
+ CloudflareSslStatus?: string | null;
28
+ /** @nullable */
29
+ CloudflareCustomHostnameCreatedAt?: string | null;
30
+ IsHttpsUpgradeAvailable?: boolean;
12
31
  /** @nullable */
13
32
  LastValidationAttempt?: string | null;
14
33
  /** @nullable */
@@ -0,0 +1,13 @@
1
+ // @ts-nocheck
2
+
3
+ export interface TokenPayload {
4
+ /** @nullable */
5
+ access_token?: string | null;
6
+ /** @nullable */
7
+ authentication_callback_url?: string | null;
8
+ expires_in?: number;
9
+ /** @nullable */
10
+ id_token?: string | null;
11
+ /** @nullable */
12
+ token_type?: string | null;
13
+ }
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type TokenTwoFactorEnrollmentBeginEmailParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type TokenTwoFactorEnrollmentBeginTotpParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type TokenTwoFactorEnrollmentConfirmEmailParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+
3
+ export type TokenTwoFactorEnrollmentConfirmTotpParams = {
4
+ /**
5
+ * @nullable
6
+ */
7
+ data: unknown | null;
8
+ };
@@ -0,0 +1,69 @@
1
+ // @ts-nocheck
2
+
3
+ /**
4
+ * Returned when a login cannot complete with a password alone because the
5
+ user has two-factor authentication enabled. Carries the opaque challenge
6
+ token that must be echoed back to POST /api/v1/tokens/two-factor
7
+ (or the recovery / resend / switch-mechanism endpoints) along with enough
8
+ metadata for a client to render the verification step without a second
9
+ round-trip. The property names are snake_case to match the wire format of
10
+ the other token endpoints (see TokenPayload).
11
+ */
12
+ export interface TwoFactorChallengePayload {
13
+ /**
14
+ * Present and true on the 202 response from POST /api/v1/tokens
15
+ when the user has at least one verified 2FA method. Absent on the
16
+ resend / switch-mechanism responses, which only ever follow an
17
+ already-issued login challenge.
18
+ * @nullable
19
+ */
20
+ two_factor_required?: boolean | null;
21
+ /**
22
+ * Present and true instead of two_factor_required
23
+ when the tenant forces 2FA but the user has not yet enrolled any
24
+ method. In that case only challenge_token and
25
+ expires_in are populated and the client must route the
26
+ user through the mid-login enrollment endpoints
27
+ (/api/v1/tokens/two-factor/enroll/...) before a token can be issued.
28
+ * @nullable
29
+ */
30
+ two_factor_enrollment_required?: boolean | null;
31
+ /**
32
+ * Short-lived signed JWT (audience outseta:2fa-challenge) that
33
+ identifies this challenge. Echo it back verbatim to complete the login.
34
+ * @nullable
35
+ */
36
+ challenge_token?: string | null;
37
+ /**
38
+ * The mechanism this challenge was issued against: Email or
39
+ Totp (authenticator app). For Email a code has already
40
+ been sent to the user; for Totp the user reads the current
41
+ code from their authenticator app and nothing is sent.
42
+ * @nullable
43
+ */
44
+ mechanism?: string | null;
45
+ /**
46
+ * A masked view of where an emailed code was sent (e.g. b***@outseta.com),
47
+ suitable for display. Empty when mechanism is Totp.
48
+ * @nullable
49
+ */
50
+ masked_destination?: string | null;
51
+ /** Seconds until the challenge expires (600). After this the
52
+ challenge_token can no longer be verified and the login must restart. */
53
+ expires_in?: number;
54
+ /**
55
+ * Every verified mechanism enrolled for this user (excluding recovery
56
+ codes), e.g. ["Totp", "Email"]. A client can offer a
57
+ "use a different method" option for any value other than the current
58
+ mechanism via POST /api/v1/tokens/two-factor/switch-mechanism.
59
+ * @nullable
60
+ */
61
+ available_mechanisms?: string[] | null;
62
+ /**
63
+ * true when the user has a batch of recovery codes on file, in
64
+ which case POST /api/v1/tokens/two-factor/recovery can be used
65
+ as a fallback if they cannot produce a primary code.
66
+ * @nullable
67
+ */
68
+ recovery_codes_available?: boolean | null;
69
+ }