Update client with new guest rsvp endpoint
This commit is contained in:
@@ -19,7 +19,8 @@ import {
|
|||||||
deleteGuest,
|
deleteGuest,
|
||||||
getGuest,
|
getGuest,
|
||||||
updateGuest,
|
updateGuest,
|
||||||
setGuestStatusApiV1EventsGuestsGuestIdStatusPatch,
|
setGuestStatus,
|
||||||
|
createGuestRsvp,
|
||||||
getRsvps,
|
getRsvps,
|
||||||
createRsvp,
|
createRsvp,
|
||||||
deleteRsvp,
|
deleteRsvp,
|
||||||
@@ -76,9 +77,12 @@ import type {
|
|||||||
UpdateGuestData,
|
UpdateGuestData,
|
||||||
UpdateGuestError,
|
UpdateGuestError,
|
||||||
UpdateGuestResponse,
|
UpdateGuestResponse,
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchData,
|
SetGuestStatusData,
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchError,
|
SetGuestStatusError,
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchResponse,
|
SetGuestStatusResponse,
|
||||||
|
CreateGuestRsvpData,
|
||||||
|
CreateGuestRsvpError,
|
||||||
|
CreateGuestRsvpResponse,
|
||||||
GetRsvpsData,
|
GetRsvpsData,
|
||||||
CreateRsvpData,
|
CreateRsvpData,
|
||||||
CreateRsvpError,
|
CreateRsvpError,
|
||||||
@@ -609,18 +613,57 @@ export const updateGuestMutation = (
|
|||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setGuestStatusApiV1EventsGuestsGuestIdStatusPatchMutation = (
|
export const setGuestStatusMutation = (
|
||||||
options?: Partial<
|
options?: Partial<Options<SetGuestStatusData>>,
|
||||||
Options<SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchData>
|
|
||||||
>,
|
|
||||||
) => {
|
) => {
|
||||||
const mutationOptions: UseMutationOptions<
|
const mutationOptions: UseMutationOptions<
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchResponse,
|
SetGuestStatusResponse,
|
||||||
AxiosError<SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchError>,
|
AxiosError<SetGuestStatusError>,
|
||||||
Options<SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchData>
|
Options<SetGuestStatusData>
|
||||||
> = {
|
> = {
|
||||||
mutationFn: async (localOptions) => {
|
mutationFn: async (localOptions) => {
|
||||||
const { data } = await setGuestStatusApiV1EventsGuestsGuestIdStatusPatch({
|
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,
|
...options,
|
||||||
...localOptions,
|
...localOptions,
|
||||||
throwOnError: true,
|
throwOnError: true,
|
||||||
|
|||||||
@@ -1506,6 +1506,29 @@ export const GuestUpdateSchema = {
|
|||||||
title: "GuestUpdate",
|
title: "GuestUpdate",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
export const GuestWithRSVPResponseSchema = {
|
||||||
|
properties: {
|
||||||
|
guest: {
|
||||||
|
$ref: "#/components/schemas/GuestRead",
|
||||||
|
},
|
||||||
|
rsvp: {
|
||||||
|
anyOf: [
|
||||||
|
{
|
||||||
|
$ref: "#/components/schemas/RSVPSchema",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "null",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
type: "object",
|
||||||
|
required: ["guest"],
|
||||||
|
title: "GuestWithRSVPResponse",
|
||||||
|
description: `Combined response model that includes both guest and RSVP information.
|
||||||
|
This gives the frontend a complete picture of the guest's response in a single object.`,
|
||||||
|
} as const;
|
||||||
|
|
||||||
export const HTTPValidationErrorSchema = {
|
export const HTTPValidationErrorSchema = {
|
||||||
properties: {
|
properties: {
|
||||||
detail: {
|
detail: {
|
||||||
|
|||||||
@@ -55,9 +55,12 @@ import type {
|
|||||||
UpdateGuestData,
|
UpdateGuestData,
|
||||||
UpdateGuestResponse,
|
UpdateGuestResponse,
|
||||||
UpdateGuestError,
|
UpdateGuestError,
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchData,
|
SetGuestStatusData,
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchResponse,
|
SetGuestStatusResponse,
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchError,
|
SetGuestStatusError,
|
||||||
|
CreateGuestRsvpData,
|
||||||
|
CreateGuestRsvpResponse,
|
||||||
|
CreateGuestRsvpError,
|
||||||
GetRsvpsData,
|
GetRsvpsData,
|
||||||
GetRsvpsResponse,
|
GetRsvpsResponse,
|
||||||
GetRsvpsError,
|
GetRsvpsError,
|
||||||
@@ -493,17 +496,12 @@ export const updateGuest = <ThrowOnError extends boolean = false>(
|
|||||||
/**
|
/**
|
||||||
* Set Guest Status
|
* Set Guest Status
|
||||||
*/
|
*/
|
||||||
export const setGuestStatusApiV1EventsGuestsGuestIdStatusPatch = <
|
export const setGuestStatus = <ThrowOnError extends boolean = false>(
|
||||||
ThrowOnError extends boolean = false,
|
options: Options<SetGuestStatusData, ThrowOnError>,
|
||||||
>(
|
|
||||||
options: Options<
|
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchData,
|
|
||||||
ThrowOnError
|
|
||||||
>,
|
|
||||||
) => {
|
) => {
|
||||||
return (options.client ?? _heyApiClient).patch<
|
return (options.client ?? _heyApiClient).patch<
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchResponse,
|
SetGuestStatusResponse,
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchError,
|
SetGuestStatusError,
|
||||||
ThrowOnError
|
ThrowOnError
|
||||||
>({
|
>({
|
||||||
url: "/api/v1/events/guests/{guest_id}/status",
|
url: "/api/v1/events/guests/{guest_id}/status",
|
||||||
@@ -511,6 +509,26 @@ export const setGuestStatusApiV1EventsGuestsGuestIdStatusPatch = <
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process Guest Rsvp
|
||||||
|
*/
|
||||||
|
export const createGuestRsvp = <ThrowOnError extends boolean = false>(
|
||||||
|
options: Options<CreateGuestRsvpData, ThrowOnError>,
|
||||||
|
) => {
|
||||||
|
return (options.client ?? _heyApiClient).post<
|
||||||
|
CreateGuestRsvpResponse,
|
||||||
|
CreateGuestRsvpError,
|
||||||
|
ThrowOnError
|
||||||
|
>({
|
||||||
|
url: "/api/v1/events/guests/{guest_id}/rsvp",
|
||||||
|
...options,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
...options?.headers,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read Rsvps
|
* Read Rsvps
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -240,6 +240,15 @@ export type GuestUpdate = {
|
|||||||
can_bring_guests?: boolean | null;
|
can_bring_guests?: boolean | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Combined response model that includes both guest and RSVP information.
|
||||||
|
* This gives the frontend a complete picture of the guest's response in a single object.
|
||||||
|
*/
|
||||||
|
export type GuestWithRsvpResponse = {
|
||||||
|
guest: GuestRead;
|
||||||
|
rsvp?: RsvpSchema | null;
|
||||||
|
};
|
||||||
|
|
||||||
export type HttpValidationError = {
|
export type HttpValidationError = {
|
||||||
detail?: Array<ValidationError>;
|
detail?: Array<ValidationError>;
|
||||||
};
|
};
|
||||||
@@ -809,7 +818,7 @@ export type UpdateGuestResponses = {
|
|||||||
export type UpdateGuestResponse =
|
export type UpdateGuestResponse =
|
||||||
UpdateGuestResponses[keyof UpdateGuestResponses];
|
UpdateGuestResponses[keyof UpdateGuestResponses];
|
||||||
|
|
||||||
export type SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchData = {
|
export type SetGuestStatusData = {
|
||||||
body?: never;
|
body?: never;
|
||||||
path: {
|
path: {
|
||||||
guest_id: string;
|
guest_id: string;
|
||||||
@@ -820,25 +829,54 @@ export type SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchData = {
|
|||||||
url: "/api/v1/events/guests/{guest_id}/status";
|
url: "/api/v1/events/guests/{guest_id}/status";
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchErrors = {
|
export type SetGuestStatusErrors = {
|
||||||
/**
|
/**
|
||||||
* Validation Error
|
* Validation Error
|
||||||
*/
|
*/
|
||||||
422: HttpValidationError;
|
422: HttpValidationError;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchError =
|
export type SetGuestStatusError =
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchErrors[keyof SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchErrors];
|
SetGuestStatusErrors[keyof SetGuestStatusErrors];
|
||||||
|
|
||||||
export type SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchResponses = {
|
export type SetGuestStatusResponses = {
|
||||||
/**
|
/**
|
||||||
* Successful Response
|
* Successful Response
|
||||||
*/
|
*/
|
||||||
200: GuestRead;
|
200: GuestRead;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchResponse =
|
export type SetGuestStatusResponse =
|
||||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchResponses[keyof SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchResponses];
|
SetGuestStatusResponses[keyof SetGuestStatusResponses];
|
||||||
|
|
||||||
|
export type CreateGuestRsvpData = {
|
||||||
|
body: RsvpSchemaCreate;
|
||||||
|
path: {
|
||||||
|
guest_id: string;
|
||||||
|
};
|
||||||
|
query?: never;
|
||||||
|
url: "/api/v1/events/guests/{guest_id}/rsvp";
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateGuestRsvpErrors = {
|
||||||
|
/**
|
||||||
|
* Validation Error
|
||||||
|
*/
|
||||||
|
422: HttpValidationError;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateGuestRsvpError =
|
||||||
|
CreateGuestRsvpErrors[keyof CreateGuestRsvpErrors];
|
||||||
|
|
||||||
|
export type CreateGuestRsvpResponses = {
|
||||||
|
/**
|
||||||
|
* Successful Response
|
||||||
|
*/
|
||||||
|
200: GuestWithRsvpResponse;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateGuestRsvpResponse =
|
||||||
|
CreateGuestRsvpResponses[keyof CreateGuestRsvpResponses];
|
||||||
|
|
||||||
export type GetRsvpsData = {
|
export type GetRsvpsData = {
|
||||||
body?: never;
|
body?: never;
|
||||||
|
|||||||
Reference in New Issue
Block a user