Add schemas and types for events and event themes

This commit introduces detailed schemas and types for events and event themes, including creation, update, and response objects. It also adds support for paginated event responses and newly defined API endpoints such as creating, updating, and fetching event themes and events. These additions enhance the schema structure and improve type safety for event-related operations.
This commit is contained in:
2025-03-11 06:18:56 +01:00
parent 79733d5bec
commit 114f0e7807
4 changed files with 1988 additions and 0 deletions

View File

@@ -9,6 +9,18 @@ import {
refreshToken,
changePassword,
getCurrentUserInfo,
listEventThemes,
createEventTheme,
getEventTheme,
updateEventTheme,
createEvent,
getUserEvents,
getUpcomingEvents,
getPublicEvents,
deleteEvent,
getEvent,
updateEvent,
getEventBySlug,
} from "../sdk.gen";
import { queryOptions, type UseMutationOptions } from "@tanstack/react-query";
import type {
@@ -28,6 +40,28 @@ import type {
ChangePasswordData,
ChangePasswordError,
GetCurrentUserInfoData,
ListEventThemesData,
CreateEventThemeData,
CreateEventThemeError,
CreateEventThemeResponse,
GetEventThemeData,
UpdateEventThemeData,
UpdateEventThemeError,
UpdateEventThemeResponse,
CreateEventData,
CreateEventError,
CreateEventResponse,
GetUserEventsData,
GetUpcomingEventsData,
GetPublicEventsData,
DeleteEventData,
DeleteEventError,
DeleteEventResponse,
GetEventData,
UpdateEventData,
UpdateEventError,
UpdateEventResponse,
GetEventBySlugData,
} from "../types.gen";
import type { AxiosError } from "axios";
import { client as _heyApiClient } from "../client.gen";
@@ -290,3 +324,277 @@ export const getCurrentUserInfoOptions = (
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 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 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),
});
};

View File

