export type CreateApiTrustExchangeContentLibraryDocumentUploadVersionArgs = {uuid: string, body: BodyInit}; export type CreateApiTrustExchangeContentLibraryDocumentUploadVersionOptions = {baseUrl?: string | undefined, APIKeyInHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload new version of content library document * * POST /trust_exchange/content_library/document/upload_version */ export const createApiTrustExchangeContentLibraryDocumentUploadVersion = async (args: CreateApiTrustExchangeContentLibraryDocumentUploadVersionArgs, options?: CreateApiTrustExchangeContentLibraryDocumentUploadVersionOptions) => { const {baseUrl = "https://cyber-risk.upguard.com/api/public", fetch: fetchFn = fetch, APIKeyInHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.uuid != null) query.append("uuid", String(args.uuid)) if (APIKeyInHeader !== undefined) headers.set("Authorization", APIKeyInHeader) const url = `${baseUrl.replace(/\/+$/, '')}/trust_exchange/content_library/document/upload_version${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };