1 | /**
|
2 | * @license
|
3 | * Copyright 2017 Google LLC
|
4 | *
|
5 | * Licensed under the Apache License, Version 2.0 (the "License");
|
6 | * you may not use this file except in compliance with the License.
|
7 | * You may obtain a copy of the License at
|
8 | *
|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
10 | *
|
11 | * Unless required by applicable law or agreed to in writing, software
|
12 | * distributed under the License is distributed on an "AS IS" BASIS,
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 | * See the License for the specific language governing permissions and
|
15 | * limitations under the License.
|
16 | */
|
17 | import { AppCheckTokenProvider } from './AppCheckTokenProvider';
|
18 | import { AuthTokenProvider } from './AuthTokenProvider';
|
19 | import { RepoInfo } from './RepoInfo';
|
20 | import { ServerActions } from './ServerActions';
|
21 | import { QueryContext } from './view/EventRegistration';
|
22 | /**
|
23 | * An implementation of ServerActions that communicates with the server via REST requests.
|
24 | * This is mostly useful for compatibility with crawlers, where we don't want to spin up a full
|
25 | * persistent connection (using WebSockets or long-polling)
|
26 | */
|
27 | export declare class ReadonlyRestClient extends ServerActions {
|
28 | private repoInfo_;
|
29 | private onDataUpdate_;
|
30 | private authTokenProvider_;
|
31 | private appCheckTokenProvider_;
|
32 | reportStats(stats: {
|
33 | [k: string]: unknown;
|
34 | }): void;
|
35 | /** @private {function(...[*])} */
|
36 | private log_;
|
37 | /**
|
38 | * We don't actually need to track listens, except to prevent us calling an onComplete for a listen
|
39 | * that's been removed. :-/
|
40 | */
|
41 | private listens_;
|
42 | static getListenId_(query: QueryContext, tag?: number | null): string;
|
43 | /**
|
44 | * @param repoInfo_ - Data about the namespace we are connecting to
|
45 | * @param onDataUpdate_ - A callback for new data from the server
|
46 | */
|
47 | constructor(repoInfo_: RepoInfo, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, authTokenProvider_: AuthTokenProvider, appCheckTokenProvider_: AppCheckTokenProvider);
|
48 | /** @inheritDoc */
|
49 | listen(query: QueryContext, currentHashFn: () => string, tag: number | null, onComplete: (a: string, b: unknown) => void): void;
|
50 | /** @inheritDoc */
|
51 | unlisten(query: QueryContext, tag: number | null): void;
|
52 | get(query: QueryContext): Promise<string>;
|
53 | /** @inheritDoc */
|
54 | refreshAuthToken(token: string): void;
|
55 | /**
|
56 | * Performs a REST request to the given path, with the provided query string parameters,
|
57 | * and any auth credentials we have.
|
58 | */
|
59 | private restRequest_;
|
60 | }
|