@@ -71,6 +71,872 @@ export const Body_login_oauthSchema = {
title: "Body_login_oauth",
} as const;
export const EventCreateSchema = {
properties: {
title: {
type: "string",
maxLength: 200,
minLength: 1,
title: "Title",
},
description: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Description",
},
location_name: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Location Name",
},
location_address: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Location Address",
},
location_url: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Location Url",
},
event_date: {
type: "string",
format: "date-time",
title: "Event Date",
},
event_start_time: {
anyOf: [
{
type: "string",
format: "time",
},
{
type: "null",
},
],
title: "Event Start Time",
},
event_end_time: {
anyOf: [
{
type: "string",
format: "time",
},
{
type: "null",
},
],
title: "Event End Time",
},
timezone: {
type: "string",
title: "Timezone",
},
rsvp_deadline: {
anyOf: [
{
type: "string",
format: "date-time",
},
{
type: "null",
},
],
title: "Rsvp Deadline",
},
is_public: {
type: "boolean",
title: "Is Public",
default: false,
},
access_code: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Access Code",
},
theme_id: {
anyOf: [
{
type: "string",
format: "uuid",
},
{
type: "null",
},
],
title: "Theme Id",
},
custom_theme_settings: {
anyOf: [
{
type: "object",
},
{
type: "null",
},
],
title: "Custom Theme Settings",
},
additional_info: {
anyOf: [
{
type: "object",
},
{
type: "null",
},
],
title: "Additional Info",
},
is_active: {
type: "boolean",
title: "Is Active",
default: true,
},
rsvp_enabled: {
type: "boolean",
title: "Rsvp Enabled",
default: true,
},
gift_registry_enabled: {
type: "boolean",
title: "Gift Registry Enabled",
default: true,
},
updates_enabled: {
type: "boolean",
title: "Updates Enabled",
default: true,
},
max_guests_per_invitation: {
anyOf: [
{
type: "integer",
minimum: 1,
},
{
type: "null",
},
],
title: "Max Guests Per Invitation",
},
contact_email: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Contact Email",
},
contact_phone: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Contact Phone",
},
slug: {
type: "string",
minLength: 1,
pattern: "^[a-z0-9-]+$",
title: "Slug",
},
},
type: "object",
required: ["title", "event_date", "timezone", "slug"],
title: "EventCreate",
} as const;
export const EventResponseSchema = {
properties: {
title: {
type: "string",
maxLength: 200,
minLength: 1,
title: "Title",
},
description: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Description",
},
location_name: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Location Name",
},
location_address: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Location Address",
},
location_url: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Location Url",
},
event_date: {
type: "string",
format: "date-time",
title: "Event Date",
},
event_start_time: {
anyOf: [
{
type: "string",
format: "time",
},
{
type: "null",
},
],
title: "Event Start Time",
},
event_end_time: {
anyOf: [
{
type: "string",
format: "time",
},
{
type: "null",
},
],
title: "Event End Time",
},
timezone: {
type: "string",
title: "Timezone",
},
rsvp_deadline: {
anyOf: [
{
type: "string",
format: "date-time",
},
{
type: "null",
},
],
title: "Rsvp Deadline",
},
is_public: {
type: "boolean",
title: "Is Public",
default: false,
},
access_code: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Access Code",
},
theme_id: {
anyOf: [
{
type: "string",
format: "uuid",
},
{
type: "null",
},
],
title: "Theme Id",
},
custom_theme_settings: {
anyOf: [
{
type: "object",
},
{
type: "null",
},
],
title: "Custom Theme Settings",
},
additional_info: {
anyOf: [
{
type: "object",
},
{
type: "null",
},
],
title: "Additional Info",
},
is_active: {
type: "boolean",
title: "Is Active",
default: true,
},
rsvp_enabled: {
type: "boolean",
title: "Rsvp Enabled",
default: true,
},
gift_registry_enabled: {
type: "boolean",
title: "Gift Registry Enabled",
default: true,
},
updates_enabled: {
type: "boolean",
title: "Updates Enabled",
default: true,
},
max_guests_per_invitation: {
anyOf: [
{
type: "integer",
minimum: 1,
},
{
type: "null",
},
],
title: "Max Guests Per Invitation",
},
contact_email: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Contact Email",
},
contact_phone: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Contact Phone",
},
id: {
type: "string",
format: "uuid",
title: "Id",
},
created_by: {
type: "string",
format: "uuid",
title: "Created By",
},
created_at: {
type: "string",
format: "date-time",
title: "Created At",
},
updated_at: {
type: "string",
format: "date-time",
title: "Updated At",
},
slug: {
type: "string",
title: "Slug",
},
},
type: "object",
required: [
"title",
"event_date",
"timezone",
"id",
"created_by",
"created_at",
"updated_at",
"slug",
],
title: "EventResponse",
} as const;
export const EventThemeCreateSchema = {
properties: {
name: {
type: "string",
minLength: 1,
title: "Name",
},
description: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Description",
},
preview_image_url: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Preview Image Url",
},
color_palette: {
additionalProperties: {
type: "string",
},
type: "object",
minProperties: 1,
title: "Color Palette",
},
fonts: {
additionalProperties: {
type: "string",
},
type: "object",
minProperties: 1,
title: "Fonts",
},
},
type: "object",
required: ["name", "color_palette", "fonts"],
title: "EventThemeCreate",
} as const;
export const EventThemeResponseSchema = {
properties: {
name: {
type: "string",
minLength: 1,
title: "Name",
},
description: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Description",
},
preview_image_url: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Preview Image Url",
},
color_palette: {
additionalProperties: {
type: "string",
},
type: "object",
minProperties: 1,
title: "Color Palette",
},
fonts: {
additionalProperties: {
type: "string",
},
type: "object",
minProperties: 1,
title: "Fonts",
},
id: {
type: "string",
format: "uuid",
title: "Id",
},
},
type: "object",
required: ["name", "color_palette", "fonts", "id"],
title: "EventThemeResponse",
} as const;
export const EventThemeUpdateSchema = {
properties: {
name: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Name",
},
description: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Description",
},
preview_image_url: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Preview Image Url",
},
color_palette: {
anyOf: [
{
additionalProperties: {
type: "string",
},
type: "object",
},
{
type: "null",
},
],
title: "Color Palette",
},
fonts: {
anyOf: [
{
additionalProperties: {
type: "string",
},
type: "object",
},
{
type: "null",
},
],
title: "Fonts",
},
},
type: "object",
title: "EventThemeUpdate",
} as const;
export const EventUpdateSchema = {
properties: {
title: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Title",
},
description: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Description",
},
location_name: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Location Name",
},
location_address: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Location Address",
},
location_url: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Location Url",
},
event_date: {
anyOf: [
{
type: "string",
format: "date-time",
},
{
type: "null",
},
],
title: "Event Date",
},
event_start_time: {
anyOf: [
{
type: "string",
format: "time",
},
{
type: "null",
},
],
title: "Event Start Time",
},
event_end_time: {
anyOf: [
{
type: "string",
format: "time",
},
{
type: "null",
},
],
title: "Event End Time",
},
timezone: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Timezone",
},
rsvp_deadline: {
anyOf: [
{
type: "string",
format: "date-time",
},
{
type: "null",
},
],
title: "Rsvp Deadline",
},
is_public: {
type: "boolean",
title: "Is Public",
default: false,
},
access_code: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Access Code",
},
theme_id: {
anyOf: [
{
type: "string",
format: "uuid",
},
{
type: "null",
},
],
title: "Theme Id",
},
custom_theme_settings: {
anyOf: [
{
type: "object",
},
{
type: "null",
},
],
title: "Custom Theme Settings",
},
additional_info: {
anyOf: [
{
type: "object",
},
{
type: "null",
},
],
title: "Additional Info",
},
is_active: {
type: "boolean",
title: "Is Active",
default: true,
},
rsvp_enabled: {
type: "boolean",
title: "Rsvp Enabled",
default: true,
},
gift_registry_enabled: {
type: "boolean",
title: "Gift Registry Enabled",
default: true,
},
updates_enabled: {
type: "boolean",
title: "Updates Enabled",
default: true,
},
max_guests_per_invitation: {
anyOf: [
{
type: "integer",
minimum: 1,
},
{
type: "null",
},
],
title: "Max Guests Per Invitation",
},
contact_email: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Contact Email",
},
contact_phone: {
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Contact Phone",
},
slug: {
anyOf: [
{
type: "string",
minLength: 1,
pattern: "^[a-z0-9-]+$",
},
{
type: "null",
},
],
title: "Slug",
},
},
type: "object",
title: "EventUpdate",
} as const;
export const HTTPValidationErrorSchema = {
properties: {
detail: {
@@ -102,6 +968,33 @@ export const LoginRequestSchema = {
title: "LoginRequest",
} as const;
export const PaginatedResponse_EventResponse_Schema = {
properties: {
total: {
type: "integer",
title: "Total",
},
items: {
items: {
$ref: "#/components/schemas/EventResponse",
},
type: "array",
title: "Items",
},
page: {
type: "integer",
title: "Page",
},
size: {
type: "integer",
title: "Size",
},
},
type: "object",
required: ["total", "items", "page", "size"],
title: "PaginatedResponse[EventResponse]",
} as const;
export const RefreshTokenRequestSchema = {
properties: {
refresh_token: {

View File

@@ -25,6 +25,42 @@ import type {
ChangePasswordError,
GetCurrentUserInfoData,
GetCurrentUserInfoResponse,
ListEventThemesData,
ListEventThemesResponse,
ListEventThemesError,
CreateEventThemeData,
CreateEventThemeResponse,
CreateEventThemeError,
GetEventThemeData,
GetEventThemeResponse,
GetEventThemeError,
UpdateEventThemeData,
UpdateEventThemeResponse,
UpdateEventThemeError,
CreateEventData,
CreateEventResponse,
CreateEventError,
GetUserEventsData,
GetUserEventsResponse,
GetUserEventsError,
GetUpcomingEventsData,
GetUpcomingEventsResponse,
GetUpcomingEventsError,
GetPublicEventsData,
GetPublicEventsResponse,
GetPublicEventsError,
DeleteEventData,
DeleteEventResponse,
DeleteEventError,
GetEventData,
GetEventResponse,
GetEventError,
UpdateEventData,
UpdateEventResponse,
UpdateEventError,
GetEventBySlugData,
GetEventBySlugResponse,
GetEventBySlugError,
} from "./types.gen";
import { client as _heyApiClient } from "./client.gen";
@@ -212,3 +248,265 @@ export const getCurrentUserInfo = <ThrowOnError extends boolean = false>(
...options,
});
};
/**
* List Themes
* List event themes.
*/
export const listEventThemes = <ThrowOnError extends boolean = false>(
options?: Options<ListEventThemesData, ThrowOnError>,
) => {
return (options?.client ?? _heyApiClient).get<
ListEventThemesResponse,
ListEventThemesError,
ThrowOnError
>({
url: "/api/v1/event_themes/",
...options,
});
};
/**
* Create Theme
* Create new event theme.
*/
export const createEventTheme = <ThrowOnError extends boolean = false>(
options: Options<CreateEventThemeData, ThrowOnError>,
) => {
return (options.client ?? _heyApiClient).post<
CreateEventThemeResponse,
CreateEventThemeError,
ThrowOnError
>({
url: "/api/v1/event_themes/",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers,
},
});
};
/**
* Get Theme
* Get specific theme by ID.
*/
export const getEventTheme = <ThrowOnError extends boolean = false>(
options: Options<GetEventThemeData, ThrowOnError>,
) => {
return (options.client ?? _heyApiClient).get<
GetEventThemeResponse,
GetEventThemeError,
ThrowOnError
>({
url: "/api/v1/event_themes/{theme_id}",
...options,
});
};
/**
* Update Theme
* Update specific theme by ID.
*/
export const updateEventTheme = <ThrowOnError extends boolean = false>(
options: Options<UpdateEventThemeData, ThrowOnError>,
) => {
return (options.client ?? _heyApiClient).patch<
UpdateEventThemeResponse,
UpdateEventThemeError,
ThrowOnError
>({
url: "/api/v1/event_themes/{theme_id}",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers,
},
});
};
/**
* Create Event
* Create a new event.
*/
export const createEvent = <ThrowOnError extends boolean = false>(
options: Options<CreateEventData, ThrowOnError>,
) => {
return (options.client ?? _heyApiClient).post<
CreateEventResponse,
CreateEventError,
ThrowOnError
>({
security: [
{
scheme: "bearer",
type: "http",
},
],
url: "/api/v1/events/",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers,
},
});
};
/**
* Get User Events
* Get all events created by the current user with pagination.
*/
export const getUserEvents = <ThrowOnError extends boolean = false>(
options?: Options<GetUserEventsData, ThrowOnError>,
) => {
return (options?.client ?? _heyApiClient).get<
GetUserEventsResponse,
GetUserEventsError,
ThrowOnError
>({
security: [
{
scheme: "bearer",
type: "http",
},
],
url: "/api/v1/events/me",
...options,
});
};
/**
* Get Upcoming Events
* Get upcoming public events with pagination.
*/
export const getUpcomingEvents = <ThrowOnError extends boolean = false>(
options?: Options<GetUpcomingEventsData, ThrowOnError>,
) => {
return (options?.client ?? _heyApiClient).get<
GetUpcomingEventsResponse,
GetUpcomingEventsError,
ThrowOnError
>({
security: [
{
scheme: "bearer",
type: "http",
},
],
url: "/api/v1/events/upcoming",
...options,
});
};
/**
* Get Public Events
* Get all public events with pagination.
*/
export const getPublicEvents = <ThrowOnError extends boolean = false>(
options?: Options<GetPublicEventsData, ThrowOnError>,
) => {
return (options?.client ?? _heyApiClient).get<
GetPublicEventsResponse,
GetPublicEventsError,
ThrowOnError
>({
url: "/api/v1/events/public",
...options,
});
};
/**
* Delete Event
* Delete event (soft delete by default).
*/
export const deleteEvent = <ThrowOnError extends boolean = false>(
options: Options<DeleteEventData, ThrowOnError>,
) => {
return (options.client ?? _heyApiClient).delete<
DeleteEventResponse,
DeleteEventError,
ThrowOnError
>({
security: [
{
scheme: "bearer",
type: "http",
},
],
url: "/api/v1/events/{event_id}",
...options,
});
};
/**
* Get Event
* Get event by ID.
*/
export const getEvent = <ThrowOnError extends boolean = false>(
options: Options<GetEventData, ThrowOnError>,
) => {
return (options.client ?? _heyApiClient).get<
GetEventResponse,
GetEventError,
ThrowOnError
>({
security: [
{
scheme: "bearer",
type: "http",
},
],
url: "/api/v1/events/{event_id}",
...options,
});
};
/**
* Update Event
* Update event.
*/
export const updateEvent = <ThrowOnError extends boolean = false>(
options: Options<UpdateEventData, ThrowOnError>,
) => {
return (options.client ?? _heyApiClient).put<
UpdateEventResponse,
UpdateEventError,
ThrowOnError
>({
security: [
{
scheme: "bearer",
type: "http",
},
],
url: "/api/v1/events/{event_id}",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers,
},
});
};
/**
* Get Event By Slug
* Get event by slug.
*/
export const getEventBySlug = <ThrowOnError extends boolean = false>(
options: Options<GetEventBySlugData, ThrowOnError>,
) => {
return (options.client ?? _heyApiClient).get<
GetEventBySlugResponse,
GetEventBySlugError,
ThrowOnError
>({
security: [
{
scheme: "bearer",
type: "http",
},
],
url: "/api/v1/events/by-slug/{slug}",
...options,
});
};

View File

@@ -14,6 +14,137 @@ export type BodyLoginOauth = {
client_secret?: string | null;
};
export type EventCreate = {
title: string;
description?: string | null;
location_name?: string | null;
location_address?: string | null;
location_url?: string | null;
event_date: string;
event_start_time?: string | null;
event_end_time?: string | null;
timezone: string;
rsvp_deadline?: string | null;
is_public?: boolean;
access_code?: string | null;
theme_id?: string | null;
custom_theme_settings?: {
[key: string]: unknown;
} | null;
additional_info?: {
[key: string]: unknown;
} | null;
is_active?: boolean;
rsvp_enabled?: boolean;
gift_registry_enabled?: boolean;
updates_enabled?: boolean;
max_guests_per_invitation?: number | null;
contact_email?: string | null;
contact_phone?: string | null;
slug: string;
};
export type EventResponse = {
title: string;
description?: string | null;
location_name?: string | null;
location_address?: string | null;
location_url?: string | null;
event_date: string;
event_start_time?: string | null;
event_end_time?: string | null;
timezone: string;
rsvp_deadline?: string | null;
is_public?: boolean;
access_code?: string | null;
theme_id?: string | null;
custom_theme_settings?: {
[key: string]: unknown;
} | null;
additional_info?: {
[key: string]: unknown;
} | null;
is_active?: boolean;
rsvp_enabled?: boolean;
gift_registry_enabled?: boolean;
updates_enabled?: boolean;
max_guests_per_invitation?: number | null;
contact_email?: string | null;
contact_phone?: string | null;
id: string;
created_by: string;
created_at: string;
updated_at: string;
slug: string;
};
export type EventThemeCreate = {
name: string;
description?: string | null;
preview_image_url?: string | null;
color_palette: {
[key: string]: string;
};
fonts: {
[key: string]: string;
};
};
export type EventThemeResponse = {
name: string;
description?: string | null;
preview_image_url?: string | null;
color_palette: {
[key: string]: string;
};
fonts: {
[key: string]: string;
};
id: string;
};
export type EventThemeUpdate = {
name?: string | null;
description?: string | null;
preview_image_url?: string | null;
color_palette?: {
[key: string]: string;
} | null;
fonts?: {
[key: string]: string;
} | null;
};
export type EventUpdate = {
title?: string | null;
description?: string | null;
location_name?: string | null;
location_address?: string | null;
location_url?: string | null;
event_date?: string | null;
event_start_time?: string | null;
event_end_time?: string | null;
timezone?: string | null;
rsvp_deadline?: string | null;
is_public?: boolean;
access_code?: string | null;
theme_id?: string | null;
custom_theme_settings?: {
[key: string]: unknown;
} | null;
additional_info?: {
[key: string]: unknown;
} | null;
is_active?: boolean;
rsvp_enabled?: boolean;
gift_registry_enabled?: boolean;
updates_enabled?: boolean;
max_guests_per_invitation?: number | null;
contact_email?: string | null;
contact_phone?: string | null;
slug?: string | null;
};
export type HttpValidationError = {
detail?: Array<ValidationError>;
};
@@ -23,6 +154,13 @@ export type LoginRequest = {
password: string;
};
export type PaginatedResponseEventResponse = {
total: number;
items: Array<EventResponse>;
page: number;
size: number;
};
export type RefreshTokenRequest = {
refresh_token: string;
};
@@ -218,6 +356,357 @@ export type GetCurrentUserInfoResponses = {
export type GetCurrentUserInfoResponse =
GetCurrentUserInfoResponses[keyof GetCurrentUserInfoResponses];
export type ListEventThemesData = {
body?: never;
path?: never;
query?: {
skip?: number;
limit?: number;
};
url: "/api/v1/event_themes/";
};
export type ListEventThemesErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type ListEventThemesError =
ListEventThemesErrors[keyof ListEventThemesErrors];
export type ListEventThemesResponses = {
/**
* Successful Response
*/
200: Array<EventThemeResponse>;
};
export type ListEventThemesResponse =
ListEventThemesResponses[keyof ListEventThemesResponses];
export type CreateEventThemeData = {
body: EventThemeCreate;
path?: never;
query?: never;
url: "/api/v1/event_themes/";
};
export type CreateEventThemeErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type CreateEventThemeError =
CreateEventThemeErrors[keyof CreateEventThemeErrors];
export type CreateEventThemeResponses = {
/**
* Successful Response
*/
200: EventThemeResponse;
};
export type CreateEventThemeResponse =
CreateEventThemeResponses[keyof CreateEventThemeResponses];
export type GetEventThemeData = {
body?: never;
path: {
theme_id: string;
};
query?: never;
url: "/api/v1/event_themes/{theme_id}";
};
export type GetEventThemeErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type GetEventThemeError = GetEventThemeErrors[keyof GetEventThemeErrors];
export type GetEventThemeResponses = {
/**
* Successful Response
*/
200: EventThemeResponse;
};
export type GetEventThemeResponse =
GetEventThemeResponses[keyof GetEventThemeResponses];
export type UpdateEventThemeData = {
body: EventThemeUpdate;
path: {
theme_id: string;
};
query?: never;
url: "/api/v1/event_themes/{theme_id}";
};
export type UpdateEventThemeErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type UpdateEventThemeError =
UpdateEventThemeErrors[keyof UpdateEventThemeErrors];
export type UpdateEventThemeResponses = {
/**
* Successful Response
*/
200: EventThemeResponse;
};
export type UpdateEventThemeResponse =
UpdateEventThemeResponses[keyof UpdateEventThemeResponses];
export type CreateEventData = {
body: EventCreate;
path?: never;
query?: never;
url: "/api/v1/events/";
};
export type CreateEventErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type CreateEventError = CreateEventErrors[keyof CreateEventErrors];
export type CreateEventResponses = {
/**
* Successful Response
*/
201: EventResponse;
};
export type CreateEventResponse =
CreateEventResponses[keyof CreateEventResponses];
export type GetUserEventsData = {
body?: never;
path?: never;
query?: {
skip?: number;
limit?: number;
include_inactive?: boolean;
};
url: "/api/v1/events/me";
};
export type GetUserEventsErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type GetUserEventsError = GetUserEventsErrors[keyof GetUserEventsErrors];
export type GetUserEventsResponses = {
/**
* Successful Response
*/
200: PaginatedResponseEventResponse;
};
export type GetUserEventsResponse =
GetUserEventsResponses[keyof GetUserEventsResponses];
export type GetUpcomingEventsData = {
body?: never;
path?: never;
query?: {
skip?: number;
limit?: number;
};
url: "/api/v1/events/upcoming";
};
export type GetUpcomingEventsErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type GetUpcomingEventsError =
GetUpcomingEventsErrors[keyof GetUpcomingEventsErrors];
export type GetUpcomingEventsResponses = {
/**
* Successful Response
*/
200: PaginatedResponseEventResponse;
};
export type GetUpcomingEventsResponse =
GetUpcomingEventsResponses[keyof GetUpcomingEventsResponses];
export type GetPublicEventsData = {
body?: never;
path?: never;
query?: {
skip?: number;
limit?: number;
};
url: "/api/v1/events/public";
};
export type GetPublicEventsErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type GetPublicEventsError =
GetPublicEventsErrors[keyof GetPublicEventsErrors];
export type GetPublicEventsResponses = {
/**
* Successful Response
*/
200: PaginatedResponseEventResponse;
};
export type GetPublicEventsResponse =
GetPublicEventsResponses[keyof GetPublicEventsResponses];
export type DeleteEventData = {
body?: never;
path: {
event_id: string;
};
query?: {
/**
* Perform hard delete instead of soft delete
*/
hard_delete?: boolean;
};
url: "/api/v1/events/{event_id}";
};
export type DeleteEventErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type DeleteEventError = DeleteEventErrors[keyof DeleteEventErrors];
export type DeleteEventResponses = {
/**
* Successful Response
*/
204: void;
};
export type DeleteEventResponse =
DeleteEventResponses[keyof DeleteEventResponses];
export type GetEventData = {
body?: never;
path: {
event_id: string;
};
query?: {
access_code?: string | null;
};
url: "/api/v1/events/{event_id}";
};
export type GetEventErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type GetEventError = GetEventErrors[keyof GetEventErrors];
export type GetEventResponses = {
/**
* Successful Response
*/
200: EventResponse;
};
export type GetEventResponse = GetEventResponses[keyof GetEventResponses];
export type UpdateEventData = {
body: EventUpdate;
path: {
event_id: string;
};
query?: never;
url: "/api/v1/events/{event_id}";
};
export type UpdateEventErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type UpdateEventError = UpdateEventErrors[keyof UpdateEventErrors];
export type UpdateEventResponses = {
/**
* Successful Response
*/
200: EventResponse;
};
export type UpdateEventResponse =
UpdateEventResponses[keyof UpdateEventResponses];
export type GetEventBySlugData = {
body?: never;
path: {
slug: string;
};
query?: {
access_code?: string | null;
};
url: "/api/v1/events/by-slug/{slug}";
};
export type GetEventBySlugErrors = {
/**
* Validation Error
*/
422: HttpValidationError;
};
export type GetEventBySlugError =
GetEventBySlugErrors[keyof GetEventBySlugErrors];
export type GetEventBySlugResponses = {
/**
* Successful Response
*/
200: EventResponse;
};
export type GetEventBySlugResponse =
GetEventBySlugResponses[keyof GetEventBySlugResponses];
export type ClientOptions = {
baseURL: "http://localhost:8000" | (string & {});
};