1676 lines
41 KiB
TypeScript
1676 lines
41 KiB
TypeScript
// This file is auto-generated by @hey-api/openapi-ts
|
|
|
|
import {
|
|
type Options,
|
|
rootGet,
|
|
register,
|
|
login,
|
|
loginOauth,
|
|
refreshToken,
|
|
changePassword,
|
|
getCurrentUserInfo,
|
|
listEventThemes,
|
|
createEventTheme,
|
|
deleteEventTheme,
|
|
getEventTheme,
|
|
updateEventTheme,
|
|
getGuests,
|
|
createGuest,
|
|
deleteGuest,
|
|
getGuest,
|
|
updateGuest,
|
|
setGuestStatus,
|
|
createGuestRsvp,
|
|
getRsvps,
|
|
createRsvp,
|
|
deleteRsvp,
|
|
getRsvp,
|
|
updateRsvp,
|
|
updateRsvpStatus,
|
|
createGiftCategory,
|
|
readGiftCategories,
|
|
deleteGiftCategory,
|
|
readGiftCategory,
|
|
updateGiftCategory,
|
|
associateCategoryWithEvent,
|
|
updateCategoryEventSettings,
|
|
getEventsForCategory,
|
|
reorderGiftsInCategory,
|
|
createGiftItem,
|
|
readGiftItems,
|
|
deleteGiftItem,
|
|
readGiftItem,
|
|
updateGiftItem,
|
|
updateGiftItemStatus,
|
|
reserveGiftItem,
|
|
cancelGiftReservation,
|
|
createGiftPurchase,
|
|
readGiftPurchase,
|
|
readGiftPurchasesByGift,
|
|
readGiftPurchasesByGuest,
|
|
createEvent,
|
|
getUserEvents,
|
|
getUpcomingEvents,
|
|
getPublicEvents,
|
|
deleteEvent,
|
|
getEvent,
|
|
updateEvent,
|
|
getEventBySlug,
|
|
generatePresignedUrl,
|
|
uploadFile,
|
|
} from "../sdk.gen";
|
|
import { queryOptions, type UseMutationOptions } from "@tanstack/react-query";
|
|
import type {
|
|
RootGetData,
|
|
RegisterData,
|
|
RegisterError,
|
|
RegisterResponse,
|
|
LoginData,
|
|
LoginError,
|
|
LoginResponse,
|
|
LoginOauthData,
|
|
LoginOauthError,
|
|
LoginOauthResponse,
|
|
RefreshTokenData,
|
|
RefreshTokenError,
|
|
RefreshTokenResponse,
|
|
ChangePasswordData,
|
|
ChangePasswordError,
|
|
GetCurrentUserInfoData,
|
|
ListEventThemesData,
|
|
CreateEventThemeData,
|
|
CreateEventThemeError,
|
|
CreateEventThemeResponse,
|
|
DeleteEventThemeData,
|
|
DeleteEventThemeError,
|
|
GetEventThemeData,
|
|
UpdateEventThemeData,
|
|
UpdateEventThemeError,
|
|
UpdateEventThemeResponse,
|
|
GetGuestsData,
|
|
CreateGuestData,
|
|
CreateGuestError,
|
|
CreateGuestResponse,
|
|
DeleteGuestData,
|
|
DeleteGuestError,
|
|
DeleteGuestResponse,
|
|
GetGuestData,
|
|
UpdateGuestData,
|
|
UpdateGuestError,
|
|
UpdateGuestResponse,
|
|
SetGuestStatusData,
|
|
SetGuestStatusError,
|
|
SetGuestStatusResponse,
|
|
CreateGuestRsvpData,
|
|
CreateGuestRsvpError,
|
|
CreateGuestRsvpResponse,
|
|
GetRsvpsData,
|
|
CreateRsvpData,
|
|
CreateRsvpError,
|
|
CreateRsvpResponse,
|
|
DeleteRsvpData,
|
|
DeleteRsvpError,
|
|
DeleteRsvpResponse,
|
|
GetRsvpData,
|
|
UpdateRsvpData,
|
|
UpdateRsvpError,
|
|
UpdateRsvpResponse,
|
|
UpdateRsvpStatusData,
|
|
UpdateRsvpStatusError,
|
|
UpdateRsvpStatusResponse,
|
|
CreateGiftCategoryData,
|
|
CreateGiftCategoryError,
|
|
CreateGiftCategoryResponse,
|
|
ReadGiftCategoriesData,
|
|
DeleteGiftCategoryData,
|
|
DeleteGiftCategoryError,
|
|
DeleteGiftCategoryResponse,
|
|
ReadGiftCategoryData,
|
|
UpdateGiftCategoryData,
|
|
UpdateGiftCategoryError,
|
|
UpdateGiftCategoryResponse,
|
|
AssociateCategoryWithEventData,
|
|
AssociateCategoryWithEventError,
|
|
AssociateCategoryWithEventResponse,
|
|
UpdateCategoryEventSettingsData,
|
|
UpdateCategoryEventSettingsError,
|
|
UpdateCategoryEventSettingsResponse,
|
|
GetEventsForCategoryData,
|
|
ReorderGiftsInCategoryData,
|
|
ReorderGiftsInCategoryError,
|
|
ReorderGiftsInCategoryResponse,
|
|
CreateGiftItemData,
|
|
CreateGiftItemError,
|
|
CreateGiftItemResponse,
|
|
ReadGiftItemsData,
|
|
DeleteGiftItemData,
|
|
DeleteGiftItemError,
|
|
DeleteGiftItemResponse,
|
|
ReadGiftItemData,
|
|
UpdateGiftItemData,
|
|
UpdateGiftItemError,
|
|
UpdateGiftItemResponse,
|
|
UpdateGiftItemStatusData,
|
|
UpdateGiftItemStatusError,
|
|
UpdateGiftItemStatusResponse,
|
|
ReserveGiftItemData,
|
|
ReserveGiftItemError,
|
|
ReserveGiftItemResponse,
|
|
CancelGiftReservationData,
|
|
CancelGiftReservationError,
|
|
CancelGiftReservationResponse,
|
|
CreateGiftPurchaseData,
|
|
CreateGiftPurchaseError,
|
|
CreateGiftPurchaseResponse,
|
|
ReadGiftPurchaseData,
|
|
ReadGiftPurchasesByGiftData,
|
|
ReadGiftPurchasesByGuestData,
|
|
CreateEventData,
|
|
CreateEventError,
|
|
CreateEventResponse,
|
|
GetUserEventsData,
|
|
GetUpcomingEventsData,
|
|
GetPublicEventsData,
|
|
DeleteEventData,
|
|
DeleteEventError,
|
|
DeleteEventResponse,
|
|
GetEventData,
|
|
UpdateEventData,
|
|
UpdateEventError,
|
|
UpdateEventResponse,
|
|
GetEventBySlugData,
|
|
GeneratePresignedUrlData,
|
|
GeneratePresignedUrlError,
|
|
GeneratePresignedUrlResponse,
|
|
UploadFileData,
|
|
UploadFileError,
|
|
} from "../types.gen";
|
|
import type { AxiosError } from "axios";
|
|
import { client as _heyApiClient } from "../client.gen";
|
|
|
|
export type QueryKey<TOptions extends Options> = [
|
|
Pick<TOptions, "baseURL" | "body" | "headers" | "path" | "query"> & {
|
|
_id: string;
|
|
_infinite?: boolean;
|
|
},
|
|
];
|
|
|
|
const createQueryKey = <TOptions extends Options>(
|
|
id: string,
|
|
options?: TOptions,
|
|
infinite?: boolean,
|
|
): [QueryKey<TOptions>[0]] => {
|
|
const params: QueryKey<TOptions>[0] = {
|
|
_id: id,
|
|
baseURL: (options?.client ?? _heyApiClient).getConfig().baseURL,
|
|
} as QueryKey<TOptions>[0];
|
|
if (infinite) {
|
|
params._infinite = infinite;
|
|
}
|
|
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 rootGetQueryKey = (options?: Options<RootGetData>) =>
|
|
createQueryKey("rootGet", options);
|
|
|
|
export const rootGetOptions = (options?: Options<RootGetData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await rootGet({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: rootGetQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const registerQueryKey = (options: Options<RegisterData>) =>
|
|
createQueryKey("register", options);
|
|
|
|
export const registerOptions = (options: Options<RegisterData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await register({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: registerQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const registerMutation = (options?: Partial<Options<RegisterData>>) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
RegisterResponse,
|
|
AxiosError<RegisterError>,
|
|
Options<RegisterData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await register({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const loginQueryKey = (options: Options<LoginData>) =>
|
|
createQueryKey("login", options);
|
|
|
|
export const loginOptions = (options: Options<LoginData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await login({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: loginQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const loginMutation = (options?: Partial<Options<LoginData>>) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
LoginResponse,
|
|
AxiosError<LoginError>,
|
|
Options<LoginData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await login({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const loginOauthQueryKey = (options: Options<LoginOauthData>) =>
|
|
createQueryKey("loginOauth", options);
|
|
|
|
export const loginOauthOptions = (options: Options<LoginOauthData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await loginOauth({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: loginOauthQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const loginOauthMutation = (
|
|
options?: Partial<Options<LoginOauthData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
LoginOauthResponse,
|
|
AxiosError<LoginOauthError>,
|
|
Options<LoginOauthData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await loginOauth({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const refreshTokenQueryKey = (options: Options<RefreshTokenData>) =>
|
|
createQueryKey("refreshToken", options);
|
|
|
|
export const refreshTokenOptions = (options: Options<RefreshTokenData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await refreshToken({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: refreshTokenQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const refreshTokenMutation = (
|
|
options?: Partial<Options<RefreshTokenData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
RefreshTokenResponse,
|
|
AxiosError<RefreshTokenError>,
|
|
Options<RefreshTokenData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await refreshToken({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const changePasswordQueryKey = (options: Options<ChangePasswordData>) =>
|
|
createQueryKey("changePassword", options);
|
|
|
|
export const changePasswordOptions = (options: Options<ChangePasswordData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await changePassword({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: changePasswordQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const changePasswordMutation = (
|
|
options?: Partial<Options<ChangePasswordData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
unknown,
|
|
AxiosError<ChangePasswordError>,
|
|
Options<ChangePasswordData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await changePassword({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getCurrentUserInfoQueryKey = (
|
|
options?: Options<GetCurrentUserInfoData>,
|
|
) => createQueryKey("getCurrentUserInfo", options);
|
|
|
|
export const getCurrentUserInfoOptions = (
|
|
options?: Options<GetCurrentUserInfoData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getCurrentUserInfo({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getCurrentUserInfoQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const listEventThemesQueryKey = (
|
|
options?: Options<ListEventThemesData>,
|
|
) => createQueryKey("listEventThemes", options);
|
|
|
|
export const listEventThemesOptions = (
|
|
options?: Options<ListEventThemesData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await listEventThemes({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: listEventThemesQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createEventThemeQueryKey = (
|
|
options: Options<CreateEventThemeData>,
|
|
) => createQueryKey("createEventTheme", options);
|
|
|
|
export const createEventThemeOptions = (
|
|
options: Options<CreateEventThemeData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await createEventTheme({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: createEventThemeQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createEventThemeMutation = (
|
|
options?: Partial<Options<CreateEventThemeData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateEventThemeResponse,
|
|
AxiosError<CreateEventThemeError>,
|
|
Options<CreateEventThemeData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await createEventTheme({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const deleteEventThemeMutation = (
|
|
options?: Partial<Options<DeleteEventThemeData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
unknown,
|
|
AxiosError<DeleteEventThemeError>,
|
|
Options<DeleteEventThemeData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await deleteEventTheme({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getEventThemeQueryKey = (options: Options<GetEventThemeData>) =>
|
|
createQueryKey("getEventTheme", options);
|
|
|
|
export const getEventThemeOptions = (options: Options<GetEventThemeData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getEventTheme({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventThemeQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const updateEventThemeMutation = (
|
|
options?: Partial<Options<UpdateEventThemeData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateEventThemeResponse,
|
|
AxiosError<UpdateEventThemeError>,
|
|
Options<UpdateEventThemeData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await updateEventTheme({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getGuestsQueryKey = (options?: Options<GetGuestsData>) =>
|
|
createQueryKey("getGuests", options);
|
|
|
|
export const getGuestsOptions = (options?: Options<GetGuestsData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getGuests({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getGuestsQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createGuestQueryKey = (options: Options<CreateGuestData>) =>
|
|
createQueryKey("createGuest", options);
|
|
|
|
export const createGuestOptions = (options: Options<CreateGuestData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await createGuest({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: createGuestQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createGuestMutation = (
|
|
options?: Partial<Options<CreateGuestData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateGuestResponse,
|
|
AxiosError<CreateGuestError>,
|
|
Options<CreateGuestData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await createGuest({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const deleteGuestMutation = (
|
|
options?: Partial<Options<DeleteGuestData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
DeleteGuestResponse,
|
|
AxiosError<DeleteGuestError>,
|
|
Options<DeleteGuestData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await deleteGuest({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getGuestQueryKey = (options: Options<GetGuestData>) =>
|
|
createQueryKey("getGuest", options);
|
|
|
|
export const getGuestOptions = (options: Options<GetGuestData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getGuest({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getGuestQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const updateGuestMutation = (
|
|
options?: Partial<Options<UpdateGuestData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateGuestResponse,
|
|
AxiosError<UpdateGuestError>,
|
|
Options<UpdateGuestData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await updateGuest({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const setGuestStatusMutation = (
|
|
options?: Partial<Options<SetGuestStatusData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
SetGuestStatusResponse,
|
|
AxiosError<SetGuestStatusError>,
|
|
Options<SetGuestStatusData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await setGuestStatus({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const createGuestRsvpQueryKey = (
|
|
options: Options<CreateGuestRsvpData>,
|
|
) => createQueryKey("createGuestRsvp", options);
|
|
|
|
export const createGuestRsvpOptions = (
|
|
options: Options<CreateGuestRsvpData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await createGuestRsvp({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: createGuestRsvpQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createGuestRsvpMutation = (
|
|
options?: Partial<Options<CreateGuestRsvpData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateGuestRsvpResponse,
|
|
AxiosError<CreateGuestRsvpError>,
|
|
Options<CreateGuestRsvpData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await createGuestRsvp({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getRsvpsQueryKey = (options?: Options<GetRsvpsData>) =>
|
|
createQueryKey("getRsvps", options);
|
|
|
|
export const getRsvpsOptions = (options?: Options<GetRsvpsData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getRsvps({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getRsvpsQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createRsvpQueryKey = (options: Options<CreateRsvpData>) =>
|
|
createQueryKey("createRsvp", options);
|
|
|
|
export const createRsvpOptions = (options: Options<CreateRsvpData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await createRsvp({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: createRsvpQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createRsvpMutation = (
|
|
options?: Partial<Options<CreateRsvpData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateRsvpResponse,
|
|
AxiosError<CreateRsvpError>,
|
|
Options<CreateRsvpData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await createRsvp({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const deleteRsvpMutation = (
|
|
options?: Partial<Options<DeleteRsvpData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
DeleteRsvpResponse,
|
|
AxiosError<DeleteRsvpError>,
|
|
Options<DeleteRsvpData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await deleteRsvp({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getRsvpQueryKey = (options: Options<GetRsvpData>) =>
|
|
createQueryKey("getRsvp", options);
|
|
|
|
export const getRsvpOptions = (options: Options<GetRsvpData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getRsvp({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getRsvpQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const updateRsvpMutation = (
|
|
options?: Partial<Options<UpdateRsvpData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateRsvpResponse,
|
|
AxiosError<UpdateRsvpError>,
|
|
Options<UpdateRsvpData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await updateRsvp({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const updateRsvpStatusMutation = (
|
|
options?: Partial<Options<UpdateRsvpStatusData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateRsvpStatusResponse,
|
|
AxiosError<UpdateRsvpStatusError>,
|
|
Options<UpdateRsvpStatusData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await updateRsvpStatus({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const createGiftCategoryQueryKey = (
|
|
options: Options<CreateGiftCategoryData>,
|
|
) => createQueryKey("createGiftCategory", options);
|
|
|
|
export const createGiftCategoryOptions = (
|
|
options: Options<CreateGiftCategoryData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await createGiftCategory({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: createGiftCategoryQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createGiftCategoryMutation = (
|
|
options?: Partial<Options<CreateGiftCategoryData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateGiftCategoryResponse,
|
|
AxiosError<CreateGiftCategoryError>,
|
|
Options<CreateGiftCategoryData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await createGiftCategory({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const readGiftCategoriesQueryKey = (
|
|
options: Options<ReadGiftCategoriesData>,
|
|
) => createQueryKey("readGiftCategories", options);
|
|
|
|
export const readGiftCategoriesOptions = (
|
|
options: Options<ReadGiftCategoriesData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await readGiftCategories({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: readGiftCategoriesQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const deleteGiftCategoryMutation = (
|
|
options?: Partial<Options<DeleteGiftCategoryData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
DeleteGiftCategoryResponse,
|
|
AxiosError<DeleteGiftCategoryError>,
|
|
Options<DeleteGiftCategoryData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await deleteGiftCategory({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const readGiftCategoryQueryKey = (
|
|
options: Options<ReadGiftCategoryData>,
|
|
) => createQueryKey("readGiftCategory", options);
|
|
|
|
export const readGiftCategoryOptions = (
|
|
options: Options<ReadGiftCategoryData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await readGiftCategory({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: readGiftCategoryQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const updateGiftCategoryMutation = (
|
|
options?: Partial<Options<UpdateGiftCategoryData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateGiftCategoryResponse,
|
|
AxiosError<UpdateGiftCategoryError>,
|
|
Options<UpdateGiftCategoryData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await updateGiftCategory({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const associateCategoryWithEventQueryKey = (
|
|
options: Options<AssociateCategoryWithEventData>,
|
|
) => createQueryKey("associateCategoryWithEvent", options);
|
|
|
|
export const associateCategoryWithEventOptions = (
|
|
options: Options<AssociateCategoryWithEventData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await associateCategoryWithEvent({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: associateCategoryWithEventQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const associateCategoryWithEventMutation = (
|
|
options?: Partial<Options<AssociateCategoryWithEventData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
AssociateCategoryWithEventResponse,
|
|
AxiosError<AssociateCategoryWithEventError>,
|
|
Options<AssociateCategoryWithEventData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await associateCategoryWithEvent({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const updateCategoryEventSettingsMutation = (
|
|
options?: Partial<Options<UpdateCategoryEventSettingsData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateCategoryEventSettingsResponse,
|
|
AxiosError<UpdateCategoryEventSettingsError>,
|
|
Options<UpdateCategoryEventSettingsData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await updateCategoryEventSettings({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getEventsForCategoryQueryKey = (
|
|
options: Options<GetEventsForCategoryData>,
|
|
) => createQueryKey("getEventsForCategory", options);
|
|
|
|
export const getEventsForCategoryOptions = (
|
|
options: Options<GetEventsForCategoryData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getEventsForCategory({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventsForCategoryQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const reorderGiftsInCategoryMutation = (
|
|
options?: Partial<Options<ReorderGiftsInCategoryData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
ReorderGiftsInCategoryResponse,
|
|
AxiosError<ReorderGiftsInCategoryError>,
|
|
Options<ReorderGiftsInCategoryData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await reorderGiftsInCategory({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const createGiftItemQueryKey = (options: Options<CreateGiftItemData>) =>
|
|
createQueryKey("createGiftItem", options);
|
|
|
|
export const createGiftItemOptions = (options: Options<CreateGiftItemData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await createGiftItem({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: createGiftItemQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createGiftItemMutation = (
|
|
options?: Partial<Options<CreateGiftItemData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateGiftItemResponse,
|
|
AxiosError<CreateGiftItemError>,
|
|
Options<CreateGiftItemData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await createGiftItem({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const readGiftItemsQueryKey = (options: Options<ReadGiftItemsData>) =>
|
|
createQueryKey("readGiftItems", options);
|
|
|
|
export const readGiftItemsOptions = (options: Options<ReadGiftItemsData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await readGiftItems({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: readGiftItemsQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const deleteGiftItemMutation = (
|
|
options?: Partial<Options<DeleteGiftItemData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
DeleteGiftItemResponse,
|
|
AxiosError<DeleteGiftItemError>,
|
|
Options<DeleteGiftItemData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await deleteGiftItem({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const readGiftItemQueryKey = (options: Options<ReadGiftItemData>) =>
|
|
createQueryKey("readGiftItem", options);
|
|
|
|
export const readGiftItemOptions = (options: Options<ReadGiftItemData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await readGiftItem({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: readGiftItemQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const updateGiftItemMutation = (
|
|
options?: Partial<Options<UpdateGiftItemData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateGiftItemResponse,
|
|
AxiosError<UpdateGiftItemError>,
|
|
Options<UpdateGiftItemData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await updateGiftItem({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const updateGiftItemStatusMutation = (
|
|
options?: Partial<Options<UpdateGiftItemStatusData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateGiftItemStatusResponse,
|
|
AxiosError<UpdateGiftItemStatusError>,
|
|
Options<UpdateGiftItemStatusData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await updateGiftItemStatus({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const reserveGiftItemQueryKey = (
|
|
options: Options<ReserveGiftItemData>,
|
|
) => createQueryKey("reserveGiftItem", options);
|
|
|
|
export const reserveGiftItemOptions = (
|
|
options: Options<ReserveGiftItemData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await reserveGiftItem({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: reserveGiftItemQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const reserveGiftItemMutation = (
|
|
options?: Partial<Options<ReserveGiftItemData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
ReserveGiftItemResponse,
|
|
AxiosError<ReserveGiftItemError>,
|
|
Options<ReserveGiftItemData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await reserveGiftItem({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const cancelGiftReservationQueryKey = (
|
|
options: Options<CancelGiftReservationData>,
|
|
) => createQueryKey("cancelGiftReservation", options);
|
|
|
|
export const cancelGiftReservationOptions = (
|
|
options: Options<CancelGiftReservationData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await cancelGiftReservation({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: cancelGiftReservationQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const cancelGiftReservationMutation = (
|
|
options?: Partial<Options<CancelGiftReservationData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CancelGiftReservationResponse,
|
|
AxiosError<CancelGiftReservationError>,
|
|
Options<CancelGiftReservationData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await cancelGiftReservation({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const createGiftPurchaseQueryKey = (
|
|
options: Options<CreateGiftPurchaseData>,
|
|
) => createQueryKey("createGiftPurchase", options);
|
|
|
|
export const createGiftPurchaseOptions = (
|
|
options: Options<CreateGiftPurchaseData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await createGiftPurchase({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: createGiftPurchaseQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createGiftPurchaseMutation = (
|
|
options?: Partial<Options<CreateGiftPurchaseData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateGiftPurchaseResponse,
|
|
AxiosError<CreateGiftPurchaseError>,
|
|
Options<CreateGiftPurchaseData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await createGiftPurchase({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const readGiftPurchaseQueryKey = (
|
|
options: Options<ReadGiftPurchaseData>,
|
|
) => createQueryKey("readGiftPurchase", options);
|
|
|
|
export const readGiftPurchaseOptions = (
|
|
options: Options<ReadGiftPurchaseData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await readGiftPurchase({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: readGiftPurchaseQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const readGiftPurchasesByGiftQueryKey = (
|
|
options: Options<ReadGiftPurchasesByGiftData>,
|
|
) => createQueryKey("readGiftPurchasesByGift", options);
|
|
|
|
export const readGiftPurchasesByGiftOptions = (
|
|
options: Options<ReadGiftPurchasesByGiftData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await readGiftPurchasesByGift({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: readGiftPurchasesByGiftQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const readGiftPurchasesByGuestQueryKey = (
|
|
options: Options<ReadGiftPurchasesByGuestData>,
|
|
) => createQueryKey("readGiftPurchasesByGuest", options);
|
|
|
|
export const readGiftPurchasesByGuestOptions = (
|
|
options: Options<ReadGiftPurchasesByGuestData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await readGiftPurchasesByGuest({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: readGiftPurchasesByGuestQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createEventQueryKey = (options: Options<CreateEventData>) =>
|
|
createQueryKey("createEvent", options);
|
|
|
|
export const createEventOptions = (options: Options<CreateEventData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await createEvent({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: createEventQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const createEventMutation = (
|
|
options?: Partial<Options<CreateEventData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
CreateEventResponse,
|
|
AxiosError<CreateEventError>,
|
|
Options<CreateEventData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await createEvent({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getUserEventsQueryKey = (options?: Options<GetUserEventsData>) =>
|
|
createQueryKey("getUserEvents", options);
|
|
|
|
export const getUserEventsOptions = (options?: Options<GetUserEventsData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getUserEvents({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getUserEventsQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const getUpcomingEventsQueryKey = (
|
|
options?: Options<GetUpcomingEventsData>,
|
|
) => createQueryKey("getUpcomingEvents", options);
|
|
|
|
export const getUpcomingEventsOptions = (
|
|
options?: Options<GetUpcomingEventsData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getUpcomingEvents({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getUpcomingEventsQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const getPublicEventsQueryKey = (
|
|
options?: Options<GetPublicEventsData>,
|
|
) => createQueryKey("getPublicEvents", options);
|
|
|
|
export const getPublicEventsOptions = (
|
|
options?: Options<GetPublicEventsData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getPublicEvents({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getPublicEventsQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const deleteEventMutation = (
|
|
options?: Partial<Options<DeleteEventData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
DeleteEventResponse,
|
|
AxiosError<DeleteEventError>,
|
|
Options<DeleteEventData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await deleteEvent({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getEventQueryKey = (options: Options<GetEventData>) =>
|
|
createQueryKey("getEvent", options);
|
|
|
|
export const getEventOptions = (options: Options<GetEventData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getEvent({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const updateEventMutation = (
|
|
options?: Partial<Options<UpdateEventData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
UpdateEventResponse,
|
|
AxiosError<UpdateEventError>,
|
|
Options<UpdateEventData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await updateEvent({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getEventBySlugQueryKey = (options: Options<GetEventBySlugData>) =>
|
|
createQueryKey("getEventBySlug", options);
|
|
|
|
export const getEventBySlugOptions = (options: Options<GetEventBySlugData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getEventBySlug({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getEventBySlugQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const generatePresignedUrlQueryKey = (
|
|
options: Options<GeneratePresignedUrlData>,
|
|
) => createQueryKey("generatePresignedUrl", options);
|
|
|
|
export const generatePresignedUrlOptions = (
|
|
options: Options<GeneratePresignedUrlData>,
|
|
) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await generatePresignedUrl({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: generatePresignedUrlQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const generatePresignedUrlMutation = (
|
|
options?: Partial<Options<GeneratePresignedUrlData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
GeneratePresignedUrlResponse,
|
|
AxiosError<GeneratePresignedUrlError>,
|
|
Options<GeneratePresignedUrlData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await generatePresignedUrl({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const uploadFileQueryKey = (options: Options<UploadFileData>) =>
|
|
createQueryKey("uploadFile", options);
|
|
|
|
export const uploadFileOptions = (options: Options<UploadFileData>) => {
|
|
return queryOptions({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await uploadFile({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: uploadFileQueryKey(options),
|
|
});
|
|
};
|
|
|
|
export const uploadFileMutation = (
|
|
options?: Partial<Options<UploadFileData>>,
|
|
) => {
|
|
const mutationOptions: UseMutationOptions<
|
|
unknown,
|
|
AxiosError<UploadFileError>,
|
|
Options<UploadFileData>
|
|
> = {
|
|
mutationFn: async (localOptions) => {
|
|
const { data } = await uploadFile({
|
|
...options,
|
|
...localOptions,
|
|
throwOnError: true,
|
|
});
|
|
return data;
|
|
},
|
|
};
|
|
return mutationOptions;
|
|
};
|