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