OLD | NEW |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
1 library googleapis.pagespeedonline.v2; | 3 library googleapis.pagespeedonline.v2; |
2 | 4 |
3 import "dart:core" as core; | 5 import 'dart:core' as core; |
4 import "dart:collection" as collection; | 6 import 'dart:collection' as collection; |
5 import "dart:async" as async; | 7 import 'dart:async' as async; |
6 import "dart:convert" as convert; | 8 import 'dart:convert' as convert; |
7 | 9 |
8 import "package:crypto/crypto.dart" as crypto; | 10 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| 11 import 'package:crypto/crypto.dart' as crypto; |
9 import 'package:http/http.dart' as http; | 12 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 |
13 export '../common/common.dart' show ApiRequestError; | 14 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show |
14 export '../common/common.dart' show DetailedApiRequestError; | 15 ApiRequestError, DetailedApiRequestError; |
| 16 |
| 17 const core.String USER_AGENT = 'dart-api-client pagespeedonline/v2'; |
15 | 18 |
16 /** | 19 /** |
17 * Lets you analyze the performance of a web page and get tailored suggestions | 20 * Lets you analyze the performance of a web page and get tailored suggestions |
18 * to make that page faster. | 21 * to make that page faster. |
19 */ | 22 */ |
20 class PagespeedonlineApi { | 23 class PagespeedonlineApi { |
21 | 24 |
22 final common_internal.ApiRequester _requester; | 25 final commons.ApiRequester _requester; |
23 | 26 |
24 PagespeedapiResourceApi get pagespeedapi => new PagespeedapiResourceApi(_reque
ster); | 27 PagespeedapiResourceApi get pagespeedapi => new PagespeedapiResourceApi(_reque
ster); |
25 | 28 |
26 PagespeedonlineApi(http.Client client, {core.String rootUrl: "https://www.goog
leapis.com/", core.String servicePath: "pagespeedonline/v2/"}) : | 29 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
); | 30 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
28 } | 31 } |
29 | 32 |
30 | 33 |
31 /** Not documented yet. */ | |
32 class PagespeedapiResourceApi { | 34 class PagespeedapiResourceApi { |
33 final common_internal.ApiRequester _requester; | 35 final commons.ApiRequester _requester; |
34 | 36 |
35 PagespeedapiResourceApi(common_internal.ApiRequester client) : | 37 PagespeedapiResourceApi(commons.ApiRequester client) : |
36 _requester = client; | 38 _requester = client; |
37 | 39 |
38 /** | 40 /** |
39 * Runs PageSpeed analysis on the page at the specified URL, and returns | 41 * 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 | 42 * PageSpeed scores, a list of suggestions to make that page faster, and other |
41 * information. | 43 * information. |
42 * | 44 * |
43 * Request parameters: | 45 * Request parameters: |
44 * | 46 * |
45 * [url] - The URL to fetch and analyze | 47 * [url] - The URL to fetch and analyze |
(...skipping 11 matching lines...) Expand all Loading... |
57 * [screenshot] - Indicates if binary data containing a screenshot should be | 59 * [screenshot] - Indicates if binary data containing a screenshot should be |
58 * included | 60 * included |
59 * | 61 * |
60 * [strategy] - The analysis strategy to use | 62 * [strategy] - The analysis strategy to use |
61 * Possible string values are: | 63 * Possible string values are: |
62 * - "desktop" : Fetch and analyze the URL for desktop browsers | 64 * - "desktop" : Fetch and analyze the URL for desktop browsers |
63 * - "mobile" : Fetch and analyze the URL for mobile devices | 65 * - "mobile" : Fetch and analyze the URL for mobile devices |
64 * | 66 * |
65 * Completes with a [Result]. | 67 * Completes with a [Result]. |
66 * | 68 * |
67 * Completes with a [common.ApiRequestError] if the API endpoint returned an | 69 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
68 * error. | 70 * error. |
69 * | 71 * |
70 * If the used [http.Client] completes with an error when making a REST call, | 72 * If the used [http.Client] completes with an error when making a REST call, |
71 * this method will complete with the same error. | 73 * this method will complete with the same error. |
72 */ | 74 */ |
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}) { | 75 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; | 76 var _url = null; |
75 var _queryParams = new core.Map(); | 77 var _queryParams = new core.Map(); |
76 var _uploadMedia = null; | 78 var _uploadMedia = null; |
77 var _uploadOptions = null; | 79 var _uploadOptions = null; |
78 var _downloadOptions = common.DownloadOptions.Metadata; | 80 var _downloadOptions = commons.DownloadOptions.Metadata; |
79 var _body = null; | 81 var _body = null; |
80 | 82 |
81 if (url == null) { | 83 if (url == null) { |
82 throw new core.ArgumentError("Parameter url is required."); | 84 throw new core.ArgumentError("Parameter url is required."); |
83 } | 85 } |
84 _queryParams["url"] = [url]; | 86 _queryParams["url"] = [url]; |
85 if (filterThirdPartyResources != null) { | 87 if (filterThirdPartyResources != null) { |
86 _queryParams["filter_third_party_resources"] = ["${filterThirdPartyResourc
es}"]; | 88 _queryParams["filter_third_party_resources"] = ["${filterThirdPartyResourc
es}"]; |
87 } | 89 } |
88 if (locale != null) { | 90 if (locale != null) { |
(...skipping 19 matching lines...) Expand all Loading... |
108 uploadOptions: _uploadOptions, | 110 uploadOptions: _uploadOptions, |
109 uploadMedia: _uploadMedia, | 111 uploadMedia: _uploadMedia, |
110 downloadOptions: _downloadOptions); | 112 downloadOptions: _downloadOptions); |
111 return _response.then((data) => new Result.fromJson(data)); | 113 return _response.then((data) => new Result.fromJson(data)); |
112 } | 114 } |
113 | 115 |
114 } | 116 } |
115 | 117 |
116 | 118 |
117 | 119 |
118 /** Not documented yet. */ | |
119 class PagespeedApiFormatStringV2ArgsRects { | 120 class PagespeedApiFormatStringV2ArgsRects { |
120 /** The height of the rect. */ | 121 /** The height of the rect. */ |
121 core.int height; | 122 core.int height; |
122 | 123 |
123 /** The left coordinate of the rect, in page coordinates. */ | 124 /** The left coordinate of the rect, in page coordinates. */ |
124 core.int left; | 125 core.int left; |
125 | 126 |
126 /** The top coordinate of the rect, in page coordinates. */ | 127 /** The top coordinate of the rect, in page coordinates. */ |
127 core.int top; | 128 core.int top; |
128 | 129 |
(...skipping 30 matching lines...) Expand all Loading... |
159 _json["top"] = top; | 160 _json["top"] = top; |
160 } | 161 } |
161 if (width != null) { | 162 if (width != null) { |
162 _json["width"] = width; | 163 _json["width"] = width; |
163 } | 164 } |
164 return _json; | 165 return _json; |
165 } | 166 } |
166 } | 167 } |
167 | 168 |
168 | 169 |
169 /** Not documented yet. */ | |
170 class PagespeedApiFormatStringV2ArgsSecondaryRects { | 170 class PagespeedApiFormatStringV2ArgsSecondaryRects { |
171 /** The height of the rect. */ | 171 /** The height of the rect. */ |
172 core.int height; | 172 core.int height; |
173 | 173 |
174 /** The left coordinate of the rect, in page coordinates. */ | 174 /** The left coordinate of the rect, in page coordinates. */ |
175 core.int left; | 175 core.int left; |
176 | 176 |
177 /** The top coordinate of the rect, in page coordinates. */ | 177 /** The top coordinate of the rect, in page coordinates. */ |
178 core.int top; | 178 core.int top; |
179 | 179 |
(...skipping 30 matching lines...) Expand all Loading... |
210 _json["top"] = top; | 210 _json["top"] = top; |
211 } | 211 } |
212 if (width != null) { | 212 if (width != null) { |
213 _json["width"] = width; | 213 _json["width"] = width; |
214 } | 214 } |
215 return _json; | 215 return _json; |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
219 | 219 |
220 /** Not documented yet. */ | |
221 class PagespeedApiFormatStringV2Args { | 220 class PagespeedApiFormatStringV2Args { |
222 /** The placeholder key for this arg, as a string. */ | 221 /** The placeholder key for this arg, as a string. */ |
223 core.String key; | 222 core.String key; |
224 | 223 |
225 /** | 224 /** |
226 * The screen rectangles being referred to, with dimensions measured in CSS | 225 * 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 | 226 * 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 | 227 * absent for a SNAPSHOT_RECT argument, it means that that argument refers to |
229 * the entire snapshot. | 228 * the entire snapshot. |
230 */ | 229 */ |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 _json["type"] = type; | 280 _json["type"] = type; |
282 } | 281 } |
283 if (value != null) { | 282 if (value != null) { |
284 _json["value"] = value; | 283 _json["value"] = value; |
285 } | 284 } |
286 return _json; | 285 return _json; |
287 } | 286 } |
288 } | 287 } |
289 | 288 |
290 | 289 |
291 /** Not documented yet. */ | |
292 class PagespeedApiFormatStringV2 { | 290 class PagespeedApiFormatStringV2 { |
293 /** List of arguments for the format string. */ | 291 /** List of arguments for the format string. */ |
294 core.List<PagespeedApiFormatStringV2Args> args; | 292 core.List<PagespeedApiFormatStringV2Args> args; |
295 | 293 |
296 /** | 294 /** |
297 * A localized format string with {{FOO}} placeholders, where 'FOO' is the key | 295 * A localized format string with {{FOO}} placeholders, where 'FOO' is the key |
298 * of the argument whose value should be substituted. For HYPERLINK arguments, | 296 * of the argument whose value should be substituted. For HYPERLINK arguments, |
299 * the format string will instead contain {{BEGIN_FOO}} and {{END_FOO}} for | 297 * the format string will instead contain {{BEGIN_FOO}} and {{END_FOO}} for |
300 * the argument with key 'FOO'. | 298 * the argument with key 'FOO'. |
301 */ | 299 */ |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 _json["top"] = top; | 371 _json["top"] = top; |
374 } | 372 } |
375 if (width != null) { | 373 if (width != null) { |
376 _json["width"] = width; | 374 _json["width"] = width; |
377 } | 375 } |
378 return _json; | 376 return _json; |
379 } | 377 } |
380 } | 378 } |
381 | 379 |
382 | 380 |
383 /** Not documented yet. */ | |
384 class PagespeedApiImageV2 { | 381 class PagespeedApiImageV2 { |
385 /** Image data base64 encoded. */ | 382 /** Image data base64 encoded. */ |
386 core.String data; | 383 core.String data; |
387 | 384 |
388 core.List<core.int> get dataAsBytes { | 385 core.List<core.int> get dataAsBytes { |
389 return crypto.CryptoUtils.base64StringToBytes(data); | 386 return crypto.CryptoUtils.base64StringToBytes(data); |
390 } | 387 } |
391 | 388 |
392 void set dataAsBytes(core.List<core.int> _bytes) { | 389 void set dataAsBytes(core.List<core.int> _bytes) { |
393 data = crypto.CryptoUtils.bytesToBase64(_bytes, urlSafe: true); | 390 data = crypto.CryptoUtils.bytesToBase64(_bytes, urlSafe: true); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 _json["page_rect"] = (pageRect).toJson(); | 450 _json["page_rect"] = (pageRect).toJson(); |
454 } | 451 } |
455 if (width != null) { | 452 if (width != null) { |
456 _json["width"] = width; | 453 _json["width"] = width; |
457 } | 454 } |
458 return _json; | 455 return _json; |
459 } | 456 } |
460 } | 457 } |
461 | 458 |
462 | 459 |
463 /** Not documented yet. */ | |
464 class ResultFormattedResultsRuleResultsValueUrlBlocksUrls { | 460 class ResultFormattedResultsRuleResultsValueUrlBlocksUrls { |
465 /** | 461 /** |
466 * List of entries that provide additional details about a single URL. | 462 * List of entries that provide additional details about a single URL. |
467 * Optional. | 463 * Optional. |
468 */ | 464 */ |
469 core.List<PagespeedApiFormatStringV2> details; | 465 core.List<PagespeedApiFormatStringV2> details; |
470 | 466 |
471 /** | 467 /** |
472 * A format string that gives information about the URL, and a list of | 468 * A format string that gives information about the URL, and a list of |
473 * arguments for that format string. | 469 * arguments for that format string. |
(...skipping 18 matching lines...) Expand all Loading... |
492 _json["details"] = details.map((value) => (value).toJson()).toList(); | 488 _json["details"] = details.map((value) => (value).toJson()).toList(); |
493 } | 489 } |
494 if (result != null) { | 490 if (result != null) { |
495 _json["result"] = (result).toJson(); | 491 _json["result"] = (result).toJson(); |
496 } | 492 } |
497 return _json; | 493 return _json; |
498 } | 494 } |
499 } | 495 } |
500 | 496 |
501 | 497 |
502 /** Not documented yet. */ | |
503 class ResultFormattedResultsRuleResultsValueUrlBlocks { | 498 class ResultFormattedResultsRuleResultsValueUrlBlocks { |
504 /** Heading to be displayed with the list of URLs. */ | 499 /** Heading to be displayed with the list of URLs. */ |
505 PagespeedApiFormatStringV2 header; | 500 PagespeedApiFormatStringV2 header; |
506 | 501 |
507 /** | 502 /** |
508 * List of entries that provide information about URLs in the url block. | 503 * List of entries that provide information about URLs in the url block. |
509 * Optional. | 504 * Optional. |
510 */ | 505 */ |
511 core.List<ResultFormattedResultsRuleResultsValueUrlBlocksUrls> urls; | 506 core.List<ResultFormattedResultsRuleResultsValueUrlBlocksUrls> urls; |
512 | 507 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 core.Map<core.String, ResultFormattedResultsRuleResultsValue> ruleResults; | 626 core.Map<core.String, ResultFormattedResultsRuleResultsValue> ruleResults; |
632 | 627 |
633 | 628 |
634 ResultFormattedResults(); | 629 ResultFormattedResults(); |
635 | 630 |
636 ResultFormattedResults.fromJson(core.Map _json) { | 631 ResultFormattedResults.fromJson(core.Map _json) { |
637 if (_json.containsKey("locale")) { | 632 if (_json.containsKey("locale")) { |
638 locale = _json["locale"]; | 633 locale = _json["locale"]; |
639 } | 634 } |
640 if (_json.containsKey("ruleResults")) { | 635 if (_json.containsKey("ruleResults")) { |
641 ruleResults = common_internal.mapMap(_json["ruleResults"], (item) => new R
esultFormattedResultsRuleResultsValue.fromJson(item)); | 636 ruleResults = commons.mapMap(_json["ruleResults"], (item) => new ResultFor
mattedResultsRuleResultsValue.fromJson(item)); |
642 } | 637 } |
643 } | 638 } |
644 | 639 |
645 core.Map toJson() { | 640 core.Map toJson() { |
646 var _json = new core.Map(); | 641 var _json = new core.Map(); |
647 if (locale != null) { | 642 if (locale != null) { |
648 _json["locale"] = locale; | 643 _json["locale"] = locale; |
649 } | 644 } |
650 if (ruleResults != null) { | 645 if (ruleResults != null) { |
651 _json["ruleResults"] = common_internal.mapMap(ruleResults, (item) => (item
).toJson()); | 646 _json["ruleResults"] = commons.mapMap(ruleResults, (item) => (item).toJson
()); |
652 } | 647 } |
653 return _json; | 648 return _json; |
654 } | 649 } |
655 } | 650 } |
656 | 651 |
657 | 652 |
658 /** | 653 /** |
659 * Summary statistics for the page, such as number of JavaScript bytes, number | 654 * Summary statistics for the page, such as number of JavaScript bytes, number |
660 * of HTML bytes, etc. | 655 * of HTML bytes, etc. |
661 */ | 656 */ |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 _json["major"] = major; | 846 _json["major"] = major; |
852 } | 847 } |
853 if (minor != null) { | 848 if (minor != null) { |
854 _json["minor"] = minor; | 849 _json["minor"] = minor; |
855 } | 850 } |
856 return _json; | 851 return _json; |
857 } | 852 } |
858 } | 853 } |
859 | 854 |
860 | 855 |
861 /** Not documented yet. */ | |
862 class Result { | 856 class Result { |
863 /** | 857 /** |
864 * Localized PageSpeed results. Contains a ruleResults entry for each | 858 * Localized PageSpeed results. Contains a ruleResults entry for each |
865 * PageSpeed rule instantiated and run by the server. | 859 * PageSpeed rule instantiated and run by the server. |
866 */ | 860 */ |
867 ResultFormattedResults formattedResults; | 861 ResultFormattedResults formattedResults; |
868 | 862 |
869 /** | 863 /** |
870 * Canonicalized and final URL for the document, after following page | 864 * Canonicalized and final URL for the document, after following page |
871 * redirects (if any). | 865 * redirects (if any). |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 if (_json.containsKey("kind")) { | 915 if (_json.containsKey("kind")) { |
922 kind = _json["kind"]; | 916 kind = _json["kind"]; |
923 } | 917 } |
924 if (_json.containsKey("pageStats")) { | 918 if (_json.containsKey("pageStats")) { |
925 pageStats = new ResultPageStats.fromJson(_json["pageStats"]); | 919 pageStats = new ResultPageStats.fromJson(_json["pageStats"]); |
926 } | 920 } |
927 if (_json.containsKey("responseCode")) { | 921 if (_json.containsKey("responseCode")) { |
928 responseCode = _json["responseCode"]; | 922 responseCode = _json["responseCode"]; |
929 } | 923 } |
930 if (_json.containsKey("ruleGroups")) { | 924 if (_json.containsKey("ruleGroups")) { |
931 ruleGroups = common_internal.mapMap(_json["ruleGroups"], (item) => new Res
ultRuleGroupsValue.fromJson(item)); | 925 ruleGroups = commons.mapMap(_json["ruleGroups"], (item) => new ResultRuleG
roupsValue.fromJson(item)); |
932 } | 926 } |
933 if (_json.containsKey("screenshot")) { | 927 if (_json.containsKey("screenshot")) { |
934 screenshot = new PagespeedApiImageV2.fromJson(_json["screenshot"]); | 928 screenshot = new PagespeedApiImageV2.fromJson(_json["screenshot"]); |
935 } | 929 } |
936 if (_json.containsKey("title")) { | 930 if (_json.containsKey("title")) { |
937 title = _json["title"]; | 931 title = _json["title"]; |
938 } | 932 } |
939 if (_json.containsKey("version")) { | 933 if (_json.containsKey("version")) { |
940 version = new ResultVersion.fromJson(_json["version"]); | 934 version = new ResultVersion.fromJson(_json["version"]); |
941 } | 935 } |
(...skipping 13 matching lines...) Expand all Loading... |
955 if (kind != null) { | 949 if (kind != null) { |
956 _json["kind"] = kind; | 950 _json["kind"] = kind; |
957 } | 951 } |
958 if (pageStats != null) { | 952 if (pageStats != null) { |
959 _json["pageStats"] = (pageStats).toJson(); | 953 _json["pageStats"] = (pageStats).toJson(); |
960 } | 954 } |
961 if (responseCode != null) { | 955 if (responseCode != null) { |
962 _json["responseCode"] = responseCode; | 956 _json["responseCode"] = responseCode; |
963 } | 957 } |
964 if (ruleGroups != null) { | 958 if (ruleGroups != null) { |
965 _json["ruleGroups"] = common_internal.mapMap(ruleGroups, (item) => (item).
toJson()); | 959 _json["ruleGroups"] = commons.mapMap(ruleGroups, (item) => (item).toJson()
); |
966 } | 960 } |
967 if (screenshot != null) { | 961 if (screenshot != null) { |
968 _json["screenshot"] = (screenshot).toJson(); | 962 _json["screenshot"] = (screenshot).toJson(); |
969 } | 963 } |
970 if (title != null) { | 964 if (title != null) { |
971 _json["title"] = title; | 965 _json["title"] = title; |
972 } | 966 } |
973 if (version != null) { | 967 if (version != null) { |
974 _json["version"] = (version).toJson(); | 968 _json["version"] = (version).toJson(); |
975 } | 969 } |
976 return _json; | 970 return _json; |
977 } | 971 } |
978 } | 972 } |
979 | |
980 | |
OLD | NEW |