export type GetApiApiV1SsoCallbackArgs = {code: string, state: string}; export type GetApiApiV1SsoCallbackOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/v1/sso/callback */ export const getApiApiV1SsoCallback = async (args: GetApiApiV1SsoCallbackArgs, options?: GetApiApiV1SsoCallbackOptions) => { const {baseUrl = "https://api-docs.gosure.ai", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.code != null) query.append("code", String(args.code)) if (args.state != null) query.append("state", String(args.state)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/sso/callback${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 };