Interface IRettiwtConfig

The configuration for initializing a new Rettiwt instance.

interface IRettiwtConfig {
    apiKey?: string;
    delay?: number | () => number | Promise<number>;
    errorHandler?: IErrorHandler;
    headers?: { [key: string]: string };
    logging?: boolean;
    maxRetries?: number;
    proxyUrl?: URL;
    timeout?: number;
}

Properties

apiKey?: string

The apiKey (cookie) to use for authenticating Rettiwt against Twitter API.

delay?: number | () => number | Promise<number>

The delay (in ms) to use between concurrent request.

Can either be a number or a function that returns a number synchronously or asynchronously.

errorHandler?: IErrorHandler

Optional custom error handler to define error conditions and process API/HTTP errors in responses.

headers?: { [key: string]: string }

Optional custom HTTP headers to add to all requests to Twitter API.

Custom headers can be useful for proxies, avoiding rate limits, etc.

logging?: boolean

Whether to write logs to console or not.

maxRetries?: number

The maximum number of retries to use.

Recommended to use a value of 5 combined with a delay of 1000 to prevent error 404.

proxyUrl?: URL

Optional URL to proxy server to use for requests to Twitter API.

When deploying to cloud platforms, if setting IRettiwtConfig.authProxyUrl does not resolve Error 429, then this might be required.

timeout?: number

The max wait time (in milli-seconds) for a response; if not set, Twitter server timeout is used.