export type GetApiUsersAuthSamlMetadataArgs = {companyName?: string | undefined}; export type GetApiUsersAuthSamlMetadataOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Gets SAML Service Provider metadata. * * GET /users/auth/saml/metadata */ export const getApiUsersAuthSamlMetadata = async (args: GetApiUsersAuthSamlMetadataArgs, options: GetApiUsersAuthSamlMetadataOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/xml") if (args.companyName != null) query.append("companyName", String(args.companyName)) const url = `${baseUrl.replace(/\/+$/, '')}/users/auth/saml/metadata${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 res.blob() };