export type CreateApiApiChannelsChannelIdPollsPollIdExpireArgs = {channel_id: string, poll_id: string}; export type CreateApiApiChannelsChannelIdPollsPollIdExpireOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /api/channels/{channel_id}/polls/{poll_id}/expire/ */ export const createApiApiChannelsChannelIdPollsPollIdExpire = async (args: CreateApiApiChannelsChannelIdPollsPollIdExpireArgs, options?: CreateApiApiChannelsChannelIdPollsPollIdExpireOptions) => { const {baseUrl = "https://api.rory.server.spacebar.chat", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/channels/${encodeURIComponent(String(args.channel_id))}/polls/${encodeURIComponent(String(args.poll_id))}/expire/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };