Interface Options<T>

interface Options<T extends Entry = Entry> {
    beforeRequest?: (request: PagedRequest<T>) => Promise<void>;
    fromDate?: string | Date;
    maxResults?: number;
    onError?: (err: Error | ScrollError) => void;
    onProgress?: (items: T[], current: number, total?: number) => void;
    onScrollError?: (err: ScrollError) => void;
    signal?: AbortSignal;
    toDate?: string | Date;
}

Type Parameters

Hierarchy (View Summary)

Properties

beforeRequest?: (request: PagedRequest<T>) => Promise<void>
fromDate?: string | Date
maxResults?: number

maximum number of search results

onError?: (err: Error | ScrollError) => void

Search results use a scrollID cursor that expires after 1-5 minutes from first request. If the scrollID expires then onScrollExpired will be called with a ScrollError. Default behavior is to throw the error.

Note that request level errors (like 401 or 500) will just be thrown as normal, not passed to this function

onProgress?: (items: T[], current: number, total?: number) => void

callback per page

onScrollError?: (err: ScrollError) => void

Use onError instead

use onError instead

signal?: AbortSignal
toDate?: string | Date