shoal-web-sdk 0.0.98 → 0.0.100

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.
@@ -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, CreateSpaceData, CreateSpaceError, CreateSpaceInviteData, CreateSpaceInviteError, CreateSpaceInviteResponse, CreateSpaceResponse, CreateUsernameData, CreateUsernameError, DeleteAccountIdentityData, DeleteAccountIdentityError, DeleteAccountIdentityResponse, DeployVersionData, DeployVersionError, FetchGraphM2mData, FetchKindeOrganisationBillingAgreementsData, GetConnectedAppUrlData, GetEnvironmentOverviewData, GetGraphOverviewData, GetProjectOverviewData, GetServiceHealthData, GetSpaceInvitesData, GetSpaceOverviewData, GetUserIdentitiesData, GetUserInvitesData, GetUserProfileData, JoinSpaceData, JoinSpaceError, LeaveSpaceData, LeaveSpaceError, ListInstallationBranchesData, ListInstallationRepositoriesData, ListSpaceMemberRolesData, ListSpaceMembersData, ListUserInstallationsData, ListUserSpacesData, RejectSpaceInviteData, RejectSpaceInviteError, RejectSpaceInviteResponse, RequestAccountPasswordResetData, RequestAccountPasswordResetError, RevokeSpaceInviteData, RevokeSpaceInviteError, RevokeSpaceInviteResponse, UpdateConnectedAppTokenData, UpdateConnectedAppTokenError, UpdateGraphStateData, UpdateGraphStateError, UpdateUsernameData, UpdateUsernameError, UpdateUserProfileData, UpdateUserProfileError, UploadNodeSourceZipData, UploadNodeSourceZipError, UploadNodeSourceZipResponse } 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, FetchGraphM2mData, FetchKindeOrganisationBillingAgreementsData, GetBillingPlanData, GetBillingUsageData, GetConnectedAppUrlData, GetEnvironmentOverviewData, GetGraphOverviewData, GetProjectOverviewData, GetServiceHealthData, GetSpaceInvitesData, GetSpaceOverviewData, GetUserIdentitiesData, GetUserInvitesData, GetUserProfileData, JoinSpaceData, JoinSpaceError, LeaveSpaceData, LeaveSpaceError, ListInstallationBranchesData, ListInstallationRepositoriesData, ListPaymentMethodsData, ListSpaceMemberRolesData, ListSpaceMembersData, ListUserInstallationsData, ListUserSpacesData, RejectSpaceInviteData, RejectSpaceInviteError, RejectSpaceInviteResponse, RemovePaymentMethodData, RemovePaymentMethodError, RemovePaymentMethodResponse, RequestAccountPasswordResetData, RequestAccountPasswordResetError, RevokeSpaceInviteData, RevokeSpaceInviteError, RevokeSpaceInviteResponse, SetDefaultPaymentMethodData, SetDefaultPaymentMethodError, SetDefaultPaymentMethodResponse, UpdateBillingPlanData, UpdateBillingPlanError, UpdateConnectedAppTokenData, UpdateConnectedAppTokenError, UpdateGraphStateData, UpdateGraphStateError, UpdateUsernameData, UpdateUsernameError, UpdateUserProfileData, UpdateUserProfileError, UploadNodeSourceZipData, UploadNodeSourceZipError, UploadNodeSourceZipResponse } from '../types.gen';
4
4
  export type QueryKey<TOptions extends Options> = [
5
5
  Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
6
6
  _id: string;
@@ -751,3 +751,103 @@ export declare const deployVersionMutation: (options?: Partial<Options<DeployVer
751
751
  *
752
752
  */
753
753
  export declare const uploadNodeSourceZipMutation: (options?: Partial<Options<UploadNodeSourceZipData>>) => UseMutationOptions<UploadNodeSourceZipResponse, UploadNodeSourceZipError, Options<UploadNodeSourceZipData>>;
754
+ export declare const getBillingPlanQueryKey: (options: Options<GetBillingPlanData>) => [Pick<Options<GetBillingPlanData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
755
+ _id: string;
756
+ _infinite?: boolean;
757
+ tags?: ReadonlyArray<string>;
758
+ }];
759
+ /**
760
+ * Get the current billing plan for a space.
761
+ */
762
+ export declare const getBillingPlanOptions: (options: Options<GetBillingPlanData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").BillingPlan, Error, import("../types.gen").BillingPlan, [Pick<Options<GetBillingPlanData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
763
+ _id: string;
764
+ _infinite?: boolean;
765
+ tags?: ReadonlyArray<string>;
766
+ }]>, "queryFn"> & {
767
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").BillingPlan, [Pick<Options<GetBillingPlanData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
768
+ _id: string;
769
+ _infinite?: boolean;
770
+ tags?: ReadonlyArray<string>;
771
+ }], never> | undefined;
772
+ } & {
773
+ queryKey: [Pick<Options<GetBillingPlanData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
774
+ _id: string;
775
+ _infinite?: boolean;
776
+ tags?: ReadonlyArray<string>;
777
+ }] & {
778
+ [dataTagSymbol]: import("../types.gen").BillingPlan;
779
+ [dataTagErrorSymbol]: Error;
780
+ };
781
+ };
782
+ /**
783
+ * Upgrade or downgrade the billing plan for a space.
784
+ */
785
+ export declare const updateBillingPlanMutation: (options?: Partial<Options<UpdateBillingPlanData>>) => UseMutationOptions<unknown, UpdateBillingPlanError, Options<UpdateBillingPlanData>>;
786
+ /**
787
+ * Create a Stripe SetupIntent to collect a payment method.
788
+ */
789
+ export declare const createSetupIntentMutation: (options?: Partial<Options<CreateSetupIntentData>>) => UseMutationOptions<CreateSetupIntentResponse, CreateSetupIntentError, Options<CreateSetupIntentData>>;
790
+ export declare const listPaymentMethodsQueryKey: (options: Options<ListPaymentMethodsData>) => [Pick<Options<ListPaymentMethodsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
791
+ _id: string;
792
+ _infinite?: boolean;
793
+ tags?: ReadonlyArray<string>;
794
+ }];
795
+ /**
796
+ * List all saved payment methods for a space.
797
+ */
798
+ export declare const listPaymentMethodsOptions: (options: Options<ListPaymentMethodsData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").PaymentMethod[], Error, import("../types.gen").PaymentMethod[], [Pick<Options<ListPaymentMethodsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
799
+ _id: string;
800
+ _infinite?: boolean;
801
+ tags?: ReadonlyArray<string>;
802
+ }]>, "queryFn"> & {
803
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").PaymentMethod[], [Pick<Options<ListPaymentMethodsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
804
+ _id: string;
805
+ _infinite?: boolean;
806
+ tags?: ReadonlyArray<string>;
807
+ }], never> | undefined;
808
+ } & {
809
+ queryKey: [Pick<Options<ListPaymentMethodsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
810
+ _id: string;
811
+ _infinite?: boolean;
812
+ tags?: ReadonlyArray<string>;
813
+ }] & {
814
+ [dataTagSymbol]: import("../types.gen").PaymentMethod[];
815
+ [dataTagErrorSymbol]: Error;
816
+ };
817
+ };
818
+ /**
819
+ * Remove a saved payment method.
820
+ */
821
+ export declare const removePaymentMethodMutation: (options?: Partial<Options<RemovePaymentMethodData>>) => UseMutationOptions<RemovePaymentMethodResponse, RemovePaymentMethodError, Options<RemovePaymentMethodData>>;
822
+ /**
823
+ * Set a payment method as the default for invoices.
824
+ */
825
+ export declare const setDefaultPaymentMethodMutation: (options?: Partial<Options<SetDefaultPaymentMethodData>>) => UseMutationOptions<SetDefaultPaymentMethodResponse, SetDefaultPaymentMethodError, Options<SetDefaultPaymentMethodData>>;
826
+ export declare const getBillingUsageQueryKey: (options: Options<GetBillingUsageData>) => [Pick<Options<GetBillingUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
827
+ _id: string;
828
+ _infinite?: boolean;
829
+ tags?: ReadonlyArray<string>;
830
+ }];
831
+ /**
832
+ * Get metered cloud usage for the current billing period.
833
+ */
834
+ export declare const getBillingUsageOptions: (options: Options<GetBillingUsageData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").BillingUsage, Error, import("../types.gen").BillingUsage, [Pick<Options<GetBillingUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
835
+ _id: string;
836
+ _infinite?: boolean;
837
+ tags?: ReadonlyArray<string>;
838
+ }]>, "queryFn"> & {
839
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").BillingUsage, [Pick<Options<GetBillingUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
840
+ _id: string;
841
+ _infinite?: boolean;
842
+ tags?: ReadonlyArray<string>;
843
+ }], never> | undefined;
844
+ } & {
845
+ queryKey: [Pick<Options<GetBillingUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
846
+ _id: string;
847
+ _infinite?: boolean;
848
+ tags?: ReadonlyArray<string>;
849
+ }] & {
850
+ [dataTagSymbol]: import("../types.gen").BillingUsage;
851
+ [dataTagErrorSymbol]: Error;
852
+ };
853
+ };
@@ -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, createSpace, createSpaceInvite, createUsername, deleteAccountIdentity, deployVersion, fetchGraphM2M, fetchKindeOrganisationBillingAgreements, getConnectedAppUrl, getEnvironmentOverview, getGraphOverview, getProjectOverview, getServiceHealth, getSpaceInvites, getSpaceOverview, getUserIdentities, getUserInvites, getUserProfile, joinSpace, leaveSpace, listInstallationBranches, listInstallationRepositories, listSpaceMemberRoles, listSpaceMembers, listUserInstallations, listUserSpaces, rejectSpaceInvite, requestAccountPasswordReset, revokeSpaceInvite, updateConnectedAppToken, updateGraphState, updateUsername, updateUserProfile, uploadNodeSourceZip } from '../sdk.gen';
4
+ import { createEnvironment, createProject, createSetupIntent, createSpace, createSpaceInvite, createUsername, deleteAccountIdentity, deployVersion, fetchGraphM2M, fetchKindeOrganisationBillingAgreements, getBillingPlan, getBillingUsage, getConnectedAppUrl, getEnvironmentOverview, getGraphOverview, getProjectOverview, getServiceHealth, getSpaceInvites, getSpaceOverview, getUserIdentities, getUserInvites, getUserProfile, joinSpace, leaveSpace, listInstallationBranches, listInstallationRepositories, listPaymentMethods, listSpaceMemberRoles, listSpaceMembers, listUserInstallations, listUserSpaces, rejectSpaceInvite, removePaymentMethod, requestAccountPasswordReset, revokeSpaceInvite, setDefaultPaymentMethod, updateBillingPlan, updateConnectedAppToken, updateGraphState, updateUsername, updateUserProfile, uploadNodeSourceZip } 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) {
@@ -844,3 +844,121 @@ export const uploadNodeSourceZipMutation = (options) => {
844
844
  };
845
845
  return mutationOptions;
846
846
  };
847
+ export const getBillingPlanQueryKey = (options) => createQueryKey('getBillingPlan', options);
848
+ /**
849
+ * Get the current billing plan for a space.
850
+ */
851
+ export const getBillingPlanOptions = (options) => {
852
+ return queryOptions({
853
+ queryFn: async ({ queryKey, signal }) => {
854
+ const { data } = await getBillingPlan({
855
+ ...options,
856
+ ...queryKey[0],
857
+ signal,
858
+ throwOnError: true
859
+ });
860
+ return data;
861
+ },
862
+ queryKey: getBillingPlanQueryKey(options)
863
+ });
864
+ };
865
+ /**
866
+ * Upgrade or downgrade the billing plan for a space.
867
+ */
868
+ export const updateBillingPlanMutation = (options) => {
869
+ const mutationOptions = {
870
+ mutationFn: async (fnOptions) => {
871
+ const { data } = await updateBillingPlan({
872
+ ...options,
873
+ ...fnOptions,
874
+ throwOnError: true
875
+ });
876
+ return data;
877
+ }
878
+ };
879
+ return mutationOptions;
880
+ };
881
+ /**
882
+ * Create a Stripe SetupIntent to collect a payment method.
883
+ */
884
+ export const createSetupIntentMutation = (options) => {
885
+ const mutationOptions = {
886
+ mutationFn: async (fnOptions) => {
887
+ const { data } = await createSetupIntent({
888
+ ...options,
889
+ ...fnOptions,
890
+ throwOnError: true
891
+ });
892
+ return data;
893
+ }
894
+ };
895
+ return mutationOptions;
896
+ };
897
+ export const listPaymentMethodsQueryKey = (options) => createQueryKey('listPaymentMethods', options);
898
+ /**
899
+ * List all saved payment methods for a space.
900
+ */
901
+ export const listPaymentMethodsOptions = (options) => {
902
+ return queryOptions({
903
+ queryFn: async ({ queryKey, signal }) => {
904
+ const { data } = await listPaymentMethods({
905
+ ...options,
906
+ ...queryKey[0],
907
+ signal,
908
+ throwOnError: true
909
+ });
910
+ return data;
911
+ },
912
+ queryKey: listPaymentMethodsQueryKey(options)
913
+ });
914
+ };
915
+ /**
916
+ * Remove a saved payment method.
917
+ */
918
+ export const removePaymentMethodMutation = (options) => {
919
+ const mutationOptions = {
920
+ mutationFn: async (fnOptions) => {
921
+ const { data } = await removePaymentMethod({
922
+ ...options,
923
+ ...fnOptions,
924
+ throwOnError: true
925
+ });
926
+ return data;
927
+ }
928
+ };
929
+ return mutationOptions;
930
+ };
931
+ /**
932
+ * Set a payment method as the default for invoices.
933
+ */
934
+ export const setDefaultPaymentMethodMutation = (options) => {
935
+ const mutationOptions = {
936
+ mutationFn: async (fnOptions) => {
937
+ const { data } = await setDefaultPaymentMethod({
938
+ ...options,
939
+ ...fnOptions,
940
+ throwOnError: true
941
+ });
942
+ return data;
943
+ }
944
+ };
945
+ return mutationOptions;
946
+ };
947
+ export const getBillingUsageQueryKey = (options) => createQueryKey('getBillingUsage', options);
948
+ /**
949
+ * Get metered cloud usage for the current billing period.
950
+ */
951
+ export const getBillingUsageOptions = (options) => {
952
+ return queryOptions({
953
+ queryFn: async ({ queryKey, signal }) => {
954
+ const { data } = await getBillingUsage({
955
+ ...options,
956
+ ...queryKey[0],
957
+ signal,
958
+ throwOnError: true
959
+ });
960
+ return data;
961
+ },
962
+ queryKey: getBillingUsageQueryKey(options)
963
+ });
964
+ };
@@ -1,5 +1,5 @@
1
1
  import { type Client, type Options as Options2, type TDataShape } from './client';
2
- import type { CreateEnvironmentData, CreateEnvironmentErrors, CreateEnvironmentResponses, CreateProjectData, CreateProjectErrors, CreateProjectResponses, CreateSpaceData, CreateSpaceErrors, CreateSpaceInviteData, CreateSpaceInviteErrors, CreateSpaceInviteResponses, CreateSpaceResponses, CreateUsernameData, CreateUsernameErrors, CreateUsernameResponses, DeleteAccountIdentityData, DeleteAccountIdentityErrors, DeleteAccountIdentityResponses, DeployVersionData, DeployVersionErrors, DeployVersionResponses, FetchGraphM2mData, FetchGraphM2mErrors, FetchGraphM2mResponses, FetchKindeOrganisationBillingAgreementsData, FetchKindeOrganisationBillingAgreementsErrors, FetchKindeOrganisationBillingAgreementsResponses, GetConnectedAppUrlData, GetConnectedAppUrlErrors, GetConnectedAppUrlResponses, GetEnvironmentOverviewData, GetEnvironmentOverviewErrors, GetEnvironmentOverviewResponses, GetGraphOverviewData, GetGraphOverviewErrors, GetGraphOverviewResponses, GetProjectOverviewData, GetProjectOverviewErrors, GetProjectOverviewResponses, GetServiceHealthData, GetServiceHealthResponses, GetSpaceInvitesData, GetSpaceInvitesErrors, GetSpaceInvitesResponses, GetSpaceOverviewData, GetSpaceOverviewErrors, GetSpaceOverviewResponses, GetUserIdentitiesData, GetUserIdentitiesErrors, GetUserIdentitiesResponses, GetUserInvitesData, GetUserInvitesErrors, GetUserInvitesResponses, GetUserProfileData, GetUserProfileErrors, GetUserProfileResponses, JoinSpaceData, JoinSpaceErrors, JoinSpaceResponses, LeaveSpaceData, LeaveSpaceErrors, LeaveSpaceResponses, ListInstallationBranchesData, ListInstallationBranchesErrors, ListInstallationBranchesResponses, ListInstallationRepositoriesData, ListInstallationRepositoriesErrors, ListInstallationRepositoriesResponses, ListSpaceMemberRolesData, ListSpaceMemberRolesErrors, ListSpaceMemberRolesResponses, ListSpaceMembersData, ListSpaceMembersErrors, ListSpaceMembersResponses, ListUserInstallationsData, ListUserInstallationsErrors, ListUserInstallationsResponses, ListUserSpacesData, ListUserSpacesErrors, ListUserSpacesResponses, RejectSpaceInviteData, RejectSpaceInviteErrors, RejectSpaceInviteResponses, RequestAccountPasswordResetData, RequestAccountPasswordResetErrors, RequestAccountPasswordResetResponses, RevokeSpaceInviteData, RevokeSpaceInviteErrors, RevokeSpaceInviteResponses, UpdateConnectedAppTokenData, UpdateConnectedAppTokenErrors, UpdateConnectedAppTokenResponses, UpdateGraphStateData, UpdateGraphStateErrors, UpdateGraphStateResponses, UpdateUsernameData, UpdateUsernameErrors, UpdateUsernameResponses, UpdateUserProfileData, UpdateUserProfileErrors, UpdateUserProfileResponses, UploadNodeSourceZipData, UploadNodeSourceZipErrors, UploadNodeSourceZipResponses } 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, 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, 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, RevokeSpaceInviteData, RevokeSpaceInviteErrors, RevokeSpaceInviteResponses, SetDefaultPaymentMethodData, SetDefaultPaymentMethodErrors, SetDefaultPaymentMethodResponses, UpdateBillingPlanData, UpdateBillingPlanErrors, UpdateBillingPlanResponses, UpdateConnectedAppTokenData, UpdateConnectedAppTokenErrors, UpdateConnectedAppTokenResponses, UpdateGraphStateData, UpdateGraphStateErrors, UpdateGraphStateResponses, UpdateUsernameData, UpdateUsernameErrors, UpdateUsernameResponses, UpdateUserProfileData, UpdateUserProfileErrors, UpdateUserProfileResponses, UploadNodeSourceZipData, UploadNodeSourceZipErrors, UploadNodeSourceZipResponses } 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
@@ -156,3 +156,31 @@ export declare const deployVersion: <ThrowOnError extends boolean = false>(optio
156
156
  *
157
157
  */
158
158
  export declare const uploadNodeSourceZip: <ThrowOnError extends boolean = false>(options: Options<UploadNodeSourceZipData, ThrowOnError>) => import("./client").RequestResult<UploadNodeSourceZipResponses, UploadNodeSourceZipErrors, ThrowOnError, "fields">;
159
+ /**
160
+ * Get the current billing plan for a space.
161
+ */
162
+ export declare const getBillingPlan: <ThrowOnError extends boolean = false>(options: Options<GetBillingPlanData, ThrowOnError>) => import("./client").RequestResult<GetBillingPlanResponses, GetBillingPlanErrors, ThrowOnError, "fields">;
163
+ /**
164
+ * Upgrade or downgrade the billing plan for a space.
165
+ */
166
+ export declare const updateBillingPlan: <ThrowOnError extends boolean = false>(options: Options<UpdateBillingPlanData, ThrowOnError>) => import("./client").RequestResult<UpdateBillingPlanResponses, UpdateBillingPlanErrors, ThrowOnError, "fields">;
167
+ /**
168
+ * Create a Stripe SetupIntent to collect a payment method.
169
+ */
170
+ export declare const createSetupIntent: <ThrowOnError extends boolean = false>(options: Options<CreateSetupIntentData, ThrowOnError>) => import("./client").RequestResult<CreateSetupIntentResponses, CreateSetupIntentErrors, ThrowOnError, "fields">;
171
+ /**
172
+ * List all saved payment methods for a space.
173
+ */
174
+ export declare const listPaymentMethods: <ThrowOnError extends boolean = false>(options: Options<ListPaymentMethodsData, ThrowOnError>) => import("./client").RequestResult<ListPaymentMethodsResponses, ListPaymentMethodsErrors, ThrowOnError, "fields">;
175
+ /**
176
+ * Remove a saved payment method.
177
+ */
178
+ export declare const removePaymentMethod: <ThrowOnError extends boolean = false>(options: Options<RemovePaymentMethodData, ThrowOnError>) => import("./client").RequestResult<RemovePaymentMethodResponses, RemovePaymentMethodErrors, ThrowOnError, "fields">;
179
+ /**
180
+ * Set a payment method as the default for invoices.
181
+ */
182
+ export declare const setDefaultPaymentMethod: <ThrowOnError extends boolean = false>(options: Options<SetDefaultPaymentMethodData, ThrowOnError>) => import("./client").RequestResult<SetDefaultPaymentMethodResponses, SetDefaultPaymentMethodErrors, ThrowOnError, "fields">;
183
+ /**
184
+ * Get metered cloud usage for the current billing period.
185
+ */
186
+ export declare const getBillingUsage: <ThrowOnError extends boolean = false>(options: Options<GetBillingUsageData, ThrowOnError>) => import("./client").RequestResult<GetBillingUsageResponses, GetBillingUsageErrors, ThrowOnError, "fields">;
@@ -566,3 +566,112 @@ export const uploadNodeSourceZip = (options) => {
566
566
  }
567
567
  });
568
568
  };
