export type GetApiTrustExchangeContentLibraryDocumentDownloadVersionArgs = {uuid: string, version?: number | undefined}; export type GetApiTrustExchangeContentLibraryDocumentDownloadVersionOptions = {baseUrl?: string | undefined, APIKeyInHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download content library document version * * GET /trust_exchange/content_library/document/download_version */ export const getApiTrustExchangeContentLibraryDocumentDownloadVersion = async (args: GetApiTrustExchangeContentLibraryDocumentDownloadVersionArgs, options?: GetApiTrustExchangeContentLibraryDocumentDownloadVersionOptions) => { const {baseUrl = "https://cyber-risk.upguard.com/api/public", fetch: fetchFn = fetch, APIKeyInHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.uuid != null) query.append("uuid", String(args.uuid)) if (args.version != null) query.append("version", String(args.version)) if (APIKeyInHeader !== undefined) headers.set("Authorization", APIKeyInHeader) const url = `${baseUrl.replace(/\/+$/, '')}/trust_exchange/content_library/document/download_version${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() };