UNPKG

4.53 kBTypeScriptView Raw
1/*! firebase-admin v10.0.0 */
2/*!
3 * Copyright 2020 Google Inc.
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 */
17import { App } from '../app';
18import { ListVersionsOptions, ListVersionsResult, RemoteConfigTemplate } from './remote-config-api';
19/**
20 * The Firebase `RemoteConfig` service interface.
21 */
22export declare class RemoteConfig {
23 readonly app: App;
24 private readonly client;
25 /**
26 * Gets the current active version of the {@link RemoteConfigTemplate} of the project.
27 *
28 * @returns A promise that fulfills with a `RemoteConfigTemplate`.
29 */
30 getTemplate(): Promise<RemoteConfigTemplate>;
31 /**
32 * Gets the requested version of the {@link RemoteConfigTemplate} of the project.
33 *
34 * @param versionNumber - Version number of the Remote Config template to look up.
35 *
36 * @returns A promise that fulfills with a `RemoteConfigTemplate`.
37 */
38 getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
39 /**
40 * Validates a {@link RemoteConfigTemplate}.
41 *
42 * @param template - The Remote Config template to be validated.
43 * @returns A promise that fulfills with the validated `RemoteConfigTemplate`.
44 */
45 validateTemplate(template: RemoteConfigTemplate): Promise<RemoteConfigTemplate>;
46 /**
47 * Publishes a Remote Config template.
48 *
49 * @param template - The Remote Config template to be published.
50 * @param options - Optional options object when publishing a Remote Config template:
51 * - `force`: Setting this to `true` forces the Remote Config template to
52 * be updated and circumvent the ETag. This approach is not recommended
53 * because it risks causing the loss of updates to your Remote Config
54 * template if multiple clients are updating the Remote Config template.
55 * See {@link https://firebase.google.com/docs/remote-config/use-config-rest#etag_usage_and_forced_updates |
56 * ETag usage and forced updates}.
57 *
58 * @returns A Promise that fulfills with the published `RemoteConfigTemplate`.
59 */
60 publishTemplate(template: RemoteConfigTemplate, options?: {
61 force: boolean;
62 }): Promise<RemoteConfigTemplate>;
63 /**
64 * Rolls back a project's published Remote Config template to the specified version.
65 * A rollback is equivalent to getting a previously published Remote Config
66 * template and re-publishing it using a force update.
67 *
68 * @param versionNumber - The version number of the Remote Config template to roll back to.
69 * The specified version number must be lower than the current version number, and not have
70 * been deleted due to staleness. Only the last 300 versions are stored.
71 * All versions that correspond to non-active Remote Config templates (that is, all except the
72 * template that is being fetched by clients) are also deleted if they are more than 90 days old.
73 * @returns A promise that fulfills with the published `RemoteConfigTemplate`.
74 */
75 rollback(versionNumber: number | string): Promise<RemoteConfigTemplate>;
76 /**
77 * Gets a list of Remote Config template versions that have been published, sorted in reverse
78 * chronological order. Only the last 300 versions are stored.
79 * All versions that correspond to non-active Remote Config templates (i.e., all except the
80 * template that is being fetched by clients) are also deleted if they are older than 90 days.
81 *
82 * @param options - Optional options object for getting a list of versions.
83 * @returns A promise that fulfills with a `ListVersionsResult`.
84 */
85 listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
86 /**
87 * Creates and returns a new Remote Config template from a JSON string.
88 *
89 * @param json - The JSON string to populate a Remote Config template.
90 *
91 * @returns A new template instance.
92 */
93 createTemplateFromJSON(json: string): RemoteConfigTemplate;
94}