1 | import { Stream, Writable } from 'stream';
|
2 |
|
3 | import { RecordResult } from './record-result';
|
4 | import { Record } from './record';
|
5 | import { Parsable } from './record-stream';
|
6 |
|
7 | export interface BatchInfo {
|
8 | id: string;
|
9 | jobId: string;
|
10 | state: string;
|
11 | stateMessage: string;
|
12 | numberRecordsProcessed: string;
|
13 | numberRecordsFailed: string;
|
14 | totalProcessingTime: string;
|
15 | }
|
16 |
|
17 | export interface BatchResultInfo {
|
18 | id: string;
|
19 | batchId?: string | undefined;
|
20 | jobId?: string | undefined;
|
21 | success?: boolean | undefined;
|
22 | errors?: string[] | undefined;
|
23 | }
|
24 |
|
25 | export class Batch extends Writable {
|
26 | check(callback?: (batchInfo: BatchInfo) => void): Promise<BatchInfo>;
|
27 | execute(input?: Record[] | Stream | string, callback?: (err: Error, result: RecordResult[] | BatchResultInfo[]) => void): Batch;
|
28 | poll(interval: number, timeout: number): void;
|
29 | retrieve(callback?: (batchInfo: BatchInfo) => void): Promise<RecordResult[] | BatchResultInfo[]>;
|
30 | result(resultId: string): Parsable<any>;
|
31 | then(): Promise<any>;
|
32 | thenAll(callback: (data: any) => void): void;
|
33 | }
|