mindee
Version:
Mindee Client Library for Node.js
57 lines (56 loc) • 1.58 kB
TypeScript
export interface TimerOptions {
ref?: boolean;
signal?: AbortSignal;
}
export interface PollingOptionsConstructor {
initialDelaySec?: number;
delaySec?: number;
maxRetries?: number;
initialTimerOptions?: TimerOptions;
recurringTimerOptions?: TimerOptions;
}
/**
* Parameters for the internal polling loop in `enqueueAndGetInference()`.
*
* Default behavior:
* - `initialDelaySec` = 2
* - `delaySec` = 1.5
* - `maxRetries` = 80
*
* Validation rules:
* - `initialDelaySec` >= 1
* - `delaySec` >= 1
* - `maxRetries` >= 2
*
* The `initialTimerOptions` and `recurringTimerOptions` objects let you pass an
* `AbortSignal` or make the timer `ref`-ed to the `setTimeout()`.
*
* @category ClientV2
* @example
* ```
* const pollingOptions = {
* initialDelaySec: 4,
* delaySec: 2,
* maxRetries: 50
* };
*
* const inference = await client.enqueueAndGetInference(
* inputDoc, params, pollingOptions
* );
* ```
*/
export declare class PollingOptions {
/** Number of seconds to wait *before the first poll*. */
initialDelaySec: number;
/** Interval in seconds between two consecutive polls. */
delaySec: number;
/** Maximum number of polling attempts (including the first one). */
maxRetries: number;
/** Options passed to the initial `setTimeout()`. */
initialTimerOptions?: TimerOptions;
/** Options passed to every recurring `setTimeout()`. */
recurringTimerOptions?: TimerOptions;
constructor(params?: PollingOptionsConstructor);
validateSettings(): void;
toString(): string;
}