export type CreateApiUpdateTypeCodeArgs = {body: {data: {unitOfMeasure?: string | undefined, typedId: string, label?: string | undefined}, oldValues: {version: number, typedId: string, sku?: string | undefined, label?: string | undefined, unitOfMeasure?: string | undefined, userGroupEdit?: (string | null) | undefined, userGroupViewDetails?: (string | null) | undefined, currency?: string | undefined, formulaName: unknown, image: unknown, createDate?: string | undefined, createdBy?: number | undefined, lastUpdateDate?: string | undefined, lastUpdateBy?: number | undefined, attribute1: unknown, attribute2: unknown, attribute3: unknown, attribute4: unknown, attribute5: unknown, attribute6: unknown, attribute7: unknown, attribute8: unknown, attribute9: unknown, attribute10: unknown, attribute11: unknown, attribute12: unknown, attribute13: unknown, attribute14: unknown, attribute15: unknown, attribute16: unknown, attribute17: unknown, attribute18: unknown, attribute19: unknown, attribute20: unknown, attribute21: unknown, attribute22: unknown, attribute23: unknown, attribute24: unknown, attribute25: unknown, attribute26: unknown, attribute27: unknown, attribute28: unknown, attribute29: unknown, attribute30: unknown}, operationType?: string | undefined, textMatchStyle?: string | undefined, noEvent?: string | undefined}}; export type CreateApiUpdateTypeCodeOptions = {baseUrl?: string | undefined, basic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Update an Object * * POST /update/{TypeCode} * * Also accepts auth: X-PriceFx-jwt */ export const createApiUpdateTypeCode = async (args: CreateApiUpdateTypeCodeArgs, options?: CreateApiUpdateTypeCodeOptions) => { const {baseUrl = "https://companynode.pricefx.com/pricefx/companypartition", fetch: fetchFn = fetch, basic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (basic !== undefined) headers.set('authorization', `Basic ${btoa(`${basic.username}:${basic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/update/${encodeURIComponent(String(args.TypeCode))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };