UNPKG

8.73 kBTypeScriptView Raw
1/*! firebase-admin v10.0.0 */
2/*!
3 * Copyright 2021 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 */
17/**
18 * Colors that are associated with conditions for display purposes.
19 */
20export declare type TagColor = 'BLUE' | 'BROWN' | 'CYAN' | 'DEEP_ORANGE' | 'GREEN' | 'INDIGO' | 'LIME' | 'ORANGE' | 'PINK' | 'PURPLE' | 'TEAL';
21/**
22 * Type representing a Remote Config parameter value data type.
23 * Defaults to `STRING` if unspecified.
24 */
25export declare type ParameterValueType = 'STRING' | 'BOOLEAN' | 'NUMBER' | 'JSON';
26/**
27 * Interface representing a Remote Config condition.
28 * A condition targets a specific group of users. A list of these conditions make up
29 * part of a Remote Config template.
30 */
31export interface RemoteConfigCondition {
32 /**
33 * A non-empty and unique name of this condition.
34 */
35 name: string;
36 /**
37 * The logic of this condition.
38 * See the documentation on
39 * {@link https://firebase.google.com/docs/remote-config/condition-reference | condition expressions}
40 * for the expected syntax of this field.
41 */
42 expression: string;
43 /**
44 * The color associated with this condition for display purposes in the Firebase Console.
45 * Not specifying this value results in the console picking an arbitrary color to associate
46 * with the condition.
47 */
48 tagColor?: TagColor;
49}
50/**
51 * Interface representing an explicit parameter value.
52 */
53export interface ExplicitParameterValue {
54 /**
55 * The `string` value that the parameter is set to.
56 */
57 value: string;
58}
59/**
60 * Interface representing an in-app-default value.
61 */
62export interface InAppDefaultValue {
63 /**
64 * If `true`, the parameter is omitted from the parameter values returned to a client.
65 */
66 useInAppDefault: boolean;
67}
68/**
69 * Type representing a Remote Config parameter value.
70 * A `RemoteConfigParameterValue` could be either an `ExplicitParameterValue` or
71 * an `InAppDefaultValue`.
72 */
73export declare type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue;
74/**
75 * Interface representing a Remote Config parameter.
76 * At minimum, a `defaultValue` or a `conditionalValues` entry must be present for the
77 * parameter to have any effect.
78 */
79export interface RemoteConfigParameter {
80 /**
81 * The value to set the parameter to, when none of the named conditions evaluate to `true`.
82 */
83 defaultValue?: RemoteConfigParameterValue;
84 /**
85 * A `(condition name, value)` map. The condition name of the highest priority
86 * (the one listed first in the Remote Config template's conditions list) determines the value of
87 * this parameter.
88 */
89 conditionalValues?: {
90 [key: string]: RemoteConfigParameterValue;
91 };
92 /**
93 * A description for this parameter. Should not be over 100 characters and may contain any
94 * Unicode characters.
95 */
96 description?: string;
97 /**
98 * The data type for all values of this parameter in the current version of the template.
99 * Defaults to `ParameterValueType.STRING` if unspecified.
100 */
101 valueType?: ParameterValueType;
102}
103/**
104 * Interface representing a Remote Config parameter group.
105 * Grouping parameters is only for management purposes and does not affect client-side
106 * fetching of parameter values.
107 */
108export interface RemoteConfigParameterGroup {
109 /**
110 * A description for the group. Its length must be less than or equal to 256 characters.
111 * A description may contain any Unicode characters.
112 */
113 description?: string;
114 /**
115 * Map of parameter keys to their optional default values and optional conditional values for
116 * parameters that belong to this group. A parameter only appears once per
117 * Remote Config template. An ungrouped parameter appears at the top level, whereas a
118 * parameter organized within a group appears within its group's map of parameters.
119 */
120 parameters: {
121 [key: string]: RemoteConfigParameter;
122 };
123}
124/**
125 * Interface representing a Remote Config template.
126 */
127export interface RemoteConfigTemplate {
128 /**
129 * A list of conditions in descending order by priority.
130 */
131 conditions: RemoteConfigCondition[];
132 /**
133 * Map of parameter keys to their optional default values and optional conditional values.
134 */
135 parameters: {
136 [key: string]: RemoteConfigParameter;
137 };
138 /**
139 * Map of parameter group names to their parameter group objects.
140 * A group's name is mutable but must be unique among groups in the Remote Config template.
141 * The name is limited to 256 characters and intended to be human-readable. Any Unicode
142 * characters are allowed.
143 */
144 parameterGroups: {
145 [key: string]: RemoteConfigParameterGroup;
146 };
147 /**
148 * ETag of the current Remote Config template (readonly).
149 */
150 readonly etag: string;
151 /**
152 * Version information for the current Remote Config template.
153 */
154 version?: Version;
155}
156/**
157 * Interface representing a Remote Config user.
158 */
159export interface RemoteConfigUser {
160 /**
161 * Email address. Output only.
162 */
163 email: string;
164 /**
165 * Display name. Output only.
166 */
167 name?: string;
168 /**
169 * Image URL. Output only.
170 */
171 imageUrl?: string;
172}
173/**
174 * Interface representing a Remote Config template version.
175 * Output only, except for the version description. Contains metadata about a particular
176 * version of the Remote Config template. All fields are set at the time the specified Remote
177 * Config template is published. A version's description field may be specified in
178 * `publishTemplate` calls.
179 */
180export interface Version {
181 /**
182 * The version number of a Remote Config template.
183 */
184 versionNumber?: string;
185 /**
186 * The timestamp of when this version of the Remote Config template was written to the
187 * Remote Config backend.
188 */
189 updateTime?: string;
190 /**
191 * The origin of the template update action.
192 */
193 updateOrigin?: ('REMOTE_CONFIG_UPDATE_ORIGIN_UNSPECIFIED' | 'CONSOLE' | 'REST_API' | 'ADMIN_SDK_NODE');
194 /**
195 * The type of the template update action.
196 */
197 updateType?: ('REMOTE_CONFIG_UPDATE_TYPE_UNSPECIFIED' | 'INCREMENTAL_UPDATE' | 'FORCED_UPDATE' | 'ROLLBACK');
198 /**
199 * Aggregation of all metadata fields about the account that performed the update.
200 */
201 updateUser?: RemoteConfigUser;
202 /**
203 * The user-provided description of the corresponding Remote Config template.
204 */
205 description?: string;
206 /**
207 * The version number of the Remote Config template that has become the current version
208 * due to a rollback. Only present if this version is the result of a rollback.
209 */
210 rollbackSource?: string;
211 /**
212 * Indicates whether this Remote Config template was published before version history was
213 * supported.
214 */
215 isLegacy?: boolean;
216}
217/**
218 * Interface representing a list of Remote Config template versions.
219 */
220export interface ListVersionsResult {
221 /**
222 * A list of version metadata objects, sorted in reverse chronological order.
223 */
224 versions: Version[];
225 /**
226 * Token to retrieve the next page of results, or empty if there are no more results
227 * in the list.
228 */
229 nextPageToken?: string;
230}
231/**
232 * Interface representing options for Remote Config list versions operation.
233 */
234export interface ListVersionsOptions {
235 /**
236 * The maximum number of items to return per page.
237 */
238 pageSize?: number;
239 /**
240 * The `nextPageToken` value returned from a previous list versions request, if any.
241 */
242 pageToken?: string;
243 /**
244 * Specifies the newest version number to include in the results.
245 * If specified, must be greater than zero. Defaults to the newest version.
246 */
247 endVersionNumber?: string | number;
248 /**
249 * Specifies the earliest update time to include in the results. Any entries updated before this
250 * time are omitted.
251 */
252 startTime?: Date | string;
253 /**
254 * Specifies the latest update time to include in the results. Any entries updated on or after
255 * this time are omitted.
256 */
257 endTime?: Date | string;
258}