Add schemas and APIs for Guest and RSVP management
Introduced schemas and types for Guests and RSVPs, along with their create, read, update, and delete endpoints. This also includes React Query integrations for managing guest and RSVP data in the frontend.
This commit is contained in:
@@ -40,6 +40,42 @@ import type {
|
||||
UpdateEventThemeData,
|
||||
UpdateEventThemeResponse,
|
||||
UpdateEventThemeError,
|
||||
GetGuestsData,
|
||||
GetGuestsResponse,
|
||||
GetGuestsError,
|
||||
CreateGuestData,
|
||||
CreateGuestResponse,
|
||||
CreateGuestError,
|
||||
DeleteGuestData,
|
||||
DeleteGuestResponse,
|
||||
DeleteGuestError,
|
||||
GetGuestData,
|
||||
GetGuestResponse,
|
||||
GetGuestError,
|
||||
UpdateGuestData,
|
||||
UpdateGuestResponse,
|
||||
UpdateGuestError,
|
||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchData,
|
||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchResponse,
|
||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchError,
|
||||
GetRsvpsData,
|
||||
GetRsvpsResponse,
|
||||
GetRsvpsError,
|
||||
CreateRsvpData,
|
||||
CreateRsvpResponse,
|
||||
CreateRsvpError,
|
||||
DeleteRsvpData,
|
||||
DeleteRsvpResponse,
|
||||
DeleteRsvpError,
|
||||
GetRsvpData,
|
||||
GetRsvpResponse,
|
||||
GetRsvpError,
|
||||
UpdateRsvpData,
|
||||
UpdateRsvpResponse,
|
||||
UpdateRsvpError,
|
||||
UpdateRsvpStatusData,
|
||||
UpdateRsvpStatusResponse,
|
||||
UpdateRsvpStatusError,
|
||||
CreateEventData,
|
||||
CreateEventResponse,
|
||||
CreateEventError,
|
||||
@@ -366,6 +402,223 @@ export const updateEventTheme = <ThrowOnError extends boolean = false>(
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Read Guests
|
||||
*/
|
||||
export const getGuests = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<GetGuestsData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? _heyApiClient).get<
|
||||
GetGuestsResponse,
|
||||
GetGuestsError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/guests/",
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Create Guest
|
||||
*/
|
||||
export const createGuest = <ThrowOnError extends boolean = false>(
|
||||
options: Options<CreateGuestData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).post<
|
||||
CreateGuestResponse,
|
||||
CreateGuestError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/guests/",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete Guest
|
||||
*/
|
||||
export const deleteGuest = <ThrowOnError extends boolean = false>(
|
||||
options: Options<DeleteGuestData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).delete<
|
||||
DeleteGuestResponse,
|
||||
DeleteGuestError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/guests/{guest_id}",
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Read Guest
|
||||
*/
|
||||
export const getGuest = <ThrowOnError extends boolean = false>(
|
||||
options: Options<GetGuestData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).get<
|
||||
GetGuestResponse,
|
||||
GetGuestError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/guests/{guest_id}",
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Update Guest
|
||||
*/
|
||||
export const updateGuest = <ThrowOnError extends boolean = false>(
|
||||
options: Options<UpdateGuestData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).put<
|
||||
UpdateGuestResponse,
|
||||
UpdateGuestError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/guests/{guest_id}",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Set Guest Status
|
||||
*/
|
||||
export const setGuestStatusApiV1EventsGuestsGuestIdStatusPatch = <
|
||||
ThrowOnError extends boolean = false,
|
||||
>(
|
||||
options: Options<
|
||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchData,
|
||||
ThrowOnError
|
||||
>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).patch<
|
||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchResponse,
|
||||
SetGuestStatusApiV1EventsGuestsGuestIdStatusPatchError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/guests/{guest_id}/status",
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Read Rsvps
|
||||
*/
|
||||
export const getRsvps = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<GetRsvpsData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? _heyApiClient).get<
|
||||
GetRsvpsResponse,
|
||||
GetRsvpsError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/rsvps/",
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Create Rsvp
|
||||
*/
|
||||
export const createRsvp = <ThrowOnError extends boolean = false>(
|
||||
options: Options<CreateRsvpData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).post<
|
||||
CreateRsvpResponse,
|
||||
CreateRsvpError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/rsvps/",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete Rsvp
|
||||
*/
|
||||
export const deleteRsvp = <ThrowOnError extends boolean = false>(
|
||||
options: Options<DeleteRsvpData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).delete<
|
||||
DeleteRsvpResponse,
|
||||
DeleteRsvpError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/rsvps/{rsvp_id}",
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Read Rsvp
|
||||
*/
|
||||
export const getRsvp = <ThrowOnError extends boolean = false>(
|
||||
options: Options<GetRsvpData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).get<
|
||||
GetRsvpResponse,
|
||||
GetRsvpError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/rsvps/{rsvp_id}",
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Update Rsvp
|
||||
*/
|
||||
export const updateRsvp = <ThrowOnError extends boolean = false>(
|
||||
options: Options<UpdateRsvpData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).put<
|
||||
UpdateRsvpResponse,
|
||||
UpdateRsvpError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/rsvps/{rsvp_id}",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Update Rsvp Status
|
||||
*/
|
||||
export const updateRsvpStatus = <ThrowOnError extends boolean = false>(
|
||||
options: Options<UpdateRsvpStatusData, ThrowOnError>,
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).patch<
|
||||
UpdateRsvpStatusResponse,
|
||||
UpdateRsvpStatusError,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/api/v1/events/rsvps/{rsvp_id}/status",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Create Event
|
||||
* Create a new event.
|
||||
|
||||
Reference in New Issue
Block a user