/** * What a logged-in Wikimedia Action API session needs: the bot-password credentials, * the session cookies the login answers set, and the request limits of each mode. * * A bot password is created at `Special:BotPasswords` and logs in as `Name@app` * with the generated password, through `action=login`. * See https://www.mediawiki.org/wiki/API:Login. */ /** * A bot-password login: `username` is `Name@app`. */ export interface WikidataBotCredentials { username: string; password: string; } /** * Whether requests go out logged in or anonymously. */ export declare const WikimediaRequestMode: { readonly anonymous: "anonymous"; readonly loggedIn: "logged-in"; }; export type WikimediaRequestMode = (typeof WikimediaRequestMode)[keyof typeof WikimediaRequestMode]; /** * The concurrency and dispatch spacing of each mode. */ export interface ActionAPILimits { /** * The most requests in flight at once. */ concurrency: number; /** * The least spacing between two dispatches of one client. */ minRequestIntervalMs: number; } /** * The Action API limits each mode keeps. * * Anonymous: one request in flight, as the robot policy asks, two per second at most (120 per minute, * under the policy's 5 per second and the rate-limit page's 200 per minute for a compliant User-Agent). * Logged in: three in flight, as both pages allow, about three per second at most (182 per minute, * under 10 per second and under the 200 per minute the rate-limit page gives an account with few edits). */ export declare const ACTION_API_LIMITS: Readonly>; /** * The bot credentials from two environment values, or `null` when neither is set. * * @throws When only one is set, or the username lacks the bot password's `@app` part. */ export declare function botCredentialsFrom(username: string | null | undefined, password: string | null | undefined): WikidataBotCredentials | null; /** * The text with each credential value replaced by a marker, for an error a login raised. */ export declare function redactCredentials(text: string, credentials: WikidataBotCredentials): string; /** * The cookies one host set, sent back on every later request to it. * * Every request of a Wikidata API client goes to one host, so a cookie's domain and path are not consulted. * A cookie set to expire, by `Max-Age=0` or a past `Expires`, is dropped. */ export declare class SessionCookies { #private; /** * The number of cookies held. */ get size(): number; /** * Keep the cookies a response's `Set-Cookie` header sets. */ absorb(header: unknown, now?: number): void; /** * The `Cookie` header value, or `null` when no cookie is held. */ header(): string | null; } //# sourceMappingURL=session.d.ts.map