export type BatchJobUpdateRequest = {name?: string | undefined, scopes?: (Array<'CLIENT_ADMIN' | 'CLIENT_SUPERUSER'>) | undefined, tags?: Array | undefined}; export type UpdateApiV6BatchesBatchIdArgs = {batchId: string, body: BatchJobUpdateRequest}; export type UpdateApiV6BatchesBatchIdOptions = {baseUrl?: string | undefined, HEADER?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a batch job * * PUT /v6/batches/{batchId} * * Also accepts auth: QUERY, COOKIE */ export const updateApiV6BatchesBatchId = async (args: UpdateApiV6BatchesBatchIdArgs, options?: UpdateApiV6BatchesBatchIdOptions) => { const {baseUrl = "https://api.extole.io", fetch: fetchFn = fetch, HEADER} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (HEADER !== undefined) headers.set("Authorization", HEADER) const url = `${baseUrl.replace(/\/+$/, '')}/v6/batches/${encodeURIComponent(String(args.batchId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };