Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: generated/googleapis/lib/firebaseremoteconfig/v1.dart

Issue 3006323002: Api-Roll 54: 2017-09-11 (Closed)
Patch Set: use 2.0.0-dev.infinity sdk constraint in pubspecs Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // This is a generated file (see the discoveryapis_generator project).
2
3 library googleapis.firebaseremoteconfig.v1;
4
5 import 'dart:core' as core;
6 import 'dart:async' as async;
7 import 'dart:convert' as convert;
8
9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons;
10 import 'package:http/http.dart' as http;
11
12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart'
13 show ApiRequestError, DetailedApiRequestError;
14
15 const core.String USER_AGENT = 'dart-api-client firebaseremoteconfig/v1';
16
17 /// Firebase Remote Config API allows the 3P clients to manage Remote Config
18 /// conditions and parameters for Firebase applications.
19 class FirebaseremoteconfigApi {
20 final commons.ApiRequester _requester;
21
22 ProjectsResourceApi get projects => new ProjectsResourceApi(_requester);
23
24 FirebaseremoteconfigApi(http.Client client,
25 {core.String rootUrl: "https://firebaseremoteconfig.googleapis.com/",
26 core.String servicePath: ""})
27 : _requester =
28 new commons.ApiRequester(client, rootUrl, servicePath, USER_AGENT);
29 }
30
31 class ProjectsResourceApi {
32 final commons.ApiRequester _requester;
33
34 ProjectsResourceApi(commons.ApiRequester client) : _requester = client;
35
36 /// Get the latest version Remote Configuration for a project.
37 /// Returns the RemoteConfig as the payload, and also the eTag as a
38 /// response header.
39 ///
40 /// Request parameters:
41 ///
42 /// [project] - The GMP project identifier. Required.
43 /// See note at the beginning of this file regarding project ids.
44 /// Value must have pattern "^projects/[^/]+$".
45 ///
46 /// Completes with a [RemoteConfig].
47 ///
48 /// Completes with a [commons.ApiRequestError] if the API endpoint returned
49 /// an error.
50 ///
51 /// If the used [http.Client] completes with an error when making a REST
52 /// call, this method will complete with the same error.
53 async.Future<RemoteConfig> getRemoteConfig(core.String project) {
54 var _url = null;
55 var _queryParams = new core.Map();
56 var _uploadMedia = null;
57 var _uploadOptions = null;
58 var _downloadOptions = commons.DownloadOptions.Metadata;
59 var _body = null;
60
61 if (project == null) {
62 throw new core.ArgumentError("Parameter project is required.");
63 }
64
65 _url = 'v1/' +
66 commons.Escaper.ecapeVariableReserved('$project') +
67 '/remoteConfig';
68
69 var _response = _requester.request(_url, "GET",
70 body: _body,
71 queryParams: _queryParams,
72 uploadOptions: _uploadOptions,
73 uploadMedia: _uploadMedia,
74 downloadOptions: _downloadOptions);
75 return _response.then((data) => new RemoteConfig.fromJson(data));
76 }
77
78 /// Update a RemoteConfig. We treat this as an always-existing
79 /// resource (when it is not found in our data store, we treat it as version
80 /// 0, a template with zero conditions and zero parameters). Hence there are
81 /// no Create or Delete operations. Returns the updated template when
82 /// successful (and the updated eTag as a response header), or an error if
83 /// things go wrong.
84 /// Possible error messages:
85 /// * VALIDATION_ERROR (HTTP status 400) with additional details if the
86 /// template being passed in can not be validated.
87 /// * AUTHENTICATION_ERROR (HTTP status 401) if the request can not be
88 /// authenticate (e.g. no access token, or invalid access token).
89 /// * AUTHORIZATION_ERROR (HTTP status 403) if the request can not be
90 /// authorized (e.g. the user has no access to the specified project id).
91 /// * VERSION_MISMATCH (HTTP status 412) when trying to update when the
92 /// expected eTag (passed in via the "If-match" header) is not specified, or
93 /// is specified but does does not match the current eTag.
94 /// * Internal error (HTTP status 500) for Database problems or other
95 /// internal
96 /// errors.
97 ///
98 /// [request] - The metadata request object.
99 ///
100 /// Request parameters:
101 ///
102 /// [project] - The GMP project identifier. Required.
103 /// See note at the beginning of this file regarding project ids.
104 /// Value must have pattern "^projects/[^/]+$".
105 ///
106 /// [validateOnly] - Optional. Defaults to <code>false</code>
107 /// (UpdateRemoteConfig call should
108 /// update the backend if there are no validation/interal errors). May be set
109 /// to <code>true</code> to indicate that, should no validation errors occur,
110 /// the call should return a "200 OK" instead of performing the update. Note
111 /// that other error messages (500 Internal Error, 412 Version Mismatch, etc)
112 /// may still result after flipping to <code>false</code>, even if getting a
113 /// "200 OK" when calling with <code>true</code>.
114 ///
115 /// Completes with a [RemoteConfig].
116 ///
117 /// Completes with a [commons.ApiRequestError] if the API endpoint returned
118 /// an error.
119 ///
120 /// If the used [http.Client] completes with an error when making a REST
121 /// call, this method will complete with the same error.
122 async.Future<RemoteConfig> updateRemoteConfig(
123 RemoteConfig request, core.String project,
124 {core.bool validateOnly}) {
125 var _url = null;
126 var _queryParams = new core.Map();
127 var _uploadMedia = null;
128 var _uploadOptions = null;
129 var _downloadOptions = commons.DownloadOptions.Metadata;
130 var _body = null;
131
132 if (request != null) {
133 _body = convert.JSON.encode((request).toJson());
134 }
135 if (project == null) {
136 throw new core.ArgumentError("Parameter project is required.");
137 }
138 if (validateOnly != null) {
139 _queryParams["validateOnly"] = ["${validateOnly}"];
140 }
141
142 _url = 'v1/' +
143 commons.Escaper.ecapeVariableReserved('$project') +
144 '/remoteConfig';
145
146 var _response = _requester.request(_url, "PUT",
147 body: _body,
148 queryParams: _queryParams,
149 uploadOptions: _uploadOptions,
150 uploadMedia: _uploadMedia,
151 downloadOptions: _downloadOptions);
152 return _response.then((data) => new RemoteConfig.fromJson(data));
153 }
154 }
155
156 /// *
157 /// The RemoteConfig consists of a list of conditions (which can be
158 /// thought of as named "if" statements) and a map of parameters (parameter key
159 /// to a stucture containing an optional default value, as well as a optional
160 /// submap of (condition name to value when that condition is true).
161 class RemoteConfig {
162 /// The list of named conditions. The order *does* affect the semantics.
163 /// The condition_name values of these entries must be unique.
164 ///
165 /// The resolved value of a config parameter P is determined as follow:
166 /// * Let Y be the set of values from the submap of P that refer to
167 /// conditions
168 /// that evaluate to <code>true</code>.
169 /// * If Y is non empty, the value is taken from the specific submap in Y
170 /// whose
171 /// condition_name is the earliest in this condition list.
172 /// * Else, if P has a default value option (condition_name is empty) then
173 /// the value is taken from that option.
174 /// * Else, parameter P has no value and is omitted from the config result.
175 ///
176 /// Example: parameter key "p1", default value "v1", submap specified as
177 /// {"c1": v2, "c2": v3} where "c1" and "c2" are names of conditions in the
178 /// condition list (where "c1" in this example appears before "c2"). The
179 /// value of p1 would be v2 as long as c1 is true. Otherwise, if c2 is true,
180 /// p1 would evaluate to v3, and if c1 and c2 are both false, p1 would
181 /// evaluate
182 /// to v1. If no default value was specified, and c1 and c2 were both false,
183 /// no value for p1 would be generated.
184 core.List<RemoteConfigCondition> conditions;
185
186 /// Map of parameter keys to their optional default values and optional
187 /// submap
188 /// of (condition name : value). Order doesn't affect semantics, and so is
189 /// sorted by the server. The 'key' values of the params must be unique.
190 core.Map<core.String, RemoteConfigParameter> parameters;
191
192 RemoteConfig();
193
194 RemoteConfig.fromJson(core.Map _json) {
195 if (_json.containsKey("conditions")) {
196 conditions = _json["conditions"]
197 .map((value) => new RemoteConfigCondition.fromJson(value))
198 .toList();
199 }
200 if (_json.containsKey("parameters")) {
201 parameters = commons
202 .mapMap<core.Map<core.String, core.Object>, RemoteConfigParameter>(
203 _json["parameters"],
204 (core.Map<core.String, core.Object> item) =>
205 new RemoteConfigParameter.fromJson(item));
206 }
207 }
208
209 core.Map<core.String, core.Object> toJson() {
210 final core.Map<core.String, core.Object> _json =
211 new core.Map<core.String, core.Object>();
212 if (conditions != null) {
213 _json["conditions"] =
214 conditions.map((value) => (value).toJson()).toList();
215 }
216 if (parameters != null) {
217 _json["parameters"] = commons
218 .mapMap<RemoteConfigParameter, core.Map<core.String, core.Object>>(
219 parameters, (RemoteConfigParameter item) => (item).toJson());
220 }
221 return _json;
222 }
223 }
224
225 /// A single RemoteConfig Condition. A list of these (because order matters)
226 /// are
227 /// part of a single RemoteConfig template.
228 class RemoteConfigCondition {
229 /// Required.
230 core.String expression;
231
232 /// Required.
233 /// A non empty and unique name of this condition.
234 core.String name;
235
236 /// Optional.
237 /// The display (tag) color of this condition. This serves as part of a tag
238 /// (in the future, we may add tag text as well as tag color, but that is not
239 /// yet implemented in the UI).
240 /// This value has no affect on the semantics of the delivered config and it
241 /// is ignored by the backend, except for passing it through write/read
242 /// requests.
243 /// Not having this value or having the "CONDITION_DISPLAY_COLOR_UNSPECIFIED"
244 /// value (0) have the same meaning: Let the UI choose any valid color when
245 /// displaying the condition.
246 /// Possible string values are:
247 /// - "CONDITION_DISPLAY_COLOR_UNSPECIFIED"
248 /// - "BLUE" : Blue
249 /// - "BROWN" : Brown
250 /// - "CYAN" : Cyan
251 /// - "DEEP_ORANGE" : aka "Red Orange"
252 /// - "GREEN" : Green
253 /// - "INDIGO" : Indigo
254 /// *
255 /// - "LIME" : Lime - Approved deviation from Material color palette
256 /// - "ORANGE" : Orange
257 /// - "PINK" : Pink
258 /// - "PURPLE" : Purple
259 /// - "TEAL" : Teal
260 core.String tagColor;
261
262 RemoteConfigCondition();
263
264 RemoteConfigCondition.fromJson(core.Map _json) {
265 if (_json.containsKey("expression")) {
266 expression = _json["expression"];
267 }
268 if (_json.containsKey("name")) {
269 name = _json["name"];
270 }
271 if (_json.containsKey("tagColor")) {
272 tagColor = _json["tagColor"];
273 }
274 }
275
276 core.Map<core.String, core.Object> toJson() {
277 final core.Map<core.String, core.Object> _json =
278 new core.Map<core.String, core.Object>();
279 if (expression != null) {
280 _json["expression"] = expression;
281 }
282 if (name != null) {
283 _json["name"] = name;
284 }
285 if (tagColor != null) {
286 _json["tagColor"] = tagColor;
287 }
288 return _json;
289 }
290 }
291
292 /// While default_value and conditional_values are each optional, at least one
293 /// of
294 /// the two is required - otherwise, the parameter is meaningless (and an
295 /// exception will be thrown by the validation logic).
296 class RemoteConfigParameter {
297 /// Optional - a map of (condition_name, value). The condition_name of the
298 /// highest priority (the one listed first in the conditions array)
299 /// determines
300 /// the value of this parameter.
301 core.Map<core.String, RemoteConfigParameterValue> conditionalValues;
302
303 /// Optional - value to set the parameter to, when none of the named
304 /// conditions
305 /// evaluate to <code>true</code>.
306 RemoteConfigParameterValue defaultValue;
307
308 RemoteConfigParameter();
309
310 RemoteConfigParameter.fromJson(core.Map _json) {
311 if (_json.containsKey("conditionalValues")) {
312 conditionalValues = commons.mapMap<core.Map<core.String, core.Object>,
313 RemoteConfigParameterValue>(
314 _json["conditionalValues"],
315 (core.Map<core.String, core.Object> item) =>
316 new RemoteConfigParameterValue.fromJson(item));
317 }
318 if (_json.containsKey("defaultValue")) {
319 defaultValue =
320 new RemoteConfigParameterValue.fromJson(_json["defaultValue"]);
321 }
322 }
323
324 core.Map<core.String, core.Object> toJson() {
325 final core.Map<core.String, core.Object> _json =
326 new core.Map<core.String, core.Object>();
327 if (conditionalValues != null) {
328 _json["conditionalValues"] = commons.mapMap<RemoteConfigParameterValue,
329 core.Map<core.String, core.Object>>(conditionalValues,
330 (RemoteConfigParameterValue item) => (item).toJson());
331 }
332 if (defaultValue != null) {
333 _json["defaultValue"] = (defaultValue).toJson();
334 }
335 return _json;
336 }
337 }
338
339 /// A RemoteConfigParameter's "value" (either the default value, or the value
340 /// associated with a condition name) is either a string, or the
341 /// "use_in_app_default" indicator (which means to leave out the parameter from
342 /// the returned <key, value> map that is the output of the parameter fetch).
343 /// We represent the "use_in_app_default" as a bool, but (when using the
344 /// boolean
345 /// instead of the string) it should always be <code>true</code>.
346 class RemoteConfigParameterValue {
347 /// if true, omit the parameter from the map of fetched parameter values
348 core.bool useInAppDefault;
349
350 /// the string to set the parameter to
351 core.String value;
352
353 RemoteConfigParameterValue();
354
355 RemoteConfigParameterValue.fromJson(core.Map _json) {
356 if (_json.containsKey("useInAppDefault")) {
357 useInAppDefault = _json["useInAppDefault"];
358 }
359 if (_json.containsKey("value")) {
360 value = _json["value"];
361 }
362 }
363
364 core.Map<core.String, core.Object> toJson() {
365 final core.Map<core.String, core.Object> _json =
366 new core.Map<core.String, core.Object>();
367 if (useInAppDefault != null) {
368 _json["useInAppDefault"] = useInAppDefault;
369 }
370 if (value != null) {
371 _json["value"] = value;
372 }
373 return _json;
374 }
375 }
OLDNEW
« no previous file with comments | « generated/googleapis/lib/firebasedynamiclinks/v1.dart ('k') | generated/googleapis/lib/firebaserules/v1.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698