export type UpdateOutputDto = {campaignId?: string | undefined, productTypeId?: number | undefined, dateStamp?: string | undefined, total?: number | undefined, monthly?: number | undefined, dailyAvg?: number | undefined}; export type PatchApiApiOutputIdArgs = {id: string, body: UpdateOutputDto}; export type PatchApiApiOutputIdOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update output record * * PATCH /api/output/{id} */ export const patchApiApiOutputId = async (args: PatchApiApiOutputIdArgs, options: PatchApiApiOutputIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("X-API-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/output/${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 };