import { ScreepsHttpMethod } from './http'; /** * Rate limit state for an individual HTTP API endpoint. * * This relevant state for a given endpoint can be looked up via * {@link ScreepsRateLimitTracker.find}. * @category HTTP API */ export interface RateLimit extends RateLimitUpdate { /** Time period to which the {@link limit} applies */ period: RateLimitPeriod; /** Time (in seconds) until {@link reset} */ toReset: number; } /** * State that is included in response headers when a rate limit is hit. * @category HTTP API */ export interface RateLimitUpdate { /** Maximum number of requests that can be sent within a given time period */ limit: number; /** Remaining number of requests that can be sent until {@link reset} */ remaining: number; /** * UNIX timestamp (in seconds) indicating when the rate limit will * automatically reset. */ reset: number; } /** * All possible time periods over which a {@link RateLimit} can apply. * @enum * @category HTTP API */ export declare const RateLimitPeriods: { readonly Minute: "minute"; readonly Hour: "hour"; readonly Day: "day"; }; /** * A {@link RateLimitPeriods} value * @category HTTP API */ export type RateLimitPeriod = typeof RateLimitPeriods[keyof typeof RateLimitPeriods]; /** * Tracks rate limit status for all HTTP API endpoints. * * Do not instantiate this class. Instead, use the instance from * {@link ScreepsHttpClient.rateLimits}. * @category HTTP API */ export declare class ScreepsRateLimitTracker { readonly global: RateLimit; readonly GET: { [path: string]: RateLimit; }; readonly POST: { [path: string]: RateLimit; }; constructor(); find(method: ScreepsHttpMethod, path: string): RateLimit; update(method: ScreepsHttpMethod, path: string, latest: RateLimitUpdate): RateLimit; describe(method: ScreepsHttpMethod, path: string, limit: RateLimit): string; } //# sourceMappingURL=ScreepsRateLimitTracker.d.ts.map