export type UpdateVendorAttributesV1RequestBody = {attributes?: {[key: string]: string} | undefined, vendor_primary_hostname: string}; export type UpdateApiVendorAttributesArgs = {body: UpdateVendorAttributesV1RequestBody}; export type UpdateApiVendorAttributesOptions = {baseUrl?: string | undefined, APIKeyInHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Assign or update the attributes for a vendor * * PUT /vendor/attributes */ export const updateApiVendorAttributes = async (args: UpdateApiVendorAttributesArgs, options?: UpdateApiVendorAttributesOptions) => { const {baseUrl = "https://cyber-risk.upguard.com/api/public", fetch: fetchFn = fetch, APIKeyInHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKeyInHeader !== undefined) headers.set("Authorization", APIKeyInHeader) const url = `${baseUrl.replace(/\/+$/, '')}/vendor/attributes${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };