import { Disposable, IDisposable, ReferenceCollection } from "../../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../../base/common/observable.js"; import { ILogService } from "../../../../../platform/log/common/log.service.js"; import { ApiRequestOptions } from "@codingame/monaco-vscode-github-service-override/vscode/vs/platform/github/common/client/request"; import { IGitHubIssue } from "../../common/types.js"; import { GitHubIssueFetcher } from "../fetchers/githubIssueFetcher.js"; import { GitHubApiClient } from "../githubApiClient.js"; /** * How long a model waits before it revalidates on demand. Issues move far more slowly * than pull requests, so repeated {@link GitHubIssueModel.refresh} calls — several * session views showing the same issue, a header re-created on a session switch — * collapse into a single request instead of producing one each. */ export declare const MIN_REFRESH_INTERVAL_MS = 60000; /** The last display value and freshness of a disposed issue model. */ interface IGitHubIssueSnapshot { readonly issue: IGitHubIssue | undefined; readonly refreshedAt: number; } export declare class GitHubIssueModelReferenceCollection extends ReferenceCollection implements IDisposable { private readonly _logService; private readonly _store; private readonly _fetcher; /** * Revalidation state of issues whose model has been disposed, keyed like the * collection itself. Session switches and list re-renders release the last reference * to an issue model routinely; without this the next model would start cold and spend * a full, rate-limited request re-fetching a payload that almost never changed. */ private readonly _snapshots; constructor(apiClient: GitHubApiClient, _logService: ILogService); dispose(): void; protected createReferencedObject(key: string, owner: string, repo: string, issueNumber: number): GitHubIssueModel; protected destroyReferencedObject(key: string, object: GitHubIssueModel): void; } /** Issue metadata with polling and on-demand refresh throttled by {@link MIN_REFRESH_INTERVAL_MS}. */ export declare class GitHubIssueModel extends Disposable { readonly owner: string; readonly repo: string; readonly issueNumber: number; private readonly _fetcher; private readonly _logService; private readonly _token; private readonly _issue; readonly issue: IObservable; private _refreshPromise; private _refreshPriority; private _refreshVersion; /** When the last successful refresh completed. */ private _refreshedAt; private readonly _pollScheduler; private readonly _pollingDisposables; constructor(owner: string, repo: string, issueNumber: number, _fetcher: GitHubIssueFetcher, _logService: ILogService); /** Adopts the revalidation state of an earlier model for the same issue. */ restore(snapshot: IGitHubIssueSnapshot): void; /** The revalidation state to hand to the next model for this issue, if any. */ snapshot(): IGitHubIssueSnapshot | undefined; /** * Revalidates the issue, unless the last request completed less than * {@link MIN_REFRESH_INTERVAL_MS} ago. */ refresh(options?: ApiRequestOptions): Promise; startPolling(intervalMs?: number): IDisposable; private _refreshNow; private _poll; private _refresh; } export {};