shoal-web-sdk 0.0.110 → 0.0.112
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/@tanstack/react-query.gen.d.ts +33 -1
- package/dist/sdk/@tanstack/react-query.gen.js +35 -1
- package/dist/sdk/sdk.gen.d.ts +9 -1
- package/dist/sdk/sdk.gen.js +34 -0
- package/dist/sdk/types.gen.d.ts +106 -5
- package/dist/sdk/zod.gen.d.ts +52 -8
- package/dist/sdk/zod.gen.js +45 -21
- package/dist/tanstack-codegen/generated/generated.d.ts +9 -1
- package/dist/tanstack-codegen/generated/generated.js +41 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type InfiniteData, type UseMutationOptions } from '@tanstack/react-query';
|
|
2
2
|
import { type Options } from '../sdk.gen';
|
|
3
|
-
import type { CreateEnvironmentData, CreateEnvironmentError, CreateEnvironmentResponse, CreateProjectData, CreateProjectError, CreateProjectResponse, CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, CreateSpaceData, CreateSpaceError, CreateSpaceInviteData, CreateSpaceInviteError, CreateSpaceInviteResponse, CreateSpaceResponse, CreateUsernameData, CreateUsernameError, DeleteAccountIdentityData, DeleteAccountIdentityError, DeleteAccountIdentityResponse, DeployVersionData, DeployVersionError, FetchGraphM2mData, FetchKindeOrganisationBillingAgreementsData, GetBillingPlanData, GetBillingUsageData, GetConnectedAppUrlData, GetEnvironmentOverviewData, GetGraphOverviewData, GetProjectOverviewData, GetServiceHealthData, GetSpaceInvitesData, GetSpaceOrgCodeData, GetSpaceOverviewData, GetUserIdentitiesData, GetUserInvitesData, GetUserProfileData, JoinSpaceData, JoinSpaceError, LeaveSpaceData, LeaveSpaceError, ListInstallationBranchesData, ListInstallationRepositoriesData, ListPaymentMethodsData, ListSpaceMemberRolesData, ListSpaceMembersData, ListUserInstallationsData, ListUserSpacesData, RejectSpaceInviteData, RejectSpaceInviteError, RejectSpaceInviteResponse, RemovePaymentMethodData, RemovePaymentMethodError, RemovePaymentMethodResponse, RequestAccountPasswordResetData, RequestAccountPasswordResetError, RequestSignedUploadUrlData, RevokeSpaceInviteData, RevokeSpaceInviteError, RevokeSpaceInviteResponse, SetDefaultPaymentMethodData, SetDefaultPaymentMethodError, SetDefaultPaymentMethodResponse, UpdateBillingPlanData, UpdateBillingPlanError, UpdateConnectedAppTokenData, UpdateConnectedAppTokenError, UpdateGraphStateData, UpdateGraphStateError, UpdateUsernameData, UpdateUsernameError, UpdateUserProfileData, UpdateUserProfileError } from '../types.gen';
|
|
3
|
+
import type { CreateEnvironmentData, CreateEnvironmentError, CreateEnvironmentResponse, CreateProjectData, CreateProjectError, CreateProjectResponse, CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, CreateSpaceData, CreateSpaceError, CreateSpaceInviteData, CreateSpaceInviteError, CreateSpaceInviteResponse, CreateSpaceResponse, CreateUsernameData, CreateUsernameError, DeleteAccountIdentityData, DeleteAccountIdentityError, DeleteAccountIdentityResponse, DeployVersionData, DeployVersionError, FetchBillingPricesData, FetchGraphM2mData, FetchKindeOrganisationBillingAgreementsData, GetBillingPlanData, GetBillingUsageData, GetConnectedAppUrlData, GetEnvironmentOverviewData, GetGraphOverviewData, GetProjectOverviewData, GetServiceHealthData, GetSpaceInvitesData, GetSpaceOrgCodeData, GetSpaceOverviewData, GetUserIdentitiesData, GetUserInvitesData, GetUserProfileData, JoinSpaceData, JoinSpaceError, LeaveSpaceData, LeaveSpaceError, ListInstallationBranchesData, ListInstallationRepositoriesData, ListPaymentMethodsData, ListSpaceMemberRolesData, ListSpaceMembersData, ListUserInstallationsData, ListUserSpacesData, RecordCloudUsageData, RecordCloudUsageError, RejectSpaceInviteData, RejectSpaceInviteError, RejectSpaceInviteResponse, RemovePaymentMethodData, RemovePaymentMethodError, RemovePaymentMethodResponse, RequestAccountPasswordResetData, RequestAccountPasswordResetError, RequestSignedUploadUrlData, RevokeSpaceInviteData, RevokeSpaceInviteError, RevokeSpaceInviteResponse, SetDefaultPaymentMethodData, SetDefaultPaymentMethodError, SetDefaultPaymentMethodResponse, UpdateBillingPlanData, UpdateBillingPlanError, UpdateConnectedAppTokenData, UpdateConnectedAppTokenError, UpdateGraphStateData, UpdateGraphStateError, UpdateUsernameData, UpdateUsernameError, UpdateUserProfileData, UpdateUserProfileError } from '../types.gen';
|
|
4
4
|
export type QueryKey<TOptions extends Options> = [
|
|
5
5
|
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
|
6
6
|
_id: string;
|
|
@@ -800,6 +800,10 @@ export declare const requestSignedUploadUrlOptions: (options: Options<RequestSig
|
|
|
800
800
|
[dataTagErrorSymbol]: Error;
|
|
801
801
|
};
|
|
802
802
|
};
|
|
803
|
+
/**
|
|
804
|
+
* Record a cloud usage event for a space (M2M only).
|
|
805
|
+
*/
|
|
806
|
+
export declare const recordCloudUsageMutation: (options?: Partial<Options<RecordCloudUsageData>>) => UseMutationOptions<unknown, RecordCloudUsageError, Options<RecordCloudUsageData>>;
|
|
803
807
|
export declare const getBillingPlanQueryKey: (options: Options<GetBillingPlanData>) => [Pick<Options<GetBillingPlanData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
804
808
|
_id: string;
|
|
805
809
|
_infinite?: boolean;
|
|
@@ -900,3 +904,31 @@ export declare const getBillingUsageOptions: (options: Options<GetBillingUsageDa
|
|
|
900
904
|
[dataTagErrorSymbol]: Error;
|
|
901
905
|
};
|
|
902
906
|
};
|
|
907
|
+
export declare const fetchBillingPricesQueryKey: (options: Options<FetchBillingPricesData>) => [Pick<Options<FetchBillingPricesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
908
|
+
_id: string;
|
|
909
|
+
_infinite?: boolean;
|
|
910
|
+
tags?: ReadonlyArray<string>;
|
|
911
|
+
}];
|
|
912
|
+
/**
|
|
913
|
+
* Fetch live unit prices for all paid plans from Stripe.
|
|
914
|
+
*/
|
|
915
|
+
export declare const fetchBillingPricesOptions: (options: Options<FetchBillingPricesData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").PlanPriceResponse[], Error, import("../types.gen").PlanPriceResponse[], [Pick<Options<FetchBillingPricesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
916
|
+
_id: string;
|
|
917
|
+
_infinite?: boolean;
|
|
918
|
+
tags?: ReadonlyArray<string>;
|
|
919
|
+
}]>, "queryFn"> & {
|
|
920
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").PlanPriceResponse[], [Pick<Options<FetchBillingPricesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
921
|
+
_id: string;
|
|
922
|
+
_infinite?: boolean;
|
|
923
|
+
tags?: ReadonlyArray<string>;
|
|
924
|
+
}], never> | undefined;
|
|
925
|
+
} & {
|
|
926
|
+
queryKey: [Pick<Options<FetchBillingPricesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
927
|
+
_id: string;
|
|
928
|
+
_infinite?: boolean;
|
|
929
|
+
tags?: ReadonlyArray<string>;
|
|
930
|
+
}] & {
|
|
931
|
+
[dataTagSymbol]: import("../types.gen").PlanPriceResponse[];
|
|
932
|
+
[dataTagErrorSymbol]: Error;
|
|
933
|
+
};
|
|
934
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
import { infiniteQueryOptions, queryOptions } from '@tanstack/react-query';
|
|
3
3
|
import { client } from '../client.gen';
|
|
4
|
-
import { createEnvironment, createProject, createSetupIntent, createSpace, createSpaceInvite, createUsername, deleteAccountIdentity, deployVersion, fetchGraphM2M, fetchKindeOrganisationBillingAgreements, getBillingPlan, getBillingUsage, getConnectedAppUrl, getEnvironmentOverview, getGraphOverview, getProjectOverview, getServiceHealth, getSpaceInvites, getSpaceOrgCode, getSpaceOverview, getUserIdentities, getUserInvites, getUserProfile, joinSpace, leaveSpace, listInstallationBranches, listInstallationRepositories, listPaymentMethods, listSpaceMemberRoles, listSpaceMembers, listUserInstallations, listUserSpaces, rejectSpaceInvite, removePaymentMethod, requestAccountPasswordReset, requestSignedUploadUrl, revokeSpaceInvite, setDefaultPaymentMethod, updateBillingPlan, updateConnectedAppToken, updateGraphState, updateUsername, updateUserProfile } from '../sdk.gen';
|
|
4
|
+
import { createEnvironment, createProject, createSetupIntent, createSpace, createSpaceInvite, createUsername, deleteAccountIdentity, deployVersion, fetchBillingPrices, fetchGraphM2M, fetchKindeOrganisationBillingAgreements, getBillingPlan, getBillingUsage, getConnectedAppUrl, getEnvironmentOverview, getGraphOverview, getProjectOverview, getServiceHealth, getSpaceInvites, getSpaceOrgCode, getSpaceOverview, getUserIdentities, getUserInvites, getUserProfile, joinSpace, leaveSpace, listInstallationBranches, listInstallationRepositories, listPaymentMethods, listSpaceMemberRoles, listSpaceMembers, listUserInstallations, listUserSpaces, recordCloudUsage, rejectSpaceInvite, removePaymentMethod, requestAccountPasswordReset, requestSignedUploadUrl, revokeSpaceInvite, setDefaultPaymentMethod, updateBillingPlan, updateConnectedAppToken, updateGraphState, updateUsername, updateUserProfile } 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) {
|
|
@@ -861,6 +861,22 @@ export const requestSignedUploadUrlOptions = (options) => {
|
|
|
861
861
|
queryKey: requestSignedUploadUrlQueryKey(options)
|
|
862
862
|
});
|
|
863
863
|
};
|
|
864
|
+
/**
|
|
865
|
+
* Record a cloud usage event for a space (M2M only).
|
|
866
|
+
*/
|
|
867
|
+
export const recordCloudUsageMutation = (options) => {
|
|
868
|
+
const mutationOptions = {
|
|
869
|
+
mutationFn: async (fnOptions) => {
|
|
870
|
+
const { data } = await recordCloudUsage({
|
|
871
|
+
...options,
|
|
872
|
+
...fnOptions,
|
|
873
|
+
throwOnError: true
|
|
874
|
+
});
|
|
875
|
+
return data;
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
return mutationOptions;
|
|
879
|
+
};
|
|
864
880
|
export const getBillingPlanQueryKey = (options) => createQueryKey('getBillingPlan', options);
|
|
865
881
|
/**
|
|
866
882
|
* Get the current billing plan for a space.
|
|
@@ -979,3 +995,21 @@ export const getBillingUsageOptions = (options) => {
|
|
|
979
995
|
queryKey: getBillingUsageQueryKey(options)
|
|
980
996
|
});
|
|
981
997
|
};
|
|
998
|
+
export const fetchBillingPricesQueryKey = (options) => createQueryKey('fetchBillingPrices', options);
|
|
999
|
+
/**
|
|
1000
|
+
* Fetch live unit prices for all paid plans from Stripe.
|
|
1001
|
+
*/
|
|
1002
|
+
export const fetchBillingPricesOptions = (options) => {
|
|
1003
|
+
return queryOptions({
|
|
1004
|
+
queryFn: async ({ queryKey, signal }) => {
|
|
1005
|
+
const { data } = await fetchBillingPrices({
|
|
1006
|
+
...options,
|
|
1007
|
+
...queryKey[0],
|
|
1008
|
+
signal,
|
|
1009
|
+
throwOnError: true
|
|
1010
|
+
});
|
|
1011
|
+
return data;
|
|
1012
|
+
},
|
|
1013
|
+
queryKey: fetchBillingPricesQueryKey(options)
|
|
1014
|
+
});
|
|
1015
|
+
};
|
package/dist/sdk/sdk.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Client, Options as Options2, TDataShape } from './client';
|
|
2
|
-
import type { CreateEnvironmentData, CreateEnvironmentErrors, CreateEnvironmentResponses, CreateProjectData, CreateProjectErrors, CreateProjectResponses, CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, CreateSpaceData, CreateSpaceErrors, CreateSpaceInviteData, CreateSpaceInviteErrors, CreateSpaceInviteResponses, CreateSpaceResponses, CreateUsernameData, CreateUsernameErrors, CreateUsernameResponses, DeleteAccountIdentityData, DeleteAccountIdentityErrors, DeleteAccountIdentityResponses, DeployVersionData, DeployVersionErrors, DeployVersionResponses, FetchGraphM2mData, FetchGraphM2mErrors, FetchGraphM2mResponses, FetchKindeOrganisationBillingAgreementsData, FetchKindeOrganisationBillingAgreementsErrors, FetchKindeOrganisationBillingAgreementsResponses, GetBillingPlanData, GetBillingPlanErrors, GetBillingPlanResponses, GetBillingUsageData, GetBillingUsageErrors, GetBillingUsageResponses, GetConnectedAppUrlData, GetConnectedAppUrlErrors, GetConnectedAppUrlResponses, GetEnvironmentOverviewData, GetEnvironmentOverviewErrors, GetEnvironmentOverviewResponses, GetGraphOverviewData, GetGraphOverviewErrors, GetGraphOverviewResponses, GetProjectOverviewData, GetProjectOverviewErrors, GetProjectOverviewResponses, GetServiceHealthData, GetServiceHealthResponses, GetSpaceInvitesData, GetSpaceInvitesErrors, GetSpaceInvitesResponses, GetSpaceOrgCodeData, GetSpaceOrgCodeErrors, GetSpaceOrgCodeResponses, GetSpaceOverviewData, GetSpaceOverviewErrors, GetSpaceOverviewResponses, GetUserIdentitiesData, GetUserIdentitiesErrors, GetUserIdentitiesResponses, GetUserInvitesData, GetUserInvitesErrors, GetUserInvitesResponses, GetUserProfileData, GetUserProfileErrors, GetUserProfileResponses, JoinSpaceData, JoinSpaceErrors, JoinSpaceResponses, LeaveSpaceData, LeaveSpaceErrors, LeaveSpaceResponses, ListInstallationBranchesData, ListInstallationBranchesErrors, ListInstallationBranchesResponses, ListInstallationRepositoriesData, ListInstallationRepositoriesErrors, ListInstallationRepositoriesResponses, ListPaymentMethodsData, ListPaymentMethodsErrors, ListPaymentMethodsResponses, ListSpaceMemberRolesData, ListSpaceMemberRolesErrors, ListSpaceMemberRolesResponses, ListSpaceMembersData, ListSpaceMembersErrors, ListSpaceMembersResponses, ListUserInstallationsData, ListUserInstallationsErrors, ListUserInstallationsResponses, ListUserSpacesData, ListUserSpacesErrors, ListUserSpacesResponses, RejectSpaceInviteData, RejectSpaceInviteErrors, RejectSpaceInviteResponses, RemovePaymentMethodData, RemovePaymentMethodErrors, RemovePaymentMethodResponses, RequestAccountPasswordResetData, RequestAccountPasswordResetErrors, RequestAccountPasswordResetResponses, RequestSignedUploadUrlData, RequestSignedUploadUrlErrors, RequestSignedUploadUrlResponses, RevokeSpaceInviteData, RevokeSpaceInviteErrors, RevokeSpaceInviteResponses, SetDefaultPaymentMethodData, SetDefaultPaymentMethodErrors, SetDefaultPaymentMethodResponses, UpdateBillingPlanData, UpdateBillingPlanErrors, UpdateBillingPlanResponses, UpdateConnectedAppTokenData, UpdateConnectedAppTokenErrors, UpdateConnectedAppTokenResponses, UpdateGraphStateData, UpdateGraphStateErrors, UpdateGraphStateResponses, UpdateUsernameData, UpdateUsernameErrors, UpdateUsernameResponses, UpdateUserProfileData, UpdateUserProfileErrors, UpdateUserProfileResponses } from './types.gen';
|
|
2
|
+
import type { CreateEnvironmentData, CreateEnvironmentErrors, CreateEnvironmentResponses, CreateProjectData, CreateProjectErrors, CreateProjectResponses, CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, CreateSpaceData, CreateSpaceErrors, CreateSpaceInviteData, CreateSpaceInviteErrors, CreateSpaceInviteResponses, CreateSpaceResponses, CreateUsernameData, CreateUsernameErrors, CreateUsernameResponses, DeleteAccountIdentityData, DeleteAccountIdentityErrors, DeleteAccountIdentityResponses, DeployVersionData, DeployVersionErrors, DeployVersionResponses, FetchBillingPricesData, FetchBillingPricesErrors, FetchBillingPricesResponses, FetchGraphM2mData, FetchGraphM2mErrors, FetchGraphM2mResponses, FetchKindeOrganisationBillingAgreementsData, FetchKindeOrganisationBillingAgreementsErrors, FetchKindeOrganisationBillingAgreementsResponses, GetBillingPlanData, GetBillingPlanErrors, GetBillingPlanResponses, GetBillingUsageData, GetBillingUsageErrors, GetBillingUsageResponses, GetConnectedAppUrlData, GetConnectedAppUrlErrors, GetConnectedAppUrlResponses, GetEnvironmentOverviewData, GetEnvironmentOverviewErrors, GetEnvironmentOverviewResponses, GetGraphOverviewData, GetGraphOverviewErrors, GetGraphOverviewResponses, GetProjectOverviewData, GetProjectOverviewErrors, GetProjectOverviewResponses, GetServiceHealthData, GetServiceHealthResponses, GetSpaceInvitesData, GetSpaceInvitesErrors, GetSpaceInvitesResponses, GetSpaceOrgCodeData, GetSpaceOrgCodeErrors, GetSpaceOrgCodeResponses, GetSpaceOverviewData, GetSpaceOverviewErrors, GetSpaceOverviewResponses, GetUserIdentitiesData, GetUserIdentitiesErrors, GetUserIdentitiesResponses, GetUserInvitesData, GetUserInvitesErrors, GetUserInvitesResponses, GetUserProfileData, GetUserProfileErrors, GetUserProfileResponses, JoinSpaceData, JoinSpaceErrors, JoinSpaceResponses, LeaveSpaceData, LeaveSpaceErrors, LeaveSpaceResponses, ListInstallationBranchesData, ListInstallationBranchesErrors, ListInstallationBranchesResponses, ListInstallationRepositoriesData, ListInstallationRepositoriesErrors, ListInstallationRepositoriesResponses, ListPaymentMethodsData, ListPaymentMethodsErrors, ListPaymentMethodsResponses, ListSpaceMemberRolesData, ListSpaceMemberRolesErrors, ListSpaceMemberRolesResponses, ListSpaceMembersData, ListSpaceMembersErrors, ListSpaceMembersResponses, ListUserInstallationsData, ListUserInstallationsErrors, ListUserInstallationsResponses, ListUserSpacesData, ListUserSpacesErrors, ListUserSpacesResponses, RecordCloudUsageData, RecordCloudUsageErrors, RecordCloudUsageResponses, RejectSpaceInviteData, RejectSpaceInviteErrors, RejectSpaceInviteResponses, RemovePaymentMethodData, RemovePaymentMethodErrors, RemovePaymentMethodResponses, RequestAccountPasswordResetData, RequestAccountPasswordResetErrors, RequestAccountPasswordResetResponses, RequestSignedUploadUrlData, RequestSignedUploadUrlErrors, RequestSignedUploadUrlResponses, RevokeSpaceInviteData, RevokeSpaceInviteErrors, RevokeSpaceInviteResponses, SetDefaultPaymentMethodData, SetDefaultPaymentMethodErrors, SetDefaultPaymentMethodResponses, UpdateBillingPlanData, UpdateBillingPlanErrors, UpdateBillingPlanResponses, UpdateConnectedAppTokenData, UpdateConnectedAppTokenErrors, UpdateConnectedAppTokenResponses, UpdateGraphStateData, UpdateGraphStateErrors, UpdateGraphStateResponses, UpdateUsernameData, UpdateUsernameErrors, UpdateUsernameResponses, UpdateUserProfileData, UpdateUserProfileErrors, UpdateUserProfileResponses } 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
|
|
@@ -157,6 +157,10 @@ export declare const deployVersion: <ThrowOnError extends boolean = false>(optio
|
|
|
157
157
|
* Request a signed upload URL to upload source code zip files.
|
|
158
158
|
*/
|
|
159
159
|
export declare const requestSignedUploadUrl: <ThrowOnError extends boolean = false>(options: Options<RequestSignedUploadUrlData, ThrowOnError>) => import("./client").RequestResult<RequestSignedUploadUrlResponses, RequestSignedUploadUrlErrors, ThrowOnError, "fields">;
|
|
160
|
+
/**
|
|
161
|
+
* Record a cloud usage event for a space (M2M only).
|
|
162
|
+
*/
|
|
163
|
+
export declare const recordCloudUsage: <ThrowOnError extends boolean = false>(options: Options<RecordCloudUsageData, ThrowOnError>) => import("./client").RequestResult<RecordCloudUsageResponses, RecordCloudUsageErrors, ThrowOnError, "fields">;
|
|
160
164
|
/**
|
|
161
165
|
* Get the current billing plan for a space.
|
|
162
166
|
*/
|
|
@@ -185,3 +189,7 @@ export declare const setDefaultPaymentMethod: <ThrowOnError extends boolean = fa
|
|
|
185
189
|
* Get metered cloud usage for the current billing period.
|
|
186
190
|
*/
|
|
187
191
|
export declare const getBillingUsage: <ThrowOnError extends boolean = false>(options: Options<GetBillingUsageData, ThrowOnError>) => import("./client").RequestResult<GetBillingUsageResponses, GetBillingUsageErrors, ThrowOnError, "fields">;
|
|
192
|
+
/**
|
|
193
|
+
* Fetch live unit prices for all paid plans from Stripe.
|
|
194
|
+
*/
|
|
195
|
+
export declare const fetchBillingPrices: <ThrowOnError extends boolean = false>(options: Options<FetchBillingPricesData, ThrowOnError>) => import("./client").RequestResult<FetchBillingPricesResponses, FetchBillingPricesErrors, ThrowOnError, "fields">;
|
package/dist/sdk/sdk.gen.js
CHANGED
|
@@ -572,6 +572,25 @@ export const requestSignedUploadUrl = (options) => {
|
|
|
572
572
|
...options
|
|
573
573
|
});
|
|
574
574
|
};
|
|
575
|
+
/**
|
|
576
|
+
* Record a cloud usage event for a space (M2M only).
|
|
577
|
+
*/
|
|
578
|
+
export const recordCloudUsage = (options) => {
|
|
579
|
+
return (options.client ?? client).post({
|
|
580
|
+
security: [
|
|
581
|
+
{
|
|
582
|
+
scheme: 'bearer',
|
|
583
|
+
type: 'http'
|
|
584
|
+
}
|
|
585
|
+
],
|
|
586
|
+
url: '/m2m/billing/usage/record',
|
|
587
|
+
...options,
|
|
588
|
+
headers: {
|
|
589
|
+
'Content-Type': 'application/json',
|
|
590
|
+
...options.headers
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
};
|
|
575
594
|
/**
|
|
576
595
|
* Get the current billing plan for a space.
|
|
577
596
|
*/
|
|
@@ -681,3 +700,18 @@ export const getBillingUsage = (options) => {
|
|
|
681
700
|
...options
|
|
682
701
|
});
|
|
683
702
|
};
|
|
703
|
+
/**
|
|
704
|
+
* Fetch live unit prices for all paid plans from Stripe.
|
|
705
|
+
*/
|
|
706
|
+
export const fetchBillingPrices = (options) => {
|
|
707
|
+
return (options.client ?? client).get({
|
|
708
|
+
security: [
|
|
709
|
+
{
|
|
710
|
+
scheme: 'bearer',
|
|
711
|
+
type: 'http'
|
|
712
|
+
}
|
|
713
|
+
],
|
|
714
|
+
url: '/auth/{spaceHandle}/billing/prices',
|
|
715
|
+
...options
|
|
716
|
+
});
|
|
717
|
+
};
|
package/dist/sdk/types.gen.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type ClientOptions = {
|
|
2
2
|
baseUrl: 'http://localhost:8080/core-service' | 'https://api-dev.shoalstack.com/core-service' | (string & {});
|
|
3
3
|
};
|
|
4
|
-
export type
|
|
4
|
+
export type PlatformTier = 'free' | 'hobby' | 'pro';
|
|
5
|
+
export type BillingInterval = 'monthly' | 'annual';
|
|
6
|
+
export type BillingPlanLookupKey = 'free-monthly' | 'hobby-monthly' | 'hobby-annual' | 'pro-monthly' | 'pro-annual';
|
|
5
7
|
export type HealthResponse = {
|
|
6
8
|
status: string;
|
|
7
9
|
};
|
|
@@ -352,15 +354,18 @@ export type SignedUrlUploadResponse = {
|
|
|
352
354
|
expiration: string;
|
|
353
355
|
};
|
|
354
356
|
export type BillingPlan = {
|
|
355
|
-
tier:
|
|
356
|
-
interval?:
|
|
357
|
+
tier: PlatformTier;
|
|
358
|
+
interval?: BillingInterval;
|
|
357
359
|
seatCount: number;
|
|
358
360
|
currentPeriodEnd?: string;
|
|
359
|
-
pendingDowngrade?:
|
|
361
|
+
pendingDowngrade?: PlatformTier;
|
|
360
362
|
entitlements: Array<string>;
|
|
361
363
|
};
|
|
362
364
|
export type UpdatePlanRequest = {
|
|
363
|
-
|
|
365
|
+
/**
|
|
366
|
+
* Stripe price lookup key (e.g. "hobby-monthly"). Empty string = Free tier.
|
|
367
|
+
*/
|
|
368
|
+
lookup_key: string;
|
|
364
369
|
};
|
|
365
370
|
export type PaymentMethod = {
|
|
366
371
|
id: string;
|
|
@@ -376,6 +381,38 @@ export type SetupIntentResponse = {
|
|
|
376
381
|
export type BillingUsage = {
|
|
377
382
|
totalUnits: number;
|
|
378
383
|
};
|
|
384
|
+
export type RecordUsageRequest = {
|
|
385
|
+
/**
|
|
386
|
+
* The Kinde organisation code for the space.
|
|
387
|
+
*/
|
|
388
|
+
orgCode: string;
|
|
389
|
+
/**
|
|
390
|
+
* Usage quantity to record.
|
|
391
|
+
*/
|
|
392
|
+
quantity: number;
|
|
393
|
+
/**
|
|
394
|
+
* Unix timestamp (seconds) at which the usage occurred. Defaults to now if omitted.
|
|
395
|
+
*/
|
|
396
|
+
timestamp?: number;
|
|
397
|
+
};
|
|
398
|
+
export type PlanPriceResponse = {
|
|
399
|
+
/**
|
|
400
|
+
* Plan code (e.g. "hobby-monthly", "pro-annual").
|
|
401
|
+
*/
|
|
402
|
+
code: string;
|
|
403
|
+
/**
|
|
404
|
+
* Price per seat in the smallest currency unit (e.g. cents).
|
|
405
|
+
*/
|
|
406
|
+
unit_amount_cents: number;
|
|
407
|
+
/**
|
|
408
|
+
* ISO 4217 currency code (e.g. "usd").
|
|
409
|
+
*/
|
|
410
|
+
currency: string;
|
|
411
|
+
/**
|
|
412
|
+
* Billing interval ("month" or "year").
|
|
413
|
+
*/
|
|
414
|
+
interval: string;
|
|
415
|
+
};
|
|
379
416
|
/**
|
|
380
417
|
* Expiry query.
|
|
381
418
|
*/
|
|
@@ -1892,6 +1929,37 @@ export type RequestSignedUploadUrlResponses = {
|
|
|
1892
1929
|
200: SignedUrlUploadResponse;
|
|
1893
1930
|
};
|
|
1894
1931
|
export type RequestSignedUploadUrlResponse = RequestSignedUploadUrlResponses[keyof RequestSignedUploadUrlResponses];
|
|
1932
|
+
export type RecordCloudUsageData = {
|
|
1933
|
+
body: RecordUsageRequest;
|
|
1934
|
+
path?: never;
|
|
1935
|
+
query?: never;
|
|
1936
|
+
url: '/m2m/billing/usage/record';
|
|
1937
|
+
};
|
|
1938
|
+
export type RecordCloudUsageErrors = {
|
|
1939
|
+
/**
|
|
1940
|
+
* Bad request.
|
|
1941
|
+
*/
|
|
1942
|
+
400: ErrorResponse;
|
|
1943
|
+
/**
|
|
1944
|
+
* Unauthorised.
|
|
1945
|
+
*/
|
|
1946
|
+
401: ErrorResponse;
|
|
1947
|
+
/**
|
|
1948
|
+
* Invalid credentials.
|
|
1949
|
+
*/
|
|
1950
|
+
403: ErrorResponse;
|
|
1951
|
+
/**
|
|
1952
|
+
* Unexpected error.
|
|
1953
|
+
*/
|
|
1954
|
+
500: ErrorResponse;
|
|
1955
|
+
};
|
|
1956
|
+
export type RecordCloudUsageError = RecordCloudUsageErrors[keyof RecordCloudUsageErrors];
|
|
1957
|
+
export type RecordCloudUsageResponses = {
|
|
1958
|
+
/**
|
|
1959
|
+
* Usage recorded successfully.
|
|
1960
|
+
*/
|
|
1961
|
+
202: unknown;
|
|
1962
|
+
};
|
|
1895
1963
|
export type GetBillingPlanData = {
|
|
1896
1964
|
body?: never;
|
|
1897
1965
|
path: {
|
|
@@ -2134,3 +2202,36 @@ export type GetBillingUsageResponses = {
|
|
|
2134
2202
|
200: BillingUsage;
|
|
2135
2203
|
};
|
|
2136
2204
|
export type GetBillingUsageResponse = GetBillingUsageResponses[keyof GetBillingUsageResponses];
|
|
2205
|
+
export type FetchBillingPricesData = {
|
|
2206
|
+
body?: never;
|
|
2207
|
+
path: {
|
|
2208
|
+
/**
|
|
2209
|
+
* The space handle. This must be globally unique.
|
|
2210
|
+
*/
|
|
2211
|
+
spaceHandle: string;
|
|
2212
|
+
};
|
|
2213
|
+
query?: never;
|
|
2214
|
+
url: '/auth/{spaceHandle}/billing/prices';
|
|
2215
|
+
};
|
|
2216
|
+
export type FetchBillingPricesErrors = {
|
|
2217
|
+
/**
|
|
2218
|
+
* Unauthorised user.
|
|
2219
|
+
*/
|
|
2220
|
+
401: ErrorResponse;
|
|
2221
|
+
/**
|
|
2222
|
+
* Invalid credentials.
|
|
2223
|
+
*/
|
|
2224
|
+
403: ErrorResponse;
|
|
2225
|
+
/**
|
|
2226
|
+
* Unexpected error.
|
|
2227
|
+
*/
|
|
2228
|
+
500: ErrorResponse;
|
|
2229
|
+
};
|
|
2230
|
+
export type FetchBillingPricesError = FetchBillingPricesErrors[keyof FetchBillingPricesErrors];
|
|
2231
|
+
export type FetchBillingPricesResponses = {
|
|
2232
|
+
/**
|
|
2233
|
+
* A list of plan prices.
|
|
2234
|
+
*/
|
|
2235
|
+
200: Array<PlanPriceResponse>;
|
|
2236
|
+
};
|
|
2237
|
+
export type FetchBillingPricesResponse = FetchBillingPricesResponses[keyof FetchBillingPricesResponses];
|
package/dist/sdk/zod.gen.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const zPlatformTier: z.ZodEnum<{
|
|
3
|
+
free: "free";
|
|
4
|
+
hobby: "hobby";
|
|
5
|
+
pro: "pro";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const zBillingInterval: z.ZodEnum<{
|
|
8
|
+
monthly: "monthly";
|
|
9
|
+
annual: "annual";
|
|
10
|
+
}>;
|
|
2
11
|
export declare const zBillingPlanLookupKey: z.ZodEnum<{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
pro_annual: "pro_annual";
|
|
12
|
+
"free-monthly": "free-monthly";
|
|
13
|
+
"hobby-monthly": "hobby-monthly";
|
|
14
|
+
"hobby-annual": "hobby-annual";
|
|
15
|
+
"pro-monthly": "pro-monthly";
|
|
16
|
+
"pro-annual": "pro-annual";
|
|
9
17
|
}>;
|
|
10
18
|
export declare const zHealthResponse: z.ZodObject<{
|
|
11
19
|
status: z.ZodString;
|
|
@@ -1039,7 +1047,7 @@ export declare const zBillingPlan: z.ZodObject<{
|
|
|
1039
1047
|
entitlements: z.ZodArray<z.ZodString>;
|
|
1040
1048
|
}, z.core.$strip>;
|
|
1041
1049
|
export declare const zUpdatePlanRequest: z.ZodObject<{
|
|
1042
|
-
|
|
1050
|
+
lookup_key: z.ZodString;
|
|
1043
1051
|
}, z.core.$strip>;
|
|
1044
1052
|
export declare const zPaymentMethod: z.ZodObject<{
|
|
1045
1053
|
id: z.ZodString;
|
|
@@ -1055,6 +1063,17 @@ export declare const zSetupIntentResponse: z.ZodObject<{
|
|
|
1055
1063
|
export declare const zBillingUsage: z.ZodObject<{
|
|
1056
1064
|
totalUnits: z.ZodCoercedBigInt<unknown>;
|
|
1057
1065
|
}, z.core.$strip>;
|
|
1066
|
+
export declare const zRecordUsageRequest: z.ZodObject<{
|
|
1067
|
+
orgCode: z.ZodString;
|
|
1068
|
+
quantity: z.ZodCoercedBigInt<unknown>;
|
|
1069
|
+
timestamp: z.ZodOptional<z.ZodCoercedBigInt<unknown>>;
|
|
1070
|
+
}, z.core.$strip>;
|
|
1071
|
+
export declare const zPlanPriceResponse: z.ZodObject<{
|
|
1072
|
+
code: z.ZodString;
|
|
1073
|
+
unit_amount_cents: z.ZodCoercedBigInt<unknown>;
|
|
1074
|
+
currency: z.ZodString;
|
|
1075
|
+
interval: z.ZodString;
|
|
1076
|
+
}, z.core.$strip>;
|
|
1058
1077
|
/**
|
|
1059
1078
|
* Expiry query.
|
|
1060
1079
|
*/
|
|
@@ -2214,6 +2233,15 @@ export declare const zRequestSignedUploadUrlResponse: z.ZodObject<{
|
|
|
2214
2233
|
signedUrl: z.ZodString;
|
|
2215
2234
|
expiration: z.ZodISODateTime;
|
|
2216
2235
|
}, z.core.$strip>;
|
|
2236
|
+
export declare const zRecordCloudUsageData: z.ZodObject<{
|
|
2237
|
+
body: z.ZodObject<{
|
|
2238
|
+
orgCode: z.ZodString;
|
|
2239
|
+
quantity: z.ZodCoercedBigInt<unknown>;
|
|
2240
|
+
timestamp: z.ZodOptional<z.ZodCoercedBigInt<unknown>>;
|
|
2241
|
+
}, z.core.$strip>;
|
|
2242
|
+
path: z.ZodOptional<z.ZodNever>;
|
|
2243
|
+
query: z.ZodOptional<z.ZodNever>;
|
|
2244
|
+
}, z.core.$strip>;
|
|
2217
2245
|
export declare const zGetBillingPlanData: z.ZodObject<{
|
|
2218
2246
|
body: z.ZodOptional<z.ZodNever>;
|
|
2219
2247
|
path: z.ZodObject<{
|
|
@@ -2245,7 +2273,7 @@ export declare const zGetBillingPlanResponse: z.ZodObject<{
|
|
|
2245
2273
|
}, z.core.$strip>;
|
|
2246
2274
|
export declare const zUpdateBillingPlanData: z.ZodObject<{
|
|
2247
2275
|
body: z.ZodObject<{
|
|
2248
|
-
|
|
2276
|
+
lookup_key: z.ZodString;
|
|
2249
2277
|
}, z.core.$strip>;
|
|
2250
2278
|
path: z.ZodObject<{
|
|
2251
2279
|
spaceHandle: z.ZodString;
|
|
@@ -2320,3 +2348,19 @@ export declare const zGetBillingUsageData: z.ZodObject<{
|
|
|
2320
2348
|
export declare const zGetBillingUsageResponse: z.ZodObject<{
|
|
2321
2349
|
totalUnits: z.ZodCoercedBigInt<unknown>;
|
|
2322
2350
|
}, z.core.$strip>;
|
|
2351
|
+
export declare const zFetchBillingPricesData: z.ZodObject<{
|
|
2352
|
+
body: z.ZodOptional<z.ZodNever>;
|
|
2353
|
+
path: z.ZodObject<{
|
|
2354
|
+
spaceHandle: z.ZodString;
|
|
2355
|
+
}, z.core.$strip>;
|
|
2356
|
+
query: z.ZodOptional<z.ZodNever>;
|
|
2357
|
+
}, z.core.$strip>;
|
|
2358
|
+
/**
|
|
2359
|
+
* A list of plan prices.
|
|
2360
|
+
*/
|
|
2361
|
+
export declare const zFetchBillingPricesResponse: z.ZodArray<z.ZodObject<{
|
|
2362
|
+
code: z.ZodString;
|
|
2363
|
+
unit_amount_cents: z.ZodCoercedBigInt<unknown>;
|
|
2364
|
+
currency: z.ZodString;
|
|
2365
|
+
interval: z.ZodString;
|
|
2366
|
+
}, z.core.$strip>>;
|
package/dist/sdk/zod.gen.js
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
export const zPlatformTier = z.enum([
|
|
4
|
+
'free',
|
|
5
|
+
'hobby',
|
|
6
|
+
'pro'
|
|
7
|
+
]);
|
|
8
|
+
export const zBillingInterval = z.enum([
|
|
9
|
+
'monthly',
|
|
10
|
+
'annual'
|
|
11
|
+
]);
|
|
3
12
|
export const zBillingPlanLookupKey = z.enum([
|
|
4
|
-
'
|
|
5
|
-
'
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'pro_annual'
|
|
13
|
+
'free-monthly',
|
|
14
|
+
'hobby-monthly',
|
|
15
|
+
'hobby-annual',
|
|
16
|
+
'pro-monthly',
|
|
17
|
+
'pro-annual'
|
|
10
18
|
]);
|
|
11
19
|
export const zHealthResponse = z.object({
|
|
12
20
|
status: z.string()
|
|
@@ -439,26 +447,15 @@ export const zSignedUrlUploadResponse = z.object({
|
|
|
439
447
|
expiration: z.iso.datetime()
|
|
440
448
|
});
|
|
441
449
|
export const zBillingPlan = z.object({
|
|
442
|
-
tier:
|
|
443
|
-
|
|
444
|
-
'hobby',
|
|
445
|
-
'pro'
|
|
446
|
-
]),
|
|
447
|
-
interval: z.optional(z.enum([
|
|
448
|
-
'monthly',
|
|
449
|
-
'annual'
|
|
450
|
-
])),
|
|
450
|
+
tier: zPlatformTier,
|
|
451
|
+
interval: z.optional(zBillingInterval),
|
|
451
452
|
seatCount: z.coerce.bigint(),
|
|
452
453
|
currentPeriodEnd: z.optional(z.iso.datetime()),
|
|
453
|
-
pendingDowngrade: z.optional(
|
|
454
|
-
'free',
|
|
455
|
-
'hobby',
|
|
456
|
-
'pro'
|
|
457
|
-
])),
|
|
454
|
+
pendingDowngrade: z.optional(zPlatformTier),
|
|
458
455
|
entitlements: z.array(z.string())
|
|
459
456
|
});
|
|
460
457
|
export const zUpdatePlanRequest = z.object({
|
|
461
|
-
|
|
458
|
+
lookup_key: z.string()
|
|
462
459
|
});
|
|
463
460
|
export const zPaymentMethod = z.object({
|
|
464
461
|
id: z.string(),
|
|
@@ -474,6 +471,17 @@ export const zSetupIntentResponse = z.object({
|
|
|
474
471
|
export const zBillingUsage = z.object({
|
|
475
472
|
totalUnits: z.coerce.bigint()
|
|
476
473
|
});
|
|
474
|
+
export const zRecordUsageRequest = z.object({
|
|
475
|
+
orgCode: z.string(),
|
|
476
|
+
quantity: z.coerce.bigint(),
|
|
477
|
+
timestamp: z.optional(z.coerce.bigint())
|
|
478
|
+
});
|
|
479
|
+
export const zPlanPriceResponse = z.object({
|
|
480
|
+
code: z.string(),
|
|
481
|
+
unit_amount_cents: z.coerce.bigint(),
|
|
482
|
+
currency: z.string(),
|
|
483
|
+
interval: z.string()
|
|
484
|
+
});
|
|
477
485
|
/**
|
|
478
486
|
* Expiry query.
|
|
479
487
|
*/
|
|
@@ -934,6 +942,11 @@ export const zRequestSignedUploadUrlData = z.object({
|
|
|
934
942
|
* A successfully generated signed url.
|
|
935
943
|
*/
|
|
936
944
|
export const zRequestSignedUploadUrlResponse = zSignedUrlUploadResponse;
|
|
945
|
+
export const zRecordCloudUsageData = z.object({
|
|
946
|
+
body: zRecordUsageRequest,
|
|
947
|
+
path: z.optional(z.never()),
|
|
948
|
+
query: z.optional(z.never())
|
|
949
|
+
});
|
|
937
950
|
export const zGetBillingPlanData = z.object({
|
|
938
951
|
body: z.optional(z.never()),
|
|
939
952
|
path: z.object({
|
|
@@ -1009,3 +1022,14 @@ export const zGetBillingUsageData = z.object({
|
|
|
1009
1022
|
* Current billing period usage.
|
|
1010
1023
|
*/
|
|
1011
1024
|
export const zGetBillingUsageResponse = zBillingUsage;
|
|
1025
|
+
export const zFetchBillingPricesData = z.object({
|
|
1026
|
+
body: z.optional(z.never()),
|
|
1027
|
+
path: z.object({
|
|
1028
|
+
spaceHandle: z.string()
|
|
1029
|
+
}),
|
|
1030
|
+
query: z.optional(z.never())
|
|
1031
|
+
});
|
|
1032
|
+
/**
|
|
1033
|
+
* A list of plan prices.
|
|
1034
|
+
*/
|
|
1035
|
+
export const zFetchBillingPricesResponse = z.array(zPlanPriceResponse);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { GetSuccessResponse } from "../util";
|
|
3
|
-
import { GetServiceHealthData, FetchGraphM2mData, RequestAccountPasswordResetData, RequestAccountPasswordResetResponses, UpdateUsernameData, UpdateUsernameResponses, CreateUsernameData, CreateUsernameResponses, GetUserProfileData, UpdateUserProfileData, UpdateUserProfileResponses, GetUserIdentitiesData, DeleteAccountIdentityData, DeleteAccountIdentityResponses, GetConnectedAppUrlData, UpdateConnectedAppTokenData, UpdateConnectedAppTokenResponses, ListInstallationRepositoriesData, ListInstallationBranchesData, ListUserInstallationsData, ListUserSpacesData, CreateSpaceData, CreateSpaceResponses, GetUserInvitesData, JoinSpaceData, JoinSpaceResponses, RejectSpaceInviteData, RejectSpaceInviteResponses, GetSpaceOverviewData, GetSpaceOrgCodeData, FetchKindeOrganisationBillingAgreementsData, GetSpaceInvitesData, CreateSpaceInviteData, CreateSpaceInviteResponses, RevokeSpaceInviteData, RevokeSpaceInviteResponses, ListSpaceMembersData, ListSpaceMemberRolesData, LeaveSpaceData, LeaveSpaceResponses, CreateProjectData, CreateProjectResponses, GetProjectOverviewData, CreateEnvironmentData, CreateEnvironmentResponses, GetEnvironmentOverviewData, GetGraphOverviewData, UpdateGraphStateData, UpdateGraphStateResponses, DeployVersionData, DeployVersionResponses, RequestSignedUploadUrlData, GetBillingPlanData, UpdateBillingPlanData, UpdateBillingPlanResponses, CreateSetupIntentData, CreateSetupIntentResponses, ListPaymentMethodsData, RemovePaymentMethodData, RemovePaymentMethodResponses, SetDefaultPaymentMethodData, SetDefaultPaymentMethodResponses, GetBillingUsageData } from "../../sdk/types.gen";
|
|
3
|
+
import { GetServiceHealthData, FetchGraphM2mData, RequestAccountPasswordResetData, RequestAccountPasswordResetResponses, UpdateUsernameData, UpdateUsernameResponses, CreateUsernameData, CreateUsernameResponses, GetUserProfileData, UpdateUserProfileData, UpdateUserProfileResponses, GetUserIdentitiesData, DeleteAccountIdentityData, DeleteAccountIdentityResponses, GetConnectedAppUrlData, UpdateConnectedAppTokenData, UpdateConnectedAppTokenResponses, ListInstallationRepositoriesData, ListInstallationBranchesData, ListUserInstallationsData, ListUserSpacesData, CreateSpaceData, CreateSpaceResponses, GetUserInvitesData, JoinSpaceData, JoinSpaceResponses, RejectSpaceInviteData, RejectSpaceInviteResponses, GetSpaceOverviewData, GetSpaceOrgCodeData, FetchKindeOrganisationBillingAgreementsData, GetSpaceInvitesData, CreateSpaceInviteData, CreateSpaceInviteResponses, RevokeSpaceInviteData, RevokeSpaceInviteResponses, ListSpaceMembersData, ListSpaceMemberRolesData, LeaveSpaceData, LeaveSpaceResponses, CreateProjectData, CreateProjectResponses, GetProjectOverviewData, CreateEnvironmentData, CreateEnvironmentResponses, GetEnvironmentOverviewData, GetGraphOverviewData, UpdateGraphStateData, UpdateGraphStateResponses, DeployVersionData, DeployVersionResponses, RequestSignedUploadUrlData, RecordCloudUsageData, RecordCloudUsageResponses, GetBillingPlanData, UpdateBillingPlanData, UpdateBillingPlanResponses, CreateSetupIntentData, CreateSetupIntentResponses, ListPaymentMethodsData, RemovePaymentMethodData, RemovePaymentMethodResponses, SetDefaultPaymentMethodData, SetDefaultPaymentMethodResponses, GetBillingUsageData, FetchBillingPricesData } from "../../sdk/types.gen";
|
|
4
4
|
export declare const useGetServiceHealth: (options?: Omit<GetServiceHealthData, "url"> & {
|
|
5
5
|
enabled?: boolean;
|
|
6
6
|
}) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").HealthResponse | undefined, Error>;
|
|
@@ -141,6 +141,11 @@ export declare const useDeployVersion: (config?: {
|
|
|
141
141
|
export declare const useRequestSignedUploadUrl: (options: Omit<RequestSignedUploadUrlData, "url"> & {
|
|
142
142
|
enabled?: boolean;
|
|
143
143
|
}) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").SignedUrlUploadResponse | undefined, Error>;
|
|
144
|
+
export declare const useRecordCloudUsage: (config?: {
|
|
145
|
+
onSuccess?: (data: GetSuccessResponse<RecordCloudUsageResponses>) => void;
|
|
146
|
+
onError?: Parameters<typeof useMutation>["0"]["onError"];
|
|
147
|
+
retry?: boolean;
|
|
148
|
+
}) => import("@tanstack/react-query").UseMutationResult<unknown, unknown, Omit<RecordCloudUsageData, "url">, unknown>;
|
|
144
149
|
export declare const useGetBillingPlan: (options: Omit<GetBillingPlanData, "url"> & {
|
|
145
150
|
enabled?: boolean;
|
|
146
151
|
}) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").BillingPlan | undefined, Error>;
|
|
@@ -170,3 +175,6 @@ export declare const useSetDefaultPaymentMethod: (config?: {
|
|
|
170
175
|
export declare const useGetBillingUsage: (options: Omit<GetBillingUsageData, "url"> & {
|
|
171
176
|
enabled?: boolean;
|
|
172
177
|
}) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").BillingUsage | undefined, Error>;
|
|
178
|
+
export declare const useFetchBillingPrices: (options: Omit<FetchBillingPricesData, "url"> & {
|
|
179
|
+
enabled?: boolean;
|
|
180
|
+
}) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").PlanPriceResponse[] | undefined, Error>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { isPromise } from "../util";
|
|
4
4
|
import { useToken } from "../../provider/token-provider";
|
|
5
|
-
import { getServiceHealth, fetchGraphM2M, requestAccountPasswordReset, updateUsername, createUsername, getUserProfile, updateUserProfile, getUserIdentities, deleteAccountIdentity, getConnectedAppUrl, updateConnectedAppToken, listInstallationRepositories, listInstallationBranches, listUserInstallations, listUserSpaces, createSpace, getUserInvites, joinSpace, rejectSpaceInvite, getSpaceOverview, getSpaceOrgCode, fetchKindeOrganisationBillingAgreements, getSpaceInvites, createSpaceInvite, revokeSpaceInvite, listSpaceMembers, listSpaceMemberRoles, leaveSpace, createProject, getProjectOverview, createEnvironment, getEnvironmentOverview, getGraphOverview, updateGraphState, deployVersion, requestSignedUploadUrl, getBillingPlan, updateBillingPlan, createSetupIntent, listPaymentMethods, removePaymentMethod, setDefaultPaymentMethod, getBillingUsage } from "../../sdk/sdk.gen";
|
|
5
|
+
import { getServiceHealth, fetchGraphM2M, requestAccountPasswordReset, updateUsername, createUsername, getUserProfile, updateUserProfile, getUserIdentities, deleteAccountIdentity, getConnectedAppUrl, updateConnectedAppToken, listInstallationRepositories, listInstallationBranches, listUserInstallations, listUserSpaces, createSpace, getUserInvites, joinSpace, rejectSpaceInvite, getSpaceOverview, getSpaceOrgCode, fetchKindeOrganisationBillingAgreements, getSpaceInvites, createSpaceInvite, revokeSpaceInvite, listSpaceMembers, listSpaceMemberRoles, leaveSpace, createProject, getProjectOverview, createEnvironment, getEnvironmentOverview, getGraphOverview, updateGraphState, deployVersion, requestSignedUploadUrl, recordCloudUsage, getBillingPlan, updateBillingPlan, createSetupIntent, listPaymentMethods, removePaymentMethod, setDefaultPaymentMethod, getBillingUsage, fetchBillingPrices } from "../../sdk/sdk.gen";
|
|
6
6
|
export const useGetServiceHealth = (options) => {
|
|
7
7
|
const token = useToken();
|
|
8
8
|
let { enabled, ...rest } = options || { enabled: true };
|
|
@@ -727,6 +727,25 @@ export const useRequestSignedUploadUrl = (options) => {
|
|
|
727
727
|
staleTime: 600000
|
|
728
728
|
});
|
|
729
729
|
};
|
|
730
|
+
export const useRecordCloudUsage = (config) => {
|
|
731
|
+
const token = useToken();
|
|
732
|
+
const queryClient = useQueryClient();
|
|
733
|
+
const opts = { throwOnError: true, url: "/m2m/billing/usage/record" };
|
|
734
|
+
const funcer = async (options) => {
|
|
735
|
+
const auth = isPromise(token) ? (await token) || "" : token || "";
|
|
736
|
+
const res = await recordCloudUsage({ ...opts, ...options, auth });
|
|
737
|
+
return res?.data;
|
|
738
|
+
};
|
|
739
|
+
return useMutation({
|
|
740
|
+
mutationFn: funcer,
|
|
741
|
+
onSuccess: (res, options, c, ctx) => {
|
|
742
|
+
queryClient.invalidateQueries({ queryKey: ["m2m", "billing", "usage", "record"] });
|
|
743
|
+
config?.onSuccess && config.onSuccess(res);
|
|
744
|
+
},
|
|
745
|
+
onError: config?.onError,
|
|
746
|
+
retry: config?.retry
|
|
747
|
+
});
|
|
748
|
+
};
|
|
730
749
|
export const useGetBillingPlan = (options) => {
|
|
731
750
|
const token = useToken();
|
|
732
751
|
let { enabled, ...rest } = options || { enabled: true };
|
|
@@ -866,3 +885,24 @@ export const useGetBillingUsage = (options) => {
|
|
|
866
885
|
staleTime: 600000
|
|
867
886
|
});
|
|
868
887
|
};
|
|
888
|
+
export const useFetchBillingPrices = (options) => {
|
|
889
|
+
const token = useToken();
|
|
890
|
+
let { enabled, ...rest } = options || { enabled: true };
|
|
891
|
+
const opts = { throwOnError: true, url: "/auth/{spaceHandle}/billing/prices" };
|
|
892
|
+
const funcer = async () => {
|
|
893
|
+
const auth = isPromise(token) ? (await token) || "" : token || "";
|
|
894
|
+
if (isPromise(token) && !token)
|
|
895
|
+
return;
|
|
896
|
+
const res = await fetchBillingPrices({ ...opts, ...rest, auth });
|
|
897
|
+
return res.data;
|
|
898
|
+
};
|
|
899
|
+
if (!token)
|
|
900
|
+
enabled = false;
|
|
901
|
+
return useQuery({
|
|
902
|
+
queryKey: [options?.path?.spaceHandle, "billing", "prices", options.query ?? {}],
|
|
903
|
+
queryFn: funcer,
|
|
904
|
+
enabled,
|
|
905
|
+
retry: false,
|
|
906
|
+
staleTime: 600000
|
|
907
|
+
});
|
|
908
|
+
};
|