548 lines
22 KiB
TypeScript
548 lines
22 KiB
TypeScript
// This file is auto-generated by @hey-api/openapi-ts
|
|
|
|
import { type InfiniteData, infiniteQueryOptions, queryOptions, type UseMutationOptions } from '@tanstack/react-query';
|
|
|
|
import { client } from '../client.gen';
|
|
import { getAuthRedirect, getEventAttendance, getEventCheckin, getEventCheckinQuery, getEventInfo, getEventJoined, getEventList, getUserInfo, getUserInfoByUserId, getUserList, type Options, patchUserUpdate, postAgendaSubmit, postAuthExchange, postAuthMagic, postAuthRefresh, postAuthToken, postEventCheckinSubmit, postEventJoin, postKycQuery, postKycSession } from '../sdk.gen';
|
|
import type { GetAuthRedirectData, GetAuthRedirectError, GetEventAttendanceData, GetEventAttendanceError, GetEventAttendanceResponse, GetEventCheckinData, GetEventCheckinError, GetEventCheckinQueryData, GetEventCheckinQueryError, GetEventCheckinQueryResponse, GetEventCheckinResponse, GetEventInfoData, GetEventInfoError, GetEventInfoResponse, GetEventJoinedData, GetEventJoinedError, GetEventJoinedResponse, GetEventListData, GetEventListError, GetEventListResponse, GetUserInfoByUserIdData, GetUserInfoByUserIdError, GetUserInfoByUserIdResponse, GetUserInfoData, GetUserInfoError, GetUserInfoResponse, GetUserListData, GetUserListError, GetUserListResponse, PatchUserUpdateData, PatchUserUpdateError, PatchUserUpdateResponse, PostAgendaSubmitData, PostAgendaSubmitError, PostAgendaSubmitResponse, PostAuthExchangeData, PostAuthExchangeError, PostAuthExchangeResponse, PostAuthMagicData, PostAuthMagicError, PostAuthMagicResponse, PostAuthRefreshData, PostAuthRefreshError, PostAuthRefreshResponse, PostAuthTokenData, PostAuthTokenError, PostAuthTokenResponse, PostEventCheckinSubmitData, PostEventCheckinSubmitError, PostEventCheckinSubmitResponse, PostEventJoinData, PostEventJoinError, PostEventJoinResponse, PostKycQueryData, PostKycQueryError, PostKycQueryResponse, PostKycSessionData, PostKycSessionError, PostKycSessionResponse } from '../types.gen';
|
|
|
|
/**
|
|
* Submit Agenda
|
|
*
|
|
* Creates a new agenda item for a specific attendance record.
|
|
*/
|
|
export const postAgendaSubmitMutation = (options?: Partial<Options<PostAgendaSubmitData>>): UseMutationOptions<PostAgendaSubmitResponse, PostAgendaSubmitError, Options<PostAgendaSubmitData>> => {
|
|
const mutationOptions: UseMutationOptions<PostAgendaSubmitResponse, PostAgendaSubmitError, Options<PostAgendaSubmitData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postAgendaSubmit({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Exchange Auth Code
|
|
*
|
|
* Exchanges client credentials and user session for a specific redirect authorization code.
|
|
*/
|
|
export const postAuthExchangeMutation = (options?: Partial<Options<PostAuthExchangeData>>): UseMutationOptions<PostAuthExchangeResponse, PostAuthExchangeError, Options<PostAuthExchangeData>> => {
|
|
const mutationOptions: UseMutationOptions<PostAuthExchangeResponse, PostAuthExchangeError, Options<PostAuthExchangeData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postAuthExchange({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Request Magic Link
|
|
*
|
|
* Verifies Turnstile token and sends an authentication link via email. Returns the URI directly if debug mode is enabled.
|
|
*/
|
|
export const postAuthMagicMutation = (options?: Partial<Options<PostAuthMagicData>>): UseMutationOptions<PostAuthMagicResponse, PostAuthMagicError, Options<PostAuthMagicData>> => {
|
|
const mutationOptions: UseMutationOptions<PostAuthMagicResponse, PostAuthMagicError, Options<PostAuthMagicData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postAuthMagic({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export type QueryKey<TOptions extends Options> = [
|
|
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
|
_id: string;
|
|
_infinite?: boolean;
|
|
tags?: ReadonlyArray<string>;
|
|
}
|
|
];
|
|
|
|
const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, infinite?: boolean, tags?: ReadonlyArray<string>): [
|
|
QueryKey<TOptions>[0]
|
|
] => {
|
|
const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl } as QueryKey<TOptions>[0];
|
|
if (infinite) {
|
|
params._infinite = infinite;
|
|
}
|
|
if (tags) {
|
|
params.tags = tags;
|
|
}
|
|
if (options?.body) {
|
|
params.body = options.body;
|
|
}
|
|
if (options?.headers) {
|
|
params.headers = options.headers;
|
|
}
|
|
if (options?.path) {
|
|
params.path = options.path;
|
|
}
|
|
if (options?.query) {
|
|
params.query = options.query;
|
|
}
|
|
return [params];
|
|
};
|
|
|
|
export const getAuthRedirectQueryKey = (options: Options<GetAuthRedirectData>) => createQueryKey('getAuthRedirect', options);
|
|
|
|
/**
|
|
* Handle Auth Callback and Redirect
|
|
*
|
|
* Verifies the temporary email code, ensures the user exists (or creates one), validates the client's redirect URI, and finally performs a 302 redirect with a new authorization code.
|
|
*/
|
|
export const getAuthRedirectOptions = (options: Options<GetAuthRedirectData>) => queryOptions<unknown, GetAuthRedirectError, unknown, ReturnType<typeof getAuthRedirectQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getAuthRedirect({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getAuthRedirectQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Refresh Access Token
|
|
*
|
|
* Accepts a valid refresh token to issue a new access token and a rotated refresh token.
|
|
*/
|
|
export const postAuthRefreshMutation = (options?: Partial<Options<PostAuthRefreshData>>): UseMutationOptions<PostAuthRefreshResponse, PostAuthRefreshError, Options<PostAuthRefreshData>> => {
|
|
const mutationOptions: UseMutationOptions<PostAuthRefreshResponse, PostAuthRefreshError, Options<PostAuthRefreshData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postAuthRefresh({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Exchange Code for Token
|
|
*
|
|
* Verifies the provided authorization code and issues a pair of JWT tokens (Access and Refresh).
|
|
*/
|
|
export const postAuthTokenMutation = (options?: Partial<Options<PostAuthTokenData>>): UseMutationOptions<PostAuthTokenResponse, PostAuthTokenError, Options<PostAuthTokenData>> => {
|
|
const mutationOptions: UseMutationOptions<PostAuthTokenResponse, PostAuthTokenError, Options<PostAuthTokenData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postAuthToken({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getEventAttendanceQueryKey = (options: Options<GetEventAttendanceData>) => createQueryKey('getEventAttendance', options);
|
|
|
|
/**
|
|
* Get Attendance List
|
|
*
|
|
* Retrieves the list of attendees, including user info and decrypted KYC data for a specified event.
|
|
*/
|
|
export const getEventAttendanceOptions = (options: Options<GetEventAttendanceData>) => queryOptions<GetEventAttendanceResponse, GetEventAttendanceError, GetEventAttendanceResponse, ReturnType<typeof getEventAttendanceQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getEventAttendance({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventAttendanceQueryKey(options)
|
|
});
|
|
|
|
export const getEventCheckinQueryKey = (options: Options<GetEventCheckinData>) => createQueryKey('getEventCheckin', options);
|
|
|
|
/**
|
|
* Generate Check-in Code
|
|
*
|
|
* Creates a temporary check-in code for the authenticated user and event.
|
|
*/
|
|
export const getEventCheckinOptions = (options: Options<GetEventCheckinData>) => queryOptions<GetEventCheckinResponse, GetEventCheckinError, GetEventCheckinResponse, ReturnType<typeof getEventCheckinQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getEventCheckin({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventCheckinQueryKey(options)
|
|
});
|
|
|
|
export const getEventCheckinQueryQueryKey = (options: Options<GetEventCheckinQueryData>) => createQueryKey('getEventCheckinQuery', options);
|
|
|
|
/**
|
|
* Query Check-in Status
|
|
*
|
|
* Returns the timestamp of when the user checked in, or null if not yet checked in.
|
|
*/
|
|
export const getEventCheckinQueryOptions = (options: Options<GetEventCheckinQueryData>) => queryOptions<GetEventCheckinQueryResponse, GetEventCheckinQueryError, GetEventCheckinQueryResponse, ReturnType<typeof getEventCheckinQueryQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getEventCheckinQuery({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventCheckinQueryQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Submit Check-in Code
|
|
*
|
|
* Submits the generated code to mark the user as attended.
|
|
*/
|
|
export const postEventCheckinSubmitMutation = (options?: Partial<Options<PostEventCheckinSubmitData>>): UseMutationOptions<PostEventCheckinSubmitResponse, PostEventCheckinSubmitError, Options<PostEventCheckinSubmitData>> => {
|
|
const mutationOptions: UseMutationOptions<PostEventCheckinSubmitResponse, PostEventCheckinSubmitError, Options<PostEventCheckinSubmitData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postEventCheckinSubmit({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getEventInfoQueryKey = (options: Options<GetEventInfoData>) => createQueryKey('getEventInfo', options);
|
|
|
|
/**
|
|
* Get Event Information
|
|
*
|
|
* Fetches the name, start time, and end time of an event using its UUID.
|
|
*/
|
|
export const getEventInfoOptions = (options: Options<GetEventInfoData>) => queryOptions<GetEventInfoResponse, GetEventInfoError, GetEventInfoResponse, ReturnType<typeof getEventInfoQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getEventInfo({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventInfoQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Join an Event
|
|
*
|
|
* Allows an authenticated user to join an event by providing the event ID. The user's role and state are initialized by the service.
|
|
*/
|
|
export const postEventJoinMutation = (options?: Partial<Options<PostEventJoinData>>): UseMutationOptions<PostEventJoinResponse, PostEventJoinError, Options<PostEventJoinData>> => {
|
|
const mutationOptions: UseMutationOptions<PostEventJoinResponse, PostEventJoinError, Options<PostEventJoinData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postEventJoin({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getEventJoinedQueryKey = (options?: Options<GetEventJoinedData>) => createQueryKey('getEventJoined', options);
|
|
|
|
/**
|
|
* Get Joined Events
|
|
*
|
|
* Fetches a list of events where the authenticated user is a participant. Supports pagination.
|
|
*/
|
|
export const getEventJoinedOptions = (options?: Options<GetEventJoinedData>) => queryOptions<GetEventJoinedResponse, GetEventJoinedError, GetEventJoinedResponse, ReturnType<typeof getEventJoinedQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getEventJoined({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventJoinedQueryKey(options)
|
|
});
|
|
|
|
const createInfiniteParams = <K extends Pick<QueryKey<Options>[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey<Options>, page: K) => {
|
|
const params = { ...queryKey[0] };
|
|
if (page.body) {
|
|
params.body = {
|
|
...queryKey[0].body as any,
|
|
...page.body as any
|
|
};
|
|
}
|
|
if (page.headers) {
|
|
params.headers = {
|
|
...queryKey[0].headers,
|
|
...page.headers
|
|
};
|
|
}
|
|
if (page.path) {
|
|
params.path = {
|
|
...queryKey[0].path as any,
|
|
...page.path as any
|
|
};
|
|
}
|
|
if (page.query) {
|
|
params.query = {
|
|
...queryKey[0].query as any,
|
|
...page.query as any
|
|
};
|
|
}
|
|
return params as unknown as typeof page;
|
|
};
|
|
|
|
export const getEventJoinedInfiniteQueryKey = (options?: Options<GetEventJoinedData>): QueryKey<Options<GetEventJoinedData>> => createQueryKey('getEventJoined', options, true);
|
|
|
|
/**
|
|
* Get Joined Events
|
|
*
|
|
* Fetches a list of events where the authenticated user is a participant. Supports pagination.
|
|
*/
|
|
export const getEventJoinedInfiniteOptions = (options?: Options<GetEventJoinedData>) => infiniteQueryOptions<GetEventJoinedResponse, GetEventJoinedError, InfiniteData<GetEventJoinedResponse>, QueryKey<Options<GetEventJoinedData>>, number | Pick<QueryKey<Options<GetEventJoinedData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
|
// @ts-ignore
|
|
{
|
|
queryFn: async ({ pageParam, queryKey, signal }) => {
|
|
// @ts-ignore
|
|
const page: Pick<QueryKey<Options<GetEventJoinedData>>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === 'object' ? pageParam : {
|
|
query: {
|
|
offset: pageParam
|
|
}
|
|
};
|
|
const params = createInfiniteParams(queryKey, page);
|
|
const { data } = await getEventJoined({
|
|
...options,
|
|
...params,
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventJoinedInfiniteQueryKey(options)
|
|
});
|
|
|
|
export const getEventListQueryKey = (options?: Options<GetEventListData>) => createQueryKey('getEventList', options);
|
|
|
|
/**
|
|
* List Events
|
|
*
|
|
* Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency.
|
|
*/
|
|
export const getEventListOptions = (options?: Options<GetEventListData>) => queryOptions<GetEventListResponse, GetEventListError, GetEventListResponse, ReturnType<typeof getEventListQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getEventList({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventListQueryKey(options)
|
|
});
|
|
|
|
export const getEventListInfiniteQueryKey = (options?: Options<GetEventListData>): QueryKey<Options<GetEventListData>> => createQueryKey('getEventList', options, true);
|
|
|
|
/**
|
|
* List Events
|
|
*
|
|
* Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency.
|
|
*/
|
|
export const getEventListInfiniteOptions = (options?: Options<GetEventListData>) => infiniteQueryOptions<GetEventListResponse, GetEventListError, InfiniteData<GetEventListResponse>, QueryKey<Options<GetEventListData>>, number | Pick<QueryKey<Options<GetEventListData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
|
// @ts-ignore
|
|
{
|
|
queryFn: async ({ pageParam, queryKey, signal }) => {
|
|
// @ts-ignore
|
|
const page: Pick<QueryKey<Options<GetEventListData>>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === 'object' ? pageParam : {
|
|
query: {
|
|
offset: pageParam
|
|
}
|
|
};
|
|
const params = createInfiniteParams(queryKey, page);
|
|
const { data } = await getEventList({
|
|
...options,
|
|
...params,
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventListInfiniteQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Query KYC Status
|
|
*
|
|
* Checks the current state of a KYC session and updates local database if approved.
|
|
*/
|
|
export const postKycQueryMutation = (options?: Partial<Options<PostKycQueryData>>): UseMutationOptions<PostKycQueryResponse, PostKycQueryError, Options<PostKycQueryData>> => {
|
|
const mutationOptions: UseMutationOptions<PostKycQueryResponse, PostKycQueryError, Options<PostKycQueryData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postKycQuery({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Create KYC Session
|
|
*
|
|
* Initializes a KYC process (CNRid or Passport) and returns the status or redirect URI.
|
|
*/
|
|
export const postKycSessionMutation = (options?: Partial<Options<PostKycSessionData>>): UseMutationOptions<PostKycSessionResponse, PostKycSessionError, Options<PostKycSessionData>> => {
|
|
const mutationOptions: UseMutationOptions<PostKycSessionResponse, PostKycSessionError, Options<PostKycSessionData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postKycSession({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getUserInfoQueryKey = (options?: Options<GetUserInfoData>) => createQueryKey('getUserInfo', options);
|
|
|
|
/**
|
|
* Get My User Information
|
|
*
|
|
* Fetches the complete profile data for the user associated with the provided session/token.
|
|
*/
|
|
export const getUserInfoOptions = (options?: Options<GetUserInfoData>) => queryOptions<GetUserInfoResponse, GetUserInfoError, GetUserInfoResponse, ReturnType<typeof getUserInfoQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getUserInfo({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getUserInfoQueryKey(options)
|
|
});
|
|
|
|
export const getUserInfoByUserIdQueryKey = (options: Options<GetUserInfoByUserIdData>) => createQueryKey('getUserInfoByUserId', options);
|
|
|
|
/**
|
|
* Get Other User Information
|
|
*
|
|
* Fetches the complete profile data for the user associated with the provided session/token.
|
|
*/
|
|
export const getUserInfoByUserIdOptions = (options: Options<GetUserInfoByUserIdData>) => queryOptions<GetUserInfoByUserIdResponse, GetUserInfoByUserIdError, GetUserInfoByUserIdResponse, ReturnType<typeof getUserInfoByUserIdQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getUserInfoByUserId({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getUserInfoByUserIdQueryKey(options)
|
|
});
|
|
|
|
export const getUserListQueryKey = (options: Options<GetUserListData>) => createQueryKey('getUserList', options);
|
|
|
|
/**
|
|
* List Users
|
|
*
|
|
* Fetches a list of users with support for pagination via limit and offset. Data is sourced from the search engine for high performance.
|
|
*/
|
|
export const getUserListOptions = (options: Options<GetUserListData>) => queryOptions<GetUserListResponse, GetUserListError, GetUserListResponse, ReturnType<typeof getUserListQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getUserList({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getUserListQueryKey(options)
|
|
});
|
|
|
|
export const getUserListInfiniteQueryKey = (options: Options<GetUserListData>): QueryKey<Options<GetUserListData>> => createQueryKey('getUserList', options, true);
|
|
|
|
/**
|
|
* List Users
|
|
*
|
|
* Fetches a list of users with support for pagination via limit and offset. Data is sourced from the search engine for high performance.
|
|
*/
|
|
export const getUserListInfiniteOptions = (options: Options<GetUserListData>) => infiniteQueryOptions<GetUserListResponse, GetUserListError, InfiniteData<GetUserListResponse>, QueryKey<Options<GetUserListData>>, string | Pick<QueryKey<Options<GetUserListData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
|
// @ts-ignore
|
|
{
|
|
queryFn: async ({ pageParam, queryKey, signal }) => {
|
|
// @ts-ignore
|
|
const page: Pick<QueryKey<Options<GetUserListData>>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === 'object' ? pageParam : {
|
|
query: {
|
|
offset: pageParam
|
|
}
|
|
};
|
|
const params = createInfiniteParams(queryKey, page);
|
|
const { data } = await getUserList({
|
|
...options,
|
|
...params,
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getUserListInfiniteQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Update User Information
|
|
*
|
|
* Updates specific profile fields such as username, nickname, subtitle, avatar (URL), and bio (Base64).
|
|
* Validation: Username (5-255 chars), Nickname (max 24 chars), Subtitle (max 32 chars).
|
|
*/
|
|
export const patchUserUpdateMutation = (options?: Partial<Options<PatchUserUpdateData>>): UseMutationOptions<PatchUserUpdateResponse, PatchUserUpdateError, Options<PatchUserUpdateData>> => {
|
|
const mutationOptions: UseMutationOptions<PatchUserUpdateResponse, PatchUserUpdateError, Options<PatchUserUpdateData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await patchUserUpdate({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|