export type GetApiVVersionSsoSaml2LogoutArgs = {samlRequest: string, sigAlg: string, signature: string, relayState?: string | undefined, version: string}; export type GetApiVVersionSsoSaml2LogoutOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /v{version}/sso/saml2/logout */ export const getApiVVersionSsoSaml2Logout = async (args: GetApiVVersionSsoSaml2LogoutArgs, options: GetApiVVersionSsoSaml2LogoutOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.samlRequest != null) query.append("samlRequest", String(args.samlRequest)) if (args.sigAlg != null) query.append("sigAlg", String(args.sigAlg)) if (args.signature != null) query.append("signature", String(args.signature)) if (args.relayState != null) query.append("relayState", String(args.relayState)) const url = `${baseUrl.replace(/\/+$/, '')}/v${encodeURIComponent(String(args.version))}/sso/saml2/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 };