export type SnowflakeType = unknown | number; export type CreateApiChannelsChannelIdCallEndArgs = {channel_id: SnowflakeType}; export type CreateApiChannelsChannelIdCallEndOptions = {baseUrl?: string | undefined, sessionToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * End call session * * POST /channels/{channel_id}/call/end */ export const createApiChannelsChannelIdCallEnd = async (args: CreateApiChannelsChannelIdCallEndArgs, options?: CreateApiChannelsChannelIdCallEndOptions) => { const {baseUrl = "https://web.fluxer.app/api/v1", fetch: fetchFn = fetch, sessionToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (sessionToken !== undefined) headers.set("Authorization", sessionToken) const url = `${baseUrl.replace(/\/+$/, '')}/channels/${encodeURIComponent(String(args.channel_id))}/call/end${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 };