shoal-web-sdk 1.0.87 → 1.0.89
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 +17 -32
- package/dist/sdk/billing/@tanstack/react-query.gen.js +13 -40
- package/dist/sdk/billing/sdk.gen.d.ts +7 -22
- package/dist/sdk/billing/sdk.gen.js +16 -46
- package/dist/sdk/billing/types.gen.d.ts +72 -81
- package/dist/sdk/billing/zod.gen.d.ts +94 -93
- package/dist/sdk/billing/zod.gen.js +27 -20
- package/dist/tanstack-codegen/generated/billing.d.ts +44 -52
- package/dist/tanstack-codegen/generated/billing.js +21 -40
- 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 {
|
|
3
|
+
import type { CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, GetCustomerData, GetInvoicesData, GetPlansData, 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;
|
|
@@ -8,81 +8,66 @@ export type QueryKey<TOptions extends Options> = [
|
|
|
8
8
|
tags?: ReadonlyArray<string>;
|
|
9
9
|
}
|
|
10
10
|
];
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const getCustomerQueryKey: (options: Options<GetCustomerData>) => [Pick<Options<GetCustomerData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
12
12
|
_id: string;
|
|
13
13
|
_infinite?: boolean;
|
|
14
14
|
tags?: ReadonlyArray<string>;
|
|
15
15
|
}];
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Fetch all related customer information for a given org.
|
|
18
18
|
*/
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const getCustomerOptions: (options: Options<GetCustomerData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").CustomerResponse, Error, import("../types.gen").CustomerResponse, [Pick<Options<GetCustomerData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
20
20
|
_id: string;
|
|
21
21
|
_infinite?: boolean;
|
|
22
22
|
tags?: ReadonlyArray<string>;
|
|
23
23
|
}]>, "queryFn"> & {
|
|
24
|
-
queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").
|
|
24
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").CustomerResponse, [Pick<Options<GetCustomerData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
25
25
|
_id: string;
|
|
26
26
|
_infinite?: boolean;
|
|
27
27
|
tags?: ReadonlyArray<string>;
|
|
28
28
|
}], never> | undefined;
|
|
29
29
|
} & {
|
|
30
|
-
queryKey: [Pick<Options<
|
|
30
|
+
queryKey: [Pick<Options<GetCustomerData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
31
31
|
_id: string;
|
|
32
32
|
_infinite?: boolean;
|
|
33
33
|
tags?: ReadonlyArray<string>;
|
|
34
34
|
}] & {
|
|
35
|
-
[dataTagSymbol]: import("../types.gen").
|
|
35
|
+
[dataTagSymbol]: import("../types.gen").CustomerResponse;
|
|
36
36
|
[dataTagErrorSymbol]: Error;
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
* Returns a list of available pricing plans.
|
|
41
|
-
*/
|
|
42
|
-
export declare const updatePlanMutation: (options?: Partial<Options<UpdatePlanData>>) => UseMutationOptions<unknown, UpdatePlanError, Options<UpdatePlanData>>;
|
|
43
|
-
export declare const getCustomerQueryKey: (options?: Options<GetCustomerData>) => [Pick<Options<GetCustomerData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
39
|
+
export declare const getPlansQueryKey: (options?: Options<GetPlansData>) => [Pick<Options<GetPlansData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
44
40
|
_id: string;
|
|
45
41
|
_infinite?: boolean;
|
|
46
42
|
tags?: ReadonlyArray<string>;
|
|
47
43
|
}];
|
|
48
44
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* Returns the account's current (and pending, if any) plan plus renewal/schedule dates, fetched live
|
|
52
|
-
* from the Stripe subscription rather than only the Account record — a customer can be grandfathered
|
|
53
|
-
* onto a price that no longer matches plan-configuration.yaml, so Stripe's subscription metadata is
|
|
54
|
-
* the source of truth for what's actually in effect.
|
|
55
|
-
*
|
|
45
|
+
* Returns a list of available pricing plans.
|
|
56
46
|
*/
|
|
57
|
-
export declare const
|
|
47
|
+
export declare const getPlansOptions: (options?: Options<GetPlansData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").CatalogResponse, Error, import("../types.gen").CatalogResponse, [Pick<Options<GetPlansData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
58
48
|
_id: string;
|
|
59
49
|
_infinite?: boolean;
|
|
60
50
|
tags?: ReadonlyArray<string>;
|
|
61
51
|
}]>, "queryFn"> & {
|
|
62
|
-
queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").
|
|
52
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").CatalogResponse, [Pick<Options<GetPlansData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
63
53
|
_id: string;
|
|
64
54
|
_infinite?: boolean;
|
|
65
55
|
tags?: ReadonlyArray<string>;
|
|
66
56
|
}], never> | undefined;
|
|
67
57
|
} & {
|
|
68
|
-
queryKey: [Pick<Options<
|
|
58
|
+
queryKey: [Pick<Options<GetPlansData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
69
59
|
_id: string;
|
|
70
60
|
_infinite?: boolean;
|
|
71
61
|
tags?: ReadonlyArray<string>;
|
|
72
62
|
}] & {
|
|
73
|
-
[dataTagSymbol]: import("../types.gen").
|
|
63
|
+
[dataTagSymbol]: import("../types.gen").CatalogResponse;
|
|
74
64
|
[dataTagErrorSymbol]: Error;
|
|
75
65
|
};
|
|
76
66
|
};
|
|
77
67
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* This instantiates an account record in our database with
|
|
81
|
-
* the account status set to "onboarding". This status is changed to active, once a a stripe update subscription
|
|
82
|
-
* webhook is received.
|
|
83
|
-
*
|
|
68
|
+
* Returns a list of available pricing plans.
|
|
84
69
|
*/
|
|
85
|
-
export declare const
|
|
70
|
+
export declare const updatePlanMutation: (options?: Partial<Options<UpdatePlanData>>) => UseMutationOptions<unknown, UpdatePlanError, Options<UpdatePlanData>>;
|
|
86
71
|
/**
|
|
87
72
|
* Creates a Stripe SetupIntent.
|
|
88
73
|
*
|
|
@@ -97,7 +82,7 @@ export declare const deletePaymentMethodMutation: (options?: Partial<Options<Del
|
|
|
97
82
|
* Sets the customer's default payment method used for invoices.
|
|
98
83
|
*/
|
|
99
84
|
export declare const updateDefaultPaymentMethodMutation: (options?: Partial<Options<UpdateDefaultPaymentMethodData>>) => UseMutationOptions<UpdateDefaultPaymentMethodResponse, UpdateDefaultPaymentMethodError, Options<UpdateDefaultPaymentMethodData>>;
|
|
100
|
-
export declare const getInvoicesQueryKey: (options
|
|
85
|
+
export declare const getInvoicesQueryKey: (options: Options<GetInvoicesData>) => [Pick<Options<GetInvoicesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
101
86
|
_id: string;
|
|
102
87
|
_infinite?: boolean;
|
|
103
88
|
tags?: ReadonlyArray<string>;
|
|
@@ -105,7 +90,7 @@ export declare const getInvoicesQueryKey: (options?: Options<GetInvoicesData>) =
|
|
|
105
90
|
/**
|
|
106
91
|
* Returns a page of the customer's invoices. This response is paginated.
|
|
107
92
|
*/
|
|
108
|
-
export declare const getInvoicesOptions: (options
|
|
93
|
+
export declare const getInvoicesOptions: (options: Options<GetInvoicesData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").InvoiceListResponse, Error, import("../types.gen").InvoiceListResponse, [Pick<Options<GetInvoicesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
109
94
|
_id: string;
|
|
110
95
|
_infinite?: boolean;
|
|
111
96
|
tags?: ReadonlyArray<string>;
|
|
@@ -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 {
|
|
4
|
+
import { createSetupIntent, deletePaymentMethod, getCustomer, getInvoices, getPlans, 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) {
|
|
@@ -26,14 +26,14 @@ const createQueryKey = (id, options, infinite, tags) => {
|
|
|
26
26
|
params
|
|
27
27
|
];
|
|
28
28
|
};
|
|
29
|
-
export const
|
|
29
|
+
export const getCustomerQueryKey = (options) => createQueryKey('getCustomer', options);
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Fetch all related customer information for a given org.
|
|
32
32
|
*/
|
|
33
|
-
export const
|
|
33
|
+
export const getCustomerOptions = (options) => {
|
|
34
34
|
return queryOptions({
|
|
35
35
|
queryFn: async ({ queryKey, signal }) => {
|
|
36
|
-
const { data } = await
|
|
36
|
+
const { data } = await getCustomer({
|
|
37
37
|
...options,
|
|
38
38
|
...queryKey[0],
|
|
39
39
|
signal,
|
|
@@ -41,39 +41,17 @@ export const getPlansOptions = (options) => {
|
|
|
41
41
|
});
|
|
42
42
|
return data;
|
|
43
43
|
},
|
|
44
|
-
queryKey:
|
|
44
|
+
queryKey: getCustomerQueryKey(options)
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
|
+
export const getPlansQueryKey = (options) => createQueryKey('getPlans', options);
|
|
47
48
|
/**
|
|
48
49
|
* Returns a list of available pricing plans.
|
|
49
50
|
*/
|
|
50
|
-
export const
|
|
51
|
-
const mutationOptions = {
|
|
52
|
-
mutationFn: async (fnOptions) => {
|
|
53
|
-
const { data } = await updatePlan({
|
|
54
|
-
...options,
|
|
55
|
-
...fnOptions,
|
|
56
|
-
throwOnError: true
|
|
57
|
-
});
|
|
58
|
-
return data;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
return mutationOptions;
|
|
62
|
-
};
|
|
63
|
-
export const getCustomerQueryKey = (options) => createQueryKey('getCustomer', options);
|
|
64
|
-
/**
|
|
65
|
-
* Fetch all related customer information.
|
|
66
|
-
*
|
|
67
|
-
* Returns the account's current (and pending, if any) plan plus renewal/schedule dates, fetched live
|
|
68
|
-
* from the Stripe subscription rather than only the Account record — a customer can be grandfathered
|
|
69
|
-
* onto a price that no longer matches plan-configuration.yaml, so Stripe's subscription metadata is
|
|
70
|
-
* the source of truth for what's actually in effect.
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
export const getCustomerOptions = (options) => {
|
|
51
|
+
export const getPlansOptions = (options) => {
|
|
74
52
|
return queryOptions({
|
|
75
53
|
queryFn: async ({ queryKey, signal }) => {
|
|
76
|
-
const { data } = await
|
|
54
|
+
const { data } = await getPlans({
|
|
77
55
|
...options,
|
|
78
56
|
...queryKey[0],
|
|
79
57
|
signal,
|
|
@@ -81,21 +59,16 @@ export const getCustomerOptions = (options) => {
|
|
|
81
59
|
});
|
|
82
60
|
return data;
|
|
83
61
|
},
|
|
84
|
-
queryKey:
|
|
62
|
+
queryKey: getPlansQueryKey(options)
|
|
85
63
|
});
|
|
86
64
|
};
|
|
87
65
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* This instantiates an account record in our database with
|
|
91
|
-
* the account status set to "onboarding". This status is changed to active, once a a stripe update subscription
|
|
92
|
-
* webhook is received.
|
|
93
|
-
*
|
|
66
|
+
* Returns a list of available pricing plans.
|
|
94
67
|
*/
|
|
95
|
-
export const
|
|
68
|
+
export const updatePlanMutation = (options) => {
|
|
96
69
|
const mutationOptions = {
|
|
97
70
|
mutationFn: async (fnOptions) => {
|
|
98
|
-
const { data } = await
|
|
71
|
+
const { data } = await updatePlan({
|
|
99
72
|
...options,
|
|
100
73
|
...fnOptions,
|
|
101
74
|
throwOnError: true
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Client, Options as Options2, TDataShape } from './client';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodErrors, DeletePaymentMethodResponses, GetCustomerData, GetCustomerErrors, GetCustomerResponses, GetInvoicesData, GetInvoicesErrors, GetInvoicesResponses, GetPlansData, GetPlansErrors, GetPlansResponses, 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
|
|
@@ -13,6 +13,10 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
13
13
|
*/
|
|
14
14
|
meta?: Record<string, unknown>;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Fetch all related customer information for a given org.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getCustomer: <ThrowOnError extends boolean = false>(options: Options<GetCustomerData, ThrowOnError>) => import("./client").RequestResult<GetCustomerResponses, GetCustomerErrors, ThrowOnError, "fields">;
|
|
16
20
|
/**
|
|
17
21
|
* Returns a list of available pricing plans.
|
|
18
22
|
*/
|
|
@@ -21,31 +25,12 @@ export declare const getPlans: <ThrowOnError extends boolean = false>(options?:
|
|
|
21
25
|
* Returns a list of available pricing plans.
|
|
22
26
|
*/
|
|
23
27
|
export declare const updatePlan: <ThrowOnError extends boolean = false>(options: Options<UpdatePlanData, ThrowOnError>) => import("./client").RequestResult<UpdatePlanResponses, UpdatePlanErrors, ThrowOnError, "fields">;
|
|
24
|
-
/**
|
|
25
|
-
* Fetch all related customer information.
|
|
26
|
-
*
|
|
27
|
-
* Returns the account's current (and pending, if any) plan plus renewal/schedule dates, fetched live
|
|
28
|
-
* from the Stripe subscription rather than only the Account record — a customer can be grandfathered
|
|
29
|
-
* onto a price that no longer matches plan-configuration.yaml, so Stripe's subscription metadata is
|
|
30
|
-
* the source of truth for what's actually in effect.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
export declare const getCustomer: <ThrowOnError extends boolean = false>(options?: Options<GetCustomerData, ThrowOnError>) => import("./client").RequestResult<GetCustomerResponses, GetCustomerErrors, ThrowOnError, "fields">;
|
|
34
|
-
/**
|
|
35
|
-
* Creates a stripe customer with a stripe subscription
|
|
36
|
-
*
|
|
37
|
-
* This instantiates an account record in our database with
|
|
38
|
-
* the account status set to "onboarding". This status is changed to active, once a a stripe update subscription
|
|
39
|
-
* webhook is received.
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
export declare const createCustomer: <ThrowOnError extends boolean = false>(options: Options<CreateCustomerData, ThrowOnError>) => import("./client").RequestResult<CreateCustomerResponses, CreateCustomerErrors, ThrowOnError, "fields">;
|
|
43
28
|
/**
|
|
44
29
|
* Creates a Stripe SetupIntent.
|
|
45
30
|
*
|
|
46
31
|
* Lets the client collect and tokenise a card without charging it.
|
|
47
32
|
*/
|
|
48
|
-
export declare const createSetupIntent: <ThrowOnError extends boolean = false>(options
|
|
33
|
+
export declare const createSetupIntent: <ThrowOnError extends boolean = false>(options: Options<CreateSetupIntentData, ThrowOnError>) => import("./client").RequestResult<CreateSetupIntentResponses, CreateSetupIntentErrors, ThrowOnError, "fields">;
|
|
49
34
|
/**
|
|
50
35
|
* Detaches a payment method from the customer.
|
|
51
36
|
*/
|
|
@@ -57,7 +42,7 @@ export declare const updateDefaultPaymentMethod: <ThrowOnError extends boolean =
|
|
|
57
42
|
/**
|
|
58
43
|
* Returns a page of the customer's invoices. This response is paginated.
|
|
59
44
|
*/
|
|
60
|
-
export declare const getInvoices: <ThrowOnError extends boolean = false>(options
|
|
45
|
+
export declare const getInvoices: <ThrowOnError extends boolean = false>(options: Options<GetInvoicesData, ThrowOnError>) => import("./client").RequestResult<GetInvoicesResponses, GetInvoicesErrors, ThrowOnError, "fields">;
|
|
61
46
|
/**
|
|
62
47
|
* Fetch all related customer information for a given org.
|
|
63
48
|
*/
|
|
@@ -1,49 +1,24 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
import { client } from './client.gen';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Fetch all related customer information for a given org.
|
|
5
5
|
*/
|
|
6
|
-
export const
|
|
7
|
-
return (options
|
|
6
|
+
export const getCustomer = (options) => {
|
|
7
|
+
return (options.client ?? client).get({
|
|
8
8
|
security: [
|
|
9
9
|
{
|
|
10
10
|
scheme: 'bearer',
|
|
11
11
|
type: 'http'
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
url: '/api/v1/
|
|
14
|
+
url: '/api/v1/customer/{org}',
|
|
15
15
|
...options
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* Returns a list of available pricing plans.
|
|
20
20
|
*/
|
|
21
|
-
export const
|
|
22
|
-
return (options.client ?? client).patch({
|
|
23
|
-
security: [
|
|
24
|
-
{
|
|
25
|
-
scheme: 'bearer',
|
|
26
|
-
type: 'http'
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
url: '/api/v1/plan',
|
|
30
|
-
...options,
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'application/json',
|
|
33
|
-
...options.headers
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Fetch all related customer information.
|
|
39
|
-
*
|
|
40
|
-
* Returns the account's current (and pending, if any) plan plus renewal/schedule dates, fetched live
|
|
41
|
-
* from the Stripe subscription rather than only the Account record — a customer can be grandfathered
|
|
42
|
-
* onto a price that no longer matches plan-configuration.yaml, so Stripe's subscription metadata is
|
|
43
|
-
* the source of truth for what's actually in effect.
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
export const getCustomer = (options) => {
|
|
21
|
+
export const getPlans = (options) => {
|
|
47
22
|
return (options?.client ?? client).get({
|
|
48
23
|
security: [
|
|
49
24
|
{
|
|
@@ -51,27 +26,22 @@ export const getCustomer = (options) => {
|
|
|
51
26
|
type: 'http'
|
|
52
27
|
}
|
|
53
28
|
],
|
|
54
|
-
url: '/api/v1/
|
|
29
|
+
url: '/api/v1/plans',
|
|
55
30
|
...options
|
|
56
31
|
});
|
|
57
32
|
};
|
|
58
33
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* This instantiates an account record in our database with
|
|
62
|
-
* the account status set to "onboarding". This status is changed to active, once a a stripe update subscription
|
|
63
|
-
* webhook is received.
|
|
64
|
-
*
|
|
34
|
+
* Returns a list of available pricing plans.
|
|
65
35
|
*/
|
|
66
|
-
export const
|
|
67
|
-
return (options.client ?? client).
|
|
36
|
+
export const updatePlan = (options) => {
|
|
37
|
+
return (options.client ?? client).patch({
|
|
68
38
|
security: [
|
|
69
39
|
{
|
|
70
40
|
scheme: 'bearer',
|
|
71
41
|
type: 'http'
|
|
72
42
|
}
|
|
73
43
|
],
|
|
74
|
-
url: '/api/v1/
|
|
44
|
+
url: '/api/v1/plan/{org}',
|
|
75
45
|
...options,
|
|
76
46
|
headers: {
|
|
77
47
|
'Content-Type': 'application/json',
|
|
@@ -85,14 +55,14 @@ export const createCustomer = (options) => {
|
|
|
85
55
|
* Lets the client collect and tokenise a card without charging it.
|
|
86
56
|
*/
|
|
87
57
|
export const createSetupIntent = (options) => {
|
|
88
|
-
return (options
|
|
58
|
+
return (options.client ?? client).post({
|
|
89
59
|
security: [
|
|
90
60
|
{
|
|
91
61
|
scheme: 'bearer',
|
|
92
62
|
type: 'http'
|
|
93
63
|
}
|
|
94
64
|
],
|
|
95
|
-
url: '/api/v1/setup-intent',
|
|
65
|
+
url: '/api/v1/setup-intent/{org}',
|
|
96
66
|
...options
|
|
97
67
|
});
|
|
98
68
|
};
|
|
@@ -107,7 +77,7 @@ export const deletePaymentMethod = (options) => {
|
|
|
107
77
|
type: 'http'
|
|
108
78
|
}
|
|
109
79
|
],
|
|
110
|
-
url: '/api/v1/payment-method/{
|
|
80
|
+
url: '/api/v1/payment-method/{paymentID}',
|
|
111
81
|
...options
|
|
112
82
|
});
|
|
113
83
|
};
|
|
@@ -122,7 +92,7 @@ export const updateDefaultPaymentMethod = (options) => {
|
|
|
122
92
|
type: 'http'
|
|
123
93
|
}
|
|
124
94
|
],
|
|
125
|
-
url: '/api/v1/payment-method/{
|
|
95
|
+
url: '/api/v1/payment-method/{paymentID}',
|
|
126
96
|
...options
|
|
127
97
|
});
|
|
128
98
|
};
|
|
@@ -130,14 +100,14 @@ export const updateDefaultPaymentMethod = (options) => {
|
|
|
130
100
|
* Returns a page of the customer's invoices. This response is paginated.
|
|
131
101
|
*/
|
|
132
102
|
export const getInvoices = (options) => {
|
|
133
|
-
return (options
|
|
103
|
+
return (options.client ?? client).get({
|
|
134
104
|
security: [
|
|
135
105
|
{
|
|
136
106
|
scheme: 'bearer',
|
|
137
107
|
type: 'http'
|
|
138
108
|
}
|
|
139
109
|
],
|
|
140
|
-
url: '/api/v1/invoices',
|
|
110
|
+
url: '/api/v1/invoices/{org}',
|
|
141
111
|
...options
|
|
142
112
|
});
|
|
143
113
|
};
|
|
@@ -164,9 +164,46 @@ export type CustomerResponseWritable = {
|
|
|
164
164
|
currentPlan: CustomerPlanResponseWritable;
|
|
165
165
|
};
|
|
166
166
|
/**
|
|
167
|
-
*
|
|
167
|
+
* Stripe payment method.
|
|
168
|
+
*/
|
|
169
|
+
export type PaymentMethodId = string;
|
|
170
|
+
/**
|
|
171
|
+
* Kinde organisation id.
|
|
168
172
|
*/
|
|
169
173
|
export type OrganisationId = string;
|
|
174
|
+
export type GetCustomerData = {
|
|
175
|
+
body?: never;
|
|
176
|
+
path: {
|
|
177
|
+
/**
|
|
178
|
+
* Kinde organisation id.
|
|
179
|
+
*/
|
|
180
|
+
org: string;
|
|
181
|
+
};
|
|
182
|
+
query?: never;
|
|
183
|
+
url: '/api/v1/customer/{org}';
|
|
184
|
+
};
|
|
185
|
+
export type GetCustomerErrors = {
|
|
186
|
+
/**
|
|
187
|
+
* Unauthorised
|
|
188
|
+
*/
|
|
189
|
+
401: _Error;
|
|
190
|
+
/**
|
|
191
|
+
* Account or subscription not found
|
|
192
|
+
*/
|
|
193
|
+
404: _Error;
|
|
194
|
+
/**
|
|
195
|
+
* Internal error
|
|
196
|
+
*/
|
|
197
|
+
500: _Error;
|
|
198
|
+
};
|
|
199
|
+
export type GetCustomerError = GetCustomerErrors[keyof GetCustomerErrors];
|
|
200
|
+
export type GetCustomerResponses = {
|
|
201
|
+
/**
|
|
202
|
+
* Customer billing state
|
|
203
|
+
*/
|
|
204
|
+
200: CustomerResponse;
|
|
205
|
+
};
|
|
206
|
+
export type GetCustomerResponse = GetCustomerResponses[keyof GetCustomerResponses];
|
|
170
207
|
export type GetPlansData = {
|
|
171
208
|
body?: never;
|
|
172
209
|
path?: never;
|
|
@@ -189,9 +226,14 @@ export type GetPlansResponses = {
|
|
|
189
226
|
export type GetPlansResponse = GetPlansResponses[keyof GetPlansResponses];
|
|
190
227
|
export type UpdatePlanData = {
|
|
191
228
|
body: UpdatePlan;
|
|
192
|
-
path
|
|
229
|
+
path: {
|
|
230
|
+
/**
|
|
231
|
+
* Kinde organisation id.
|
|
232
|
+
*/
|
|
233
|
+
org: string;
|
|
234
|
+
};
|
|
193
235
|
query?: never;
|
|
194
|
-
url: '/api/v1/plan';
|
|
236
|
+
url: '/api/v1/plan/{org}';
|
|
195
237
|
};
|
|
196
238
|
export type UpdatePlanErrors = {
|
|
197
239
|
/**
|
|
@@ -218,78 +260,16 @@ export type UpdatePlanResponses = {
|
|
|
218
260
|
*/
|
|
219
261
|
202: unknown;
|
|
220
262
|
};
|
|
221
|
-
export type GetCustomerData = {
|
|
222
|
-
body?: never;
|
|
223
|
-
path?: never;
|
|
224
|
-
query?: never;
|
|
225
|
-
url: '/api/v1/customer';
|
|
226
|
-
};
|
|
227
|
-
export type GetCustomerErrors = {
|
|
228
|
-
/**
|
|
229
|
-
* Unauthorised user
|
|
230
|
-
*/
|
|
231
|
-
401: _Error;
|
|
232
|
-
/**
|
|
233
|
-
* Account or subscription not found
|
|
234
|
-
*/
|
|
235
|
-
404: _Error;
|
|
236
|
-
/**
|
|
237
|
-
* Account has no Stripe customer yet
|
|
238
|
-
*/
|
|
239
|
-
409: _Error;
|
|
240
|
-
/**
|
|
241
|
-
* Internal error (e.g. subscription references a plan key no longer in the catalog)
|
|
242
|
-
*/
|
|
243
|
-
500: _Error;
|
|
244
|
-
};
|
|
245
|
-
export type GetCustomerError = GetCustomerErrors[keyof GetCustomerErrors];
|
|
246
|
-
export type GetCustomerResponses = {
|
|
247
|
-
/**
|
|
248
|
-
* Customer billing state
|
|
249
|
-
*/
|
|
250
|
-
200: CustomerResponse;
|
|
251
|
-
};
|
|
252
|
-
export type GetCustomerResponse = GetCustomerResponses[keyof GetCustomerResponses];
|
|
253
|
-
export type CreateCustomerData = {
|
|
254
|
-
body: CreateCustomerRequest;
|
|
255
|
-
path?: never;
|
|
256
|
-
query?: never;
|
|
257
|
-
url: '/api/v1/customer';
|
|
258
|
-
};
|
|
259
|
-
export type CreateCustomerErrors = {
|
|
260
|
-
/**
|
|
261
|
-
* Invalid request body, or an invalid/unsupported plan or seat count for the plan.
|
|
262
|
-
*/
|
|
263
|
-
400: _Error;
|
|
264
|
-
/**
|
|
265
|
-
* Unreadable claims.
|
|
266
|
-
*/
|
|
267
|
-
403: _Error;
|
|
268
|
-
/**
|
|
269
|
-
* Account already exists.
|
|
270
|
-
*/
|
|
271
|
-
409: _Error;
|
|
272
|
-
/**
|
|
273
|
-
* Could not look up the organisation, register with Stripe, or create the Stripe subscription.
|
|
274
|
-
*/
|
|
275
|
-
422: _Error;
|
|
276
|
-
/**
|
|
277
|
-
* Unexpected error whilst persisting the account.
|
|
278
|
-
*/
|
|
279
|
-
500: _Error;
|
|
280
|
-
};
|
|
281
|
-
export type CreateCustomerError = CreateCustomerErrors[keyof CreateCustomerErrors];
|
|
282
|
-
export type CreateCustomerResponses = {
|
|
283
|
-
/**
|
|
284
|
-
* Billing account created; awaiting the Stripe subscription webhook to become active.
|
|
285
|
-
*/
|
|
286
|
-
201: unknown;
|
|
287
|
-
};
|
|
288
263
|
export type CreateSetupIntentData = {
|
|
289
264
|
body?: never;
|
|
290
|
-
path
|
|
265
|
+
path: {
|
|
266
|
+
/**
|
|
267
|
+
* Kinde organisation id.
|
|
268
|
+
*/
|
|
269
|
+
org: string;
|
|
270
|
+
};
|
|
291
271
|
query?: never;
|
|
292
|
-
url: '/api/v1/setup-intent';
|
|
272
|
+
url: '/api/v1/setup-intent/{org}';
|
|
293
273
|
};
|
|
294
274
|
export type CreateSetupIntentErrors = {
|
|
295
275
|
/**
|
|
@@ -320,10 +300,13 @@ export type CreateSetupIntentResponse = CreateSetupIntentResponses[keyof CreateS
|
|
|
320
300
|
export type DeletePaymentMethodData = {
|
|
321
301
|
body?: never;
|
|
322
302
|
path: {
|
|
323
|
-
|
|
303
|
+
/**
|
|
304
|
+
* Stripe payment method.
|
|
305
|
+
*/
|
|
306
|
+
paymentID: string;
|
|
324
307
|
};
|
|
325
308
|
query?: never;
|
|
326
|
-
url: '/api/v1/payment-method/{
|
|
309
|
+
url: '/api/v1/payment-method/{paymentID}';
|
|
327
310
|
};
|
|
328
311
|
export type DeletePaymentMethodErrors = {
|
|
329
312
|
/**
|
|
@@ -358,10 +341,13 @@ export type DeletePaymentMethodResponse = DeletePaymentMethodResponses[keyof Del
|
|
|
358
341
|
export type UpdateDefaultPaymentMethodData = {
|
|
359
342
|
body?: never;
|
|
360
343
|
path: {
|
|
361
|
-
|
|
344
|
+
/**
|
|
345
|
+
* Stripe payment method.
|
|
346
|
+
*/
|
|
347
|
+
paymentID: string;
|
|
362
348
|
};
|
|
363
349
|
query?: never;
|
|
364
|
-
url: '/api/v1/payment-method/{
|
|
350
|
+
url: '/api/v1/payment-method/{paymentID}';
|
|
365
351
|
};
|
|
366
352
|
export type UpdateDefaultPaymentMethodErrors = {
|
|
367
353
|
/**
|
|
@@ -395,12 +381,17 @@ export type UpdateDefaultPaymentMethodResponses = {
|
|
|
395
381
|
export type UpdateDefaultPaymentMethodResponse = UpdateDefaultPaymentMethodResponses[keyof UpdateDefaultPaymentMethodResponses];
|
|
396
382
|
export type GetInvoicesData = {
|
|
397
383
|
body?: never;
|
|
398
|
-
path
|
|
384
|
+
path: {
|
|
385
|
+
/**
|
|
386
|
+
* Kinde organisation id.
|
|
387
|
+
*/
|
|
388
|
+
org: string;
|
|
389
|
+
};
|
|
399
390
|
query?: {
|
|
400
391
|
limit?: number;
|
|
401
392
|
starting_after?: string;
|
|
402
393
|
};
|
|
403
|
-
url: '/api/v1/invoices';
|
|
394
|
+
url: '/api/v1/invoices/{org}';
|
|
404
395
|
};
|
|
405
396
|
export type GetInvoicesErrors = {
|
|
406
397
|
/**
|
|
@@ -436,7 +427,7 @@ export type M2mGetCustomerData = {
|
|
|
436
427
|
body?: never;
|
|
437
428
|
path: {
|
|
438
429
|
/**
|
|
439
|
-
* Kinde
|
|
430
|
+
* Kinde organisation id.
|
|
440
431
|
*/
|
|
441
432
|
org: string;
|
|
442
433
|
};
|
|
@@ -469,7 +460,7 @@ export type M2mCreateCustomerData = {
|
|
|
469
460
|
body: CreateCustomerRequest;
|
|
470
461
|
path: {
|
|
471
462
|
/**
|
|
472
|
-
* Kinde
|
|
463
|
+
* Kinde organisation id.
|
|
473
464
|
*/
|
|
474
465
|
org: string;
|
|
475
466
|
};
|
|
@@ -509,7 +500,7 @@ export type M2mUpdatePlanData = {
|
|
|
509
500
|
body: UpdatePlan;
|
|
510
501
|
path: {
|
|
511
502
|
/**
|
|
512
|
-
* Kinde
|
|
503
|
+
* Kinde organisation id.
|
|
513
504
|
*/
|
|
514
505
|
org: string;
|
|
515
506
|
};
|