export type CreateApiVendorContactUpdateArgs = {id?: number | undefined, name?: string | undefined, title?: string | undefined, email_address?: string | undefined, phone_mobile?: string | undefined, notes?: string | undefined}; export type CreateApiVendorContactUpdateOptions = {baseUrl?: string | undefined, APIKeyInHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a vendor contact * * POST /vendor/contact/update */ export const createApiVendorContactUpdate = async (args: CreateApiVendorContactUpdateArgs, options?: CreateApiVendorContactUpdateOptions) => { 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.name != null) query.append("name", String(args.name)) if (args.title != null) query.append("title", String(args.title)) if (args.email_address != null) query.append("email_address", String(args.email_address)) if (args.phone_mobile != null) query.append("phone_mobile", String(args.phone_mobile)) if (args.notes != null) query.append("notes", String(args.notes)) if (APIKeyInHeader !== undefined) headers.set("Authorization", APIKeyInHeader) const url = `${baseUrl.replace(/\/+$/, '')}/vendor/contact/update${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 };