569
+ /**
570
+ * Get the current billing plan for a space.
571
+ */
572
+ export const getBillingPlan = (options) => {
573
+ return (options.client ?? client).get({
574
+ security: [
575
+ {
576
+ scheme: 'bearer',
577
+ type: 'http'
578
+ }
579
+ ],
580
+ url: '/auth/{spaceHandle}/billing/plan',
581
+ ...options
582
+ });
583
+ };
584
+ /**
585
+ * Upgrade or downgrade the billing plan for a space.
586
+ */
587
+ export const updateBillingPlan = (options) => {
588
+ return (options.client ?? client).post({
589
+ security: [
590
+ {
591
+ scheme: 'bearer',
592
+ type: 'http'
593
+ }
594
+ ],
595
+ url: '/auth/{spaceHandle}/billing/plan',
596
+ ...options,
597
+ headers: {
598
+ 'Content-Type': 'application/json',
599
+ ...options.headers
600
+ }
601
+ });
602
+ };
603
+ /**
604
+ * Create a Stripe SetupIntent to collect a payment method.
605
+ */
606
+ export const createSetupIntent = (options) => {
607
+ return (options.client ?? client).post({
608
+ security: [
609
+ {
610
+ scheme: 'bearer',
611
+ type: 'http'
612
+ }
613
+ ],
614
+ url: '/auth/{spaceHandle}/billing/setup-intent',
615
+ ...options
616
+ });
617
+ };
618
+ /**
619
+ * List all saved payment methods for a space.
620
+ */
621
+ export const listPaymentMethods = (options) => {
622
+ return (options.client ?? client).get({
623
+ security: [
624
+ {
625
+ scheme: 'bearer',
626
+ type: 'http'
627
+ }
628
+ ],
629
+ url: '/auth/{spaceHandle}/billing/payment-methods',
630
+ ...options
631
+ });
632
+ };
633
+ /**
634
+ * Remove a saved payment method.
635
+ */
636
+ export const removePaymentMethod = (options) => {
637
+ return (options.client ?? client).delete({
638
+ security: [
639
+ {
640
+ scheme: 'bearer',
641
+ type: 'http'
642
+ }
643
+ ],
644
+ url: '/auth/{spaceHandle}/billing/payment-methods/{pmId}',
645
+ ...options
646
+ });
647
+ };
648
+ /**
649
+ * Set a payment method as the default for invoices.
650
+ */
651
+ export const setDefaultPaymentMethod = (options) => {
652
+ return (options.client ?? client).patch({
653
+ security: [
654
+ {
655
+ scheme: 'bearer',
656
+ type: 'http'
657
+ }
658
+ ],
659
+ url: '/auth/{spaceHandle}/billing/payment-methods/{pmId}/default',
660
+ ...options
661
+ });
662
+ };
663
+ /**
664
+ * Get metered cloud usage for the current billing period.
665
+ */
666
+ export const getBillingUsage = (options) => {
667
+ return (options.client ?? client).get({
668
+ security: [
669
+ {
670
+ scheme: 'bearer',
671
+ type: 'http'
672
+ }
673
+ ],
674
+ url: '/auth/{spaceHandle}/billing/usage',
675
+ ...options
676
+ });
677
+ };
@@ -4,7 +4,7 @@ export type ClientOptions = {
4
4
  export type HealthResponse = {
5
5
  status: string;
6
6
  };
7
- export type ErrorCode = 'UNKNOWN_ERROR' | 'AUTHORISATION_ERROR' | 'CONTENT_NOT_FOUND' | 'INVALID_PAGINATION' | 'INVALID_REQUEST_BODY' | 'INVALID_PATH_PARAM' | 'MISSING_CONTEXT_VALUE' | 'CONSTRAINT_ERROR' | 'PROJECT_CREATION_ERROR' | 'INVALID_QUERY_PARAM' | 'EXPIRED';
7
+ export type ErrorCode = 'UNKNOWN_ERROR' | 'AUTHORISATION_ERROR' | 'CONTENT_NOT_FOUND' | 'INVALID_PAGINATION' | 'INVALID_REQUEST_BODY' | 'INVALID_PATH_PARAM' | 'MISSING_CONTEXT_VALUE' | 'CONSTRAINT_ERROR' | 'PROJECT_CREATION_ERROR' | 'INVALID_QUERY_PARAM' | 'EXPIRED' | 'IDENTITY_NOT_FOUND';
8
8
  export type ErrorResponse = {
9
9
  message: string;
10
10
  internalCode: ErrorCode;
@@ -359,6 +359,31 @@ export type NodeSourceUploadResponse = {
359
359
  */
360
360
  contentType?: string;
361
361
  };
362
+ export type BillingPlan = {
363
+ tier: 'free' | 'hobby' | 'pro';
364
+ interval?: 'monthly' | 'annual';
365
+ seatCount: number;
366
+ currentPeriodEnd?: string;
367
+ pendingDowngrade?: 'free' | 'hobby' | 'pro';
368
+ entitlements: Array<string>;
369
+ };
370
+ export type UpdatePlanRequest = {
371
+ priceId: string;
372
+ };
373
+ export type PaymentMethod = {
374
+ id: string;
375
+ brand: string;
376
+ last4: string;
377
+ expMonth: number;
378
+ expYear: number;
379
+ isDefault: boolean;
380
+ };
381
+ export type SetupIntentResponse = {
382
+ clientSecret: string;
383
+ };
384
+ export type BillingUsage = {
385
+ totalUnits: number;
386
+ };
362
387
  /**
363
388
  * Expiry query.
364
389
  */
@@ -1835,3 +1860,245 @@ export type UploadNodeSourceZipResponses = {
1835
1860
  201: NodeSourceUploadResponse;
1836
1861
  };
1837
1862
  export type UploadNodeSourceZipResponse = UploadNodeSourceZipResponses[keyof UploadNodeSourceZipResponses];
1863
+ export type GetBillingPlanData = {
1864
+ body?: never;
1865
+ path: {
1866
+ /**
1867
+ * The space handle. This must be globally unique.
1868
+ */
1869
+ spaceHandle: string;
1870
+ };
1871
+ query?: never;
1872
+ url: '/auth/{spaceHandle}/billing/plan';
1873
+ };
1874
+ export type GetBillingPlanErrors = {
1875
+ /**
1876
+ * Unauthorised user.
1877
+ */
1878
+ 401: ErrorResponse;
1879
+ /**
1880
+ * Invalid credentials.
1881
+ */
1882
+ 403: ErrorResponse;
1883
+ /**
1884
+ * Unexpected error.
1885
+ */
1886
+ 500: ErrorResponse;
1887
+ };
1888
+ export type GetBillingPlanError = GetBillingPlanErrors[keyof GetBillingPlanErrors];
1889
+ export type GetBillingPlanResponses = {
1890
+ /**
1891
+ * The space's current billing plan.
1892
+ */
1893
+ 200: BillingPlan;
1894
+ };
1895
+ export type GetBillingPlanResponse = GetBillingPlanResponses[keyof GetBillingPlanResponses];
1896
+ export type UpdateBillingPlanData = {
1897
+ body: UpdatePlanRequest;
1898
+ path: {
1899
+ /**
1900
+ * The space handle. This must be globally unique.
1901
+ */
1902
+ spaceHandle: string;
1903
+ };
1904
+ query?: never;
1905
+ url: '/auth/{spaceHandle}/billing/plan';
1906
+ };
1907
+ export type UpdateBillingPlanErrors = {
1908
+ /**
1909
+ * Bad request.
1910
+ */
1911
+ 400: ErrorResponse;
1912
+ /**
1913
+ * Unauthorised user.
1914
+ */
1915
+ 401: ErrorResponse;
1916
+ /**
1917
+ * Invalid credentials.
1918
+ */
1919
+ 403: ErrorResponse;
1920
+ /**
1921
+ * Unexpected error.
1922
+ */
1923
+ 500: ErrorResponse;
1924
+ };
1925
+ export type UpdateBillingPlanError = UpdateBillingPlanErrors[keyof UpdateBillingPlanErrors];
1926
+ export type UpdateBillingPlanResponses = {
1927
+ /**
1928
+ * Plan update accepted.
1929
+ */
1930
+ 202: unknown;
1931
+ };
1932
+ export type CreateSetupIntentData = {
1933
+ body?: never;
1934
+ path: {
1935
+ /**
1936
+ * The space handle. This must be globally unique.
1937
+ */
1938
+ spaceHandle: string;
1939
+ };
1940
+ query?: never;
1941
+ url: '/auth/{spaceHandle}/billing/setup-intent';
1942
+ };
1943
+ export type CreateSetupIntentErrors = {
1944
+ /**
1945
+ * Unauthorised user.
1946
+ */
1947
+ 401: ErrorResponse;
1948
+ /**
1949
+ * Invalid credentials.
1950
+ */
1951
+ 403: ErrorResponse;
1952
+ /**
1953
+ * Unexpected error.
1954
+ */
1955
+ 500: ErrorResponse;
1956
+ };
1957
+ export type CreateSetupIntentError = CreateSetupIntentErrors[keyof CreateSetupIntentErrors];
1958
+ export type CreateSetupIntentResponses = {
1959
+ /**
1960
+ * SetupIntent client secret.
1961
+ */
1962
+ 200: SetupIntentResponse;
1963
+ };
1964
+ export type CreateSetupIntentResponse = CreateSetupIntentResponses[keyof CreateSetupIntentResponses];
1965
+ export type ListPaymentMethodsData = {
1966
+ body?: never;
1967
+ path: {
1968
+ /**
1969
+ * The space handle. This must be globally unique.
1970
+ */
1971
+ spaceHandle: string;
1972
+ };
1973
+ query?: never;
1974
+ url: '/auth/{spaceHandle}/billing/payment-methods';
1975
+ };
1976
+ export type ListPaymentMethodsErrors = {
1977
+ /**
1978
+ * Unauthorised user.
1979
+ */
1980
+ 401: ErrorResponse;
1981
+ /**
1982
+ * Invalid credentials.
1983
+ */
1984
+ 403: ErrorResponse;
1985
+ /**
1986
+ * Unexpected error.
1987
+ */
1988
+ 500: ErrorResponse;
1989
+ };
1990
+ export type ListPaymentMethodsError = ListPaymentMethodsErrors[keyof ListPaymentMethodsErrors];
1991
+ export type ListPaymentMethodsResponses = {
1992
+ /**
1993
+ * A list of payment methods.
1994
+ */
1995
+ 200: Array<PaymentMethod>;
1996
+ };
1997
+ export type ListPaymentMethodsResponse = ListPaymentMethodsResponses[keyof ListPaymentMethodsResponses];
1998
+ export type RemovePaymentMethodData = {
1999
+ body?: never;
2000
+ path: {
2001
+ /**
2002
+ * The space handle. This must be globally unique.
2003
+ */
2004
+ spaceHandle: string;
2005
+ /**
2006
+ * The payment method ID to remove.
2007
+ */
2008
+ pmId: string;
2009
+ };
2010
+ query?: never;
2011
+ url: '/auth/{spaceHandle}/billing/payment-methods/{pmId}';
2012
+ };
2013
+ export type RemovePaymentMethodErrors = {
2014
+ /**
2015
+ * Unauthorised user.
2016
+ */
2017
+ 401: ErrorResponse;
2018
+ /**
2019
+ * Invalid credentials.
2020
+ */
2021
+ 403: ErrorResponse;
2022
+ /**
2023
+ * Unexpected error.
2024
+ */
2025
+ 500: ErrorResponse;
2026
+ };
2027
+ export type RemovePaymentMethodError = RemovePaymentMethodErrors[keyof RemovePaymentMethodErrors];
2028
+ export type RemovePaymentMethodResponses = {
2029
+ /**
2030
+ * Payment method removed.
2031
+ */
2032
+ 204: void;
2033
+ };
2034
+ export type RemovePaymentMethodResponse = RemovePaymentMethodResponses[keyof RemovePaymentMethodResponses];
2035
+ export type SetDefaultPaymentMethodData = {
2036
+ body?: never;
2037
+ path: {
2038
+ /**
2039
+ * The space handle. This must be globally unique.
2040
+ */
2041
+ spaceHandle: string;
2042
+ /**
2043
+ * The payment method ID to set as default.
2044
+ */
2045
+ pmId: string;
2046
+ };
2047
+ query?: never;
2048
+ url: '/auth/{spaceHandle}/billing/payment-methods/{pmId}/default';
2049
+ };
2050
+ export type SetDefaultPaymentMethodErrors = {
2051
+ /**
2052
+ * Unauthorised user.
2053
+ */
2054
+ 401: ErrorResponse;
2055
+ /**
2056
+ * Invalid credentials.
2057
+ */
2058
+ 403: ErrorResponse;
2059
+ /**
2060
+ * Unexpected error.
2061
+ */
2062
+ 500: ErrorResponse;
2063
+ };
2064
+ export type SetDefaultPaymentMethodError = SetDefaultPaymentMethodErrors[keyof SetDefaultPaymentMethodErrors];
2065
+ export type SetDefaultPaymentMethodResponses = {
2066
+ /**
2067
+ * Default payment method updated.
2068
+ */
2069
+ 204: void;
2070
+ };
2071
+ export type SetDefaultPaymentMethodResponse = SetDefaultPaymentMethodResponses[keyof SetDefaultPaymentMethodResponses];
2072
+ export type GetBillingUsageData = {
2073
+ body?: never;
2074
+ path: {
2075
+ /**
2076
+ * The space handle. This must be globally unique.
2077
+ */
2078
+ spaceHandle: string;
2079
+ };
2080
+ query?: never;
2081
+ url: '/auth/{spaceHandle}/billing/usage';
2082
+ };
2083
+ export type GetBillingUsageErrors = {
2084
+ /**
2085
+ * Unauthorised user.
2086
+ */
2087
+ 401: ErrorResponse;
2088
+ /**
2089
+ * Invalid credentials.
2090
+ */
2091
+ 403: ErrorResponse;
2092
+ /**
2093
+ * Unexpected error.
2094
+ */
2095
+ 500: ErrorResponse;
2096
+ };
2097
+ export type GetBillingUsageError = GetBillingUsageErrors[keyof GetBillingUsageErrors];
2098
+ export type GetBillingUsageResponses = {
2099
+ /**
2100
+ * Current billing period usage.
2101
+ */
2102
+ 200: BillingUsage;
2103
+ };
2104
+ export type GetBillingUsageResponse = GetBillingUsageResponses[keyof GetBillingUsageResponses];
@@ -14,6 +14,7 @@ export declare const zErrorCode: z.ZodEnum<{
14
14
  PROJECT_CREATION_ERROR: "PROJECT_CREATION_ERROR";
15
15
  INVALID_QUERY_PARAM: "INVALID_QUERY_PARAM";
16
16
  EXPIRED: "EXPIRED";
17
+ IDENTITY_NOT_FOUND: "IDENTITY_NOT_FOUND";
17
18
  }>;
18
19
  export declare const zErrorResponse: z.ZodObject<{
19
20
  message: z.ZodString;
@@ -29,6 +30,7 @@ export declare const zErrorResponse: z.ZodObject<{
29
30
  PROJECT_CREATION_ERROR: "PROJECT_CREATION_ERROR";
30
31
  INVALID_QUERY_PARAM: "INVALID_QUERY_PARAM";
31
32
  EXPIRED: "EXPIRED";
33
+ IDENTITY_NOT_FOUND: "IDENTITY_NOT_FOUND";
32
34
  }>;
33
35
  }, z.core.$strip>;
34
36
  export declare const zCreateProject: z.ZodObject<{
@@ -1012,6 +1014,42 @@ export declare const zNodeSourceUploadResponse: z.ZodObject<{
1012
1014
  bucketPath: z.ZodString;
1013
1015
  contentType: z.ZodOptional<z.ZodString>;
1014
1016
  }, z.core.$strip>;
1017
+ export declare const zBillingPlan: z.ZodObject<{
1018
+ tier: z.ZodEnum<{
1019
+ free: "free";
1020
+ hobby: "hobby";
1021
+ pro: "pro";
1022
+ }>;
1023
+ interval: z.ZodOptional<z.ZodEnum<{
1024
+ monthly: "monthly";
1025
+ annual: "annual";
1026
+ }>>;
1027
+ seatCount: z.ZodCoercedBigInt<unknown>;
1028
+ currentPeriodEnd: z.ZodOptional<z.ZodISODateTime>;
1029
+ pendingDowngrade: z.ZodOptional<z.ZodEnum<{
1030
+ free: "free";
1031
+ hobby: "hobby";
1032
+ pro: "pro";
1033
+ }>>;
1034
+ entitlements: z.ZodArray<z.ZodString>;
1035
+ }, z.core.$strip>;
1036
+ export declare const zUpdatePlanRequest: z.ZodObject<{
1037
+ priceId: z.ZodString;
1038
+ }, z.core.$strip>;
1039
+ export declare const zPaymentMethod: z.ZodObject<{
1040
+ id: z.ZodString;
1041
+ brand: z.ZodString;
1042
+ last4: z.ZodString;
1043
+ expMonth: z.ZodCoercedBigInt<unknown>;
1044
+ expYear: z.ZodCoercedBigInt<unknown>;
1045
+ isDefault: z.ZodBoolean;
1046
+ }, z.core.$strip>;
1047
+ export declare const zSetupIntentResponse: z.ZodObject<{
1048
+ clientSecret: z.ZodString;
1049
+ }, z.core.$strip>;
1050
+ export declare const zBillingUsage: z.ZodObject<{
1051
+ totalUnits: z.ZodCoercedBigInt<unknown>;
1052
+ }, z.core.$strip>;
1015
1053
  /**
1016
1054
  * Expiry query.
1017
1055
  */
@@ -2161,3 +2199,109 @@ export declare const zUploadNodeSourceZipResponse: z.ZodObject<{
2161
2199
  bucketPath: z.ZodString;
2162
2200
  contentType: z.ZodOptional<z.ZodString>;
2163
2201
  }, z.core.$strip>;
2202
+ export declare const zGetBillingPlanData: z.ZodObject<{
2203
+ body: z.ZodOptional<z.ZodNever>;
2204
+ path: z.ZodObject<{
2205
+ spaceHandle: z.ZodString;
2206
+ }, z.core.$strip>;
2207
+ query: z.ZodOptional<z.ZodNever>;
2208
+ }, z.core.$strip>;
2209
+ /**
2210
+ * The space's current billing plan.
2211
+ */
2212
+ export declare const zGetBillingPlanResponse: z.ZodObject<{
2213
+ tier: z.ZodEnum<{
2214
+ free: "free";
2215
+ hobby: "hobby";
2216
+ pro: "pro";
2217
+ }>;
2218
+ interval: z.ZodOptional<z.ZodEnum<{
2219
+ monthly: "monthly";
2220
+ annual: "annual";
2221
+ }>>;
2222
+ seatCount: z.ZodCoercedBigInt<unknown>;
2223
+ currentPeriodEnd: z.ZodOptional<z.ZodISODateTime>;
2224
+ pendingDowngrade: z.ZodOptional<z.ZodEnum<{
2225
+ free: "free";
2226
+ hobby: "hobby";
2227
+ pro: "pro";
2228
+ }>>;
2229
+ entitlements: z.ZodArray<z.ZodString>;
2230
+ }, z.core.$strip>;
2231
+ export declare const zUpdateBillingPlanData: z.ZodObject<{
2232
+ body: z.ZodObject<{
2233
+ priceId: z.ZodString;
2234
+ }, z.core.$strip>;
2235
+ path: z.ZodObject<{
2236
+ spaceHandle: z.ZodString;
2237
+ }, z.core.$strip>;
2238
+ query: z.ZodOptional<z.ZodNever>;
2239
+ }, z.core.$strip>;
2240
+ export declare const zCreateSetupIntentData: z.ZodObject<{
2241
+ body: z.ZodOptional<z.ZodNever>;
2242
+ path: z.ZodObject<{
2243
+ spaceHandle: z.ZodString;
2244
+ }, z.core.$strip>;
2245
+ query: z.ZodOptional<z.ZodNever>;
2246
+ }, z.core.$strip>;
2247
+ /**
2248
+ * SetupIntent client secret.
2249
+ */
2250
+ export declare const zCreateSetupIntentResponse: z.ZodObject<{
2251
+ clientSecret: z.ZodString;
2252
+ }, z.core.$strip>;
2253
+ export declare const zListPaymentMethodsData: z.ZodObject<{
2254
+ body: z.ZodOptional<z.ZodNever>;
2255
+ path: z.ZodObject<{
2256
+ spaceHandle: z.ZodString;
2257
+ }, z.core.$strip>;
2258
+ query: z.ZodOptional<z.ZodNever>;
2259
+ }, z.core.$strip>;
2260
+ /**
2261
+ * A list of payment methods.
2262
+ */
2263
+ export declare const zListPaymentMethodsResponse: z.ZodArray<z.ZodObject<{
2264
+ id: z.ZodString;
2265
+ brand: z.ZodString;
2266
+ last4: z.ZodString;
2267
+ expMonth: z.ZodCoercedBigInt<unknown>;
2268
+ expYear: z.ZodCoercedBigInt<unknown>;
2269
+ isDefault: z.ZodBoolean;
2270
+ }, z.core.$strip>>;
2271
+ export declare const zRemovePaymentMethodData: z.ZodObject<{
2272
+ body: z.ZodOptional<z.ZodNever>;
2273
+ path: z.ZodObject<{
2274
+ spaceHandle: z.ZodString;
2275
+ pmId: z.ZodString;
2276
+ }, z.core.$strip>;
2277
+ query: z.ZodOptional<z.ZodNever>;
2278
+ }, z.core.$strip>;
2279
+ /**
2280
+ * Payment method removed.
2281
+ */
2282
+ export declare const zRemovePaymentMethodResponse: z.ZodVoid;
2283
+ export declare const zSetDefaultPaymentMethodData: z.ZodObject<{
2284
+ body: z.ZodOptional<z.ZodNever>;
2285
+ path: z.ZodObject<{
2286
+ spaceHandle: z.ZodString;
2287
+ pmId: z.ZodString;
2288
+ }, z.core.$strip>;
2289
+ query: z.ZodOptional<z.ZodNever>;
2290
+ }, z.core.$strip>;
2291
+ /**
2292
+ * Default payment method updated.
2293
+ */
2294
+ export declare const zSetDefaultPaymentMethodResponse: z.ZodVoid;
2295
+ export declare const zGetBillingUsageData: z.ZodObject<{
2296
+ body: z.ZodOptional<z.ZodNever>;
2297
+ path: z.ZodObject<{
2298
+ spaceHandle: z.ZodString;
2299
+ }, z.core.$strip>;
2300
+ query: z.ZodOptional<z.ZodNever>;
2301
+ }, z.core.$strip>;
2302
+ /**
2303
+ * Current billing period usage.
2304
+ */
2305
+ export declare const zGetBillingUsageResponse: z.ZodObject<{
2306
+ totalUnits: z.ZodCoercedBigInt<unknown>;
2307
+ }, z.core.$strip>;
@@ -14,7 +14,8 @@ export const zErrorCode = z.enum([
14
14
  'CONSTRAINT_ERROR',
15
15
  'PROJECT_CREATION_ERROR',
16
16
  'INVALID_QUERY_PARAM',
17
- 'EXPIRED'
17
+ 'EXPIRED',
18
+ 'IDENTITY_NOT_FOUND'
18
19
  ]);
19
20
  export const zErrorResponse = z.object({
20
21
  message: z.string(),
@@ -429,6 +430,42 @@ export const zNodeSourceUploadResponse = z.object({
429
430
  bucketPath: z.string(),
430
431
  contentType: z.optional(z.string())
431
432
  });
433
+ export const zBillingPlan = z.object({
434
+ tier: z.enum([
435
+ 'free',
436
+ 'hobby',
437
+ 'pro'
438
+ ]),
439
+ interval: z.optional(z.enum([
440
+ 'monthly',
441
+ 'annual'
442
+ ])),
443
+ seatCount: z.coerce.bigint(),
444
+ currentPeriodEnd: z.optional(z.iso.datetime()),
445
+ pendingDowngrade: z.optional(z.enum([
446
+ 'free',
447
+ 'hobby',
448
+ 'pro'
449
+ ])),
450
+ entitlements: z.array(z.string())
451
+ });
452
+ export const zUpdatePlanRequest = z.object({
453
+ priceId: z.string()
454
+ });
455
+ export const zPaymentMethod = z.object({
456
+ id: z.string(),
457
+ brand: z.string(),
458
+ last4: z.string(),
459
+ expMonth: z.coerce.bigint(),
460
+ expYear: z.coerce.bigint(),
461
+ isDefault: z.boolean()
462
+ });
463
+ export const zSetupIntentResponse = z.object({
464
+ clientSecret: z.string()
465
+ });
466
+ export const zBillingUsage = z.object({
467
+ totalUnits: z.coerce.bigint()
468
+ });
432
469
  /**
433
470
  * Expiry query.
434
471
  */
@@ -876,3 +913,78 @@ export const zUploadNodeSourceZipData = z.object({
876
913
  * Source ZIP uploaded successfully.
877
914
  */
878
915
  export const zUploadNodeSourceZipResponse = zNodeSourceUploadResponse;
916
+ export const zGetBillingPlanData = z.object({
917
+ body: z.optional(z.never()),
918
+ path: z.object({
919
+ spaceHandle: z.string()
920
+ }),
921
+ query: z.optional(z.never())
922
+ });
923
+ /**
924
+ * The space's current billing plan.
925
+ */
926
+ export const zGetBillingPlanResponse = zBillingPlan;
927
+ export const zUpdateBillingPlanData = z.object({
928
+ body: zUpdatePlanRequest,
929
+ path: z.object({
930
+ spaceHandle: z.string()
931
+ }),
932
+ query: z.optional(z.never())
933
+ });
934
+ export const zCreateSetupIntentData = z.object({
935
+ body: z.optional(z.never()),
936
+ path: z.object({
937
+ spaceHandle: z.string()
938
+ }),
939
+ query: z.optional(z.never())
940
+ });
941
+ /**
942
+ * SetupIntent client secret.
943
+ */
944
+ export const zCreateSetupIntentResponse = zSetupIntentResponse;
945
+ export const zListPaymentMethodsData = z.object({
946
+ body: z.optional(z.never()),
947
+ path: z.object({
948
+ spaceHandle: z.string()
949
+ }),
950
+ query: z.optional(z.never())
951
+ });
952
+ /**
953
+ * A list of payment methods.
954
+ */
955
+ export const zListPaymentMethodsResponse = z.array(zPaymentMethod);
956
+ export const zRemovePaymentMethodData = z.object({
957
+ body: z.optional(z.never()),
958
+ path: z.object({
959
+ spaceHandle: z.string(),
960
+ pmId: z.string()
961
+ }),
962
+ query: z.optional(z.never())
963
+ });
964
+ /**
965
+ * Payment method removed.
966
+ */
967
+ export const zRemovePaymentMethodResponse = z.void();
968
+ export const zSetDefaultPaymentMethodData = z.object({
969
+ body: z.optional(z.never()),
970
+ path: z.object({
971
+ spaceHandle: z.string(),
972
+ pmId: z.string()
973
+ }),
974
+ query: z.optional(z.never())
975
+ });
976
+ /**
977
+ * Default payment method updated.
978
+ */
979
+ export const zSetDefaultPaymentMethodResponse = z.void();
980
+ export const zGetBillingUsageData = z.object({
981
+ body: z.optional(z.never()),
982
+ path: z.object({
983
+ spaceHandle: z.string()
984
+ }),
985
+ query: z.optional(z.never())
986
+ });
987
+ /**
988
+ * Current billing period usage.
989
+ */
990
+ export const zGetBillingUsageResponse = zBillingUsage;
@@ -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, FetchKindeOrganisationBillingAgreementsData, GetSpaceInvitesData, CreateSpaceInviteData, CreateSpaceInviteResponses, RevokeSpaceInviteData, RevokeSpaceInviteResponses, ListSpaceMembersData, ListSpaceMemberRolesData, LeaveSpaceData, LeaveSpaceResponses, CreateProjectData, CreateProjectResponses, GetProjectOverviewData, CreateEnvironmentData, CreateEnvironmentResponses, GetEnvironmentOverviewData, GetGraphOverviewData, UpdateGraphStateData, UpdateGraphStateResponses, DeployVersionData, DeployVersionResponses, UploadNodeSourceZipData, UploadNodeSourceZipResponses } 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, FetchKindeOrganisationBillingAgreementsData, GetSpaceInvitesData, CreateSpaceInviteData, CreateSpaceInviteResponses, RevokeSpaceInviteData, RevokeSpaceInviteResponses, ListSpaceMembersData, ListSpaceMemberRolesData, LeaveSpaceData, LeaveSpaceResponses, CreateProjectData, CreateProjectResponses, GetProjectOverviewData, CreateEnvironmentData, CreateEnvironmentResponses, GetEnvironmentOverviewData, GetGraphOverviewData, UpdateGraphStateData, UpdateGraphStateResponses, DeployVersionData, DeployVersionResponses, UploadNodeSourceZipData, UploadNodeSourceZipResponses, GetBillingPlanData, UpdateBillingPlanData, UpdateBillingPlanResponses, CreateSetupIntentData, CreateSetupIntentResponses, ListPaymentMethodsData, RemovePaymentMethodData, RemovePaymentMethodResponses, SetDefaultPaymentMethodData, SetDefaultPaymentMethodResponses, GetBillingUsageData } 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>;
@@ -140,3 +140,32 @@ export declare const useUploadNodeSourceZip: (config?: {
140
140
  onError?: Parameters<typeof useMutation>["0"]["onError"];
141
141
  retry?: boolean;
142
142
  }) => import("@tanstack/react-query").UseMutationResult<import("../../sdk/types.gen").NodeSourceUploadResponse | undefined, unknown, Omit<UploadNodeSourceZipData, "url">, unknown>;
143
+ export declare const useGetBillingPlan: (options: Omit<GetBillingPlanData, "url"> & {
144
+ enabled?: boolean;
145
+ }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").BillingPlan | undefined, Error>;
146
+ export declare const useUpdateBillingPlan: (config?: {
147
+ onSuccess?: (data: GetSuccessResponse<UpdateBillingPlanResponses>) => void;
148
+ onError?: Parameters<typeof useMutation>["0"]["onError"];
149
+ retry?: boolean;
150
+ }) => import("@tanstack/react-query").UseMutationResult<unknown, unknown, Omit<UpdateBillingPlanData, "url">, unknown>;
151
+ export declare const useCreateSetupIntent: (config?: {
152
+ onSuccess?: (data: GetSuccessResponse<CreateSetupIntentResponses>) => void;
153
+ onError?: Parameters<typeof useMutation>["0"]["onError"];
154
+ retry?: boolean;
155
+ }) => import("@tanstack/react-query").UseMutationResult<import("../../sdk/types.gen").SetupIntentResponse | undefined, unknown, Omit<CreateSetupIntentData, "url">, unknown>;
156
+ export declare const useListPaymentMethods: (options: Omit<ListPaymentMethodsData, "url"> & {
157
+ enabled?: boolean;
158
+ }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").PaymentMethod[] | undefined, Error>;
159
+ export declare const useRemovePaymentMethod: (config?: {
160
+ onSuccess?: (data: GetSuccessResponse<RemovePaymentMethodResponses>) => void;
161
+ onError?: Parameters<typeof useMutation>["0"]["onError"];
162
+ retry?: boolean;
163
+ }) => import("@tanstack/react-query").UseMutationResult<void | undefined, unknown, Omit<RemovePaymentMethodData, "url">, unknown>;
164
+ export declare const useSetDefaultPaymentMethod: (config?: {
165
+ onSuccess?: (data: GetSuccessResponse<SetDefaultPaymentMethodResponses>) => void;
166
+ onError?: Parameters<typeof useMutation>["0"]["onError"];
167
+ retry?: boolean;
168
+ }) => import("@tanstack/react-query").UseMutationResult<void | undefined, unknown, Omit<SetDefaultPaymentMethodData, "url">, unknown>;
169
+ export declare const useGetBillingUsage: (options: Omit<GetBillingUsageData, "url"> & {
170
+ enabled?: boolean;
171
+ }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").BillingUsage | 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, fetchKindeOrganisationBillingAgreements, getSpaceInvites, createSpaceInvite, revokeSpaceInvite, listSpaceMembers, listSpaceMemberRoles, leaveSpace, createProject, getProjectOverview, createEnvironment, getEnvironmentOverview, getGraphOverview, updateGraphState, deployVersion, uploadNodeSourceZip } 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, fetchKindeOrganisationBillingAgreements, getSpaceInvites, createSpaceInvite, revokeSpaceInvite, listSpaceMembers, listSpaceMemberRoles, leaveSpace, createProject, getProjectOverview, createEnvironment, getEnvironmentOverview, getGraphOverview, updateGraphState, deployVersion, uploadNodeSourceZip, getBillingPlan, updateBillingPlan, createSetupIntent, listPaymentMethods, removePaymentMethod, setDefaultPaymentMethod, getBillingUsage } from "../../sdk/sdk.gen";
6
6
  export const useGetServiceHealth = (options) => {
7
7
  const token = useToken();
8
8
  let { enabled, ...rest } = options || { enabled: true };
@@ -704,3 +704,142 @@ export const useUploadNodeSourceZip = (config) => {
704
704
  retry: config?.retry
705
705
  });
706
706
  };
707
+ export const useGetBillingPlan = (options) => {
708
+ const token = useToken();
709
+ let { enabled, ...rest } = options || { enabled: true };
710
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/billing/plan" };
711
+ const funcer = async () => {
712
+ const auth = isPromise(token) ? (await token) || "" : token || "";
713
+ if (isPromise(token) && !token)
714
+ return;
715
+ const res = await getBillingPlan({ ...opts, ...rest, auth });
716
+ return res.data;
717
+ };
718
+ if (!token)
719
+ enabled = false;
720
+ return useQuery({
721
+ queryKey: [options?.path?.spaceHandle, "billing", "plan", options.query ?? {}],
722
+ queryFn: funcer,
723
+ enabled,
724
+ retry: false,
725
+ staleTime: 600000
726
+ });
727
+ };
728
+ export const useUpdateBillingPlan = (config) => {
729
+ const token = useToken();
730
+ const queryClient = useQueryClient();
731
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/billing/plan" };
732
+ const funcer = async (options) => {
733
+ const auth = isPromise(token) ? (await token) || "" : token || "";
734
+ const res = await updateBillingPlan({ ...opts, ...options, auth });
735
+ return res?.data;
736
+ };
737
+ return useMutation({
738
+ mutationFn: funcer,
739
+ onSuccess: (res, options, c, ctx) => {
740
+ queryClient.invalidateQueries({ queryKey: [options?.path?.spaceHandle, "billing", "plan"] });
741
+ config?.onSuccess && config.onSuccess(res);
742
+ },
743
+ onError: config?.onError,
744
+ retry: config?.retry
745
+ });
746
+ };
747
+ export const useCreateSetupIntent = (config) => {
748
+ const token = useToken();
749
+ const queryClient = useQueryClient();
750
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/billing/setup-intent" };
751
+ const funcer = async (options) => {
752
+ const auth = isPromise(token) ? (await token) || "" : token || "";
753
+ const res = await createSetupIntent({ ...opts, ...options, auth });
754
+ return res?.data;
755
+ };
756
+ return useMutation({
757
+ mutationFn: funcer,
758
+ onSuccess: (res, options, c, ctx) => {
759
+ queryClient.invalidateQueries({ queryKey: [options?.path?.spaceHandle, "billing", "setup-intent"] });
760
+ config?.onSuccess && config.onSuccess(res);
761
+ },
762
+ onError: config?.onError,
763
+ retry: config?.retry
764
+ });
765
+ };
766
+ export const useListPaymentMethods = (options) => {
767
+ const token = useToken();
768
+ let { enabled, ...rest } = options || { enabled: true };
769
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/billing/payment-methods" };
770
+ const funcer = async () => {
771
+ const auth = isPromise(token) ? (await token) || "" : token || "";
772
+ if (isPromise(token) && !token)
773
+ return;
774
+ const res = await listPaymentMethods({ ...opts, ...rest, auth });
775
+ return res.data;
776
+ };
777
+ if (!token)
778
+ enabled = false;
779
+ return useQuery({
780
+ queryKey: [options?.path?.spaceHandle, "billing", "payment-methods", options.query ?? {}],
781
+ queryFn: funcer,
782
+ enabled,
783
+ retry: false,
784
+ staleTime: 600000
785
+ });
786
+ };
787
+ export const useRemovePaymentMethod = (config) => {
788
+ const token = useToken();
789
+ const queryClient = useQueryClient();
790
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/billing/payment-methods/{pmId}" };
791
+ const funcer = async (options) => {
792
+ const auth = isPromise(token) ? (await token) || "" : token || "";
793
+ const res = await removePaymentMethod({ ...opts, ...options, auth });
794
+ return res?.data;
795
+ };
796
+ return useMutation({
797
+ mutationFn: funcer,
798
+ onSuccess: (res, options, c, ctx) => {
799
+ queryClient.invalidateQueries({ queryKey: [options?.path?.spaceHandle, "billing", "payment-methods", options?.path?.pmId] });
800
+ config?.onSuccess && config.onSuccess(res);
801
+ },
802
+ onError: config?.onError,
803
+ retry: config?.retry
804
+ });
805
+ };
806
+ export const useSetDefaultPaymentMethod = (config) => {
807
+ const token = useToken();
808
+ const queryClient = useQueryClient();
809
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/billing/payment-methods/{pmId}/default" };
810
+ const funcer = async (options) => {
811
+ const auth = isPromise(token) ? (await token) || "" : token || "";
812
+ const res = await setDefaultPaymentMethod({ ...opts, ...options, auth });
813
+ return res?.data;
814
+ };
815
+ return useMutation({
816
+ mutationFn: funcer,
817
+ onSuccess: (res, options, c, ctx) => {
818
+ queryClient.invalidateQueries({ queryKey: [options?.path?.spaceHandle, "billing", "payment-methods", options?.path?.pmId, "default"] });
819
+ config?.onSuccess && config.onSuccess(res);
820
+ },
821
+ onError: config?.onError,
822
+ retry: config?.retry
823
+ });
824
+ };
825
+ export const useGetBillingUsage = (options) => {
826
+ const token = useToken();
827
+ let { enabled, ...rest } = options || { enabled: true };
828
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/billing/usage" };
829
+ const funcer = async () => {
830
+ const auth = isPromise(token) ? (await token) || "" : token || "";
831
+ if (isPromise(token) && !token)
832
+ return;
833
+ const res = await getBillingUsage({ ...opts, ...rest, auth });
834
+ return res.data;
835
+ };
836
+ if (!token)
837
+ enabled = false;
838
+ return useQuery({
839
+ queryKey: [options?.path?.spaceHandle, "billing", "usage", options.query ?? {}],
840
+ queryFn: funcer,
841
+ enabled,
842
+ retry: false,
843
+ staleTime: 600000
844
+ });
845
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoal-web-sdk",
3
- "version": "0.0.98",
3
+ "version": "0.0.100",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build-hooks": "npx tsx tanstack-codegen/generator.ts",