export type GetApiV1AuthenticationLogoutAllDevicesArgs = {code: string, redirect_host?: string | undefined, device_token: string}; export type GetApiV1AuthenticationLogoutAllDevicesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Logout user from all devices * * GET /v1/authentication/logout-all-devices */ export const getApiV1AuthenticationLogoutAllDevices = async (args: GetApiV1AuthenticationLogoutAllDevicesArgs, options?: GetApiV1AuthenticationLogoutAllDevicesOptions) => { const {baseUrl = "http://api.floik.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.code != null) query.append("code", String(args.code)) if (args.redirect_host != null) query.append("redirect_host", String(args.redirect_host)) if (args.device_token != null) query.append("device_token", String(args.device_token)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/authentication/logout-all-devices${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 };