export type GetApiBulkOperationsIdArgs = {id: string, fields?: Array<'NONE'> | undefined}; export type GetApiBulkOperationsIdOptions = {baseUrl?: string | undefined, authToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get bulk operation * * GET /bulk-operations/{id} */ export const getApiBulkOperationsId = async (args: GetApiBulkOperationsIdArgs, options?: GetApiBulkOperationsIdOptions) => { const {baseUrl = "https://commerce_studio_id.experiencemanager.lucidworks.com", fetch: fetchFn = fetch, authToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") for (const item of args.fields ?? []) query.append("fields", String(item)) if (authToken !== undefined) headers.set('authorization', `Bearer ${authToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/bulk-operations/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };