Add support for fetching all guest gift reservations
Introduce new types, query functions, and SDK methods to enable retrieving all guest gift purchases via the `/api/v1/events/gifts/purchases/guest/all` endpoint. This addition integrates with React Query and ensures type safety throughout the client.
This commit is contained in:
@@ -48,6 +48,7 @@ import {
|
||||
readGiftPurchase,
|
||||
readGiftPurchasesByGift,
|
||||
readGiftPurchasesByGuest,
|
||||
readGuestsGiftPurchases,
|
||||
createEvent,
|
||||
getUserEvents,
|
||||
getUpcomingEvents,
|
||||
@@ -165,6 +166,7 @@ import type {
|
||||
ReadGiftPurchaseData,
|
||||
ReadGiftPurchasesByGiftData,
|
||||
ReadGiftPurchasesByGuestData,
|
||||
ReadGuestsGiftPurchasesData,
|
||||
CreateEventData,
|
||||
CreateEventError,
|
||||
CreateEventResponse,
|
||||
@@ -1421,6 +1423,27 @@ export const readGiftPurchasesByGuestOptions = (
|
||||
});
|
||||
};
|
||||
|
||||
export const readGuestsGiftPurchasesQueryKey = (
|
||||
options?: Options<ReadGuestsGiftPurchasesData>,
|
||||
) => createQueryKey("readGuestsGiftPurchases", options);
|
||||
|
||||
export const readGuestsGiftPurchasesOptions = (
|
||||
options?: Options<ReadGuestsGiftPurchasesData>,
|
||||
) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await readGuestsGiftPurchases({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: readGuestsGiftPurchasesQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
export const createEventQueryKey = (options: Options<CreateEventData>) =>
|
||||
createQueryKey("createEvent", options);
|
||||
|
||||
|
||||
@@ -142,6 +142,8 @@ import type {
|
||||
ReadGiftPurchasesByGuestData,
|
||||
ReadGiftPurchasesByGuestResponse,
|
||||
ReadGiftPurchasesByGuestError,
|
||||
ReadGuestsGiftPurchasesData,
|
||||
ReadGuestsGiftPurchasesResponse,
|
||||
CreateEventData,
|
||||
CreateEventResponse,
|
||||
CreateEventError,
|
||||
@@ -1153,6 +1155,23 @@ export const readGiftPurchasesByGuest = <ThrowOnError extends boolean = false>(
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Read All Guest Gift Reservations
|
||||
* Retrieve all guest gift reservations.
|
||||
*/
|
||||
export const readGuestsGiftPurchases = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<ReadGuestsGiftPurchasesData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? _heyApiClient).get<
|
||||
ReadGuestsGiftPurchasesResponse,
|
||||
unknown,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/gifts/purchases/guest/all",
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Create Event
|
||||
* Create a new event.
|
||||
|
||||
@@ -1876,6 +1876,23 @@ export type ReadGiftPurchasesByGuestResponses = {
|
||||
export type ReadGiftPurchasesByGuestResponse =
|
||||
ReadGiftPurchasesByGuestResponses[keyof ReadGiftPurchasesByGuestResponses];
|
||||
|
||||
export type ReadGuestsGiftPurchasesData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: "/api/v1/events/gifts/purchases/guest/all";
|
||||
};
|
||||
|
||||
export type ReadGuestsGiftPurchasesResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: Array<GiftPurchase>;
|
||||
};
|
||||
|
||||
export type ReadGuestsGiftPurchasesResponse =
|
||||
ReadGuestsGiftPurchasesResponses[keyof ReadGuestsGiftPurchasesResponses];
|
||||
|
||||
export type CreateEventData = {
|
||||
body: EventCreate;
|
||||
path?: never;
|
||||
|
||||
Reference in New Issue
Block a user