OLD | NEW |
(Empty) | |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
| 3 library googleapis.searchconsole.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' show |
| 13 ApiRequestError, DetailedApiRequestError; |
| 14 |
| 15 const core.String USER_AGENT = 'dart-api-client searchconsole/v1'; |
| 16 |
| 17 /** Provides tools for running validation tests against single URLs */ |
| 18 class SearchconsoleApi { |
| 19 |
| 20 final commons.ApiRequester _requester; |
| 21 |
| 22 UrlTestingToolsResourceApi get urlTestingTools => new UrlTestingToolsResourceA
pi(_requester); |
| 23 |
| 24 SearchconsoleApi(http.Client client, {core.String rootUrl: "https://searchcons
ole.googleapis.com/", core.String servicePath: ""}) : |
| 25 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
| 26 } |
| 27 |
| 28 |
| 29 class UrlTestingToolsResourceApi { |
| 30 final commons.ApiRequester _requester; |
| 31 |
| 32 UrlTestingToolsMobileFriendlyTestResourceApi get mobileFriendlyTest => new Url
TestingToolsMobileFriendlyTestResourceApi(_requester); |
| 33 |
| 34 UrlTestingToolsResourceApi(commons.ApiRequester client) : |
| 35 _requester = client; |
| 36 } |
| 37 |
| 38 |
| 39 class UrlTestingToolsMobileFriendlyTestResourceApi { |
| 40 final commons.ApiRequester _requester; |
| 41 |
| 42 UrlTestingToolsMobileFriendlyTestResourceApi(commons.ApiRequester client) : |
| 43 _requester = client; |
| 44 |
| 45 /** |
| 46 * Runs Mobile-Friendly Test for a given URL. |
| 47 * |
| 48 * [request] - The metadata request object. |
| 49 * |
| 50 * Request parameters: |
| 51 * |
| 52 * Completes with a [RunMobileFriendlyTestResponse]. |
| 53 * |
| 54 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 55 * error. |
| 56 * |
| 57 * If the used [http.Client] completes with an error when making a REST call, |
| 58 * this method will complete with the same error. |
| 59 */ |
| 60 async.Future<RunMobileFriendlyTestResponse> run(RunMobileFriendlyTestRequest r
equest) { |
| 61 var _url = null; |
| 62 var _queryParams = new core.Map(); |
| 63 var _uploadMedia = null; |
| 64 var _uploadOptions = null; |
| 65 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 66 var _body = null; |
| 67 |
| 68 if (request != null) { |
| 69 _body = convert.JSON.encode((request).toJson()); |
| 70 } |
| 71 |
| 72 _url = 'v1/urlTestingTools/mobileFriendlyTest:run'; |
| 73 |
| 74 var _response = _requester.request(_url, |
| 75 "POST", |
| 76 body: _body, |
| 77 queryParams: _queryParams, |
| 78 uploadOptions: _uploadOptions, |
| 79 uploadMedia: _uploadMedia, |
| 80 downloadOptions: _downloadOptions); |
| 81 return _response.then((data) => new RunMobileFriendlyTestResponse.fromJson(d
ata)); |
| 82 } |
| 83 |
| 84 } |
| 85 |
| 86 |
| 87 |
| 88 /** Blocked resource. */ |
| 89 class BlockedResource { |
| 90 /** URL of the blocked resource. */ |
| 91 core.String url; |
| 92 |
| 93 BlockedResource(); |
| 94 |
| 95 BlockedResource.fromJson(core.Map _json) { |
| 96 if (_json.containsKey("url")) { |
| 97 url = _json["url"]; |
| 98 } |
| 99 } |
| 100 |
| 101 core.Map toJson() { |
| 102 var _json = new core.Map(); |
| 103 if (url != null) { |
| 104 _json["url"] = url; |
| 105 } |
| 106 return _json; |
| 107 } |
| 108 } |
| 109 |
| 110 /** Describe image data. */ |
| 111 class Image { |
| 112 /** |
| 113 * Image data in format determined by the mime type. Currently, the format |
| 114 * will always be "image/png", but this might change in the future. |
| 115 */ |
| 116 core.String data; |
| 117 core.List<core.int> get dataAsBytes { |
| 118 return convert.BASE64.decode(data); |
| 119 } |
| 120 |
| 121 void set dataAsBytes(core.List<core.int> _bytes) { |
| 122 data = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+", "-
"); |
| 123 } |
| 124 /** The mime-type of the image data. */ |
| 125 core.String mimeType; |
| 126 |
| 127 Image(); |
| 128 |
| 129 Image.fromJson(core.Map _json) { |
| 130 if (_json.containsKey("data")) { |
| 131 data = _json["data"]; |
| 132 } |
| 133 if (_json.containsKey("mimeType")) { |
| 134 mimeType = _json["mimeType"]; |
| 135 } |
| 136 } |
| 137 |
| 138 core.Map toJson() { |
| 139 var _json = new core.Map(); |
| 140 if (data != null) { |
| 141 _json["data"] = data; |
| 142 } |
| 143 if (mimeType != null) { |
| 144 _json["mimeType"] = mimeType; |
| 145 } |
| 146 return _json; |
| 147 } |
| 148 } |
| 149 |
| 150 /** Mobile-friendly issue. */ |
| 151 class MobileFriendlyIssue { |
| 152 /** |
| 153 * Rule violated. |
| 154 * Possible string values are: |
| 155 * - "MOBILE_FRIENDLY_RULE_UNSPECIFIED" : Unknown rule. Sorry, we don't have |
| 156 * any description for the rule that was |
| 157 * broken. |
| 158 * - "USES_INCOMPATIBLE_PLUGINS" : Plugins incompatible with mobile devices |
| 159 * are being used. [Learn more] |
| 160 * (https://support.google.com/webmasters/answer/6352293#flash_usage). |
| 161 * - "CONFIGURE_VIEWPORT" : Viewsport is not specified using the meta viewport |
| 162 * tag. [Learn more] |
| 163 * (https://support.google.com/webmasters/answer/6352293#viewport_not_configur
ed). |
| 164 * - "FIXED_WIDTH_VIEWPORT" : Viewport defined to a fixed width. [Learn more] |
| 165 * (https://support.google.com/webmasters/answer/6352293#fixed-width_viewport)
. |
| 166 * - "SIZE_CONTENT_TO_VIEWPORT" : Content not sized to viewport. [Learn more] |
| 167 * (https://support.google.com/webmasters/answer/6352293#content_not_sized_to_
viewport). |
| 168 * - "USE_LEGIBLE_FONT_SIZES" : Font size is too small for easy reading on a |
| 169 * small screen. [Learn More] |
| 170 * (https://support.google.com/webmasters/answer/6352293#small_font_size). |
| 171 * - "TAP_TARGETS_TOO_CLOSE" : Touch elements are too close to each other. |
| 172 * [Learn more] |
| 173 * (https://support.google.com/webmasters/answer/6352293#touch_elements_too_cl
ose). |
| 174 */ |
| 175 core.String rule; |
| 176 |
| 177 MobileFriendlyIssue(); |
| 178 |
| 179 MobileFriendlyIssue.fromJson(core.Map _json) { |
| 180 if (_json.containsKey("rule")) { |
| 181 rule = _json["rule"]; |
| 182 } |
| 183 } |
| 184 |
| 185 core.Map toJson() { |
| 186 var _json = new core.Map(); |
| 187 if (rule != null) { |
| 188 _json["rule"] = rule; |
| 189 } |
| 190 return _json; |
| 191 } |
| 192 } |
| 193 |
| 194 /** Information about a resource with issue. */ |
| 195 class ResourceIssue { |
| 196 /** Describes a blocked resource issue. */ |
| 197 BlockedResource blockedResource; |
| 198 |
| 199 ResourceIssue(); |
| 200 |
| 201 ResourceIssue.fromJson(core.Map _json) { |
| 202 if (_json.containsKey("blockedResource")) { |
| 203 blockedResource = new BlockedResource.fromJson(_json["blockedResource"]); |
| 204 } |
| 205 } |
| 206 |
| 207 core.Map toJson() { |
| 208 var _json = new core.Map(); |
| 209 if (blockedResource != null) { |
| 210 _json["blockedResource"] = (blockedResource).toJson(); |
| 211 } |
| 212 return _json; |
| 213 } |
| 214 } |
| 215 |
| 216 /** Mobile-friendly test request. */ |
| 217 class RunMobileFriendlyTestRequest { |
| 218 /** Whether or not screenshot is requested. Default is false. */ |
| 219 core.bool requestScreenshot; |
| 220 /** URL for inspection. */ |
| 221 core.String url; |
| 222 |
| 223 RunMobileFriendlyTestRequest(); |
| 224 |
| 225 RunMobileFriendlyTestRequest.fromJson(core.Map _json) { |
| 226 if (_json.containsKey("requestScreenshot")) { |
| 227 requestScreenshot = _json["requestScreenshot"]; |
| 228 } |
| 229 if (_json.containsKey("url")) { |
| 230 url = _json["url"]; |
| 231 } |
| 232 } |
| 233 |
| 234 core.Map toJson() { |
| 235 var _json = new core.Map(); |
| 236 if (requestScreenshot != null) { |
| 237 _json["requestScreenshot"] = requestScreenshot; |
| 238 } |
| 239 if (url != null) { |
| 240 _json["url"] = url; |
| 241 } |
| 242 return _json; |
| 243 } |
| 244 } |
| 245 |
| 246 /** |
| 247 * Mobile-friendly test response, including mobile-friendly issues and resource |
| 248 * issues. |
| 249 */ |
| 250 class RunMobileFriendlyTestResponse { |
| 251 /** |
| 252 * Test verdict, whether the page is mobile friendly or not. |
| 253 * Possible string values are: |
| 254 * - "MOBILE_FRIENDLY_TEST_RESULT_UNSPECIFIED" : Internal error when running |
| 255 * this test. Please try running the test again. |
| 256 * - "MOBILE_FRIENDLY" : The page is mobile friendly. |
| 257 * - "NOT_MOBILE_FRIENDLY" : The page is not mobile friendly. |
| 258 */ |
| 259 core.String mobileFriendliness; |
| 260 /** List of mobile-usability issues. */ |
| 261 core.List<MobileFriendlyIssue> mobileFriendlyIssues; |
| 262 /** Information about embedded resources issues. */ |
| 263 core.List<ResourceIssue> resourceIssues; |
| 264 /** Screenshot of the requested URL. */ |
| 265 Image screenshot; |
| 266 /** Final state of the test, can be either complete or an error. */ |
| 267 TestStatus testStatus; |
| 268 |
| 269 RunMobileFriendlyTestResponse(); |
| 270 |
| 271 RunMobileFriendlyTestResponse.fromJson(core.Map _json) { |
| 272 if (_json.containsKey("mobileFriendliness")) { |
| 273 mobileFriendliness = _json["mobileFriendliness"]; |
| 274 } |
| 275 if (_json.containsKey("mobileFriendlyIssues")) { |
| 276 mobileFriendlyIssues = _json["mobileFriendlyIssues"].map((value) => new Mo
bileFriendlyIssue.fromJson(value)).toList(); |
| 277 } |
| 278 if (_json.containsKey("resourceIssues")) { |
| 279 resourceIssues = _json["resourceIssues"].map((value) => new ResourceIssue.
fromJson(value)).toList(); |
| 280 } |
| 281 if (_json.containsKey("screenshot")) { |
| 282 screenshot = new Image.fromJson(_json["screenshot"]); |
| 283 } |
| 284 if (_json.containsKey("testStatus")) { |
| 285 testStatus = new TestStatus.fromJson(_json["testStatus"]); |
| 286 } |
| 287 } |
| 288 |
| 289 core.Map toJson() { |
| 290 var _json = new core.Map(); |
| 291 if (mobileFriendliness != null) { |
| 292 _json["mobileFriendliness"] = mobileFriendliness; |
| 293 } |
| 294 if (mobileFriendlyIssues != null) { |
| 295 _json["mobileFriendlyIssues"] = mobileFriendlyIssues.map((value) => (value
).toJson()).toList(); |
| 296 } |
| 297 if (resourceIssues != null) { |
| 298 _json["resourceIssues"] = resourceIssues.map((value) => (value).toJson()).
toList(); |
| 299 } |
| 300 if (screenshot != null) { |
| 301 _json["screenshot"] = (screenshot).toJson(); |
| 302 } |
| 303 if (testStatus != null) { |
| 304 _json["testStatus"] = (testStatus).toJson(); |
| 305 } |
| 306 return _json; |
| 307 } |
| 308 } |
| 309 |
| 310 /** Final state of the test, including error details if necessary. */ |
| 311 class TestStatus { |
| 312 /** Error details if applicable. */ |
| 313 core.String details; |
| 314 /** |
| 315 * Status of the test. |
| 316 * Possible string values are: |
| 317 * - "TEST_STATUS_UNSPECIFIED" : Internal error when running this test. Please |
| 318 * try running the test again. |
| 319 * - "COMPLETE" : Inspection has completed without errors. |
| 320 * - "INTERNAL_ERROR" : Inspection terminated in an error state. This |
| 321 * indicates a problem in |
| 322 * Google's infrastructure, not a user error. Please try again later. |
| 323 * - "PAGE_UNREACHABLE" : Google can not access the URL because of a user |
| 324 * error such as a robots.txt |
| 325 * blockage, a 403 or 500 code etc. Please make sure that the URL provided is |
| 326 * accessible by Googlebot and is not password protected. |
| 327 */ |
| 328 core.String status; |
| 329 |
| 330 TestStatus(); |
| 331 |
| 332 TestStatus.fromJson(core.Map _json) { |
| 333 if (_json.containsKey("details")) { |
| 334 details = _json["details"]; |
| 335 } |
| 336 if (_json.containsKey("status")) { |
| 337 status = _json["status"]; |
| 338 } |
| 339 } |
| 340 |
| 341 core.Map toJson() { |
| 342 var _json = new core.Map(); |
| 343 if (details != null) { |
| 344 _json["details"] = details; |
| 345 } |
| 346 if (status != null) { |
| 347 _json["status"] = status; |
| 348 } |
| 349 return _json; |
| 350 } |
| 351 } |
OLD | NEW |