export type GetApiApiWebsiteV1EventsSlugsArgs = {category?: string | undefined}; export type GetApiApiWebsiteV1EventsSlugsOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get event slugs * * GET /api/website/v1/events/slugs */ export const getApiApiWebsiteV1EventsSlugs = async (args: GetApiApiWebsiteV1EventsSlugsArgs, options: GetApiApiWebsiteV1EventsSlugsOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.category != null) query.append("category", String(args.category)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/website/v1/events/slugs${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };