export type GetApiGuildsGuildIdScheduledEventsArgs = {with_user_count?: string | undefined, guild_id: string}; export type GetApiGuildsGuildIdScheduledEventsOptions = {baseUrl: string, apikeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * list guild scheduled events * * GET /guilds/{guild_id}/scheduled-events */ export const getApiGuildsGuildIdScheduledEvents = async (args: GetApiGuildsGuildIdScheduledEventsArgs, options: GetApiGuildsGuildIdScheduledEventsOptions) => { const {baseUrl, fetch: fetchFn = fetch, apikeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args.with_user_count != null) query.append("with_user_count", String(args.with_user_count)) if (apikeyAuth !== undefined) headers.set('authorization', `apikey ${apikeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/guilds/${encodeURIComponent(String(args.guild_id))}/scheduled-events${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 res.text() };