shoal-web-sdk 1.0.112 → 1.0.114
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/sdk/billing/@tanstack/react-query.gen.d.ts +8 -1
- package/dist/sdk/billing/@tanstack/react-query.gen.js +20 -1
- package/dist/sdk/billing/sdk.gen.d.ts +8 -1
- package/dist/sdk/billing/sdk.gen.js +18 -0
- package/dist/sdk/billing/types.gen.d.ts +40 -0
- package/dist/sdk/billing/zod.gen.d.ts +7 -0
- package/dist/sdk/billing/zod.gen.js +7 -0
- package/dist/sdk/types.gen.d.ts +1 -1
- package/dist/sdk/zod.gen.d.ts +0 -14
- package/dist/sdk/zod.gen.js +0 -1
- package/dist/tanstack-codegen/generated/billing.d.ts +9 -1
- package/dist/tanstack-codegen/generated/billing.js +20 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UseMutationOptions } from '@tanstack/react-query';
|
|
2
2
|
import { type Options } from '../sdk.gen';
|
|
3
|
-
import type { CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, CreateSubscriptionData, CreateSubscriptionError, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, GetCustomerData, GetInvoicesData, GetPlansData, GetUsageData, M2mCreateCustomerData, M2mCreateCustomerError, M2mGetCustomerData, M2mUpdatePlanData, M2mUpdatePlanError, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodError, UpdateDefaultPaymentMethodResponse, UpdatePlanData, UpdatePlanError } from '../types.gen';
|
|
3
|
+
import type { CancelSubscriptionData, CancelSubscriptionError, CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, CreateSubscriptionData, CreateSubscriptionError, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, GetCustomerData, GetInvoicesData, GetPlansData, GetUsageData, M2mCreateCustomerData, M2mCreateCustomerError, M2mGetCustomerData, M2mUpdatePlanData, M2mUpdatePlanError, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodError, UpdateDefaultPaymentMethodResponse, UpdatePlanData, UpdatePlanError } from '../types.gen';
|
|
4
4
|
export type QueryKey<TOptions extends Options> = [
|
|
5
5
|
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
|
6
6
|
_id: string;
|
|
@@ -96,6 +96,13 @@ export declare const getPlansOptions: (options?: Options<GetPlansData>) => impor
|
|
|
96
96
|
* Returns a list of available pricing plans.
|
|
97
97
|
*/
|
|
98
98
|
export declare const updatePlanMutation: (options?: Partial<Options<UpdatePlanData>>) => UseMutationOptions<unknown, UpdatePlanError, Options<UpdatePlanData>>;
|
|
99
|
+
/**
|
|
100
|
+
* Cancels the account's subscription at the end of the current billing period.
|
|
101
|
+
*
|
|
102
|
+
* The subscription is resolved from the organisation's Stripe customer, so no subscription id is required. The customer keeps access until the current period ends, at which point the account is downgraded to the solo plan.
|
|
103
|
+
*
|
|
104
|
+
*/
|
|
105
|
+
export declare const cancelSubscriptionMutation: (options?: Partial<Options<CancelSubscriptionData>>) => UseMutationOptions<unknown, CancelSubscriptionError, Options<CancelSubscriptionData>>;
|
|
99
106
|
/**
|
|
100
107
|
* Starts a new subscription for a customer who no longer has one.
|
|
101
108
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
import { queryOptions } from '@tanstack/react-query';
|
|
3
3
|
import { client } from '../client.gen';
|
|
4
|
-
import { createSetupIntent, createSubscription, deletePaymentMethod, getCustomer, getInvoices, getPlans, getUsage, m2mCreateCustomer, m2mGetCustomer, m2mUpdatePlan, updateDefaultPaymentMethod, updatePlan } from '../sdk.gen';
|
|
4
|
+
import { cancelSubscription, createSetupIntent, createSubscription, deletePaymentMethod, getCustomer, getInvoices, getPlans, getUsage, m2mCreateCustomer, m2mGetCustomer, m2mUpdatePlan, updateDefaultPaymentMethod, updatePlan } from '../sdk.gen';
|
|
5
5
|
const createQueryKey = (id, options, infinite, tags) => {
|
|
6
6
|
const params = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl };
|
|
7
7
|
if (infinite) {
|
|
@@ -96,6 +96,25 @@ export const updatePlanMutation = (options) => {
|
|
|
96
96
|
};
|
|
97
97
|
return mutationOptions;
|
|
98
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Cancels the account's subscription at the end of the current billing period.
|
|
101
|
+
*
|
|
102
|
+
* The subscription is resolved from the organisation's Stripe customer, so no subscription id is required. The customer keeps access until the current period ends, at which point the account is downgraded to the solo plan.
|
|
103
|
+
*
|
|
104
|
+
*/
|
|
105
|
+
export const cancelSubscriptionMutation = (options) => {
|
|
106
|
+
const mutationOptions = {
|
|
107
|
+
mutationFn: async (fnOptions) => {
|
|
108
|
+
const { data } = await cancelSubscription({
|
|
109
|
+
...options,
|
|
110
|
+
...fnOptions,
|
|
111
|
+
throwOnError: true
|
|
112
|
+
});
|
|
113
|
+
return data;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
return mutationOptions;
|
|
117
|
+
};
|
|
99
118
|
/**
|
|
100
119
|
* Starts a new subscription for a customer who no longer has one.
|
|
101
120
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Client, Options as Options2, TDataShape } from './client';
|
|
2
|
-
import type { CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, CreateSubscriptionData, CreateSubscriptionErrors, CreateSubscriptionResponses, DeletePaymentMethodData, DeletePaymentMethodErrors, DeletePaymentMethodResponses, GetCustomerData, GetCustomerErrors, GetCustomerResponses, GetInvoicesData, GetInvoicesErrors, GetInvoicesResponses, GetPlansData, GetPlansErrors, GetPlansResponses, GetUsageData, GetUsageErrors, GetUsageResponses, M2mCreateCustomerData, M2mCreateCustomerErrors, M2mCreateCustomerResponses, M2mGetCustomerData, M2mGetCustomerErrors, M2mGetCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanErrors, M2mUpdatePlanResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodErrors, UpdateDefaultPaymentMethodResponses, UpdatePlanData, UpdatePlanErrors, UpdatePlanResponses } from './types.gen';
|
|
2
|
+
import type { CancelSubscriptionData, CancelSubscriptionErrors, CancelSubscriptionResponses, CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, CreateSubscriptionData, CreateSubscriptionErrors, CreateSubscriptionResponses, DeletePaymentMethodData, DeletePaymentMethodErrors, DeletePaymentMethodResponses, GetCustomerData, GetCustomerErrors, GetCustomerResponses, GetInvoicesData, GetInvoicesErrors, GetInvoicesResponses, GetPlansData, GetPlansErrors, GetPlansResponses, GetUsageData, GetUsageErrors, GetUsageResponses, M2mCreateCustomerData, M2mCreateCustomerErrors, M2mCreateCustomerResponses, M2mGetCustomerData, M2mGetCustomerErrors, M2mGetCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanErrors, M2mUpdatePlanResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodErrors, UpdateDefaultPaymentMethodResponses, UpdatePlanData, UpdatePlanErrors, UpdatePlanResponses } from './types.gen';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -29,6 +29,13 @@ export declare const getPlans: <ThrowOnError extends boolean = false>(options?:
|
|
|
29
29
|
* Returns a list of available pricing plans.
|
|
30
30
|
*/
|
|
31
31
|
export declare const updatePlan: <ThrowOnError extends boolean = false>(options: Options<UpdatePlanData, ThrowOnError>) => import("./client").RequestResult<UpdatePlanResponses, UpdatePlanErrors, ThrowOnError, "fields">;
|
|
32
|
+
/**
|
|
33
|
+
* Cancels the account's subscription at the end of the current billing period.
|
|
34
|
+
*
|
|
35
|
+
* The subscription is resolved from the organisation's Stripe customer, so no subscription id is required. The customer keeps access until the current period ends, at which point the account is downgraded to the solo plan.
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export declare const cancelSubscription: <ThrowOnError extends boolean = false>(options: Options<CancelSubscriptionData, ThrowOnError>) => import("./client").RequestResult<CancelSubscriptionResponses, CancelSubscriptionErrors, ThrowOnError, "fields">;
|
|
32
39
|
/**
|
|
33
40
|
* Starts a new subscription for a customer who no longer has one.
|
|
34
41
|
*
|
|
@@ -64,6 +64,24 @@ export const updatePlan = (options) => {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Cancels the account's subscription at the end of the current billing period.
|
|
69
|
+
*
|
|
70
|
+
* The subscription is resolved from the organisation's Stripe customer, so no subscription id is required. The customer keeps access until the current period ends, at which point the account is downgraded to the solo plan.
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
export const cancelSubscription = (options) => {
|
|
74
|
+
return (options.client ?? client).delete({
|
|
75
|
+
security: [
|
|
76
|
+
{
|
|
77
|
+
scheme: 'bearer',
|
|
78
|
+
type: 'http'
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
url: '/api/v1/subscription/{org}',
|
|
82
|
+
...options
|
|
83
|
+
});
|
|
84
|
+
};
|
|
67
85
|
/**
|
|
68
86
|
* Starts a new subscription for a customer who no longer has one.
|
|
69
87
|
*
|
|
@@ -384,6 +384,46 @@ export type UpdatePlanResponses = {
|
|
|
384
384
|
*/
|
|
385
385
|
202: unknown;
|
|
386
386
|
};
|
|
387
|
+
export type CancelSubscriptionData = {
|
|
388
|
+
body?: never;
|
|
389
|
+
path: {
|
|
390
|
+
/**
|
|
391
|
+
* Kinde organisation id.
|
|
392
|
+
*/
|
|
393
|
+
org: string;
|
|
394
|
+
};
|
|
395
|
+
query?: never;
|
|
396
|
+
url: '/api/v1/subscription/{org}';
|
|
397
|
+
};
|
|
398
|
+
export type CancelSubscriptionErrors = {
|
|
399
|
+
/**
|
|
400
|
+
* Unauthorised user
|
|
401
|
+
*/
|
|
402
|
+
401: _Error;
|
|
403
|
+
/**
|
|
404
|
+
* Account not found, or the account has no in-force subscription
|
|
405
|
+
*/
|
|
406
|
+
404: _Error;
|
|
407
|
+
/**
|
|
408
|
+
* The subscription is already scheduled to cancel, or the account has no Stripe customer yet
|
|
409
|
+
*/
|
|
410
|
+
409: _Error;
|
|
411
|
+
/**
|
|
412
|
+
* The subscription cannot be cancelled
|
|
413
|
+
*/
|
|
414
|
+
422: _Error;
|
|
415
|
+
/**
|
|
416
|
+
* Internal error
|
|
417
|
+
*/
|
|
418
|
+
500: _Error;
|
|
419
|
+
};
|
|
420
|
+
export type CancelSubscriptionError = CancelSubscriptionErrors[keyof CancelSubscriptionErrors];
|
|
421
|
+
export type CancelSubscriptionResponses = {
|
|
422
|
+
/**
|
|
423
|
+
* The subscription is scheduled to cancel at the end of the period
|
|
424
|
+
*/
|
|
425
|
+
202: unknown;
|
|
426
|
+
};
|
|
387
427
|
export type CreateSubscriptionData = {
|
|
388
428
|
body: CreateSubscriptionRequest;
|
|
389
429
|
path: {
|
|
@@ -6522,6 +6522,13 @@ export declare const zUpdatePlanData: z.ZodObject<{
|
|
|
6522
6522
|
}, z.core.$strip>;
|
|
6523
6523
|
query: z.ZodOptional<z.ZodNever>;
|
|
6524
6524
|
}, z.core.$strip>;
|
|
6525
|
+
export declare const zCancelSubscriptionData: z.ZodObject<{
|
|
6526
|
+
body: z.ZodOptional<z.ZodNever>;
|
|
6527
|
+
path: z.ZodObject<{
|
|
6528
|
+
org: z.ZodString;
|
|
6529
|
+
}, z.core.$strip>;
|
|
6530
|
+
query: z.ZodOptional<z.ZodNever>;
|
|
6531
|
+
}, z.core.$strip>;
|
|
6525
6532
|
export declare const zCreateSubscriptionData: z.ZodObject<{
|
|
6526
6533
|
body: z.ZodObject<{
|
|
6527
6534
|
plan: z.ZodString;
|
|
@@ -326,6 +326,13 @@ export const zUpdatePlanData = z.object({
|
|
|
326
326
|
}),
|
|
327
327
|
query: z.optional(z.never())
|
|
328
328
|
});
|
|
329
|
+
export const zCancelSubscriptionData = z.object({
|
|
330
|
+
body: z.optional(z.never()),
|
|
331
|
+
path: z.object({
|
|
332
|
+
org: z.string()
|
|
333
|
+
}),
|
|
334
|
+
query: z.optional(z.never())
|
|
335
|
+
});
|
|
329
336
|
export const zCreateSubscriptionData = z.object({
|
|
330
337
|
body: zCreateSubscriptionRequest,
|
|
331
338
|
path: z.object({
|
package/dist/sdk/types.gen.d.ts
CHANGED
|
@@ -711,7 +711,7 @@ export type CloudSqlEdition = 'ENTERPRISE' | 'ENTERPRISE_PLUS';
|
|
|
711
711
|
export type CloudSqlAvailabilityType = 'ZONAL' | 'REGIONAL';
|
|
712
712
|
export type CloudSqlDbVersion = 'POSTGRES_15' | 'POSTGRES_16' | 'POSTGRES_17';
|
|
713
713
|
export type MachineType = 'e2-micro' | 'e2-small' | 'e2-medium' | 'e2-standard-2' | 'e2-standard-4' | 'e2-standard-8';
|
|
714
|
-
export type ImageVersion = 'debian-cloud/debian-12' | 'debian-cloud/debian-11' | 'ubuntu-os-cloud/ubuntu-
|
|
714
|
+
export type ImageVersion = 'debian-cloud/debian-12' | 'debian-cloud/debian-11' | 'ubuntu-os-cloud/ubuntu-2204-lts' | 'cos-cloud/cos-stable' | 'cos-cloud/cos-beta' | 'cos-cloud/cos-arm64-stable' | 'cos-cloud/cos-arm64-beta';
|
|
715
715
|
export type Region = 'europe-west2';
|
|
716
716
|
export type Cpu = '1' | '2';
|
|
717
717
|
export type Memory = '512Mi' | '1Gi' | '2Gi';
|
package/dist/sdk/zod.gen.d.ts
CHANGED
|
@@ -873,7 +873,6 @@ export declare const zMachineType: z.ZodEnum<{
|
|
|
873
873
|
export declare const zImageVersion: z.ZodEnum<{
|
|
874
874
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
875
875
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
876
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
877
876
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
878
877
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
879
878
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -1099,7 +1098,6 @@ export declare const zVmNodeProps: z.ZodObject<{
|
|
|
1099
1098
|
image: z.ZodEnum<{
|
|
1100
1099
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
1101
1100
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
1102
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
1103
1101
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
1104
1102
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
1105
1103
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -1359,7 +1357,6 @@ export declare const zNode: z.ZodObject<{
|
|
|
1359
1357
|
image: z.ZodEnum<{
|
|
1360
1358
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
1361
1359
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
1362
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
1363
1360
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
1364
1361
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
1365
1362
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -1638,7 +1635,6 @@ export declare const zNodes: z.ZodObject<{
|
|
|
1638
1635
|
image: z.ZodEnum<{
|
|
1639
1636
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
1640
1637
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
1641
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
1642
1638
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
1643
1639
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
1644
1640
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -1920,7 +1916,6 @@ export declare const zGraph: z.ZodObject<{
|
|
|
1920
1916
|
image: z.ZodEnum<{
|
|
1921
1917
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
1922
1918
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
1923
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
1924
1919
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
1925
1920
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
1926
1921
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -2207,7 +2202,6 @@ export declare const zBlueprintDetail: z.ZodObject<{
|
|
|
2207
2202
|
image: z.ZodEnum<{
|
|
2208
2203
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
2209
2204
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
2210
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
2211
2205
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
2212
2206
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
2213
2207
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -3114,7 +3108,6 @@ export declare const zUpdateGraphM2mData: z.ZodObject<{
|
|
|
3114
3108
|
image: z.ZodEnum<{
|
|
3115
3109
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
3116
3110
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
3117
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
3118
3111
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
3119
3112
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
3120
3113
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -3415,7 +3408,6 @@ export declare const zFetchGraphM2mResponse: z.ZodObject<{
|
|
|
3415
3408
|
image: z.ZodEnum<{
|
|
3416
3409
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
3417
3410
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
3418
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
3419
3411
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
3420
3412
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
3421
3413
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -3705,7 +3697,6 @@ export declare const zFetchNodeM2mResponse: z.ZodObject<{
|
|
|
3705
3697
|
image: z.ZodEnum<{
|
|
3706
3698
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
3707
3699
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
3708
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
3709
3700
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
3710
3701
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
3711
3702
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -3984,7 +3975,6 @@ export declare const zUpdateNodeM2mData: z.ZodObject<{
|
|
|
3984
3975
|
image: z.ZodEnum<{
|
|
3985
3976
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
3986
3977
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
3987
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
3988
3978
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
3989
3979
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
3990
3980
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -4332,7 +4322,6 @@ export declare const zGetBlueprintM2mResponse: z.ZodObject<{
|
|
|
4332
4322
|
image: z.ZodEnum<{
|
|
4333
4323
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
4334
4324
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
4335
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
4336
4325
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
4337
4326
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
4338
4327
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -5275,7 +5264,6 @@ export declare const zPreviewBlueprintResponse: z.ZodObject<{
|
|
|
5275
5264
|
image: z.ZodEnum<{
|
|
5276
5265
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
5277
5266
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
5278
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
5279
5267
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
5280
5268
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
5281
5269
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -6464,7 +6452,6 @@ export declare const zGetGraphOverviewResponse: z.ZodObject<{
|
|
|
6464
6452
|
image: z.ZodEnum<{
|
|
6465
6453
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
6466
6454
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
6467
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
6468
6455
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
6469
6456
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
6470
6457
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
|
@@ -6745,7 +6732,6 @@ export declare const zUpdateGraphStateData: z.ZodObject<{
|
|
|
6745
6732
|
image: z.ZodEnum<{
|
|
6746
6733
|
"debian-cloud/debian-12": "debian-cloud/debian-12";
|
|
6747
6734
|
"debian-cloud/debian-11": "debian-cloud/debian-11";
|
|
6748
|
-
"ubuntu-os-cloud/ubuntu-2404-lts": "ubuntu-os-cloud/ubuntu-2404-lts";
|
|
6749
6735
|
"ubuntu-os-cloud/ubuntu-2204-lts": "ubuntu-os-cloud/ubuntu-2204-lts";
|
|
6750
6736
|
"cos-cloud/cos-stable": "cos-cloud/cos-stable";
|
|
6751
6737
|
"cos-cloud/cos-beta": "cos-cloud/cos-beta";
|
package/dist/sdk/zod.gen.js
CHANGED
|
@@ -626,7 +626,6 @@ export const zMachineType = z.enum([
|
|
|
626
626
|
export const zImageVersion = z.enum([
|
|
627
627
|
'debian-cloud/debian-12',
|
|
628
628
|
'debian-cloud/debian-11',
|
|
629
|
-
'ubuntu-os-cloud/ubuntu-2404-lts',
|
|
630
629
|
'ubuntu-os-cloud/ubuntu-2204-lts',
|
|
631
630
|
'cos-cloud/cos-stable',
|
|
632
631
|
'cos-cloud/cos-beta',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { GetSuccessResponse } from "../util";
|
|
3
|
-
import { GetCustomerData, GetUsageData, GetPlansData, UpdatePlanData, UpdatePlanResponses, CreateSubscriptionData, CreateSubscriptionResponses, CreateSetupIntentData, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodResponses, GetInvoicesData, M2mGetCustomerData, M2mCreateCustomerData, M2mCreateCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanResponses } from "../../sdk/billing/types.gen";
|
|
3
|
+
import { GetCustomerData, GetUsageData, GetPlansData, UpdatePlanData, UpdatePlanResponses, CancelSubscriptionData, CancelSubscriptionResponses, CreateSubscriptionData, CreateSubscriptionResponses, CreateSetupIntentData, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodResponses, GetInvoicesData, M2mGetCustomerData, M2mCreateCustomerData, M2mCreateCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanResponses } from "../../sdk/billing/types.gen";
|
|
4
4
|
export declare const useGetCustomer: (options: Omit<GetCustomerData, "url"> & {
|
|
5
5
|
enabled?: boolean;
|
|
6
6
|
}) => {
|
|
@@ -630,6 +630,14 @@ export declare const useUpdatePlan: (config?: {
|
|
|
630
630
|
data: unknown;
|
|
631
631
|
headers: Record<string, string>;
|
|
632
632
|
}, unknown, Omit<UpdatePlanData, "url">, unknown>;
|
|
633
|
+
export declare const useCancelSubscription: (config?: {
|
|
634
|
+
onSuccess?: (data: GetSuccessResponse<CancelSubscriptionResponses>, headers: Record<string, string>) => void;
|
|
635
|
+
onError?: Parameters<typeof useMutation>["0"]["onError"];
|
|
636
|
+
retry?: boolean;
|
|
637
|
+
}) => import("@tanstack/react-query").UseMutationResult<{
|
|
638
|
+
data: unknown;
|
|
639
|
+
headers: Record<string, string>;
|
|
640
|
+
}, unknown, Omit<CancelSubscriptionData, "url">, unknown>;
|
|
633
641
|
export declare const useCreateSubscription: (config?: {
|
|
634
642
|
onSuccess?: (data: GetSuccessResponse<CreateSubscriptionResponses>, headers: Record<string, string>) => void;
|
|
635
643
|
onError?: Parameters<typeof useMutation>["0"]["onError"];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { isPromise, headersToObject } from "../util";
|
|
4
4
|
import { useToken } from "../../provider/token-provider";
|
|
5
|
-
import { getCustomer, getUsage, getPlans, updatePlan, createSubscription, createSetupIntent, deletePaymentMethod, updateDefaultPaymentMethod, getInvoices, m2mGetCustomer, m2mCreateCustomer, m2mUpdatePlan } from "../../sdk/billing/sdk.gen";
|
|
5
|
+
import { getCustomer, getUsage, getPlans, updatePlan, cancelSubscription, createSubscription, createSetupIntent, deletePaymentMethod, updateDefaultPaymentMethod, getInvoices, m2mGetCustomer, m2mCreateCustomer, m2mUpdatePlan } from "../../sdk/billing/sdk.gen";
|
|
6
6
|
export const useGetCustomer = (options) => {
|
|
7
7
|
const token = useToken();
|
|
8
8
|
let { enabled, ...rest } = options || { enabled: true };
|
|
@@ -88,6 +88,25 @@ export const useUpdatePlan = (config) => {
|
|
|
88
88
|
retry: config?.retry
|
|
89
89
|
});
|
|
90
90
|
};
|
|
91
|
+
export const useCancelSubscription = (config) => {
|
|
92
|
+
const token = useToken();
|
|
93
|
+
const queryClient = useQueryClient();
|
|
94
|
+
const opts = { throwOnError: true, url: "/api/v1/subscription/{org}" };
|
|
95
|
+
const funcer = async (options) => {
|
|
96
|
+
const auth = isPromise(token) ? (await token) || "" : token || "";
|
|
97
|
+
const res = await cancelSubscription({ ...opts, ...options, auth });
|
|
98
|
+
return { data: res.data, headers: headersToObject(res.response.headers) };
|
|
99
|
+
};
|
|
100
|
+
return useMutation({
|
|
101
|
+
mutationFn: funcer,
|
|
102
|
+
onSuccess: (res, options, c, ctx) => {
|
|
103
|
+
queryClient.invalidateQueries({ queryKey: ["api", "v1", "subscription", options?.path?.org] });
|
|
104
|
+
config?.onSuccess && config.onSuccess(res.data, res.headers);
|
|
105
|
+
},
|
|
106
|
+
onError: config?.onError,
|
|
107
|
+
retry: config?.retry
|
|
108
|
+
});
|
|
109
|
+
};
|
|
91
110
|
export const useCreateSubscription = (config) => {
|
|
92
111
|
const token = useToken();
|
|
93
112
|
const queryClient = useQueryClient();
|