shoal-web-sdk 1.0.97 → 1.0.98
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 +29 -1
- package/dist/sdk/billing/@tanstack/react-query.gen.js +19 -1
- package/dist/sdk/billing/sdk.gen.d.ts +5 -1
- package/dist/sdk/billing/sdk.gen.js +15 -0
- package/dist/sdk/billing/types.gen.d.ts +65 -25
- package/dist/sdk/billing/zod.gen.d.ts +190 -122
- package/dist/sdk/billing/zod.gen.js +52 -32
- package/dist/tanstack-codegen/generated/billing.d.ts +208 -1
- package/dist/tanstack-codegen/generated/billing.js +23 -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, M2mCreateCustomerData, M2mCreateCustomerError, M2mGetCustomerData, M2mUpdatePlanData, M2mUpdatePlanError, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodError, UpdateDefaultPaymentMethodResponse, UpdatePlanData, UpdatePlanError } from '../types.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';
|
|
4
4
|
export type QueryKey<TOptions extends Options> = [
|
|
5
5
|
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
|
6
6
|
_id: string;
|
|
@@ -36,6 +36,34 @@ export declare const getCustomerOptions: (options: Options<GetCustomerData>) =>
|
|
|
36
36
|
[dataTagErrorSymbol]: Error;
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
+
export declare const getUsageQueryKey: (options: Options<GetUsageData>) => [Pick<Options<GetUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
40
|
+
_id: string;
|
|
41
|
+
_infinite?: boolean;
|
|
42
|
+
tags?: ReadonlyArray<string>;
|
|
43
|
+
}];
|
|
44
|
+
/**
|
|
45
|
+
* Returns usage information for the current billing period.
|
|
46
|
+
*/
|
|
47
|
+
export declare const getUsageOptions: (options: Options<GetUsageData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").UsageInfoResponse, Error, import("../types.gen").UsageInfoResponse, [Pick<Options<GetUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
48
|
+
_id: string;
|
|
49
|
+
_infinite?: boolean;
|
|
50
|
+
tags?: ReadonlyArray<string>;
|
|
51
|
+
}]>, "queryFn"> & {
|
|
52
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").UsageInfoResponse, [Pick<Options<GetUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
53
|
+
_id: string;
|
|
54
|
+
_infinite?: boolean;
|
|
55
|
+
tags?: ReadonlyArray<string>;
|
|
56
|
+
}], never> | undefined;
|
|
57
|
+
} & {
|
|
58
|
+
queryKey: [Pick<Options<GetUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
59
|
+
_id: string;
|
|
60
|
+
_infinite?: boolean;
|
|
61
|
+
tags?: ReadonlyArray<string>;
|
|
62
|
+
}] & {
|
|
63
|
+
[dataTagSymbol]: import("../types.gen").UsageInfoResponse;
|
|
64
|
+
[dataTagErrorSymbol]: Error;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
39
67
|
export declare const getPlansQueryKey: (options?: Options<GetPlansData>) => [Pick<Options<GetPlansData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
40
68
|
_id: string;
|
|
41
69
|
_infinite?: boolean;
|
|
@@ -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, m2mCreateCustomer, m2mGetCustomer, m2mUpdatePlan, updateDefaultPaymentMethod, updatePlan } from '../sdk.gen';
|
|
4
|
+
import { 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) {
|
|
@@ -44,6 +44,24 @@ export const getCustomerOptions = (options) => {
|
|
|
44
44
|
queryKey: getCustomerQueryKey(options)
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
|
+
export const getUsageQueryKey = (options) => createQueryKey('getUsage', options);
|
|
48
|
+
/**
|
|
49
|
+
* Returns usage information for the current billing period.
|
|
50
|
+
*/
|
|
51
|
+
export const getUsageOptions = (options) => {
|
|
52
|
+
return queryOptions({
|
|
53
|
+
queryFn: async ({ queryKey, signal }) => {
|
|
54
|
+
const { data } = await getUsage({
|
|
55
|
+
...options,
|
|
56
|
+
...queryKey[0],
|
|
57
|
+
signal,
|
|
58
|
+
throwOnError: true
|
|
59
|
+
});
|
|
60
|
+
return data;
|
|
61
|
+
},
|
|
62
|
+
queryKey: getUsageQueryKey(options)
|
|
63
|
+
});
|
|
64
|
+
};
|
|
47
65
|
export const getPlansQueryKey = (options) => createQueryKey('getPlans', options);
|
|
48
66
|
/**
|
|
49
67
|
* Returns a list of available pricing plans.
|
|
@@ -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, M2mCreateCustomerData, M2mCreateCustomerErrors, M2mCreateCustomerResponses, M2mGetCustomerData, M2mGetCustomerErrors, M2mGetCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanErrors, M2mUpdatePlanResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodErrors, UpdateDefaultPaymentMethodResponses, UpdatePlanData, UpdatePlanErrors, UpdatePlanResponses } from './types.gen';
|
|
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';
|
|
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
|
|
@@ -17,6 +17,10 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
17
17
|
* Fetch all related customer information for a given org.
|
|
18
18
|
*/
|
|
19
19
|
export declare const getCustomer: <ThrowOnError extends boolean = false>(options: Options<GetCustomerData, ThrowOnError>) => import("./client").RequestResult<GetCustomerResponses, GetCustomerErrors, ThrowOnError, "fields">;
|
|
20
|
+
/**
|
|
21
|
+
* Returns usage information for the current billing period.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getUsage: <ThrowOnError extends boolean = false>(options: Options<GetUsageData, ThrowOnError>) => import("./client").RequestResult<GetUsageResponses, GetUsageErrors, ThrowOnError, "fields">;
|
|
20
24
|
/**
|
|
21
25
|
* Returns a list of available pricing plans.
|
|
22
26
|
*/
|
|
@@ -15,6 +15,21 @@ export const getCustomer = (options) => {
|
|
|
15
15
|
...options
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Returns usage information for the current billing period.
|
|
20
|
+
*/
|
|
21
|
+
export const getUsage = (options) => {
|
|
22
|
+
return (options.client ?? client).get({
|
|
23
|
+
security: [
|
|
24
|
+
{
|
|
25
|
+
scheme: 'bearer',
|
|
26
|
+
type: 'http'
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
url: '/api/v1/usage/{org}',
|
|
30
|
+
...options
|
|
31
|
+
});
|
|
32
|
+
};
|
|
18
33
|
/**
|
|
19
34
|
* Returns a list of available pricing plans.
|
|
20
35
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type ClientOptions = {
|
|
2
2
|
baseUrl: 'http://localhost:8080/billing-service' | (string & {});
|
|
3
3
|
};
|
|
4
|
+
export type Currency = 'GBP' | 'USD';
|
|
4
5
|
export type _Error = {
|
|
5
6
|
error: string;
|
|
6
7
|
};
|
|
@@ -44,7 +45,6 @@ export type PlanResponse = {
|
|
|
44
45
|
githubOrganizationIntegration?: BooleanPlanFeatureResponse;
|
|
45
46
|
};
|
|
46
47
|
pricing?: PricesResponse;
|
|
47
|
-
categories?: CategoriesResponse;
|
|
48
48
|
trial?: PlanTrialResponse;
|
|
49
49
|
readonly isSelfServe: boolean;
|
|
50
50
|
readonly isActive: boolean;
|
|
@@ -58,20 +58,6 @@ export type PlanPriceResponse = {
|
|
|
58
58
|
readonly currency: string;
|
|
59
59
|
readonly amount: number;
|
|
60
60
|
};
|
|
61
|
-
export type CategoriesResponse = {
|
|
62
|
-
default: CategoryResponse;
|
|
63
|
-
};
|
|
64
|
-
export type CategoryAllowanceResponse = {
|
|
65
|
-
readonly refreshAmount: number;
|
|
66
|
-
refreshPeriod: CategoryPeriodResponse;
|
|
67
|
-
readonly isActive: boolean;
|
|
68
|
-
readonly isCarryOver: boolean;
|
|
69
|
-
};
|
|
70
|
-
export type CategoryResponse = {
|
|
71
|
-
readonly displayName: string;
|
|
72
|
-
readonly displayDescription?: string;
|
|
73
|
-
allowance: CategoryAllowanceResponse;
|
|
74
|
-
};
|
|
75
61
|
export type PlanTrialResponse = {
|
|
76
62
|
readonly lengthInDays: number;
|
|
77
63
|
readonly startingBonusCents: number;
|
|
@@ -151,6 +137,28 @@ export type CustomerResponse = {
|
|
|
151
137
|
readonly paymentMethods: Array<PaymentMethodSummary>;
|
|
152
138
|
readonly upcomingInvoiceTotalCents?: number;
|
|
153
139
|
};
|
|
140
|
+
export type UsageInfoResponse = {
|
|
141
|
+
meters: Meters;
|
|
142
|
+
total: unknown;
|
|
143
|
+
from: string;
|
|
144
|
+
to: string;
|
|
145
|
+
};
|
|
146
|
+
export type MeterType = {
|
|
147
|
+
displayName: string;
|
|
148
|
+
total: unknown;
|
|
149
|
+
values: Array<unknown>;
|
|
150
|
+
};
|
|
151
|
+
export type Meters = {
|
|
152
|
+
computeVms: MeterType;
|
|
153
|
+
appHosting: MeterType;
|
|
154
|
+
databaseStorage: MeterType;
|
|
155
|
+
networkingSecurity: MeterType;
|
|
156
|
+
observability: MeterType;
|
|
157
|
+
platformServices: MeterType;
|
|
158
|
+
aiMlApis: MeterType;
|
|
159
|
+
marketplaceLicences: MeterType;
|
|
160
|
+
infraOverhead: MeterType;
|
|
161
|
+
};
|
|
154
162
|
export type CatalogResponseWritable = {
|
|
155
163
|
[key: string]: unknown;
|
|
156
164
|
};
|
|
@@ -184,20 +192,10 @@ export type PlanResponseWritable = {
|
|
|
184
192
|
maximumEnvironments?: IntegerPlanFeatureResponseWritable;
|
|
185
193
|
githubOrganizationIntegration?: BooleanPlanFeatureResponseWritable;
|
|
186
194
|
};
|
|
187
|
-
categories?: CategoriesResponseWritable;
|
|
188
195
|
};
|
|
189
196
|
export type PricesResponseWritable = {
|
|
190
197
|
[key: string]: unknown;
|
|
191
198
|
};
|
|
192
|
-
export type CategoriesResponseWritable = {
|
|
193
|
-
default: CategoryResponseWritable;
|
|
194
|
-
};
|
|
195
|
-
export type CategoryAllowanceResponseWritable = {
|
|
196
|
-
[key: string]: unknown;
|
|
197
|
-
};
|
|
198
|
-
export type CategoryResponseWritable = {
|
|
199
|
-
allowance: CategoryAllowanceResponseWritable;
|
|
200
|
-
};
|
|
201
199
|
export type CustomerPlanResponseWritable = {
|
|
202
200
|
interval?: BillingInterval;
|
|
203
201
|
};
|
|
@@ -214,6 +212,10 @@ export type PaymentMethodId = string;
|
|
|
214
212
|
* Kinde organisation id.
|
|
215
213
|
*/
|
|
216
214
|
export type OrganisationId = string;
|
|
215
|
+
/**
|
|
216
|
+
* A valid currency.
|
|
217
|
+
*/
|
|
218
|
+
export type Currency2 = Currency;
|
|
217
219
|
export type GetCustomerData = {
|
|
218
220
|
body?: never;
|
|
219
221
|
path: {
|
|
@@ -247,6 +249,44 @@ export type GetCustomerResponses = {
|
|
|
247
249
|
200: CustomerResponse;
|
|
248
250
|
};
|
|
249
251
|
export type GetCustomerResponse = GetCustomerResponses[keyof GetCustomerResponses];
|
|
252
|
+
export type GetUsageData = {
|
|
253
|
+
body?: never;
|
|
254
|
+
path: {
|
|
255
|
+
/**
|
|
256
|
+
* Kinde organisation id.
|
|
257
|
+
*/
|
|
258
|
+
org: string;
|
|
259
|
+
};
|
|
260
|
+
query: {
|
|
261
|
+
/**
|
|
262
|
+
* A valid currency.
|
|
263
|
+
*/
|
|
264
|
+
currency: Currency;
|
|
265
|
+
};
|
|
266
|
+
url: '/api/v1/usage/{org}';
|
|
267
|
+
};
|
|
268
|
+
export type GetUsageErrors = {
|
|
269
|
+
/**
|
|
270
|
+
* Invalid currency
|
|
271
|
+
*/
|
|
272
|
+
400: _Error;
|
|
273
|
+
/**
|
|
274
|
+
* Unauthorised user
|
|
275
|
+
*/
|
|
276
|
+
401: _Error;
|
|
277
|
+
/**
|
|
278
|
+
* Internal error
|
|
279
|
+
*/
|
|
280
|
+
500: _Error;
|
|
281
|
+
};
|
|
282
|
+
export type GetUsageError = GetUsageErrors[keyof GetUsageErrors];
|
|
283
|
+
export type GetUsageResponses = {
|
|
284
|
+
/**
|
|
285
|
+
* Usage
|
|
286
|
+
*/
|
|
287
|
+
200: UsageInfoResponse;
|
|
288
|
+
};
|
|
289
|
+
export type GetUsageResponse = GetUsageResponses[keyof GetUsageResponses];
|
|
250
290
|
export type GetPlansData = {
|
|
251
291
|
body?: never;
|
|
252
292
|
path?: never;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const zCurrency: z.ZodEnum<{
|
|
3
|
+
GBP: "GBP";
|
|
4
|
+
USD: "USD";
|
|
5
|
+
}>;
|
|
2
6
|
export declare const zError: z.ZodObject<{
|
|
3
7
|
error: z.ZodString;
|
|
4
8
|
}, z.core.$strip>;
|
|
@@ -103,59 +107,6 @@ export declare const zBooleanPlanFeatureResponse: z.ZodUnion<readonly [z.ZodInte
|
|
|
103
107
|
disabled: "disabled";
|
|
104
108
|
}>;
|
|
105
109
|
}, z.core.$strip>>>]>;
|
|
106
|
-
export declare const zCategoryPeriodResponse: z.ZodEnum<{
|
|
107
|
-
day: "day";
|
|
108
|
-
week: "week";
|
|
109
|
-
month: "month";
|
|
110
|
-
year: "year";
|
|
111
|
-
onetime: "onetime";
|
|
112
|
-
}>;
|
|
113
|
-
export declare const zCategoryAllowanceResponse: z.ZodObject<{
|
|
114
|
-
refreshAmount: z.ZodReadonly<z.ZodInt>;
|
|
115
|
-
refreshPeriod: z.ZodEnum<{
|
|
116
|
-
day: "day";
|
|
117
|
-
week: "week";
|
|
118
|
-
month: "month";
|
|
119
|
-
year: "year";
|
|
120
|
-
onetime: "onetime";
|
|
121
|
-
}>;
|
|
122
|
-
isActive: z.ZodReadonly<z.ZodBoolean>;
|
|
123
|
-
isCarryOver: z.ZodReadonly<z.ZodBoolean>;
|
|
124
|
-
}, z.core.$strip>;
|
|
125
|
-
export declare const zCategoryResponse: z.ZodObject<{
|
|
126
|
-
displayName: z.ZodReadonly<z.ZodString>;
|
|
127
|
-
displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
|
|
128
|
-
allowance: z.ZodObject<{
|
|
129
|
-
refreshAmount: z.ZodReadonly<z.ZodInt>;
|
|
130
|
-
refreshPeriod: z.ZodEnum<{
|
|
131
|
-
day: "day";
|
|
132
|
-
week: "week";
|
|
133
|
-
month: "month";
|
|
134
|
-
year: "year";
|
|
135
|
-
onetime: "onetime";
|
|
136
|
-
}>;
|
|
137
|
-
isActive: z.ZodReadonly<z.ZodBoolean>;
|
|
138
|
-
isCarryOver: z.ZodReadonly<z.ZodBoolean>;
|
|
139
|
-
}, z.core.$strip>;
|
|
140
|
-
}, z.core.$strip>;
|
|
141
|
-
export declare const zCategoriesResponse: z.ZodObject<{
|
|
142
|
-
default: z.ZodObject<{
|
|
143
|
-
displayName: z.ZodReadonly<z.ZodString>;
|
|
144
|
-
displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
|
|
145
|
-
allowance: z.ZodObject<{
|
|
146
|
-
refreshAmount: z.ZodReadonly<z.ZodInt>;
|
|
147
|
-
refreshPeriod: z.ZodEnum<{
|
|
148
|
-
day: "day";
|
|
149
|
-
week: "week";
|
|
150
|
-
month: "month";
|
|
151
|
-
year: "year";
|
|
152
|
-
onetime: "onetime";
|
|
153
|
-
}>;
|
|
154
|
-
isActive: z.ZodReadonly<z.ZodBoolean>;
|
|
155
|
-
isCarryOver: z.ZodReadonly<z.ZodBoolean>;
|
|
156
|
-
}, z.core.$strip>;
|
|
157
|
-
}, z.core.$strip>;
|
|
158
|
-
}, z.core.$strip>;
|
|
159
110
|
export declare const zPlanResponse: z.ZodObject<{
|
|
160
111
|
key: z.ZodReadonly<z.ZodString>;
|
|
161
112
|
rank: z.ZodReadonly<z.ZodInt>;
|
|
@@ -252,24 +203,6 @@ export declare const zPlanResponse: z.ZodObject<{
|
|
|
252
203
|
amount: z.ZodReadonly<z.ZodInt>;
|
|
253
204
|
}, z.core.$strip>;
|
|
254
205
|
}, z.core.$strip>>;
|
|
255
|
-
categories: z.ZodOptional<z.ZodObject<{
|
|
256
|
-
default: z.ZodObject<{
|
|
257
|
-
displayName: z.ZodReadonly<z.ZodString>;
|
|
258
|
-
displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
|
|
259
|
-
allowance: z.ZodObject<{
|
|
260
|
-
refreshAmount: z.ZodReadonly<z.ZodInt>;
|
|
261
|
-
refreshPeriod: z.ZodEnum<{
|
|
262
|
-
day: "day";
|
|
263
|
-
week: "week";
|
|
264
|
-
month: "month";
|
|
265
|
-
year: "year";
|
|
266
|
-
onetime: "onetime";
|
|
267
|
-
}>;
|
|
268
|
-
isActive: z.ZodReadonly<z.ZodBoolean>;
|
|
269
|
-
isCarryOver: z.ZodReadonly<z.ZodBoolean>;
|
|
270
|
-
}, z.core.$strip>;
|
|
271
|
-
}, z.core.$strip>;
|
|
272
|
-
}, z.core.$strip>>;
|
|
273
206
|
trial: z.ZodOptional<z.ZodObject<{
|
|
274
207
|
lengthInDays: z.ZodReadonly<z.ZodInt>;
|
|
275
208
|
startingBonusCents: z.ZodReadonly<z.ZodInt>;
|
|
@@ -376,24 +309,6 @@ export declare const zCatalogResponse: z.ZodObject<{
|
|
|
376
309
|
amount: z.ZodReadonly<z.ZodInt>;
|
|
377
310
|
}, z.core.$strip>;
|
|
378
311
|
}, z.core.$strip>>;
|
|
379
|
-
categories: z.ZodOptional<z.ZodObject<{
|
|
380
|
-
default: z.ZodObject<{
|
|
381
|
-
displayName: z.ZodReadonly<z.ZodString>;
|
|
382
|
-
displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
|
|
383
|
-
allowance: z.ZodObject<{
|
|
384
|
-
refreshAmount: z.ZodReadonly<z.ZodInt>;
|
|
385
|
-
refreshPeriod: z.ZodEnum<{
|
|
386
|
-
day: "day";
|
|
387
|
-
week: "week";
|
|
388
|
-
month: "month";
|
|
389
|
-
year: "year";
|
|
390
|
-
onetime: "onetime";
|
|
391
|
-
}>;
|
|
392
|
-
isActive: z.ZodReadonly<z.ZodBoolean>;
|
|
393
|
-
isCarryOver: z.ZodReadonly<z.ZodBoolean>;
|
|
394
|
-
}, z.core.$strip>;
|
|
395
|
-
}, z.core.$strip>;
|
|
396
|
-
}, z.core.$strip>>;
|
|
397
312
|
trial: z.ZodOptional<z.ZodObject<{
|
|
398
313
|
lengthInDays: z.ZodReadonly<z.ZodInt>;
|
|
399
314
|
startingBonusCents: z.ZodReadonly<z.ZodInt>;
|
|
@@ -404,6 +319,13 @@ export declare const zCatalogResponse: z.ZodObject<{
|
|
|
404
319
|
isVisible: z.ZodReadonly<z.ZodBoolean>;
|
|
405
320
|
}, z.core.$strip>>>;
|
|
406
321
|
}, z.core.$strip>;
|
|
322
|
+
export declare const zCategoryPeriodResponse: z.ZodEnum<{
|
|
323
|
+
day: "day";
|
|
324
|
+
week: "week";
|
|
325
|
+
month: "month";
|
|
326
|
+
year: "year";
|
|
327
|
+
onetime: "onetime";
|
|
328
|
+
}>;
|
|
407
329
|
export declare const zBillingInterval: z.ZodEnum<{
|
|
408
330
|
monthly: "monthly";
|
|
409
331
|
annual: "annual";
|
|
@@ -787,6 +709,110 @@ export declare const zCustomerResponse: z.ZodObject<{
|
|
|
787
709
|
}, z.core.$strip>>>;
|
|
788
710
|
upcomingInvoiceTotalCents: z.ZodOptional<z.ZodReadonly<z.ZodInt>>;
|
|
789
711
|
}, z.core.$strip>;
|
|
712
|
+
export declare const zMeterType: z.ZodObject<{
|
|
713
|
+
displayName: z.ZodString;
|
|
714
|
+
total: z.ZodUnknown;
|
|
715
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
716
|
+
}, z.core.$strip>;
|
|
717
|
+
export declare const zMeters: z.ZodObject<{
|
|
718
|
+
computeVms: z.ZodObject<{
|
|
719
|
+
displayName: z.ZodString;
|
|
720
|
+
total: z.ZodUnknown;
|
|
721
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
722
|
+
}, z.core.$strip>;
|
|
723
|
+
appHosting: z.ZodObject<{
|
|
724
|
+
displayName: z.ZodString;
|
|
725
|
+
total: z.ZodUnknown;
|
|
726
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
727
|
+
}, z.core.$strip>;
|
|
728
|
+
databaseStorage: z.ZodObject<{
|
|
729
|
+
displayName: z.ZodString;
|
|
730
|
+
total: z.ZodUnknown;
|
|
731
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
732
|
+
}, z.core.$strip>;
|
|
733
|
+
networkingSecurity: z.ZodObject<{
|
|
734
|
+
displayName: z.ZodString;
|
|
735
|
+
total: z.ZodUnknown;
|
|
736
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
737
|
+
}, z.core.$strip>;
|
|
738
|
+
observability: z.ZodObject<{
|
|
739
|
+
displayName: z.ZodString;
|
|
740
|
+
total: z.ZodUnknown;
|
|
741
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
742
|
+
}, z.core.$strip>;
|
|
743
|
+
platformServices: z.ZodObject<{
|
|
744
|
+
displayName: z.ZodString;
|
|
745
|
+
total: z.ZodUnknown;
|
|
746
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
747
|
+
}, z.core.$strip>;
|
|
748
|
+
aiMlApis: z.ZodObject<{
|
|
749
|
+
displayName: z.ZodString;
|
|
750
|
+
total: z.ZodUnknown;
|
|
751
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
752
|
+
}, z.core.$strip>;
|
|
753
|
+
marketplaceLicences: z.ZodObject<{
|
|
754
|
+
displayName: z.ZodString;
|
|
755
|
+
total: z.ZodUnknown;
|
|
756
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
757
|
+
}, z.core.$strip>;
|
|
758
|
+
infraOverhead: z.ZodObject<{
|
|
759
|
+
displayName: z.ZodString;
|
|
760
|
+
total: z.ZodUnknown;
|
|
761
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
762
|
+
}, z.core.$strip>;
|
|
763
|
+
}, z.core.$strip>;
|
|
764
|
+
export declare const zUsageInfoResponse: z.ZodObject<{
|
|
765
|
+
meters: z.ZodObject<{
|
|
766
|
+
computeVms: z.ZodObject<{
|
|
767
|
+
displayName: z.ZodString;
|
|
768
|
+
total: z.ZodUnknown;
|
|
769
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
770
|
+
}, z.core.$strip>;
|
|
771
|
+
appHosting: z.ZodObject<{
|
|
772
|
+
displayName: z.ZodString;
|
|
773
|
+
total: z.ZodUnknown;
|
|
774
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
775
|
+
}, z.core.$strip>;
|
|
776
|
+
databaseStorage: z.ZodObject<{
|
|
777
|
+
displayName: z.ZodString;
|
|
778
|
+
total: z.ZodUnknown;
|
|
779
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
780
|
+
}, z.core.$strip>;
|
|
781
|
+
networkingSecurity: z.ZodObject<{
|
|
782
|
+
displayName: z.ZodString;
|
|
783
|
+
total: z.ZodUnknown;
|
|
784
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
785
|
+
}, z.core.$strip>;
|
|
786
|
+
observability: z.ZodObject<{
|
|
787
|
+
displayName: z.ZodString;
|
|
788
|
+
total: z.ZodUnknown;
|
|
789
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
790
|
+
}, z.core.$strip>;
|
|
791
|
+
platformServices: z.ZodObject<{
|
|
792
|
+
displayName: z.ZodString;
|
|
793
|
+
total: z.ZodUnknown;
|
|
794
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
795
|
+
}, z.core.$strip>;
|
|
796
|
+
aiMlApis: z.ZodObject<{
|
|
797
|
+
displayName: z.ZodString;
|
|
798
|
+
total: z.ZodUnknown;
|
|
799
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
800
|
+
}, z.core.$strip>;
|
|
801
|
+
marketplaceLicences: z.ZodObject<{
|
|
802
|
+
displayName: z.ZodString;
|
|
803
|
+
total: z.ZodUnknown;
|
|
804
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
805
|
+
}, z.core.$strip>;
|
|
806
|
+
infraOverhead: z.ZodObject<{
|
|
807
|
+
displayName: z.ZodString;
|
|
808
|
+
total: z.ZodUnknown;
|
|
809
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
810
|
+
}, z.core.$strip>;
|
|
811
|
+
}, z.core.$strip>;
|
|
812
|
+
total: z.ZodUnknown;
|
|
813
|
+
from: z.ZodISODateTime;
|
|
814
|
+
to: z.ZodISODateTime;
|
|
815
|
+
}, z.core.$strip>;
|
|
790
816
|
export declare const zCatalogResponseWritable: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
791
817
|
export declare const zLimitedIntegerPlanFeatureResponseWritable: z.ZodObject<{
|
|
792
818
|
type: z.ZodEnum<{
|
|
@@ -836,16 +862,6 @@ export declare const zBooleanPlanFeatureResponseWritable: z.ZodUnion<readonly [z
|
|
|
836
862
|
disabled: "disabled";
|
|
837
863
|
}>;
|
|
838
864
|
}, z.core.$strip>>]>;
|
|
839
|
-
export declare const zPricesResponseWritable: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
840
|
-
export declare const zCategoryAllowanceResponseWritable: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
841
|
-
export declare const zCategoryResponseWritable: z.ZodObject<{
|
|
842
|
-
allowance: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
843
|
-
}, z.core.$strip>;
|
|
844
|
-
export declare const zCategoriesResponseWritable: z.ZodObject<{
|
|
845
|
-
default: z.ZodObject<{
|
|
846
|
-
allowance: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
847
|
-
}, z.core.$strip>;
|
|
848
|
-
}, z.core.$strip>;
|
|
849
865
|
export declare const zPlanResponseWritable: z.ZodObject<{
|
|
850
866
|
features: z.ZodObject<{
|
|
851
867
|
maximumSeats: z.ZodOptional<z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
|
|
@@ -904,12 +920,8 @@ export declare const zPlanResponseWritable: z.ZodObject<{
|
|
|
904
920
|
}>;
|
|
905
921
|
}, z.core.$strip>>]>>;
|
|
906
922
|
}, z.core.$strip>;
|
|
907
|
-
categories: z.ZodOptional<z.ZodObject<{
|
|
908
|
-
default: z.ZodObject<{
|
|
909
|
-
allowance: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
910
|
-
}, z.core.$strip>;
|
|
911
|
-
}, z.core.$strip>>;
|
|
912
923
|
}, z.core.$strip>;
|
|
924
|
+
export declare const zPricesResponseWritable: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
913
925
|
export declare const zCustomerPlanResponseWritable: z.ZodObject<{
|
|
914
926
|
interval: z.ZodOptional<z.ZodEnum<{
|
|
915
927
|
monthly: "monthly";
|
|
@@ -944,6 +956,13 @@ export declare const zPaymentMethodId: z.ZodString;
|
|
|
944
956
|
* Kinde organisation id.
|
|
945
957
|
*/
|
|
946
958
|
export declare const zOrganisationId: z.ZodString;
|
|
959
|
+
/**
|
|
960
|
+
* A valid currency.
|
|
961
|
+
*/
|
|
962
|
+
export declare const zCurrency2: z.ZodEnum<{
|
|
963
|
+
GBP: "GBP";
|
|
964
|
+
USD: "USD";
|
|
965
|
+
}>;
|
|
947
966
|
export declare const zGetCustomerData: z.ZodObject<{
|
|
948
967
|
body: z.ZodOptional<z.ZodNever>;
|
|
949
968
|
path: z.ZodObject<{
|
|
@@ -1166,6 +1185,73 @@ export declare const zGetCustomerResponse: z.ZodObject<{
|
|
|
1166
1185
|
}, z.core.$strip>>>;
|
|
1167
1186
|
upcomingInvoiceTotalCents: z.ZodOptional<z.ZodReadonly<z.ZodInt>>;
|
|
1168
1187
|
}, z.core.$strip>;
|
|
1188
|
+
export declare const zGetUsageData: z.ZodObject<{
|
|
1189
|
+
body: z.ZodOptional<z.ZodNever>;
|
|
1190
|
+
path: z.ZodObject<{
|
|
1191
|
+
org: z.ZodString;
|
|
1192
|
+
}, z.core.$strip>;
|
|
1193
|
+
query: z.ZodObject<{
|
|
1194
|
+
currency: z.ZodEnum<{
|
|
1195
|
+
GBP: "GBP";
|
|
1196
|
+
USD: "USD";
|
|
1197
|
+
}>;
|
|
1198
|
+
}, z.core.$strip>;
|
|
1199
|
+
}, z.core.$strip>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Usage
|
|
1202
|
+
*/
|
|
1203
|
+
export declare const zGetUsageResponse: z.ZodObject<{
|
|
1204
|
+
meters: z.ZodObject<{
|
|
1205
|
+
computeVms: z.ZodObject<{
|
|
1206
|
+
displayName: z.ZodString;
|
|
1207
|
+
total: z.ZodUnknown;
|
|
1208
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
1209
|
+
}, z.core.$strip>;
|
|
1210
|
+
appHosting: z.ZodObject<{
|
|
1211
|
+
displayName: z.ZodString;
|
|
1212
|
+
total: z.ZodUnknown;
|
|
1213
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
1214
|
+
}, z.core.$strip>;
|
|
1215
|
+
databaseStorage: z.ZodObject<{
|
|
1216
|
+
displayName: z.ZodString;
|
|
1217
|
+
total: z.ZodUnknown;
|
|
1218
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
1219
|
+
}, z.core.$strip>;
|
|
1220
|
+
networkingSecurity: z.ZodObject<{
|
|
1221
|
+
displayName: z.ZodString;
|
|
1222
|
+
total: z.ZodUnknown;
|
|
1223
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
1224
|
+
}, z.core.$strip>;
|
|
1225
|
+
observability: z.ZodObject<{
|
|
1226
|
+
displayName: z.ZodString;
|
|
1227
|
+
total: z.ZodUnknown;
|
|
1228
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
1229
|
+
}, z.core.$strip>;
|
|
1230
|
+
platformServices: z.ZodObject<{
|
|
1231
|
+
displayName: z.ZodString;
|
|
1232
|
+
total: z.ZodUnknown;
|
|
1233
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
1234
|
+
}, z.core.$strip>;
|
|
1235
|
+
aiMlApis: z.ZodObject<{
|
|
1236
|
+
displayName: z.ZodString;
|
|
1237
|
+
total: z.ZodUnknown;
|
|
1238
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
1239
|
+
}, z.core.$strip>;
|
|
1240
|
+
marketplaceLicences: z.ZodObject<{
|
|
1241
|
+
displayName: z.ZodString;
|
|
1242
|
+
total: z.ZodUnknown;
|
|
1243
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
1244
|
+
}, z.core.$strip>;
|
|
1245
|
+
infraOverhead: z.ZodObject<{
|
|
1246
|
+
displayName: z.ZodString;
|
|
1247
|
+
total: z.ZodUnknown;
|
|
1248
|
+
values: z.ZodArray<z.ZodUnknown>;
|
|
1249
|
+
}, z.core.$strip>;
|
|
1250
|
+
}, z.core.$strip>;
|
|
1251
|
+
total: z.ZodUnknown;
|
|
1252
|
+
from: z.ZodISODateTime;
|
|
1253
|
+
to: z.ZodISODateTime;
|
|
1254
|
+
}, z.core.$strip>;
|
|
1169
1255
|
export declare const zGetPlansData: z.ZodObject<{
|
|
1170
1256
|
body: z.ZodOptional<z.ZodNever>;
|
|
1171
1257
|
path: z.ZodOptional<z.ZodNever>;
|
|
@@ -1271,24 +1357,6 @@ export declare const zGetPlansResponse: z.ZodObject<{
|
|
|
1271
1357
|
amount: z.ZodReadonly<z.ZodInt>;
|
|
1272
1358
|
}, z.core.$strip>;
|
|
1273
1359
|
}, z.core.$strip>>;
|
|
1274
|
-
categories: z.ZodOptional<z.ZodObject<{
|
|
1275
|
-
default: z.ZodObject<{
|
|
1276
|
-
displayName: z.ZodReadonly<z.ZodString>;
|
|
1277
|
-
displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
|
|
1278
|
-
allowance: z.ZodObject<{
|
|
1279
|
-
refreshAmount: z.ZodReadonly<z.ZodInt>;
|
|
1280
|
-
refreshPeriod: z.ZodEnum<{
|
|
1281
|
-
day: "day";
|
|
1282
|
-
week: "week";
|
|
1283
|
-
month: "month";
|
|
1284
|
-
year: "year";
|
|
1285
|
-
onetime: "onetime";
|
|
1286
|
-
}>;
|
|
1287
|
-
isActive: z.ZodReadonly<z.ZodBoolean>;
|
|
1288
|
-
isCarryOver: z.ZodReadonly<z.ZodBoolean>;
|
|
1289
|
-
}, z.core.$strip>;
|
|
1290
|
-
}, z.core.$strip>;
|
|
1291
|
-
}, z.core.$strip>>;
|
|
1292
1360
|
trial: z.ZodOptional<z.ZodObject<{
|
|
1293
1361
|
lengthInDays: z.ZodReadonly<z.ZodInt>;
|
|
1294
1362
|
startingBonusCents: z.ZodReadonly<z.ZodInt>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
export const zCurrency = z.enum([
|
|
4
|
+
'GBP',
|
|
5
|
+
'USD'
|
|
6
|
+
]);
|
|
3
7
|
export const zError = z.object({
|
|
4
8
|
error: z.string()
|
|
5
9
|
});
|
|
@@ -59,27 +63,6 @@ export const zBooleanPlanFeatureResponse = z.union([
|
|
|
59
63
|
type: z.literal('disabled')
|
|
60
64
|
}).and(zDisabledBooleanPlanFeatureResponse)
|
|
61
65
|
]);
|
|
62
|
-
export const zCategoryPeriodResponse = z.enum([
|
|
63
|
-
'day',
|
|
64
|
-
'week',
|
|
65
|
-
'month',
|
|
66
|
-
'year',
|
|
67
|
-
'onetime'
|
|
68
|
-
]);
|
|
69
|
-
export const zCategoryAllowanceResponse = z.object({
|
|
70
|
-
refreshAmount: z.int().readonly(),
|
|
71
|
-
refreshPeriod: zCategoryPeriodResponse,
|
|
72
|
-
isActive: z.boolean().readonly(),
|
|
73
|
-
isCarryOver: z.boolean().readonly()
|
|
74
|
-
});
|
|
75
|
-
export const zCategoryResponse = z.object({
|
|
76
|
-
displayName: z.string().readonly(),
|
|
77
|
-
displayDescription: z.optional(z.string().readonly()),
|
|
78
|
-
allowance: zCategoryAllowanceResponse
|
|
79
|
-
});
|
|
80
|
-
export const zCategoriesResponse = z.object({
|
|
81
|
-
default: zCategoryResponse
|
|
82
|
-
});
|
|
83
66
|
export const zPlanResponse = z.object({
|
|
84
67
|
key: z.string().readonly(),
|
|
85
68
|
rank: z.int().readonly(),
|
|
@@ -92,7 +75,6 @@ export const zPlanResponse = z.object({
|
|
|
92
75
|
githubOrganizationIntegration: z.optional(zBooleanPlanFeatureResponse)
|
|
93
76
|
}),
|
|
94
77
|
pricing: z.optional(zPricesResponse),
|
|
95
|
-
categories: z.optional(zCategoriesResponse),
|
|
96
78
|
trial: z.optional(zPlanTrialResponse),
|
|
97
79
|
isSelfServe: z.boolean().readonly(),
|
|
98
80
|
isActive: z.boolean().readonly(),
|
|
@@ -101,6 +83,13 @@ export const zPlanResponse = z.object({
|
|
|
101
83
|
export const zCatalogResponse = z.object({
|
|
102
84
|
plans: z.array(zPlanResponse).readonly()
|
|
103
85
|
});
|
|
86
|
+
export const zCategoryPeriodResponse = z.enum([
|
|
87
|
+
'day',
|
|
88
|
+
'week',
|
|
89
|
+
'month',
|
|
90
|
+
'year',
|
|
91
|
+
'onetime'
|
|
92
|
+
]);
|
|
104
93
|
export const zBillingInterval = z.enum([
|
|
105
94
|
'monthly',
|
|
106
95
|
'annual'
|
|
@@ -183,6 +172,28 @@ export const zCustomerResponse = z.object({
|
|
|
183
172
|
paymentMethods: z.array(zPaymentMethodSummary).readonly(),
|
|
184
173
|
upcomingInvoiceTotalCents: z.optional(z.int().readonly())
|
|
185
174
|
});
|
|
175
|
+
export const zMeterType = z.object({
|
|
176
|
+
displayName: z.string(),
|
|
177
|
+
total: z.unknown(),
|
|
178
|
+
values: z.array(z.unknown())
|
|
179
|
+
});
|
|
180
|
+
export const zMeters = z.object({
|
|
181
|
+
computeVms: zMeterType,
|
|
182
|
+
appHosting: zMeterType,
|
|
183
|
+
databaseStorage: zMeterType,
|
|
184
|
+
networkingSecurity: zMeterType,
|
|
185
|
+
observability: zMeterType,
|
|
186
|
+
platformServices: zMeterType,
|
|
187
|
+
aiMlApis: zMeterType,
|
|
188
|
+
marketplaceLicences: zMeterType,
|
|
189
|
+
infraOverhead: zMeterType
|
|
190
|
+
});
|
|
191
|
+
export const zUsageInfoResponse = z.object({
|
|
192
|
+
meters: zMeters,
|
|
193
|
+
total: z.unknown(),
|
|
194
|
+
from: z.iso.datetime(),
|
|
195
|
+
to: z.iso.datetime()
|
|
196
|
+
});
|
|
186
197
|
export const zCatalogResponseWritable = z.record(z.string(), z.unknown());
|
|
187
198
|
export const zLimitedIntegerPlanFeatureResponseWritable = z.object({
|
|
188
199
|
type: z.enum([
|
|
@@ -217,23 +228,15 @@ export const zBooleanPlanFeatureResponseWritable = z.union([
|
|
|
217
228
|
type: z.literal('DisabledBooleanPlanFeatureResponseWritable')
|
|
218
229
|
}).and(zDisabledBooleanPlanFeatureResponseWritable)
|
|
219
230
|
]);
|
|
220
|
-
export const zPricesResponseWritable = z.record(z.string(), z.unknown());
|
|
221
|
-
export const zCategoryAllowanceResponseWritable = z.record(z.string(), z.unknown());
|
|
222
|
-
export const zCategoryResponseWritable = z.object({
|
|
223
|
-
allowance: zCategoryAllowanceResponseWritable
|
|
224
|
-
});
|
|
225
|
-
export const zCategoriesResponseWritable = z.object({
|
|
226
|
-
default: zCategoryResponseWritable
|
|
227
|
-
});
|
|
228
231
|
export const zPlanResponseWritable = z.object({
|
|
229
232
|
features: z.object({
|
|
230
233
|
maximumSeats: z.optional(zIntegerPlanFeatureResponseWritable),
|
|
231
234
|
maximumProjects: z.optional(zIntegerPlanFeatureResponseWritable),
|
|
232
235
|
maximumEnvironments: z.optional(zIntegerPlanFeatureResponseWritable),
|
|
233
236
|
githubOrganizationIntegration: z.optional(zBooleanPlanFeatureResponseWritable)
|
|
234
|
-
})
|
|
235
|
-
categories: z.optional(zCategoriesResponseWritable)
|
|
237
|
+
})
|
|
236
238
|
});
|
|
239
|
+
export const zPricesResponseWritable = z.record(z.string(), z.unknown());
|
|
237
240
|
export const zCustomerPlanResponseWritable = z.object({
|
|
238
241
|
interval: z.optional(zBillingInterval)
|
|
239
242
|
});
|
|
@@ -250,6 +253,10 @@ export const zPaymentMethodId = z.string();
|
|
|
250
253
|
* Kinde organisation id.
|
|
251
254
|
*/
|
|
252
255
|
export const zOrganisationId = z.string();
|
|
256
|
+
/**
|
|
257
|
+
* A valid currency.
|
|
258
|
+
*/
|
|
259
|
+
export const zCurrency2 = zCurrency;
|
|
253
260
|
export const zGetCustomerData = z.object({
|
|
254
261
|
body: z.optional(z.never()),
|
|
255
262
|
path: z.object({
|
|
@@ -261,6 +268,19 @@ export const zGetCustomerData = z.object({
|
|
|
261
268
|
* Customer billing state
|
|
262
269
|
*/
|
|
263
270
|
export const zGetCustomerResponse = zCustomerResponse;
|
|
271
|
+
export const zGetUsageData = z.object({
|
|
272
|
+
body: z.optional(z.never()),
|
|
273
|
+
path: z.object({
|
|
274
|
+
org: z.string()
|
|
275
|
+
}),
|
|
276
|
+
query: z.object({
|
|
277
|
+
currency: zCurrency
|
|
278
|
+
})
|
|
279
|
+
});
|
|
280
|
+
/**
|
|
281
|
+
* Usage
|
|
282
|
+
*/
|
|
283
|
+
export const zGetUsageResponse = zUsageInfoResponse;
|
|
264
284
|
export const zGetPlansData = z.object({
|
|
265
285
|
body: z.optional(z.never()),
|
|
266
286
|
path: z.optional(z.never()),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { GetSuccessResponse } from "../util";
|
|
3
|
-
import { GetCustomerData, 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, 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
|
}) => {
|
|
@@ -208,6 +208,213 @@ export declare const useGetCustomer: (options: Omit<GetCustomerData, "url"> & {
|
|
|
208
208
|
headers: Record<string, string>;
|
|
209
209
|
} | undefined>;
|
|
210
210
|
};
|
|
211
|
+
export declare const useGetUsage: (options: Omit<GetUsageData, "url"> & {
|
|
212
|
+
enabled?: boolean;
|
|
213
|
+
}) => {
|
|
214
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
215
|
+
headers: Record<string, string> | undefined;
|
|
216
|
+
error: Error;
|
|
217
|
+
isError: true;
|
|
218
|
+
isPending: false;
|
|
219
|
+
isLoading: false;
|
|
220
|
+
isLoadingError: false;
|
|
221
|
+
isRefetchError: true;
|
|
222
|
+
isSuccess: false;
|
|
223
|
+
isPlaceholderData: false;
|
|
224
|
+
status: "error";
|
|
225
|
+
dataUpdatedAt: number;
|
|
226
|
+
errorUpdatedAt: number;
|
|
227
|
+
failureCount: number;
|
|
228
|
+
failureReason: Error | null;
|
|
229
|
+
errorUpdateCount: number;
|
|
230
|
+
isFetched: boolean;
|
|
231
|
+
isFetchedAfterMount: boolean;
|
|
232
|
+
isFetching: boolean;
|
|
233
|
+
isInitialLoading: boolean;
|
|
234
|
+
isPaused: boolean;
|
|
235
|
+
isRefetching: boolean;
|
|
236
|
+
isStale: boolean;
|
|
237
|
+
isEnabled: boolean;
|
|
238
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
239
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
240
|
+
headers: Record<string, string>;
|
|
241
|
+
} | undefined, Error>>;
|
|
242
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
243
|
+
promise: Promise<{
|
|
244
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
245
|
+
headers: Record<string, string>;
|
|
246
|
+
} | undefined>;
|
|
247
|
+
} | {
|
|
248
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
249
|
+
headers: Record<string, string> | undefined;
|
|
250
|
+
error: null;
|
|
251
|
+
isError: false;
|
|
252
|
+
isPending: false;
|
|
253
|
+
isLoading: false;
|
|
254
|
+
isLoadingError: false;
|
|
255
|
+
isRefetchError: false;
|
|
256
|
+
isSuccess: true;
|
|
257
|
+
isPlaceholderData: false;
|
|
258
|
+
status: "success";
|
|
259
|
+
dataUpdatedAt: number;
|
|
260
|
+
errorUpdatedAt: number;
|
|
261
|
+
failureCount: number;
|
|
262
|
+
failureReason: Error | null;
|
|
263
|
+
errorUpdateCount: number;
|
|
264
|
+
isFetched: boolean;
|
|
265
|
+
isFetchedAfterMount: boolean;
|
|
266
|
+
isFetching: boolean;
|
|
267
|
+
isInitialLoading: boolean;
|
|
268
|
+
isPaused: boolean;
|
|
269
|
+
isRefetching: boolean;
|
|
270
|
+
isStale: boolean;
|
|
271
|
+
isEnabled: boolean;
|
|
272
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
273
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
274
|
+
headers: Record<string, string>;
|
|
275
|
+
} | undefined, Error>>;
|
|
276
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
277
|
+
promise: Promise<{
|
|
278
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
279
|
+
headers: Record<string, string>;
|
|
280
|
+
} | undefined>;
|
|
281
|
+
} | {
|
|
282
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
283
|
+
headers: Record<string, string> | undefined;
|
|
284
|
+
error: Error;
|
|
285
|
+
isError: true;
|
|
286
|
+
isPending: false;
|
|
287
|
+
isLoading: false;
|
|
288
|
+
isLoadingError: true;
|
|
289
|
+
isRefetchError: false;
|
|
290
|
+
isSuccess: false;
|
|
291
|
+
isPlaceholderData: false;
|
|
292
|
+
status: "error";
|
|
293
|
+
dataUpdatedAt: number;
|
|
294
|
+
errorUpdatedAt: number;
|
|
295
|
+
failureCount: number;
|
|
296
|
+
failureReason: Error | null;
|
|
297
|
+
errorUpdateCount: number;
|
|
298
|
+
isFetched: boolean;
|
|
299
|
+
isFetchedAfterMount: boolean;
|
|
300
|
+
isFetching: boolean;
|
|
301
|
+
isInitialLoading: boolean;
|
|
302
|
+
isPaused: boolean;
|
|
303
|
+
isRefetching: boolean;
|
|
304
|
+
isStale: boolean;
|
|
305
|
+
isEnabled: boolean;
|
|
306
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
307
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
308
|
+
headers: Record<string, string>;
|
|
309
|
+
} | undefined, Error>>;
|
|
310
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
311
|
+
promise: Promise<{
|
|
312
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
313
|
+
headers: Record<string, string>;
|
|
314
|
+
} | undefined>;
|
|
315
|
+
} | {
|
|
316
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
317
|
+
headers: Record<string, string> | undefined;
|
|
318
|
+
error: null;
|
|
319
|
+
isError: false;
|
|
320
|
+
isPending: true;
|
|
321
|
+
isLoading: true;
|
|
322
|
+
isLoadingError: false;
|
|
323
|
+
isRefetchError: false;
|
|
324
|
+
isSuccess: false;
|
|
325
|
+
isPlaceholderData: false;
|
|
326
|
+
status: "pending";
|
|
327
|
+
dataUpdatedAt: number;
|
|
328
|
+
errorUpdatedAt: number;
|
|
329
|
+
failureCount: number;
|
|
330
|
+
failureReason: Error | null;
|
|
331
|
+
errorUpdateCount: number;
|
|
332
|
+
isFetched: boolean;
|
|
333
|
+
isFetchedAfterMount: boolean;
|
|
334
|
+
isFetching: boolean;
|
|
335
|
+
isInitialLoading: boolean;
|
|
336
|
+
isPaused: boolean;
|
|
337
|
+
isRefetching: boolean;
|
|
338
|
+
isStale: boolean;
|
|
339
|
+
isEnabled: boolean;
|
|
340
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
341
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
342
|
+
headers: Record<string, string>;
|
|
343
|
+
} | undefined, Error>>;
|
|
344
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
345
|
+
promise: Promise<{
|
|
346
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
347
|
+
headers: Record<string, string>;
|
|
348
|
+
} | undefined>;
|
|
349
|
+
} | {
|
|
350
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
351
|
+
headers: Record<string, string> | undefined;
|
|
352
|
+
error: null;
|
|
353
|
+
isError: false;
|
|
354
|
+
isPending: true;
|
|
355
|
+
isLoadingError: false;
|
|
356
|
+
isRefetchError: false;
|
|
357
|
+
isSuccess: false;
|
|
358
|
+
isPlaceholderData: false;
|
|
359
|
+
status: "pending";
|
|
360
|
+
dataUpdatedAt: number;
|
|
361
|
+
errorUpdatedAt: number;
|
|
362
|
+
failureCount: number;
|
|
363
|
+
failureReason: Error | null;
|
|
364
|
+
errorUpdateCount: number;
|
|
365
|
+
isFetched: boolean;
|
|
366
|
+
isFetchedAfterMount: boolean;
|
|
367
|
+
isFetching: boolean;
|
|
368
|
+
isLoading: boolean;
|
|
369
|
+
isInitialLoading: boolean;
|
|
370
|
+
isPaused: boolean;
|
|
371
|
+
isRefetching: boolean;
|
|
372
|
+
isStale: boolean;
|
|
373
|
+
isEnabled: boolean;
|
|
374
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
375
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
376
|
+
headers: Record<string, string>;
|
|
377
|
+
} | undefined, Error>>;
|
|
378
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
379
|
+
promise: Promise<{
|
|
380
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
381
|
+
headers: Record<string, string>;
|
|
382
|
+
} | undefined>;
|
|
383
|
+
} | {
|
|
384
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
385
|
+
headers: Record<string, string> | undefined;
|
|
386
|
+
isError: false;
|
|
387
|
+
error: null;
|
|
388
|
+
isPending: false;
|
|
389
|
+
isLoading: false;
|
|
390
|
+
isLoadingError: false;
|
|
391
|
+
isRefetchError: false;
|
|
392
|
+
isSuccess: true;
|
|
393
|
+
isPlaceholderData: true;
|
|
394
|
+
status: "success";
|
|
395
|
+
dataUpdatedAt: number;
|
|
396
|
+
errorUpdatedAt: number;
|
|
397
|
+
failureCount: number;
|
|
398
|
+
failureReason: Error | null;
|
|
399
|
+
errorUpdateCount: number;
|
|
400
|
+
isFetched: boolean;
|
|
401
|
+
isFetchedAfterMount: boolean;
|
|
402
|
+
isFetching: boolean;
|
|
403
|
+
isInitialLoading: boolean;
|
|
404
|
+
isPaused: boolean;
|
|
405
|
+
isRefetching: boolean;
|
|
406
|
+
isStale: boolean;
|
|
407
|
+
isEnabled: boolean;
|
|
408
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
409
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
410
|
+
headers: Record<string, string>;
|
|
411
|
+
} | undefined, Error>>;
|
|
412
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
413
|
+
promise: Promise<{
|
|
414
|
+
data: import("../../sdk/billing/types.gen").UsageInfoResponse | undefined;
|
|
415
|
+
headers: Record<string, string>;
|
|
416
|
+
} | undefined>;
|
|
417
|
+
};
|
|
211
418
|
export declare const useGetPlans: (options?: Omit<GetPlansData, "url"> & {
|
|
212
419
|
enabled?: boolean;
|
|
213
420
|
}) => {
|
|
@@ -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, getPlans, updatePlan, createSubscription, createSetupIntent, deletePaymentMethod, updateDefaultPaymentMethod, getInvoices, m2mGetCustomer, m2mCreateCustomer, m2mUpdatePlan } from "../../sdk/billing/sdk.gen";
|
|
5
|
+
import { getCustomer, getUsage, getPlans, updatePlan, 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 };
|
|
@@ -25,6 +25,28 @@ export const useGetCustomer = (options) => {
|
|
|
25
25
|
});
|
|
26
26
|
return { ...query, data: query.data?.data, headers: query.data?.headers };
|
|
27
27
|
};
|
|
28
|
+
export const useGetUsage = (options) => {
|
|
29
|
+
const token = useToken();
|
|
30
|
+
let { enabled, ...rest } = options || { enabled: true };
|
|
31
|
+
const opts = { throwOnError: true, url: "/api/v1/usage/{org}" };
|
|
32
|
+
const funcer = async () => {
|
|
33
|
+
const auth = isPromise(token) ? (await token) || "" : token || "";
|
|
34
|
+
if (isPromise(token) && !token)
|
|
35
|
+
return;
|
|
36
|
+
const res = await getUsage({ ...opts, ...rest, auth });
|
|
37
|
+
return { data: res.data, headers: headersToObject(res.response.headers) };
|
|
38
|
+
};
|
|
39
|
+
if (!token)
|
|
40
|
+
enabled = false;
|
|
41
|
+
const query = useQuery({
|
|
42
|
+
queryKey: ["api", "v1", "usage", options?.path?.org, options.query ?? {}],
|
|
43
|
+
queryFn: funcer,
|
|
44
|
+
enabled,
|
|
45
|
+
retry: false,
|
|
46
|
+
staleTime: 600000
|
|
47
|
+
});
|
|
48
|
+
return { ...query, data: query.data?.data, headers: query.data?.headers };
|
|
49
|
+
};
|
|
28
50
|
export const useGetPlans = (options) => {
|
|
29
51
|
const token = useToken();
|
|
30
52
|
let { enabled, ...rest } = options || { enabled: true };
|