1 | /**
|
2 | * @license
|
3 | * Copyright 2020 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 { FirebaseApp } from '@firebase/app';
|
18 | import { LogLevel as RemoteConfigLogLevel, RemoteConfig, Value } from './public_types';
|
19 | /**
|
20 | *
|
21 | * @param app - The {@link @firebase/app#FirebaseApp} instance.
|
22 | * @returns A {@link RemoteConfig} instance.
|
23 | *
|
24 | * @public
|
25 | */
|
26 | export declare function getRemoteConfig(app?: FirebaseApp): RemoteConfig;
|
27 | /**
|
28 | * Makes the last fetched config available to the getters.
|
29 | * @param remoteConfig - The {@link RemoteConfig} instance.
|
30 | * @returns A `Promise` which resolves to true if the current call activated the fetched configs.
|
31 | * If the fetched configs were already activated, the `Promise` will resolve to false.
|
32 | *
|
33 | * @public
|
34 | */
|
35 | export declare function activate(remoteConfig: RemoteConfig): Promise<boolean>;
|
36 | /**
|
37 | * Ensures the last activated config are available to the getters.
|
38 | * @param remoteConfig - The {@link RemoteConfig} instance.
|
39 | *
|
40 | * @returns A `Promise` that resolves when the last activated config is available to the getters.
|
41 | * @public
|
42 | */
|
43 | export declare function ensureInitialized(remoteConfig: RemoteConfig): Promise<void>;
|
44 | /**
|
45 | * Fetches and caches configuration from the Remote Config service.
|
46 | * @param remoteConfig - The {@link RemoteConfig} instance.
|
47 | * @public
|
48 | */
|
49 | export declare function fetchConfig(remoteConfig: RemoteConfig): Promise<void>;
|
50 | /**
|
51 | * Gets all config.
|
52 | *
|
53 | * @param remoteConfig - The {@link RemoteConfig} instance.
|
54 | * @returns All config.
|
55 | *
|
56 | * @public
|
57 | */
|
58 | export declare function getAll(remoteConfig: RemoteConfig): Record<string, Value>;
|
59 | /**
|
60 | * Gets the value for the given key as a boolean.
|
61 | *
|
62 | * Convenience method for calling <code>remoteConfig.getValue(key).asBoolean()</code>.
|
63 | *
|
64 | * @param remoteConfig - The {@link RemoteConfig} instance.
|
65 | * @param key - The name of the parameter.
|
66 | *
|
67 | * @returns The value for the given key as a boolean.
|
68 | * @public
|
69 | */
|
70 | export declare function getBoolean(remoteConfig: RemoteConfig, key: string): boolean;
|
71 | /**
|
72 | * Gets the value for the given key as a number.
|
73 | *
|
74 | * Convenience method for calling <code>remoteConfig.getValue(key).asNumber()</code>.
|
75 | *
|
76 | * @param remoteConfig - The {@link RemoteConfig} instance.
|
77 | * @param key - The name of the parameter.
|
78 | *
|
79 | * @returns The value for the given key as a number.
|
80 | *
|
81 | * @public
|
82 | */
|
83 | export declare function getNumber(remoteConfig: RemoteConfig, key: string): number;
|
84 | /**
|
85 | * Gets the value for the given key as a string.
|
86 | * Convenience method for calling <code>remoteConfig.getValue(key).asString()</code>.
|
87 | *
|
88 | * @param remoteConfig - The {@link RemoteConfig} instance.
|
89 | * @param key - The name of the parameter.
|
90 | *
|
91 | * @returns The value for the given key as a string.
|
92 | *
|
93 | * @public
|
94 | */
|
95 | export declare function getString(remoteConfig: RemoteConfig, key: string): string;
|
96 | /**
|
97 | * Gets the {@link Value} for the given key.
|
98 | *
|
99 | * @param remoteConfig - The {@link RemoteConfig} instance.
|
100 | * @param key - The name of the parameter.
|
101 | *
|
102 | * @returns The value for the given key.
|
103 | *
|
104 | * @public
|
105 | */
|
106 | export declare function getValue(remoteConfig: RemoteConfig, key: string): Value;
|
107 | /**
|
108 | * Defines the log level to use.
|
109 | *
|
110 | * @param remoteConfig - The {@link RemoteConfig} instance.
|
111 | * @param logLevel - The log level to set.
|
112 | *
|
113 | * @public
|
114 | */
|
115 | export declare function setLogLevel(remoteConfig: RemoteConfig, logLevel: RemoteConfigLogLevel): void;
|