1 | import LoggerInterface from "./Interfaces/LoggerInterface";
|
2 | import RequestLimiter, { IRequestLimiterCallback } from "./RequestLimiter";
|
3 | export declare type RequestLimitConfig = {
|
4 | run: (callable: IRequestLimiterCallback) => Promise<any>;
|
5 | limiter: RequestLimiter;
|
6 | method: string;
|
7 | limiterKey: string;
|
8 | endpoint: string;
|
9 | };
|
10 | export declare type RequestLimitProxyType = false | any;
|
11 | export declare type RequestLimitProxyTypes = RequestLimitProxyType[];
|
12 | export default class RequestLimitFactory {
|
13 | private limiters;
|
14 | private logger;
|
15 | private enabledProxies;
|
16 | private axiosClients;
|
17 | |
18 |
|
19 |
|
20 | private proxyCounter;
|
21 | |
22 |
|
23 |
|
24 |
|
25 | constructor(loggerInterface: LoggerInterface, enabledProxies?: RequestLimitProxyTypes);
|
26 | /**
|
27 | * @param enabledProxies
|
28 | */
|
29 | setEnabledProxies(enabledProxies?: RequestLimitProxyTypes): void;
|
30 | /**
|
31 | * @param {string} endpoint
|
32 | * @param {string} method
|
33 | * @param {boolean} noProxy
|
34 | * @returns {RequestLimitConfig}
|
35 | */
|
36 | create(endpoint: string, method?: string, noProxy?: boolean): RequestLimitConfig;
|
37 | |
38 |
|
39 |
|
40 |
|
41 | getLimiter(limiterKey: string): RequestLimitConfig | false;
|
42 | |
43 |
|
44 |
|
45 |
|
46 | removeLimiter(limiterKey: string): boolean;
|
47 | getAllLimiters(): any;
|
48 | clearLimiters(): void;
|
49 | |
50 |
|
51 |
|
52 | private getProxyIndex;
|
53 | }
|