export type GetApiApiV1SsoProviderLoginArgs = {provider: string, tenantName: string, redirectUrl: string, newTenantRequest?: boolean | undefined}; export type GetApiApiV1SsoProviderLoginOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/v1/sso/{provider}/login */ export const getApiApiV1SsoProviderLogin = async (args: GetApiApiV1SsoProviderLoginArgs, options?: GetApiApiV1SsoProviderLoginOptions) => { const {baseUrl = "https://api-docs.gosure.ai", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.tenantName != null) query.append("tenantName", String(args.tenantName)) if (args.redirectUrl != null) query.append("redirectUrl", String(args.redirectUrl)) if (args.newTenantRequest != null) query.append("newTenantRequest", String(args.newTenantRequest)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/sso/${encodeURIComponent(String(args.provider))}/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 };