export type UpdateContractV3Dto = {name?: string | undefined, closeDate?: string | undefined, externalId?: string | undefined, sourceType?: string | undefined}; export type PatchApiV3ContractsIdArgs = {id: string, body: UpdateContractV3Dto}; export type PatchApiV3ContractsIdOptions = {baseUrl?: string | undefined, customHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update contract * * PATCH /v3/contracts/{id} */ export const patchApiV3ContractsId = async (args: PatchApiV3ContractsIdArgs, options?: PatchApiV3ContractsIdOptions) => { const {baseUrl = "https://integrators.prod.api.tabsplatform.com", fetch: fetchFn = fetch, customHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (customHeader !== undefined) headers.set("Authorization", customHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v3/contracts/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };