export type GetApiAuthOidcLoginArgs = {tenant_id: string}; export type GetApiAuthOidcLoginOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Initiate OIDC login flow * * GET /auth/oidc/login */ export const getApiAuthOidcLogin = async (args: GetApiAuthOidcLoginArgs, options?: GetApiAuthOidcLoginOptions) => { const {baseUrl = "https://api.qustody.io/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.tenant_id != null) query.append("tenant_id", String(args.tenant_id)) const url = `${baseUrl.replace(/\/+$/, '')}/auth/oidc/login${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 };