shoal-web-sdk 0.0.88 → 0.0.90
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 +13 -1
- package/dist/sdk/@tanstack/react-query.gen.js +49 -1
- package/dist/sdk/sdk.gen.d.ts +13 -1
- package/dist/sdk/sdk.gen.js +58 -1
- package/dist/sdk/types.gen.d.ts +113 -2
- package/dist/sdk/zod.gen.d.ts +34 -1
- package/dist/sdk/zod.gen.js +27 -1
- package/dist/tanstack-codegen/generated/generated.d.ts +16 -1
- package/dist/tanstack-codegen/generated/generated.js +60 -3
- 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, CreateSpaceData, CreateSpaceError, CreateSpaceInviteData, CreateSpaceInviteError, CreateSpaceInviteResponse, CreateSpaceResponse, DeleteAccountIdentityData, DeleteAccountIdentityError, DeleteAccountIdentityResponse, DeployVersionData, DeployVersionError, FetchGraphM2mData, FetchKindeOrganisationBillingAgreementsData, GetConnectedAppUrlData, GetEnvironmentOverviewData, GetGraphOverviewData, GetProjectOverviewData, GetServiceHealthData, GetSpaceInvitesData, GetSpaceOverviewData, GetUserIdentitiesData, GetUserInvitesData, GetUserProfileData, JoinSpaceData, JoinSpaceError, LeaveSpaceData, LeaveSpaceError, ListInstallationBranchesData, ListInstallationRepositoriesData, ListSpaceMembersData, ListUserInstallationsData, ListUserSpacesData, RejectSpaceInviteData, RejectSpaceInviteError, RejectSpaceInviteResponse, RequestAccountPasswordResetData, RequestAccountPasswordResetError, RevokeSpaceInviteData, RevokeSpaceInviteError, RevokeSpaceInviteResponse, UpdateConnectedAppTokenData, UpdateConnectedAppTokenError, UpdateGraphStateData, UpdateGraphStateError, UploadNodeSourceZipData, UploadNodeSourceZipError, UploadNodeSourceZipResponse } from '../types.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, 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';
|
|
4
4
|
export type QueryKey<TOptions extends Options> = [
|
|
5
5
|
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
|
6
6
|
_id: string;
|
|
@@ -68,6 +68,14 @@ export declare const fetchGraphM2mOptions: (options: Options<FetchGraphM2mData>)
|
|
|
68
68
|
* This will submit a password reset request requiring the user to reset their password on next sign in.
|
|
69
69
|
*/
|
|
70
70
|
export declare const requestAccountPasswordResetMutation: (options?: Partial<Options<RequestAccountPasswordResetData>>) => UseMutationOptions<unknown, RequestAccountPasswordResetError, Options<RequestAccountPasswordResetData>>;
|
|
71
|
+
/**
|
|
72
|
+
* Update username for current user
|
|
73
|
+
*/
|
|
74
|
+
export declare const updateUsernameMutation: (options?: Partial<Options<UpdateUsernameData>>) => UseMutationOptions<unknown, UpdateUsernameError, Options<UpdateUsernameData>>;
|
|
75
|
+
/**
|
|
76
|
+
* Create username for current user
|
|
77
|
+
*/
|
|
78
|
+
export declare const createUsernameMutation: (options?: Partial<Options<CreateUsernameData>>) => UseMutationOptions<unknown, CreateUsernameError, Options<CreateUsernameData>>;
|
|
71
79
|
export declare const getUserProfileQueryKey: (options?: Options<GetUserProfileData>) => [Pick<Options<GetUserProfileData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
72
80
|
_id: string;
|
|
73
81
|
_infinite?: boolean;
|
|
@@ -96,6 +104,10 @@ export declare const getUserProfileOptions: (options?: Options<GetUserProfileDat
|
|
|
96
104
|
[dataTagErrorSymbol]: Error;
|
|
97
105
|
};
|
|
98
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Update the authenticated user's Kinde profile fields.
|
|
109
|
+
*/
|
|
110
|
+
export declare const updateUserProfileMutation: (options?: Partial<Options<UpdateUserProfileData>>) => UseMutationOptions<unknown, UpdateUserProfileError, Options<UpdateUserProfileData>>;
|
|
99
111
|
export declare const getUserIdentitiesQueryKey: (options?: Options<GetUserIdentitiesData>) => [Pick<Options<GetUserIdentitiesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
|
|
100
112
|
_id: string;
|
|
101
113
|
_infinite?: boolean;
|
|
@@ -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, deleteAccountIdentity, deployVersion, fetchGraphM2M, fetchKindeOrganisationBillingAgreements, getConnectedAppUrl, getEnvironmentOverview, getGraphOverview, getProjectOverview, getServiceHealth, getSpaceInvites, getSpaceOverview, getUserIdentities, getUserInvites, getUserProfile, joinSpace, leaveSpace, listInstallationBranches, listInstallationRepositories, listSpaceMembers, listUserInstallations, listUserSpaces, rejectSpaceInvite, requestAccountPasswordReset, revokeSpaceInvite, updateConnectedAppToken, updateGraphState, uploadNodeSourceZip } from '../sdk.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, listSpaceMembers, listUserInstallations, listUserSpaces, rejectSpaceInvite, requestAccountPasswordReset, revokeSpaceInvite, 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) {
|
|
@@ -78,6 +78,38 @@ export const requestAccountPasswordResetMutation = (options) => {
|
|
|
78
78
|
};
|
|
79
79
|
return mutationOptions;
|
|
80
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* Update username for current user
|
|
83
|
+
*/
|
|
84
|
+
export const updateUsernameMutation = (options) => {
|
|
85
|
+
const mutationOptions = {
|
|
86
|
+
mutationFn: async (fnOptions) => {
|
|
87
|
+
const { data } = await updateUsername({
|
|
88
|
+
...options,
|
|
89
|
+
...fnOptions,
|
|
90
|
+
throwOnError: true
|
|
91
|
+
});
|
|
92
|
+
return data;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return mutationOptions;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Create username for current user
|
|
99
|
+
*/
|
|
100
|
+
export const createUsernameMutation = (options) => {
|
|
101
|
+
const mutationOptions = {
|
|
102
|
+
mutationFn: async (fnOptions) => {
|
|
103
|
+
const { data } = await createUsername({
|
|
104
|
+
...options,
|
|
105
|
+
...fnOptions,
|
|
106
|
+
throwOnError: true
|
|
107
|
+
});
|
|
108
|
+
return data;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return mutationOptions;
|
|
112
|
+
};
|
|
81
113
|
export const getUserProfileQueryKey = (options) => createQueryKey('getUserProfile', options);
|
|
82
114
|
/**
|
|
83
115
|
* Fetch the users profile.
|
|
@@ -96,6 +128,22 @@ export const getUserProfileOptions = (options) => {
|
|
|
96
128
|
queryKey: getUserProfileQueryKey(options)
|
|
97
129
|
});
|
|
98
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* Update the authenticated user's Kinde profile fields.
|
|
133
|
+
*/
|
|
134
|
+
export const updateUserProfileMutation = (options) => {
|
|
135
|
+
const mutationOptions = {
|
|
136
|
+
mutationFn: async (fnOptions) => {
|
|
137
|
+
const { data } = await updateUserProfile({
|
|
138
|
+
...options,
|
|
139
|
+
...fnOptions,
|
|
140
|
+
throwOnError: true
|
|
141
|
+
});
|
|
142
|
+
return data;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
return mutationOptions;
|
|
146
|
+
};
|
|
99
147
|
export const getUserIdentitiesQueryKey = (options) => createQueryKey('getUserIdentities', options);
|
|
100
148
|
/**
|
|
101
149
|
* Fetch the users identities.
|
package/dist/sdk/sdk.gen.d.ts
CHANGED
|
@@ -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, 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, ListSpaceMembersData, ListSpaceMembersErrors, ListSpaceMembersResponses, ListUserInstallationsData, ListUserInstallationsErrors, ListUserInstallationsResponses, ListUserSpacesData, ListUserSpacesErrors, ListUserSpacesResponses, RejectSpaceInviteData, RejectSpaceInviteErrors, RejectSpaceInviteResponses, RequestAccountPasswordResetData, RequestAccountPasswordResetErrors, RequestAccountPasswordResetResponses, RevokeSpaceInviteData, RevokeSpaceInviteErrors, RevokeSpaceInviteResponses, UpdateConnectedAppTokenData, UpdateConnectedAppTokenErrors, UpdateConnectedAppTokenResponses, UpdateGraphStateData, UpdateGraphStateErrors, UpdateGraphStateResponses, UploadNodeSourceZipData, UploadNodeSourceZipErrors, UploadNodeSourceZipResponses } from './types.gen';
|
|
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, 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';
|
|
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
|
|
@@ -25,10 +25,22 @@ export declare const fetchGraphM2M: <ThrowOnError extends boolean = false>(optio
|
|
|
25
25
|
* This will submit a password reset request requiring the user to reset their password on next sign in.
|
|
26
26
|
*/
|
|
27
27
|
export declare const requestAccountPasswordReset: <ThrowOnError extends boolean = false>(options?: Options<RequestAccountPasswordResetData, ThrowOnError>) => import("./client").RequestResult<RequestAccountPasswordResetResponses, RequestAccountPasswordResetErrors, ThrowOnError, "fields">;
|
|
28
|
+
/**
|
|
29
|
+
* Update username for current user
|
|
30
|
+
*/
|
|
31
|
+
export declare const updateUsername: <ThrowOnError extends boolean = false>(options: Options<UpdateUsernameData, ThrowOnError>) => import("./client").RequestResult<UpdateUsernameResponses, UpdateUsernameErrors, ThrowOnError, "fields">;
|
|
32
|
+
/**
|
|
33
|
+
* Create username for current user
|
|
34
|
+
*/
|
|
35
|
+
export declare const createUsername: <ThrowOnError extends boolean = false>(options: Options<CreateUsernameData, ThrowOnError>) => import("./client").RequestResult<CreateUsernameResponses, CreateUsernameErrors, ThrowOnError, "fields">;
|
|
28
36
|
/**
|
|
29
37
|
* Fetch the users profile.
|
|
30
38
|
*/
|
|
31
39
|
export declare const getUserProfile: <ThrowOnError extends boolean = false>(options?: Options<GetUserProfileData, ThrowOnError>) => import("./client").RequestResult<GetUserProfileResponses, GetUserProfileErrors, ThrowOnError, "fields">;
|
|
40
|
+
/**
|
|
41
|
+
* Update the authenticated user's Kinde profile fields.
|
|
42
|
+
*/
|
|
43
|
+
export declare const updateUserProfile: <ThrowOnError extends boolean = false>(options: Options<UpdateUserProfileData, ThrowOnError>) => import("./client").RequestResult<UpdateUserProfileResponses, UpdateUserProfileErrors, ThrowOnError, "fields">;
|
|
32
44
|
/**
|
|
33
45
|
* Fetch the users identities.
|
|
34
46
|
*/
|
package/dist/sdk/sdk.gen.js
CHANGED
|
@@ -27,7 +27,7 @@ export const fetchGraphM2M = (options) => {
|
|
|
27
27
|
type: 'http'
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
|
-
url: '/
|
|
30
|
+
url: '/m2m/graph/{versionUUID}',
|
|
31
31
|
...options
|
|
32
32
|
});
|
|
33
33
|
};
|
|
@@ -46,6 +46,44 @@ export const requestAccountPasswordReset = (options) => {
|
|
|
46
46
|
...options
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Update username for current user
|
|
51
|
+
*/
|
|
52
|
+
export const updateUsername = (options) => {
|
|
53
|
+
return (options.client ?? client).patch({
|
|
54
|
+
security: [
|
|
55
|
+
{
|
|
56
|
+
scheme: 'bearer',
|
|
57
|
+
type: 'http'
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
url: '/auth/account/username',
|
|
61
|
+
...options,
|
|
62
|
+
headers: {
|
|
63
|
+
'Content-Type': 'application/json',
|
|
64
|
+
...options.headers
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Create username for current user
|
|
70
|
+
*/
|
|
71
|
+
export const createUsername = (options) => {
|
|
72
|
+
return (options.client ?? client).post({
|
|
73
|
+
security: [
|
|
74
|
+
{
|
|
75
|
+
scheme: 'bearer',
|
|
76
|
+
type: 'http'
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
url: '/auth/account/username',
|
|
80
|
+
...options,
|
|
81
|
+
headers: {
|
|
82
|
+
'Content-Type': 'application/json',
|
|
83
|
+
...options.headers
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
49
87
|
/**
|
|
50
88
|
* Fetch the users profile.
|
|
51
89
|
*/
|
|
@@ -61,6 +99,25 @@ export const getUserProfile = (options) => {
|
|
|
61
99
|
...options
|
|
62
100
|
});
|
|
63
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* Update the authenticated user's Kinde profile fields.
|
|
104
|
+
*/
|
|
105
|
+
export const updateUserProfile = (options) => {
|
|
106
|
+
return (options.client ?? client).patch({
|
|
107
|
+
security: [
|
|
108
|
+
{
|
|
109
|
+
scheme: 'bearer',
|
|
110
|
+
type: 'http'
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
url: '/auth/account/profile',
|
|
114
|
+
...options,
|
|
115
|
+
headers: {
|
|
116
|
+
'Content-Type': 'application/json',
|
|
117
|
+
...options.headers
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
};
|
|
64
121
|
/**
|
|
65
122
|
* Fetch the users identities.
|
|
66
123
|
*/
|
package/dist/sdk/types.gen.d.ts
CHANGED
|
@@ -185,6 +185,13 @@ export type AccountProfile = {
|
|
|
185
185
|
lastSignedIn: string;
|
|
186
186
|
createdOn: string;
|
|
187
187
|
};
|
|
188
|
+
export type UserInfo = {
|
|
189
|
+
firstname: string;
|
|
190
|
+
lastname: string;
|
|
191
|
+
};
|
|
192
|
+
export type UsernamePayload = {
|
|
193
|
+
username: string;
|
|
194
|
+
};
|
|
188
195
|
export type UserSpace = {
|
|
189
196
|
code: string;
|
|
190
197
|
name: string;
|
|
@@ -334,6 +341,10 @@ export type Expired = boolean;
|
|
|
334
341
|
* An invite UUID.
|
|
335
342
|
*/
|
|
336
343
|
export type InviteUuid = string;
|
|
344
|
+
/**
|
|
345
|
+
* A version UUID.
|
|
346
|
+
*/
|
|
347
|
+
export type VersionUuid = string;
|
|
337
348
|
/**
|
|
338
349
|
* A version number with in an environment.
|
|
339
350
|
*/
|
|
@@ -410,10 +421,13 @@ export type GetServiceHealthResponse = GetServiceHealthResponses[keyof GetServic
|
|
|
410
421
|
export type FetchGraphM2mData = {
|
|
411
422
|
body?: never;
|
|
412
423
|
path: {
|
|
413
|
-
|
|
424
|
+
/**
|
|
425
|
+
* A version UUID.
|
|
426
|
+
*/
|
|
427
|
+
versionUUID: string;
|
|
414
428
|
};
|
|
415
429
|
query?: never;
|
|
416
|
-
url: '/
|
|
430
|
+
url: '/m2m/graph/{versionUUID}';
|
|
417
431
|
};
|
|
418
432
|
export type FetchGraphM2mErrors = {
|
|
419
433
|
/**
|
|
@@ -456,6 +470,72 @@ export type RequestAccountPasswordResetResponses = {
|
|
|
456
470
|
*/
|
|
457
471
|
202: unknown;
|
|
458
472
|
};
|
|
473
|
+
export type UpdateUsernameData = {
|
|
474
|
+
body: UsernamePayload;
|
|
475
|
+
path?: never;
|
|
476
|
+
query?: never;
|
|
477
|
+
url: '/auth/account/username';
|
|
478
|
+
};
|
|
479
|
+
export type UpdateUsernameErrors = {
|
|
480
|
+
/**
|
|
481
|
+
* Bad request.
|
|
482
|
+
*/
|
|
483
|
+
400: ErrorResponse;
|
|
484
|
+
/**
|
|
485
|
+
* Unauthorised user.
|
|
486
|
+
*/
|
|
487
|
+
401: ErrorResponse;
|
|
488
|
+
/**
|
|
489
|
+
* Invalid credentials.
|
|
490
|
+
*/
|
|
491
|
+
403: ErrorResponse;
|
|
492
|
+
/**
|
|
493
|
+
* Username identity not found.
|
|
494
|
+
*/
|
|
495
|
+
404: ErrorResponse;
|
|
496
|
+
/**
|
|
497
|
+
* Unexpected error.
|
|
498
|
+
*/
|
|
499
|
+
500: ErrorResponse;
|
|
500
|
+
};
|
|
501
|
+
export type UpdateUsernameError = UpdateUsernameErrors[keyof UpdateUsernameErrors];
|
|
502
|
+
export type UpdateUsernameResponses = {
|
|
503
|
+
/**
|
|
504
|
+
* Username update accepted.
|
|
505
|
+
*/
|
|
506
|
+
202: unknown;
|
|
507
|
+
};
|
|
508
|
+
export type CreateUsernameData = {
|
|
509
|
+
body: UsernamePayload;
|
|
510
|
+
path?: never;
|
|
511
|
+
query?: never;
|
|
512
|
+
url: '/auth/account/username';
|
|
513
|
+
};
|
|
514
|
+
export type CreateUsernameErrors = {
|
|
515
|
+
/**
|
|
516
|
+
* Bad request.
|
|
517
|
+
*/
|
|
518
|
+
400: ErrorResponse;
|
|
519
|
+
/**
|
|
520
|
+
* Unauthorised user.
|
|
521
|
+
*/
|
|
522
|
+
401: ErrorResponse;
|
|
523
|
+
/**
|
|
524
|
+
* Invalid credentials.
|
|
525
|
+
*/
|
|
526
|
+
403: ErrorResponse;
|
|
527
|
+
/**
|
|
528
|
+
* Unexpected error.
|
|
529
|
+
*/
|
|
530
|
+
500: ErrorResponse;
|
|
531
|
+
};
|
|
532
|
+
export type CreateUsernameError = CreateUsernameErrors[keyof CreateUsernameErrors];
|
|
533
|
+
export type CreateUsernameResponses = {
|
|
534
|
+
/**
|
|
535
|
+
* Username creation accepted.
|
|
536
|
+
*/
|
|
537
|
+
202: unknown;
|
|
538
|
+
};
|
|
459
539
|
export type GetUserProfileData = {
|
|
460
540
|
body?: never;
|
|
461
541
|
path?: never;
|
|
@@ -488,6 +568,37 @@ export type GetUserProfileResponses = {
|
|
|
488
568
|
200: AccountProfile;
|
|
489
569
|
};
|
|
490
570
|
export type GetUserProfileResponse = GetUserProfileResponses[keyof GetUserProfileResponses];
|
|
571
|
+
export type UpdateUserProfileData = {
|
|
572
|
+
body: UserInfo;
|
|
573
|
+
path?: never;
|
|
574
|
+
query?: never;
|
|
575
|
+
url: '/auth/account/profile';
|
|
576
|
+
};
|
|
577
|
+
export type UpdateUserProfileErrors = {
|
|
578
|
+
/**
|
|
579
|
+
* Bad request.
|
|
580
|
+
*/
|
|
581
|
+
400: ErrorResponse;
|
|
582
|
+
/**
|
|
583
|
+
* Unauthorised user.
|
|
584
|
+
*/
|
|
585
|
+
401: ErrorResponse;
|
|
586
|
+
/**
|
|
587
|
+
* Invalid credentials.
|
|
588
|
+
*/
|
|
589
|
+
403: ErrorResponse;
|
|
590
|
+
/**
|
|
591
|
+
* Unexpected error.
|
|
592
|
+
*/
|
|
593
|
+
500: ErrorResponse;
|
|
594
|
+
};
|
|
595
|
+
export type UpdateUserProfileError = UpdateUserProfileErrors[keyof UpdateUserProfileErrors];
|
|
596
|
+
export type UpdateUserProfileResponses = {
|
|
597
|
+
/**
|
|
598
|
+
* User profile update accepted.
|
|
599
|
+
*/
|
|
600
|
+
202: unknown;
|
|
601
|
+
};
|
|
491
602
|
export type GetUserIdentitiesData = {
|
|
492
603
|
body?: never;
|
|
493
604
|
path?: never;
|
package/dist/sdk/zod.gen.d.ts
CHANGED
|
@@ -304,6 +304,13 @@ export declare const zAccountProfile: z.ZodObject<{
|
|
|
304
304
|
lastSignedIn: z.ZodISODateTime;
|
|
305
305
|
createdOn: z.ZodISODateTime;
|
|
306
306
|
}, z.core.$strip>;
|
|
307
|
+
export declare const zUserInfo: z.ZodObject<{
|
|
308
|
+
firstname: z.ZodString;
|
|
309
|
+
lastname: z.ZodString;
|
|
310
|
+
}, z.core.$strip>;
|
|
311
|
+
export declare const zUsernamePayload: z.ZodObject<{
|
|
312
|
+
username: z.ZodString;
|
|
313
|
+
}, z.core.$strip>;
|
|
307
314
|
export declare const zUserSpace: z.ZodObject<{
|
|
308
315
|
code: z.ZodString;
|
|
309
316
|
name: z.ZodString;
|
|
@@ -934,6 +941,10 @@ export declare const zExpired: z.ZodBoolean;
|
|
|
934
941
|
* An invite UUID.
|
|
935
942
|
*/
|
|
936
943
|
export declare const zInviteUuid: z.ZodUUID;
|
|
944
|
+
/**
|
|
945
|
+
* A version UUID.
|
|
946
|
+
*/
|
|
947
|
+
export declare const zVersionUuid: z.ZodUUID;
|
|
937
948
|
/**
|
|
938
949
|
* A version number with in an environment.
|
|
939
950
|
*/
|
|
@@ -1010,7 +1021,7 @@ export declare const zGetServiceHealthResponse: z.ZodObject<{
|
|
|
1010
1021
|
export declare const zFetchGraphM2mData: z.ZodObject<{
|
|
1011
1022
|
body: z.ZodOptional<z.ZodNever>;
|
|
1012
1023
|
path: z.ZodObject<{
|
|
1013
|
-
|
|
1024
|
+
versionUUID: z.ZodUUID;
|
|
1014
1025
|
}, z.core.$strip>;
|
|
1015
1026
|
query: z.ZodOptional<z.ZodNever>;
|
|
1016
1027
|
}, z.core.$strip>;
|
|
@@ -1153,6 +1164,20 @@ export declare const zRequestAccountPasswordResetData: z.ZodObject<{
|
|
|
1153
1164
|
path: z.ZodOptional<z.ZodNever>;
|
|
1154
1165
|
query: z.ZodOptional<z.ZodNever>;
|
|
1155
1166
|
}, z.core.$strip>;
|
|
1167
|
+
export declare const zUpdateUsernameData: z.ZodObject<{
|
|
1168
|
+
body: z.ZodObject<{
|
|
1169
|
+
username: z.ZodString;
|
|
1170
|
+
}, z.core.$strip>;
|
|
1171
|
+
path: z.ZodOptional<z.ZodNever>;
|
|
1172
|
+
query: z.ZodOptional<z.ZodNever>;
|
|
1173
|
+
}, z.core.$strip>;
|
|
1174
|
+
export declare const zCreateUsernameData: z.ZodObject<{
|
|
1175
|
+
body: z.ZodObject<{
|
|
1176
|
+
username: z.ZodString;
|
|
1177
|
+
}, z.core.$strip>;
|
|
1178
|
+
path: z.ZodOptional<z.ZodNever>;
|
|
1179
|
+
query: z.ZodOptional<z.ZodNever>;
|
|
1180
|
+
}, z.core.$strip>;
|
|
1156
1181
|
export declare const zGetUserProfileData: z.ZodObject<{
|
|
1157
1182
|
body: z.ZodOptional<z.ZodNever>;
|
|
1158
1183
|
path: z.ZodOptional<z.ZodNever>;
|
|
@@ -1174,6 +1199,14 @@ export declare const zGetUserProfileResponse: z.ZodObject<{
|
|
|
1174
1199
|
lastSignedIn: z.ZodISODateTime;
|
|
1175
1200
|
createdOn: z.ZodISODateTime;
|
|
1176
1201
|
}, z.core.$strip>;
|
|
1202
|
+
export declare const zUpdateUserProfileData: z.ZodObject<{
|
|
1203
|
+
body: z.ZodObject<{
|
|
1204
|
+
firstname: z.ZodString;
|
|
1205
|
+
lastname: z.ZodString;
|
|
1206
|
+
}, z.core.$strip>;
|
|
1207
|
+
path: z.ZodOptional<z.ZodNever>;
|
|
1208
|
+
query: z.ZodOptional<z.ZodNever>;
|
|
1209
|
+
}, z.core.$strip>;
|
|
1177
1210
|
export declare const zGetUserIdentitiesData: z.ZodObject<{
|
|
1178
1211
|
body: z.ZodOptional<z.ZodNever>;
|
|
1179
1212
|
path: z.ZodOptional<z.ZodNever>;
|
package/dist/sdk/zod.gen.js
CHANGED
|
@@ -194,6 +194,13 @@ export const zAccountProfile = z.object({
|
|
|
194
194
|
lastSignedIn: z.iso.datetime(),
|
|
195
195
|
createdOn: z.iso.datetime()
|
|
196
196
|
});
|
|
197
|
+
export const zUserInfo = z.object({
|
|
198
|
+
firstname: z.string(),
|
|
199
|
+
lastname: z.string()
|
|
200
|
+
});
|
|
201
|
+
export const zUsernamePayload = z.object({
|
|
202
|
+
username: z.string()
|
|
203
|
+
});
|
|
197
204
|
export const zUserSpace = z.object({
|
|
198
205
|
code: z.string(),
|
|
199
206
|
name: z.string(),
|
|
@@ -400,6 +407,10 @@ export const zExpired = z.boolean();
|
|
|
400
407
|
* An invite UUID.
|
|
401
408
|
*/
|
|
402
409
|
export const zInviteUuid = z.uuid();
|
|
410
|
+
/**
|
|
411
|
+
* A version UUID.
|
|
412
|
+
*/
|
|
413
|
+
export const zVersionUuid = z.uuid();
|
|
403
414
|
/**
|
|
404
415
|
* A version number with in an environment.
|
|
405
416
|
*/
|
|
@@ -474,7 +485,7 @@ export const zGetServiceHealthResponse = zHealthResponse;
|
|
|
474
485
|
export const zFetchGraphM2mData = z.object({
|
|
475
486
|
body: z.optional(z.never()),
|
|
476
487
|
path: z.object({
|
|
477
|
-
|
|
488
|
+
versionUUID: z.uuid()
|
|
478
489
|
}),
|
|
479
490
|
query: z.optional(z.never())
|
|
480
491
|
});
|
|
@@ -487,6 +498,16 @@ export const zRequestAccountPasswordResetData = z.object({
|
|
|
487
498
|
path: z.optional(z.never()),
|
|
488
499
|
query: z.optional(z.never())
|
|
489
500
|
});
|
|
501
|
+
export const zUpdateUsernameData = z.object({
|
|
502
|
+
body: zUsernamePayload,
|
|
503
|
+
path: z.optional(z.never()),
|
|
504
|
+
query: z.optional(z.never())
|
|
505
|
+
});
|
|
506
|
+
export const zCreateUsernameData = z.object({
|
|
507
|
+
body: zUsernamePayload,
|
|
508
|
+
path: z.optional(z.never()),
|
|
509
|
+
query: z.optional(z.never())
|
|
510
|
+
});
|
|
490
511
|
export const zGetUserProfileData = z.object({
|
|
491
512
|
body: z.optional(z.never()),
|
|
492
513
|
path: z.optional(z.never()),
|
|
@@ -496,6 +517,11 @@ export const zGetUserProfileData = z.object({
|
|
|
496
517
|
* The users profile.
|
|
497
518
|
*/
|
|
498
519
|
export const zGetUserProfileResponse = zAccountProfile;
|
|
520
|
+
export const zUpdateUserProfileData = z.object({
|
|
521
|
+
body: zUserInfo,
|
|
522
|
+
path: z.optional(z.never()),
|
|
523
|
+
query: z.optional(z.never())
|
|
524
|
+
});
|
|
499
525
|
export const zGetUserIdentitiesData = z.object({
|
|
500
526
|
body: z.optional(z.never()),
|
|
501
527
|
path: z.optional(z.never()),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { GetSuccessResponse } from "../util";
|
|
3
|
-
import { GetServiceHealthData, FetchGraphM2mData, RequestAccountPasswordResetData, RequestAccountPasswordResetResponses, GetUserProfileData, 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, 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, LeaveSpaceData, LeaveSpaceResponses, CreateProjectData, CreateProjectResponses, GetProjectOverviewData, CreateEnvironmentData, CreateEnvironmentResponses, GetEnvironmentOverviewData, GetGraphOverviewData, UpdateGraphStateData, UpdateGraphStateResponses, DeployVersionData, DeployVersionResponses, UploadNodeSourceZipData, UploadNodeSourceZipResponses } 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>;
|
|
@@ -12,9 +12,24 @@ export declare const useRequestAccountPasswordReset: (config?: {
|
|
|
12
12
|
onError?: Parameters<typeof useMutation>["0"]["onError"];
|
|
13
13
|
retry?: boolean;
|
|
14
14
|
}) => import("@tanstack/react-query").UseMutationResult<unknown, unknown, Omit<RequestAccountPasswordResetData, "url"> | undefined, unknown>;
|
|
15
|
+
export declare const useUpdateUsername: (config?: {
|
|
16
|
+
onSuccess?: (data: GetSuccessResponse<UpdateUsernameResponses>) => void;
|
|
17
|
+
onError?: Parameters<typeof useMutation>["0"]["onError"];
|
|
18
|
+
retry?: boolean;
|
|
19
|
+
}) => import("@tanstack/react-query").UseMutationResult<unknown, unknown, Omit<UpdateUsernameData, "url">, unknown>;
|
|
20
|
+
export declare const useCreateUsername: (config?: {
|
|
21
|
+
onSuccess?: (data: GetSuccessResponse<CreateUsernameResponses>) => void;
|
|
22
|
+
onError?: Parameters<typeof useMutation>["0"]["onError"];
|
|
23
|
+
retry?: boolean;
|
|
24
|
+
}) => import("@tanstack/react-query").UseMutationResult<unknown, unknown, Omit<CreateUsernameData, "url">, unknown>;
|
|
15
25
|
export declare const useGetUserProfile: (options?: Omit<GetUserProfileData, "url"> & {
|
|
16
26
|
enabled?: boolean;
|
|
17
27
|
}) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").AccountProfile | undefined, Error>;
|
|
28
|
+
export declare const useUpdateUserProfile: (config?: {
|
|
29
|
+
onSuccess?: (data: GetSuccessResponse<UpdateUserProfileResponses>) => void;
|
|
30
|
+
onError?: Parameters<typeof useMutation>["0"]["onError"];
|
|
31
|
+
retry?: boolean;
|
|
32
|
+
}) => import("@tanstack/react-query").UseMutationResult<unknown, unknown, Omit<UpdateUserProfileData, "url">, unknown>;
|
|
18
33
|
export declare const useGetUserIdentities: (options?: Omit<GetUserIdentitiesData, "url"> & {
|
|
19
34
|
enabled?: boolean;
|
|
20
35
|
}) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").AccountIdentities | 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, getUserProfile, getUserIdentities, deleteAccountIdentity, getConnectedAppUrl, updateConnectedAppToken, listInstallationRepositories, listInstallationBranches, listUserInstallations, listUserSpaces, createSpace, getUserInvites, joinSpace, rejectSpaceInvite, getSpaceOverview, fetchKindeOrganisationBillingAgreements, getSpaceInvites, createSpaceInvite, revokeSpaceInvite, listSpaceMembers, 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, leaveSpace, createProject, getProjectOverview, createEnvironment, getEnvironmentOverview, getGraphOverview, updateGraphState, deployVersion, uploadNodeSourceZip } from "../../sdk/sdk.gen";
|
|
6
6
|
export const useGetServiceHealth = (options) => {
|
|
7
7
|
const token = useToken();
|
|
8
8
|
let { enabled, ...rest } = options || { enabled: true };
|
|
@@ -27,7 +27,7 @@ export const useGetServiceHealth = (options) => {
|
|
|
27
27
|
export const useFetchGraphM2M = (options) => {
|
|
28
28
|
const token = useToken();
|
|
29
29
|
let { enabled, ...rest } = options || { enabled: true };
|
|
30
|
-
const opts = { throwOnError: true, url: "/
|
|
30
|
+
const opts = { throwOnError: true, url: "/m2m/graph/{versionUUID}" };
|
|
31
31
|
const funcer = async () => {
|
|
32
32
|
const auth = isPromise(token) ? (await token) || "" : token || "";
|
|
33
33
|
if (isPromise(token) && !token)
|
|
@@ -38,7 +38,7 @@ export const useFetchGraphM2M = (options) => {
|
|
|
38
38
|
if (!token)
|
|
39
39
|
enabled = false;
|
|
40
40
|
return useQuery({
|
|
41
|
-
queryKey: ["m2m", "graph", options?.path?.
|
|
41
|
+
queryKey: ["m2m", "graph", options?.path?.versionUUID, options.query ?? {}],
|
|
42
42
|
queryFn: funcer,
|
|
43
43
|
enabled,
|
|
44
44
|
retry: false,
|
|
@@ -64,6 +64,44 @@ export const useRequestAccountPasswordReset = (config) => {
|
|
|
64
64
|
retry: config?.retry
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
+
export const useUpdateUsername = (config) => {
|
|
68
|
+
const token = useToken();
|
|
69
|
+
const queryClient = useQueryClient();
|
|
70
|
+
const opts = { throwOnError: true, url: "/auth/account/username" };
|
|
71
|
+
const funcer = async (options) => {
|
|
72
|
+
const auth = isPromise(token) ? (await token) || "" : token || "";
|
|
73
|
+
const res = await updateUsername({ ...opts, ...options, auth });
|
|
74
|
+
return res?.data;
|
|
75
|
+
};
|
|
76
|
+
return useMutation({
|
|
77
|
+
mutationFn: funcer,
|
|
78
|
+
onSuccess: (res, options, c, ctx) => {
|
|
79
|
+
queryClient.invalidateQueries({ queryKey: ["account", "username"] });
|
|
80
|
+
config?.onSuccess && config.onSuccess(res);
|
|
81
|
+
},
|
|
82
|
+
onError: config?.onError,
|
|
83
|
+
retry: config?.retry
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
export const useCreateUsername = (config) => {
|
|
87
|
+
const token = useToken();
|
|
88
|
+
const queryClient = useQueryClient();
|
|
89
|
+
const opts = { throwOnError: true, url: "/auth/account/username" };
|
|
90
|
+
const funcer = async (options) => {
|
|
91
|
+
const auth = isPromise(token) ? (await token) || "" : token || "";
|
|
92
|
+
const res = await createUsername({ ...opts, ...options, auth });
|
|
93
|
+
return res?.data;
|
|
94
|
+
};
|
|
95
|
+
return useMutation({
|
|
96
|
+
mutationFn: funcer,
|
|
97
|
+
onSuccess: (res, options, c, ctx) => {
|
|
98
|
+
queryClient.invalidateQueries({ queryKey: ["account", "username"] });
|
|
99
|
+
config?.onSuccess && config.onSuccess(res);
|
|
100
|
+
},
|
|
101
|
+
onError: config?.onError,
|
|
102
|
+
retry: config?.retry
|
|
103
|
+
});
|
|
104
|
+
};
|
|
67
105
|
export const useGetUserProfile = (options) => {
|
|
68
106
|
const token = useToken();
|
|
69
107
|
let { enabled, ...rest } = options || { enabled: true };
|
|
@@ -85,6 +123,25 @@ export const useGetUserProfile = (options) => {
|
|
|
85
123
|
staleTime: 600000
|
|
86
124
|
});
|
|
87
125
|
};
|
|
126
|
+
export const useUpdateUserProfile = (config) => {
|
|
127
|
+
const token = useToken();
|
|
128
|
+
const queryClient = useQueryClient();
|
|
129
|
+
const opts = { throwOnError: true, url: "/auth/account/profile" };
|
|
130
|
+
const funcer = async (options) => {
|
|
131
|
+
const auth = isPromise(token) ? (await token) || "" : token || "";
|
|
132
|
+
const res = await updateUserProfile({ ...opts, ...options, auth });
|
|
133
|
+
return res?.data;
|
|
134
|
+
};
|
|
135
|
+
return useMutation({
|
|
136
|
+
mutationFn: funcer,
|
|
137
|
+
onSuccess: (res, options, c, ctx) => {
|
|
138
|
+
queryClient.invalidateQueries({ queryKey: ["account", "profile"] });
|
|
139
|
+
config?.onSuccess && config.onSuccess(res);
|
|
140
|
+
},
|
|
141
|
+
onError: config?.onError,
|
|
142
|
+
retry: config?.retry
|
|
143
|
+
});
|
|
144
|
+
};
|
|
88
145
|
export const useGetUserIdentities = (options) => {
|
|
89
146
|
const token = useToken();
|
|
90
147
|
let { enabled, ...rest } = options || { enabled: true };
|