Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 5x 5x 2x 2x 2x 5x 1x 1x 1x 1x 1x | import { AxiosRequestConfig } from 'axios'
import qs from 'query-string'
export interface IParams {
[key: string]: string | number
}
export interface IBaseApiParams {
/**
* If api response is 429 (rate limits) try reattempt after needed time (default true)
*/
rateLimitRetry?: boolean
/**
* Number of time to retry after rate limit response (default 1)
*/
rateLimitRetryAttempts?: number
/**
* Riot games api key
*/
key?: string,
/**
* Concurrency calls to riot (default infinity)
* Concurrency per method (example: summoner api, match api, etc)
*/
concurrency?: number,
/**
* Debug methods
*/
debug?: {
/**
* Log methods execution time (default false)
*/
logTime?: boolean
/**
* Log urls (default false)
*/
logUrls?: boolean
/**
* Log when is waiting for rate limits (default false)
*/
logRatelimits?: boolean
}
}
export function waiter (ms: number) {
return new Promise<void>((resolve) => {
setTimeout(() => {
resolve()
}, ms)
})
}
export function getUrlFromConfig (config: AxiosRequestConfig): string {
let uri = config.url as string
Eif (config.params) {
uri += '?'
uri += qs.stringify(config.params)
}
return uri
}
|