export type CreateApiV6BatchesBatchIdExpireArgs = {batchId: string}; export type CreateApiV6BatchesBatchIdExpireOptions = {baseUrl?: string | undefined, HEADER?: string | undefined, fetch?: typeof fetch | undefined}; /** * Expire a batch job * * POST /v6/batches/{batchId}/expire * * Also accepts auth: QUERY, COOKIE */ export const createApiV6BatchesBatchIdExpire = async (args: CreateApiV6BatchesBatchIdExpireArgs, options?: CreateApiV6BatchesBatchIdExpireOptions) => { const {baseUrl = "https://api.extole.io", fetch: fetchFn = fetch, HEADER} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (HEADER !== undefined) headers.set("Authorization", HEADER) const url = `${baseUrl.replace(/\/+$/, '')}/v6/batches/${encodeURIComponent(String(args.batchId))}/expire${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 };