@outseta/api-client 0.3.1 → 0.3.3
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 +4 -2
- package/package.json +1 -1
- package/src/generated/activity/activity.ts +28 -1
- package/src/generated/billing/billing.ts +39 -12
- package/src/generated/crm/crm.ts +42 -14
- package/src/generated/email/email.ts +30 -3
- package/src/generated/models/abstractBean.ts +2 -2
- package/src/generated/models/authRefreshTokenParams.ts +8 -0
- package/src/generated/models/index.ts +1 -0
- package/src/generated/models/sendGridDomainAuthenticationAllOf.ts +21 -0
- package/src/generated/models/tokenPayload.ts +2 -0
- package/src/generated/public/public.ts +63 -3
- package/src/generated/support/support.ts +28 -1
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
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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),
|
package/src/generated/crm/crm.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
544
|
+
emailListAddSubscriptionBody: NonReadonly<EmailListAddSubscriptionBody>, options?: RequestInit): Promise<emailListAddSubscriptionResponse> => {
|
|
518
545
|
|
|
519
546
|
return customFetch<emailListAddSubscriptionResponse>(getEmailListAddSubscriptionUrl(emailListUid),
|
|
520
547
|
{
|
|
@@ -100,6 +100,7 @@ export * from './articleAllOf';
|
|
|
100
100
|
export * from './articleAllOfCategory';
|
|
101
101
|
export * from './articleGetAllArticlesParams';
|
|
102
102
|
export * from './authGetTokenParams';
|
|
103
|
+
export * from './authRefreshTokenParams';
|
|
103
104
|
export * from './authResendTwoFactorParams';
|
|
104
105
|
export * from './authSwitchTwoFactorMechanismParams';
|
|
105
106
|
export * from './authVerifyTwoFactorRecoveryParams';
|
|
@@ -7,10 +7,31 @@ 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 */
|
|
15
34
|
DnsEntries?: DnsEntry[] | null;
|
|
35
|
+
/** @nullable */
|
|
36
|
+
LegacyDnsEntries?: DnsEntry[] | null;
|
|
16
37
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import type {
|
|
3
3
|
AuthGetTokenParams,
|
|
4
|
+
AuthRefreshTokenParams,
|
|
4
5
|
AuthResendTwoFactorParams,
|
|
5
6
|
AuthSwitchTwoFactorMechanismParams,
|
|
6
7
|
AuthVerifyTwoFactorRecoveryParams,
|
|
@@ -22,9 +23,9 @@ import { customFetch } from '../../client';
|
|
|
22
23
|
|
|
23
24
|
{ "username": "user@example.com", "password": "their-password" }
|
|
24
25
|
|
|
25
|
-
On success the response is `200` with an access token:
|
|
26
|
+
On success the response is `200` with an access token and refresh token:
|
|
26
27
|
|
|
27
|
-
{ "access_token": "eyJ...", "token_type": "Bearer", "expires_in": 31536000 }
|
|
28
|
+
{ "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
|
|
28
29
|
|
|
29
30
|
**Two-factor authentication.** If the user has a verified 2FA method,
|
|
30
31
|
the password alone is not enough. After verifying the password this
|
|
@@ -117,7 +118,7 @@ authenticator app):
|
|
|
117
118
|
On success the response is `200` with the final access token, in the
|
|
118
119
|
same shape as `POST /api/v1/tokens`:
|
|
119
120
|
|
|
120
|
-
{ "access_token": "eyJ...", "token_type": "Bearer", "expires_in": 31536000 }
|
|
121
|
+
{ "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
|
|
121
122
|
|
|
122
123
|
An incorrect code returns `400` (`invalid_grant`). A code has at most
|
|
123
124
|
five attempts before the challenge locks. An expired challenge returns
|
|
@@ -373,6 +374,65 @@ export const authVerifyTwoFactorRecovery = async (params: AuthVerifyTwoFactorRec
|
|
|
373
374
|
);}
|
|
374
375
|
|
|
375
376
|
|
|
377
|
+
/**
|
|
378
|
+
* Post the refresh token returned from `POST /api/v1/tokens` or the
|
|
379
|
+
two-factor completion endpoints:
|
|
380
|
+
|
|
381
|
+
{ "refresh_token": "..." }
|
|
382
|
+
|
|
383
|
+
On success the response is `200` with a new access token and refresh token:
|
|
384
|
+
|
|
385
|
+
{ "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
|
|
386
|
+
|
|
387
|
+
An invalid or expired refresh token returns `400` with a body of `invalid_grant`.
|
|
388
|
+
* @summary Exchange a refresh token for a new access token.
|
|
389
|
+
*/
|
|
390
|
+
export type authRefreshTokenResponse200 = {
|
|
391
|
+
data: TokenPayload
|
|
392
|
+
status: 200
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export type authRefreshTokenResponse400 = {
|
|
396
|
+
data: string
|
|
397
|
+
status: 400
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export type authRefreshTokenResponseSuccess = (authRefreshTokenResponse200) & {
|
|
401
|
+
headers: Headers;
|
|
402
|
+
};
|
|
403
|
+
export type authRefreshTokenResponseError = (authRefreshTokenResponse400) & {
|
|
404
|
+
headers: Headers;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
export type authRefreshTokenResponse = (authRefreshTokenResponseSuccess | authRefreshTokenResponseError)
|
|
408
|
+
|
|
409
|
+
export const getAuthRefreshTokenUrl = (params: AuthRefreshTokenParams,) => {
|
|
410
|
+
const normalizedParams = new URLSearchParams();
|
|
411
|
+
|
|
412
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
413
|
+
|
|
414
|
+
if (value !== undefined) {
|
|
415
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
const stringifiedParams = normalizedParams.toString();
|
|
420
|
+
|
|
421
|
+
return stringifiedParams.length > 0 ? `/api/v1/tokens/refresh-token?${stringifiedParams}` : `/api/v1/tokens/refresh-token`
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export const authRefreshToken = async (params: AuthRefreshTokenParams, options?: RequestInit): Promise<authRefreshTokenResponse> => {
|
|
425
|
+
|
|
426
|
+
return customFetch<authRefreshTokenResponse>(getAuthRefreshTokenUrl(params),
|
|
427
|
+
{
|
|
428
|
+
...options,
|
|
429
|
+
method: 'POST'
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
}
|
|
433
|
+
);}
|
|
434
|
+
|
|
435
|
+
|
|
376
436
|
/**
|
|
377
437
|
* Call this when `POST /api/v1/tokens` returned
|
|
378
438
|
`two_factor_enrollment_required` and the user chooses email. Post the
|
|
@@ -12,6 +12,33 @@ import type {
|
|
|
12
12
|
|
|
13
13
|
import { customFetch } from '../../client';
|
|
14
14
|
|
|
15
|
+
// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
|
|
16
|
+
type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <
|
|
17
|
+
T,
|
|
18
|
+
>() => T extends Y ? 1 : 2
|
|
19
|
+
? A
|
|
20
|
+
: B;
|
|
21
|
+
|
|
22
|
+
type WritableKeys<T> = {
|
|
23
|
+
[P in keyof T]-?: IfEquals<
|
|
24
|
+
{ [Q in P]: T[P] },
|
|
25
|
+
{ -readonly [Q in P]: T[P] },
|
|
26
|
+
P
|
|
27
|
+
>;
|
|
28
|
+
}[keyof T];
|
|
29
|
+
|
|
30
|
+
type UnionToIntersection<U> =
|
|
31
|
+
(U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;
|
|
32
|
+
type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;
|
|
33
|
+
|
|
34
|
+
type Writable<T> = Pick<T, WritableKeys<T>>;
|
|
35
|
+
type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
|
|
36
|
+
[P in keyof Writable<T>]: T[P] extends object
|
|
37
|
+
? NonReadonly<NonNullable<T[P]>>
|
|
38
|
+
: T[P];
|
|
39
|
+
} : DistributeReadOnlyOverUnions<T>;
|
|
40
|
+
|
|
41
|
+
|
|
15
42
|
/**
|
|
16
43
|
* Assigned cases can be filtered by passing in the AssignedToPersonClientIdentifier,
|
|
17
44
|
which is the Uid of the person the case is assigned to.
|
|
@@ -105,7 +132,7 @@ export const getCaseAddCaseUrl = (params?: CaseAddCaseParams,) => {
|
|
|
105
132
|
return stringifiedParams.length > 0 ? `/api/v1/support/cases?${stringifiedParams}` : `/api/v1/support/cases`
|
|
106
133
|
}
|
|
107
134
|
|
|
108
|
-
export const caseAddCase = async (caseAddCaseBody: CaseAddCaseBody
|
|
135
|
+
export const caseAddCase = async (caseAddCaseBody: NonReadonly<CaseAddCaseBody>,
|
|
109
136
|
params?: CaseAddCaseParams, options?: RequestInit): Promise<caseAddCaseResponse> => {
|
|
110
137
|
|
|
111
138
|
return customFetch<caseAddCaseResponse>(getCaseAddCaseUrl(params),
|