43 lines
1.9 KiB
TypeScript
43 lines
1.9 KiB
TypeScript
import { NetworkResponse } from "./NetworkManager";
|
|
import { ServerAuthorizationTokenResponse } from "../response/ServerAuthorizationTokenResponse";
|
|
import { CacheManager } from "../cache/CacheManager";
|
|
import { RequestThumbprint } from "./RequestThumbprint";
|
|
import { BaseAuthRequest } from "../request/BaseAuthRequest";
|
|
/** @internal */
|
|
export declare class ThrottlingUtils {
|
|
/**
|
|
* Prepares a RequestThumbprint to be stored as a key.
|
|
* @param thumbprint
|
|
*/
|
|
static generateThrottlingStorageKey(thumbprint: RequestThumbprint): string;
|
|
/**
|
|
* Performs necessary throttling checks before a network request.
|
|
* @param cacheManager
|
|
* @param thumbprint
|
|
*/
|
|
static preProcess(cacheManager: CacheManager, thumbprint: RequestThumbprint): void;
|
|
/**
|
|
* Performs necessary throttling checks after a network request.
|
|
* @param cacheManager
|
|
* @param thumbprint
|
|
* @param response
|
|
*/
|
|
static postProcess(cacheManager: CacheManager, thumbprint: RequestThumbprint, response: NetworkResponse<ServerAuthorizationTokenResponse>): void;
|
|
/**
|
|
* Checks a NetworkResponse object's status codes against 429 or 5xx
|
|
* @param response
|
|
*/
|
|
static checkResponseStatus(response: NetworkResponse<ServerAuthorizationTokenResponse>): boolean;
|
|
/**
|
|
* Checks a NetworkResponse object's RetryAfter header
|
|
* @param response
|
|
*/
|
|
static checkResponseForRetryAfter(response: NetworkResponse<ServerAuthorizationTokenResponse>): boolean;
|
|
/**
|
|
* Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.
|
|
* @param throttleTime
|
|
*/
|
|
static calculateThrottleTime(throttleTime: number): number;
|
|
static removeThrottle(cacheManager: CacheManager, clientId: string, request: BaseAuthRequest, homeAccountIdentifier?: string): void;
|
|
}
|
|
//# sourceMappingURL=ThrottlingUtils.d.ts.map
|