export type IdentityOidcProviderAuthorizeRequest = {client_id: string, code_challenge?: string | undefined, code_challenge_method?: string | undefined, max_age?: number | undefined, nonce?: string | undefined, redirect_uri: string, response_type: string, scope: string, state?: string | undefined}; export type CreateApiIdentityOidcProviderNameAuthorizeArgs = {body: IdentityOidcProviderAuthorizeRequest}; export type CreateApiIdentityOidcProviderNameAuthorizeOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /identity/oidc/provider/{name}/authorize */ export const createApiIdentityOidcProviderNameAuthorize = async (args: CreateApiIdentityOidcProviderNameAuthorizeArgs, options: CreateApiIdentityOidcProviderNameAuthorizeOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/identity/oidc/provider/${encodeURIComponent(String(args.name))}/authorize${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };