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

Side by Side Diff: generated/googleapis/lib/pagespeedonline/v2.dart

Issue 904493003: API roll 11 v2: 2015-02-06 (Closed) Base URL: https://github.com/dart-lang/googleapis.git@master
Patch Set: Created 5 years, 10 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 library googleapis.pagespeedonline.v2;
2
3 import "dart:core" as core;
4 import "dart:collection" as collection;
5 import "dart:async" as async;
6 import "dart:convert" as convert;
7
8 import "package:crypto/crypto.dart" as crypto;
9 import 'package:http/http.dart' as http;
10 import '../src/common_internal.dart' as common_internal;
11 import '../common/common.dart' as common;
12
13 export '../common/common.dart' show ApiRequestError;
14 export '../common/common.dart' show DetailedApiRequestError;
15
16 /**
17 * Lets you analyze the performance of a web page and get tailored suggestions
18 * to make that page faster.
19 */
20 class PagespeedonlineApi {
21
22 final common_internal.ApiRequester _requester;
23
24 PagespeedapiResourceApi get pagespeedapi => new PagespeedapiResourceApi(_reque ster);
25
26 PagespeedonlineApi(http.Client client, {core.String rootUrl: "https://www.goog leapis.com/", core.String servicePath: "pagespeedonline/v2/"}) :
27 _requester = new common_internal.ApiRequester(client, rootUrl, servicePath );
28 }
29
30
31 /** Not documented yet. */
32 class PagespeedapiResourceApi {
33 final common_internal.ApiRequester _requester;
34
35 PagespeedapiResourceApi(common_internal.ApiRequester client) :
36 _requester = client;
37
38 /**
39 * Runs PageSpeed analysis on the page at the specified URL, and returns
40 * PageSpeed scores, a list of suggestions to make that page faster, and other
41 * information.
42 *
43 * Request parameters:
44 *
45 * [url] - The URL to fetch and analyze
46 * Value must have pattern "http(s)?://.*".
47 *
48 * [filterThirdPartyResources] - Indicates if third party resources should be
49 * filtered out before PageSpeed analysis.
50 *
51 * [locale] - The locale used to localize formatted results
52 * Value must have pattern "[a-zA-Z]+(_[a-zA-Z]+)?".
53 *
54 * [rule] - A PageSpeed rule to run; if none are given, all rules are run
55 * Value must have pattern "[a-zA-Z]+".
56 *
57 * [screenshot] - Indicates if binary data containing a screenshot should be
58 * included
59 *
60 * [strategy] - The analysis strategy to use
61 * Possible string values are:
62 * - "desktop" : Fetch and analyze the URL for desktop browsers
63 * - "mobile" : Fetch and analyze the URL for mobile devices
64 *
65 * Completes with a [Result].
66 *
67 * Completes with a [common.ApiRequestError] if the API endpoint returned an
68 * error.
69 *
70 * If the used [http.Client] completes with an error when making a REST call,
71 * this method will complete with the same error.
72 */
73 async.Future<Result> runpagespeed(core.String url, {core.bool filterThirdParty Resources, core.String locale, core.List<core.String> rule, core.bool screenshot , core.String strategy}) {
74 var _url = null;
75 var _queryParams = new core.Map();
76 var _uploadMedia = null;
77 var _uploadOptions = null;
78 var _downloadOptions = common.DownloadOptions.Metadata;
79 var _body = null;
80
81 if (url == null) {
82 throw new core.ArgumentError("Parameter url is required.");
83 }
84 _queryParams["url"] = [url];
85 if (filterThirdPartyResources != null) {
86 _queryParams["filter_third_party_resources"] = ["${filterThirdPartyResourc es}"];
87 }
88 if (locale != null) {
89 _queryParams["locale"] = [locale];
90 }
91 if (rule != null) {
92 _queryParams["rule"] = rule;
93 }
94 if (screenshot != null) {
95 _queryParams["screenshot"] = ["${screenshot}"];
96 }
97 if (strategy != null) {
98 _queryParams["strategy"] = [strategy];
99 }
100
101
102 _url = 'runPagespeed';
103
104 var _response = _requester.request(_url,
105 "GET",
106 body: _body,
107 queryParams: _queryParams,
108 uploadOptions: _uploadOptions,
109 uploadMedia: _uploadMedia,
110 downloadOptions: _downloadOptions);
111 return _response.then((data) => new Result.fromJson(data));
112 }
113
114 }
115
116
117
118 /** Not documented yet. */
119 class PagespeedApiFormatStringV2ArgsRects {
120 /** The height of the rect. */
121 core.int height;
122
123 /** The left coordinate of the rect, in page coordinates. */
124 core.int left;
125
126 /** The top coordinate of the rect, in page coordinates. */
127 core.int top;
128
129 /** The width of the rect. */
130 core.int width;
131
132
133 PagespeedApiFormatStringV2ArgsRects();
134
135 PagespeedApiFormatStringV2ArgsRects.fromJson(core.Map _json) {
136 if (_json.containsKey("height")) {
137 height = _json["height"];
138 }
139 if (_json.containsKey("left")) {
140 left = _json["left"];
141 }
142 if (_json.containsKey("top")) {
143 top = _json["top"];
144 }
145 if (_json.containsKey("width")) {
146 width = _json["width"];
147 }
148 }
149
150 core.Map toJson() {
151 var _json = new core.Map();
152 if (height != null) {
153 _json["height"] = height;
154 }
155 if (left != null) {
156 _json["left"] = left;
157 }
158 if (top != null) {
159 _json["top"] = top;
160 }
161 if (width != null) {
162 _json["width"] = width;
163 }
164 return _json;
165 }
166 }
167
168
169 /** Not documented yet. */
170 class PagespeedApiFormatStringV2ArgsSecondaryRects {
171 /** The height of the rect. */
172 core.int height;
173
174 /** The left coordinate of the rect, in page coordinates. */
175 core.int left;
176
177 /** The top coordinate of the rect, in page coordinates. */
178 core.int top;
179
180 /** The width of the rect. */
181 core.int width;
182
183
184 PagespeedApiFormatStringV2ArgsSecondaryRects();
185
186 PagespeedApiFormatStringV2ArgsSecondaryRects.fromJson(core.Map _json) {
187 if (_json.containsKey("height")) {
188 height = _json["height"];
189 }
190 if (_json.containsKey("left")) {
191 left = _json["left"];
192 }
193 if (_json.containsKey("top")) {
194 top = _json["top"];
195 }
196 if (_json.containsKey("width")) {
197 width = _json["width"];
198 }
199 }
200
201 core.Map toJson() {
202 var _json = new core.Map();
203 if (height != null) {
204 _json["height"] = height;
205 }
206 if (left != null) {
207 _json["left"] = left;
208 }
209 if (top != null) {
210 _json["top"] = top;
211 }
212 if (width != null) {
213 _json["width"] = width;
214 }
215 return _json;
216 }
217 }
218
219
220 /** Not documented yet. */
221 class PagespeedApiFormatStringV2Args {
222 /** The placeholder key for this arg, as a string. */
223 core.String key;
224
225 /**
226 * The screen rectangles being referred to, with dimensions measured in CSS
227 * pixels. This is only ever used for SNAPSHOT_RECT arguments. If this is
228 * absent for a SNAPSHOT_RECT argument, it means that that argument refers to
229 * the entire snapshot.
230 */
231 core.List<PagespeedApiFormatStringV2ArgsRects> rects;
232
233 /**
234 * Secondary screen rectangles being referred to, with dimensions measured in
235 * CSS pixels. This is only ever used for SNAPSHOT_RECT arguments.
236 */
237 core.List<PagespeedApiFormatStringV2ArgsSecondaryRects> secondaryRects;
238
239 /**
240 * Type of argument. One of URL, STRING_LITERAL, INT_LITERAL, BYTES, DURATION,
241 * VERBATIM_STRING, PERCENTAGE, HYPERLINK, or SNAPSHOT_RECT.
242 */
243 core.String type;
244
245 /** Argument value, as a localized string. */
246 core.String value;
247
248
249 PagespeedApiFormatStringV2Args();
250
251 PagespeedApiFormatStringV2Args.fromJson(core.Map _json) {
252 if (_json.containsKey("key")) {
253 key = _json["key"];
254 }
255 if (_json.containsKey("rects")) {
256 rects = _json["rects"].map((value) => new PagespeedApiFormatStringV2ArgsRe cts.fromJson(value)).toList();
257 }
258 if (_json.containsKey("secondary_rects")) {
259 secondaryRects = _json["secondary_rects"].map((value) => new PagespeedApiF ormatStringV2ArgsSecondaryRects.fromJson(value)).toList();
260 }
261 if (_json.containsKey("type")) {
262 type = _json["type"];
263 }
264 if (_json.containsKey("value")) {
265 value = _json["value"];
266 }
267 }
268
269 core.Map toJson() {
270 var _json = new core.Map();
271 if (key != null) {
272 _json["key"] = key;
273 }
274 if (rects != null) {
275 _json["rects"] = rects.map((value) => (value).toJson()).toList();
276 }
277 if (secondaryRects != null) {
278 _json["secondary_rects"] = secondaryRects.map((value) => (value).toJson()) .toList();
279 }
280 if (type != null) {
281 _json["type"] = type;
282 }
283 if (value != null) {
284 _json["value"] = value;
285 }
286 return _json;
287 }
288 }
289
290
291 /** Not documented yet. */
292 class PagespeedApiFormatStringV2 {
293 /** List of arguments for the format string. */
294 core.List<PagespeedApiFormatStringV2Args> args;
295
296 /**
297 * A localized format string with {{FOO}} placeholders, where 'FOO' is the key
298 * of the argument whose value should be substituted. For HYPERLINK arguments,
299 * the format string will instead contain {{BEGIN_FOO}} and {{END_FOO}} for
300 * the argument with key 'FOO'.
301 */
302 core.String format;
303
304
305 PagespeedApiFormatStringV2();
306
307 PagespeedApiFormatStringV2.fromJson(core.Map _json) {
308 if (_json.containsKey("args")) {
309 args = _json["args"].map((value) => new PagespeedApiFormatStringV2Args.fro mJson(value)).toList();
310 }
311 if (_json.containsKey("format")) {
312 format = _json["format"];
313 }
314 }
315
316 core.Map toJson() {
317 var _json = new core.Map();
318 if (args != null) {
319 _json["args"] = args.map((value) => (value).toJson()).toList();
320 }
321 if (format != null) {
322 _json["format"] = format;
323 }
324 return _json;
325 }
326 }
327
328
329 /**
330 * The region of the page that is captured by this image, with dimensions
331 * measured in CSS pixels.
332 */
333 class PagespeedApiImageV2PageRect {
334 /** The height of the rect. */
335 core.int height;
336
337 /** The left coordinate of the rect, in page coordinates. */
338 core.int left;
339
340 /** The top coordinate of the rect, in page coordinates. */
341 core.int top;
342
343 /** The width of the rect. */
344 core.int width;
345
346
347 PagespeedApiImageV2PageRect();
348
349 PagespeedApiImageV2PageRect.fromJson(core.Map _json) {
350 if (_json.containsKey("height")) {
351 height = _json["height"];
352 }
353 if (_json.containsKey("left")) {
354 left = _json["left"];
355 }
356 if (_json.containsKey("top")) {
357 top = _json["top"];
358 }
359 if (_json.containsKey("width")) {
360 width = _json["width"];
361 }
362 }
363
364 core.Map toJson() {
365 var _json = new core.Map();
366 if (height != null) {
367 _json["height"] = height;
368 }
369 if (left != null) {
370 _json["left"] = left;
371 }
372 if (top != null) {
373 _json["top"] = top;
374 }
375 if (width != null) {
376 _json["width"] = width;
377 }
378 return _json;
379 }
380 }
381
382
383 /** Not documented yet. */
384 class PagespeedApiImageV2 {
385 /** Image data base64 encoded. */
386 core.String data;
387
388 core.List<core.int> get dataAsBytes {
389 return crypto.CryptoUtils.base64StringToBytes(data);
390 }
391
392 void set dataAsBytes(core.List<core.int> _bytes) {
393 data = crypto.CryptoUtils.bytesToBase64(_bytes, urlSafe: true);
394 }
395
396 /** Height of screenshot in pixels. */
397 core.int height;
398
399 /** Unique string key, if any, identifying this image. */
400 core.String key;
401
402 /** Mime type of image data (e.g. "image/jpeg"). */
403 core.String mimeType;
404
405 /**
406 * The region of the page that is captured by this image, with dimensions
407 * measured in CSS pixels.
408 */
409 PagespeedApiImageV2PageRect pageRect;
410
411 /** Width of screenshot in pixels. */
412 core.int width;
413
414
415 PagespeedApiImageV2();
416
417 PagespeedApiImageV2.fromJson(core.Map _json) {
418 if (_json.containsKey("data")) {
419 data = _json["data"];
420 }
421 if (_json.containsKey("height")) {
422 height = _json["height"];
423 }
424 if (_json.containsKey("key")) {
425 key = _json["key"];
426 }
427 if (_json.containsKey("mime_type")) {
428 mimeType = _json["mime_type"];
429 }
430 if (_json.containsKey("page_rect")) {
431 pageRect = new PagespeedApiImageV2PageRect.fromJson(_json["page_rect"]);
432 }
433 if (_json.containsKey("width")) {
434 width = _json["width"];
435 }
436 }
437
438 core.Map toJson() {
439 var _json = new core.Map();
440 if (data != null) {
441 _json["data"] = data;
442 }
443 if (height != null) {
444 _json["height"] = height;
445 }
446 if (key != null) {
447 _json["key"] = key;
448 }
449 if (mimeType != null) {
450 _json["mime_type"] = mimeType;
451 }
452 if (pageRect != null) {
453 _json["page_rect"] = (pageRect).toJson();
454 }
455 if (width != null) {
456 _json["width"] = width;
457 }
458 return _json;
459 }
460 }
461
462
463 /** Not documented yet. */
464 class ResultFormattedResultsRuleResultsValueUrlBlocksUrls {
465 /**
466 * List of entries that provide additional details about a single URL.
467 * Optional.
468 */
469 core.List<PagespeedApiFormatStringV2> details;
470
471 /**
472 * A format string that gives information about the URL, and a list of
473 * arguments for that format string.
474 */
475 PagespeedApiFormatStringV2 result;
476
477
478 ResultFormattedResultsRuleResultsValueUrlBlocksUrls();
479
480 ResultFormattedResultsRuleResultsValueUrlBlocksUrls.fromJson(core.Map _json) {
481 if (_json.containsKey("details")) {
482 details = _json["details"].map((value) => new PagespeedApiFormatStringV2.f romJson(value)).toList();
483 }
484 if (_json.containsKey("result")) {
485 result = new PagespeedApiFormatStringV2.fromJson(_json["result"]);
486 }
487 }
488
489 core.Map toJson() {
490 var _json = new core.Map();
491 if (details != null) {
492 _json["details"] = details.map((value) => (value).toJson()).toList();
493 }
494 if (result != null) {
495 _json["result"] = (result).toJson();
496 }
497 return _json;
498 }
499 }
500
501
502 /** Not documented yet. */
503 class ResultFormattedResultsRuleResultsValueUrlBlocks {
504 /** Heading to be displayed with the list of URLs. */
505 PagespeedApiFormatStringV2 header;
506
507 /**
508 * List of entries that provide information about URLs in the url block.
509 * Optional.
510 */
511 core.List<ResultFormattedResultsRuleResultsValueUrlBlocksUrls> urls;
512
513
514 ResultFormattedResultsRuleResultsValueUrlBlocks();
515
516 ResultFormattedResultsRuleResultsValueUrlBlocks.fromJson(core.Map _json) {
517 if (_json.containsKey("header")) {
518 header = new PagespeedApiFormatStringV2.fromJson(_json["header"]);
519 }
520 if (_json.containsKey("urls")) {
521 urls = _json["urls"].map((value) => new ResultFormattedResultsRuleResultsV alueUrlBlocksUrls.fromJson(value)).toList();
522 }
523 }
524
525 core.Map toJson() {
526 var _json = new core.Map();
527 if (header != null) {
528 _json["header"] = (header).toJson();
529 }
530 if (urls != null) {
531 _json["urls"] = urls.map((value) => (value).toJson()).toList();
532 }
533 return _json;
534 }
535 }
536
537
538 /**
539 * The enum-like identifier for this rule. For instance "EnableKeepAlive" or
540 * "AvoidCssImport". Not localized.
541 */
542 class ResultFormattedResultsRuleResultsValue {
543 /**
544 * List of rule groups that this rule belongs to. Each entry in the list is
545 * one of "SPEED" or "USABILITY".
546 */
547 core.List<core.String> groups;
548
549 /** Localized name of the rule, intended for presentation to a user. */
550 core.String localizedRuleName;
551
552 /**
553 * The impact (unbounded floating point value) that implementing the
554 * suggestions for this rule would have on making the page faster. Impact is
555 * comparable between rules to determine which rule's suggestions would have a
556 * higher or lower impact on making a page faster. For instance, if enabling
557 * compression would save 1MB, while optimizing images would save 500kB, the
558 * enable compression rule would have 2x the impact of the image optimization
559 * rule, all other things being equal.
560 */
561 core.double ruleImpact;
562
563 /**
564 * A brief summary description for the rule, indicating at a high level what
565 * should be done to follow the rule and what benefit can be gained by doing
566 * so.
567 */
568 PagespeedApiFormatStringV2 summary;
569
570 /**
571 * List of blocks of URLs. Each block may contain a heading and a list of
572 * URLs. Each URL may optionally include additional details.
573 */
574 core.List<ResultFormattedResultsRuleResultsValueUrlBlocks> urlBlocks;
575
576
577 ResultFormattedResultsRuleResultsValue();
578
579 ResultFormattedResultsRuleResultsValue.fromJson(core.Map _json) {
580 if (_json.containsKey("groups")) {
581 groups = _json["groups"];
582 }
583 if (_json.containsKey("localizedRuleName")) {
584 localizedRuleName = _json["localizedRuleName"];
585 }
586 if (_json.containsKey("ruleImpact")) {
587 ruleImpact = _json["ruleImpact"];
588 }
589 if (_json.containsKey("summary")) {
590 summary = new PagespeedApiFormatStringV2.fromJson(_json["summary"]);
591 }
592 if (_json.containsKey("urlBlocks")) {
593 urlBlocks = _json["urlBlocks"].map((value) => new ResultFormattedResultsRu leResultsValueUrlBlocks.fromJson(value)).toList();
594 }
595 }
596
597 core.Map toJson() {
598 var _json = new core.Map();
599 if (groups != null) {
600 _json["groups"] = groups;
601 }
602 if (localizedRuleName != null) {
603 _json["localizedRuleName"] = localizedRuleName;
604 }
605 if (ruleImpact != null) {
606 _json["ruleImpact"] = ruleImpact;
607 }
608 if (summary != null) {
609 _json["summary"] = (summary).toJson();
610 }
611 if (urlBlocks != null) {
612 _json["urlBlocks"] = urlBlocks.map((value) => (value).toJson()).toList();
613 }
614 return _json;
615 }
616 }
617
618
619 /**
620 * Localized PageSpeed results. Contains a ruleResults entry for each PageSpeed
621 * rule instantiated and run by the server.
622 */
623 class ResultFormattedResults {
624 /** The locale of the formattedResults, e.g. "en_US". */
625 core.String locale;
626
627 /**
628 * Dictionary of formatted rule results, with one entry for each PageSpeed
629 * rule instantiated and run by the server.
630 */
631 core.Map<core.String, ResultFormattedResultsRuleResultsValue> ruleResults;
632
633
634 ResultFormattedResults();
635
636 ResultFormattedResults.fromJson(core.Map _json) {
637 if (_json.containsKey("locale")) {
638 locale = _json["locale"];
639 }
640 if (_json.containsKey("ruleResults")) {
641 ruleResults = common_internal.mapMap(_json["ruleResults"], (item) => new R esultFormattedResultsRuleResultsValue.fromJson(item));
642 }
643 }
644
645 core.Map toJson() {
646 var _json = new core.Map();
647 if (locale != null) {
648 _json["locale"] = locale;
649 }
650 if (ruleResults != null) {
651 _json["ruleResults"] = common_internal.mapMap(ruleResults, (item) => (item ).toJson());
652 }
653 return _json;
654 }
655 }
656
657
658 /**
659 * Summary statistics for the page, such as number of JavaScript bytes, number
660 * of HTML bytes, etc.
661 */
662 class ResultPageStats {
663 /** Number of uncompressed response bytes for CSS resources on the page. */
664 core.String cssResponseBytes;
665
666 /** Number of response bytes for flash resources on the page. */
667 core.String flashResponseBytes;
668
669 /**
670 * Number of uncompressed response bytes for the main HTML document and all
671 * iframes on the page.
672 */
673 core.String htmlResponseBytes;
674
675 /** Number of response bytes for image resources on the page. */
676 core.String imageResponseBytes;
677
678 /** Number of uncompressed response bytes for JS resources on the page. */
679 core.String javascriptResponseBytes;
680
681 /** Number of CSS resources referenced by the page. */
682 core.int numberCssResources;
683
684 /** Number of unique hosts referenced by the page. */
685 core.int numberHosts;
686
687 /** Number of JavaScript resources referenced by the page. */
688 core.int numberJsResources;
689
690 /** Number of HTTP resources loaded by the page. */
691 core.int numberResources;
692
693 /** Number of static (i.e. cacheable) resources on the page. */
694 core.int numberStaticResources;
695
696 /** Number of response bytes for other resources on the page. */
697 core.String otherResponseBytes;
698
699 /**
700 * Number of uncompressed response bytes for text resources not covered by
701 * other statistics (i.e non-HTML, non-script, non-CSS resources) on the page.
702 */
703 core.String textResponseBytes;
704
705 /** Total size of all request bytes sent by the page. */
706 core.String totalRequestBytes;
707
708
709 ResultPageStats();
710
711 ResultPageStats.fromJson(core.Map _json) {
712 if (_json.containsKey("cssResponseBytes")) {
713 cssResponseBytes = _json["cssResponseBytes"];
714 }
715 if (_json.containsKey("flashResponseBytes")) {
716 flashResponseBytes = _json["flashResponseBytes"];
717 }
718 if (_json.containsKey("htmlResponseBytes")) {
719 htmlResponseBytes = _json["htmlResponseBytes"];
720 }
721 if (_json.containsKey("imageResponseBytes")) {
722 imageResponseBytes = _json["imageResponseBytes"];
723 }
724 if (_json.containsKey("javascriptResponseBytes")) {
725 javascriptResponseBytes = _json["javascriptResponseBytes"];
726 }
727 if (_json.containsKey("numberCssResources")) {
728 numberCssResources = _json["numberCssResources"];
729 }
730 if (_json.containsKey("numberHosts")) {
731 numberHosts = _json["numberHosts"];
732 }
733 if (_json.containsKey("numberJsResources")) {
734 numberJsResources = _json["numberJsResources"];
735 }
736 if (_json.containsKey("numberResources")) {
737 numberResources = _json["numberResources"];
738 }
739 if (_json.containsKey("numberStaticResources")) {
740 numberStaticResources = _json["numberStaticResources"];
741 }
742 if (_json.containsKey("otherResponseBytes")) {
743 otherResponseBytes = _json["otherResponseBytes"];
744 }
745 if (_json.containsKey("textResponseBytes")) {
746 textResponseBytes = _json["textResponseBytes"];
747 }
748 if (_json.containsKey("totalRequestBytes")) {
749 totalRequestBytes = _json["totalRequestBytes"];
750 }
751 }
752
753 core.Map toJson() {
754 var _json = new core.Map();
755 if (cssResponseBytes != null) {
756 _json["cssResponseBytes"] = cssResponseBytes;
757 }
758 if (flashResponseBytes != null) {
759 _json["flashResponseBytes"] = flashResponseBytes;
760 }
761 if (htmlResponseBytes != null) {
762 _json["htmlResponseBytes"] = htmlResponseBytes;
763 }
764 if (imageResponseBytes != null) {
765 _json["imageResponseBytes"] = imageResponseBytes;
766 }
767 if (javascriptResponseBytes != null) {
768 _json["javascriptResponseBytes"] = javascriptResponseBytes;
769 }
770 if (numberCssResources != null) {
771 _json["numberCssResources"] = numberCssResources;
772 }
773 if (numberHosts != null) {
774 _json["numberHosts"] = numberHosts;
775 }
776 if (numberJsResources != null) {
777 _json["numberJsResources"] = numberJsResources;
778 }
779 if (numberResources != null) {
780 _json["numberResources"] = numberResources;
781 }
782 if (numberStaticResources != null) {
783 _json["numberStaticResources"] = numberStaticResources;
784 }
785 if (otherResponseBytes != null) {
786 _json["otherResponseBytes"] = otherResponseBytes;
787 }
788 if (textResponseBytes != null) {
789 _json["textResponseBytes"] = textResponseBytes;
790 }
791 if (totalRequestBytes != null) {
792 _json["totalRequestBytes"] = totalRequestBytes;
793 }
794 return _json;
795 }
796 }
797
798
799 /** The name of this rule group: one of "SPEED" or "USABILITY". */
800 class ResultRuleGroupsValue {
801 /**
802 * The score (0-100) for this rule group, which indicates how much better a
803 * page could be in that category (e.g. how much faster, or how much more
804 * usable). A high score indicates little room for improvement, while a lower
805 * score indicates more room for improvement.
806 */
807 core.int score;
808
809
810 ResultRuleGroupsValue();
811
812 ResultRuleGroupsValue.fromJson(core.Map _json) {
813 if (_json.containsKey("score")) {
814 score = _json["score"];
815 }
816 }
817
818 core.Map toJson() {
819 var _json = new core.Map();
820 if (score != null) {
821 _json["score"] = score;
822 }
823 return _json;
824 }
825 }
826
827
828 /** The version of PageSpeed used to generate these results. */
829 class ResultVersion {
830 /** The major version number of PageSpeed used to generate these results. */
831 core.int major;
832
833 /** The minor version number of PageSpeed used to generate these results. */
834 core.int minor;
835
836
837 ResultVersion();
838
839 ResultVersion.fromJson(core.Map _json) {
840 if (_json.containsKey("major")) {
841 major = _json["major"];
842 }
843 if (_json.containsKey("minor")) {
844 minor = _json["minor"];
845 }
846 }
847
848 core.Map toJson() {
849 var _json = new core.Map();
850 if (major != null) {
851 _json["major"] = major;
852 }
853 if (minor != null) {
854 _json["minor"] = minor;
855 }
856 return _json;
857 }
858 }
859
860
861 /** Not documented yet. */
862 class Result {
863 /**
864 * Localized PageSpeed results. Contains a ruleResults entry for each
865 * PageSpeed rule instantiated and run by the server.
866 */
867 ResultFormattedResults formattedResults;
868
869 /**
870 * Canonicalized and final URL for the document, after following page
871 * redirects (if any).
872 */
873 core.String id;
874
875 /**
876 * List of rules that were specified in the request, but which the server did
877 * not know how to instantiate.
878 */
879 core.List<core.String> invalidRules;
880
881 /** Kind of result. */
882 core.String kind;
883
884 /**
885 * Summary statistics for the page, such as number of JavaScript bytes, number
886 * of HTML bytes, etc.
887 */
888 ResultPageStats pageStats;
889
890 /**
891 * Response code for the document. 200 indicates a normal page load. 4xx/5xx
892 * indicates an error.
893 */
894 core.int responseCode;
895
896 /** A map with one entry for each rule group in these results. */
897 core.Map<core.String, ResultRuleGroupsValue> ruleGroups;
898
899 /** Base64-encoded screenshot of the page that was analyzed. */
900 PagespeedApiImageV2 screenshot;
901
902 /** Title of the page, as displayed in the browser's title bar. */
903 core.String title;
904
905 /** The version of PageSpeed used to generate these results. */
906 ResultVersion version;
907
908
909 Result();
910
911 Result.fromJson(core.Map _json) {
912 if (_json.containsKey("formattedResults")) {
913 formattedResults = new ResultFormattedResults.fromJson(_json["formattedRes ults"]);
914 }
915 if (_json.containsKey("id")) {
916 id = _json["id"];
917 }
918 if (_json.containsKey("invalidRules")) {
919 invalidRules = _json["invalidRules"];
920 }
921 if (_json.containsKey("kind")) {
922 kind = _json["kind"];
923 }
924 if (_json.containsKey("pageStats")) {
925 pageStats = new ResultPageStats.fromJson(_json["pageStats"]);
926 }
927 if (_json.containsKey("responseCode")) {
928 responseCode = _json["responseCode"];
929 }
930 if (_json.containsKey("ruleGroups")) {
931 ruleGroups = common_internal.mapMap(_json["ruleGroups"], (item) => new Res ultRuleGroupsValue.fromJson(item));
932 }
933 if (_json.containsKey("screenshot")) {
934 screenshot = new PagespeedApiImageV2.fromJson(_json["screenshot"]);
935 }
936 if (_json.containsKey("title")) {
937 title = _json["title"];
938 }
939 if (_json.containsKey("version")) {
940 version = new ResultVersion.fromJson(_json["version"]);
941 }
942 }
943
944 core.Map toJson() {
945 var _json = new core.Map();
946 if (formattedResults != null) {
947 _json["formattedResults"] = (formattedResults).toJson();
948 }
949 if (id != null) {
950 _json["id"] = id;
951 }
952 if (invalidRules != null) {
953 _json["invalidRules"] = invalidRules;
954 }
955 if (kind != null) {
956 _json["kind"] = kind;
957 }
958 if (pageStats != null) {
959 _json["pageStats"] = (pageStats).toJson();
960 }
961 if (responseCode != null) {
962 _json["responseCode"] = responseCode;
963 }
964 if (ruleGroups != null) {
965 _json["ruleGroups"] = common_internal.mapMap(ruleGroups, (item) => (item). toJson());
966 }
967 if (screenshot != null) {
968 _json["screenshot"] = (screenshot).toJson();
969 }
970 if (title != null) {
971 _json["title"] = title;
972 }
973 if (version != null) {
974 _json["version"] = (version).toJson();
975 }
976 return _json;
977 }
978 }
979
980
OLDNEW
« no previous file with comments | « generated/googleapis/lib/gamesconfiguration/v1configuration.dart ('k') | generated/googleapis/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698