export type CreateApiVendorUnmonitorArgs = {id?: number | undefined, hostname?: string | undefined}; export type CreateApiVendorUnmonitorOptions = {baseUrl?: string | undefined, APIKeyInHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Stop monitoring a vendor * * POST /vendor/unmonitor */ export const createApiVendorUnmonitor = async (args: CreateApiVendorUnmonitorArgs, options?: CreateApiVendorUnmonitorOptions) => { const {baseUrl = "https://cyber-risk.upguard.com/api/public", fetch: fetchFn = fetch, APIKeyInHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.id != null) query.append("id", String(args.id)) if (args.hostname != null) query.append("hostname", String(args.hostname)) if (APIKeyInHeader !== undefined) headers.set("Authorization", APIKeyInHeader) const url = `${baseUrl.replace(/\/+$/, '')}/vendor/unmonitor${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };