880 lines
18 KiB
TypeScript
880 lines
18 KiB
TypeScript
// This file is auto-generated by @hey-api/openapi-ts
|
|
|
|
import {
|
|
type Options as ClientOptions,
|
|
type TDataShape,
|
|
type Client,
|
|
urlSearchParamsBodySerializer,
|
|
formDataBodySerializer,
|
|
} from "@hey-api/client-axios";
|
|
import type {
|
|
RootGetData,
|
|
RootGetResponse,
|
|
RegisterData,
|
|
RegisterResponse,
|
|
RegisterError,
|
|
LoginData,
|
|
LoginResponse,
|
|
LoginError,
|
|
LoginOauthData,
|
|
LoginOauthResponse,
|
|
LoginOauthError,
|
|
RefreshTokenData,
|
|
RefreshTokenResponse,
|
|
RefreshTokenError,
|
|
ChangePasswordData,
|
|
ChangePasswordError,
|
|
GetCurrentUserInfoData,
|
|
GetCurrentUserInfoResponse,
|
|
ListEventThemesData,
|
|
ListEventThemesResponse,
|
|
ListEventThemesError,
|
|
CreateEventThemeData,
|
|
CreateEventThemeResponse,
|
|
CreateEventThemeError,
|
|
DeleteEventThemeData,
|
|
DeleteEventThemeError,
|
|
GetEventThemeData,
|
|
GetEventThemeResponse,
|
|
GetEventThemeError,
|
|
UpdateEventThemeData,
|
|
UpdateEventThemeResponse,
|
|
UpdateEventThemeError,
|
|
GetGuestsData,
|
|
GetGuestsResponse,
|
|
GetGuestsError,
|
|
CreateGuestData,
|
|
CreateGuestResponse,
|
|
CreateGuestError,
|
|
DeleteGuestData,
|
|
DeleteGuestResponse,
|
|
DeleteGuestError,
|
|
GetGuestData,
|
|
GetGuestResponse,
|
|
GetGuestError,
|
|
UpdateGuestData,
|
|
UpdateGuestResponse,
|
|
UpdateGuestError,
|
|
SetGuestStatusData,
|
|
SetGuestStatusResponse,
|
|
SetGuestStatusError,
|
|
CreateGuestRsvpData,
|
|
CreateGuestRsvpResponse,
|
|
CreateGuestRsvpError,
|
|
GetRsvpsData,
|
|
GetRsvpsResponse,
|
|
GetRsvpsError,
|
|
CreateRsvpData,
|
|
CreateRsvpResponse,
|
|
CreateRsvpError,
|
|
DeleteRsvpData,
|
|
DeleteRsvpResponse,
|
|
DeleteRsvpError,
|
|
GetRsvpData,
|
|
GetRsvpResponse,
|
|
GetRsvpError,
|
|
UpdateRsvpData,
|
|
UpdateRsvpResponse,
|
|
UpdateRsvpError,
|
|
UpdateRsvpStatusData,
|
|
UpdateRsvpStatusResponse,
|
|
UpdateRsvpStatusError,
|
|
CreateEventData,
|
|
CreateEventResponse,
|
|
CreateEventError,
|
|
GetUserEventsData,
|
|
GetUserEventsResponse,
|
|
GetUserEventsError,
|
|
GetUpcomingEventsData,
|
|
GetUpcomingEventsResponse,
|
|
GetUpcomingEventsError,
|
|
GetPublicEventsData,
|
|
GetPublicEventsResponse,
|
|
GetPublicEventsError,
|
|
DeleteEventData,
|
|
DeleteEventResponse,
|
|
DeleteEventError,
|
|
GetEventData,
|
|
GetEventResponse,
|
|
GetEventError,
|
|
UpdateEventData,
|
|
UpdateEventResponse,
|
|
UpdateEventError,
|
|
GetEventBySlugData,
|
|
GetEventBySlugResponse,
|
|
GetEventBySlugError,
|
|
GeneratePresignedUrlData,
|
|
GeneratePresignedUrlResponse,
|
|
GeneratePresignedUrlError,
|
|
UploadFileData,
|
|
UploadFileError,
|
|
} from "./types.gen";
|
|
import { client as _heyApiClient } from "./client.gen";
|
|
|
|
export type Options<
|
|
TData extends TDataShape = TDataShape,
|
|
ThrowOnError extends boolean = boolean,
|
|
> = ClientOptions<TData, ThrowOnError> & {
|
|
/**
|
|
* You can provide a client instance returned by `createClient()` instead of
|
|
* individual options. This might be also useful if you want to implement a
|
|
* custom client.
|
|
*/
|
|
client?: Client;
|
|
/**
|
|
* You can pass arbitrary values through the `meta` object. This can be
|
|
* used to access values that aren't defined as part of the SDK function.
|
|
*/
|
|
meta?: Record<string, unknown>;
|
|
};
|
|
|
|
/**
|
|
* Root
|
|
*/
|
|
export const rootGet = <ThrowOnError extends boolean = false>(
|
|
options?: Options<RootGetData, ThrowOnError>,
|
|
) => {
|
|
return (options?.client ?? _heyApiClient).get<
|
|
RootGetResponse,
|
|
unknown,
|
|
ThrowOnError
|
|
>({
|
|
responseType: "text",
|
|
url: "/",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Register User
|
|
* Register a new user.
|
|
*
|
|
* Returns:
|
|
* The created user information.
|
|
*/
|
|
export const register = <ThrowOnError extends boolean = false>(
|
|
options: Options<RegisterData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
RegisterResponse,
|
|
RegisterError,
|
|
ThrowOnError
|
|
>({
|
|
url: "/api/v1/auth/register",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Login
|
|
* Login with username and password.
|
|
*
|
|
* Returns:
|
|
* Access and refresh tokens.
|
|
*/
|
|
export const login = <ThrowOnError extends boolean = false>(
|
|
options: Options<LoginData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
LoginResponse,
|
|
LoginError,
|
|
ThrowOnError
|
|
>({
|
|
url: "/api/v1/auth/login",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Login Oauth
|
|
* OAuth2-compatible login endpoint, used by the OpenAPI UI.
|
|
*
|
|
* Returns:
|
|
* Access and refresh tokens.
|
|
*/
|
|
export const loginOauth = <ThrowOnError extends boolean = false>(
|
|
options: Options<LoginOauthData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
LoginOauthResponse,
|
|
LoginOauthError,
|
|
ThrowOnError
|
|
>({
|
|
...urlSearchParamsBodySerializer,
|
|
url: "/api/v1/auth/login/oauth",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Refresh Token
|
|
* Refresh access token using a refresh token.
|
|
*
|
|
* Returns:
|
|
* New access and refresh tokens.
|
|
*/
|
|
export const refreshToken = <ThrowOnError extends boolean = false>(
|
|
options: Options<RefreshTokenData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
RefreshTokenResponse,
|
|
RefreshTokenError,
|
|
ThrowOnError
|
|
>({
|
|
url: "/api/v1/auth/refresh",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Change Password
|
|
* Change current user's password.
|
|
*
|
|
* Requires authentication.
|
|
*/
|
|
export const changePassword = <ThrowOnError extends boolean = false>(
|
|
options: Options<ChangePasswordData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
unknown,
|
|
ChangePasswordError,
|
|
ThrowOnError
|
|
>({
|
|
security: [
|
|
{
|
|
scheme: "bearer",
|
|
type: "http",
|
|
},
|
|
],
|
|
url: "/api/v1/auth/change-password",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Get Current User Info
|
|
* Get current user information.
|
|
*
|
|
* Requires authentication.
|
|
*/
|
|
export const getCurrentUserInfo = <ThrowOnError extends boolean = false>(
|
|
options?: Options<GetCurrentUserInfoData, ThrowOnError>,
|
|
) => {
|
|
return (options?.client ?? _heyApiClient).get<
|
|
GetCurrentUserInfoResponse,
|
|
unknown,
|
|
ThrowOnError
|
|
>({
|
|
security: [
|
|
{
|
|
scheme: "bearer",
|
|
type: "http",
|
|
},
|
|
],
|
|
url: "/api/v1/auth/me",
|
|
...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
|
|
*/
|
|
export const createEventTheme = <ThrowOnError extends boolean = false>(
|
|
options: Options<CreateEventThemeData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
CreateEventThemeResponse,
|
|
CreateEventThemeError,
|
|
ThrowOnError
|
|
>({
|
|
security: [
|
|
{
|
|
scheme: "bearer",
|
|
type: "http",
|
|
},
|
|
],
|
|
url: "/api/v1/event_themes/",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Delete Theme
|
|
* Delete specific theme by ID.
|
|
*/
|
|
export const deleteEventTheme = <ThrowOnError extends boolean = false>(
|
|
options: Options<DeleteEventThemeData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).delete<
|
|
unknown,
|
|
DeleteEventThemeError,
|
|
ThrowOnError
|
|
>({
|
|
security: [
|
|
{
|
|
scheme: "bearer",
|
|
type: "http",
|
|
},
|
|
],
|
|
url: "/api/v1/event_themes/{theme_id}",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
export const updateEventTheme = <ThrowOnError extends boolean = false>(
|
|
options: Options<UpdateEventThemeData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).patch<
|
|
UpdateEventThemeResponse,
|
|
UpdateEventThemeError,
|
|
ThrowOnError
|
|
>({
|
|
security: [
|
|
{
|
|
scheme: "bearer",
|
|
type: "http",
|
|
},
|
|
],
|
|
url: "/api/v1/event_themes/{theme_id}",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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 setGuestStatus = <ThrowOnError extends boolean = false>(
|
|
options: Options<SetGuestStatusData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).patch<
|
|
SetGuestStatusResponse,
|
|
SetGuestStatusError,
|
|
ThrowOnError
|
|
>({
|
|
url: "/api/v1/events/guests/{guest_id}/status",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
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.
|
|
*/
|
|
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,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Generate Presigned Url
|
|
* Generate a presigned URL for uploading a file.
|
|
*
|
|
* This endpoint creates a secure token that allows direct upload to the storage system.
|
|
* After successful upload, the file will be accessible at the returned file_url.
|
|
*/
|
|
export const generatePresignedUrl = <ThrowOnError extends boolean = false>(
|
|
options: Options<GeneratePresignedUrlData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
GeneratePresignedUrlResponse,
|
|
GeneratePresignedUrlError,
|
|
ThrowOnError
|
|
>({
|
|
security: [
|
|
{
|
|
scheme: "bearer",
|
|
type: "http",
|
|
},
|
|
],
|
|
url: "/api/v1/uploads/presigned-url",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Upload File
|
|
* Upload a file using a presigned URL token.
|
|
*
|
|
* This endpoint handles the actual file upload after a presigned URL is generated.
|
|
* The token validates the upload permissions and destination.
|
|
*/
|
|
export const uploadFile = <ThrowOnError extends boolean = false>(
|
|
options: Options<UploadFileData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).post<
|
|
unknown,
|
|
UploadFileError,
|
|
ThrowOnError
|
|
>({
|
|
...formDataBodySerializer,
|
|
url: "/api/v1/uploads/{token}",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": null,
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|