export type DeleteApiV1SessionsIdArgs = {id: string}; export type DeleteApiV1SessionsIdOptions = {baseUrl?: string | undefined, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Ends a session * * DELETE /v1/sessions/{id} */ export const deleteApiV1SessionsId = async (args: DeleteApiV1SessionsIdArgs, options?: DeleteApiV1SessionsIdOptions) => { const {baseUrl = "https://api.airtop.ai/api", fetch: fetchFn = fetch, defaultValue} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (defaultValue !== undefined) headers.set('authorization', `Bearer ${defaultValue}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/sessions/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };