OLD | NEW |
(Empty) | |
| 1 library googleapis.webmasters.v3; |
| 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 /** Lets you view Google Webmaster Tools data for your verified sites. */ |
| 17 class WebmastersApi { |
| 18 /** View and modify Webmaster Tools data for your verified sites */ |
| 19 static const WebmastersScope = "https://www.googleapis.com/auth/webmasters"; |
| 20 |
| 21 /** View Webmaster Tools data for your verified sites */ |
| 22 static const WebmastersReadonlyScope = "https://www.googleapis.com/auth/webmas
ters.readonly"; |
| 23 |
| 24 |
| 25 final common_internal.ApiRequester _requester; |
| 26 |
| 27 SitemapsResourceApi get sitemaps => new SitemapsResourceApi(_requester); |
| 28 SitesResourceApi get sites => new SitesResourceApi(_requester); |
| 29 UrlcrawlerrorscountsResourceApi get urlcrawlerrorscounts => new Urlcrawlerrors
countsResourceApi(_requester); |
| 30 UrlcrawlerrorssamplesResourceApi get urlcrawlerrorssamples => new Urlcrawlerro
rssamplesResourceApi(_requester); |
| 31 |
| 32 WebmastersApi(http.Client client) : |
| 33 _requester = new common_internal.ApiRequester(client, "https://www.googlea
pis.com/", "webmasters/v3/"); |
| 34 } |
| 35 |
| 36 |
| 37 /** Not documented yet. */ |
| 38 class SitemapsResourceApi { |
| 39 final common_internal.ApiRequester _requester; |
| 40 |
| 41 SitemapsResourceApi(common_internal.ApiRequester client) : |
| 42 _requester = client; |
| 43 |
| 44 /** |
| 45 * Deletes a sitemap from this site. |
| 46 * |
| 47 * Request parameters: |
| 48 * |
| 49 * [siteUrl] - The site's URL, including protocol, for example |
| 50 * 'http://www.example.com/' |
| 51 * |
| 52 * [feedpath] - The URL of the actual sitemap (for example |
| 53 * http://www.example.com/sitemap.xml). |
| 54 * |
| 55 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 56 * error. |
| 57 * |
| 58 * If the used [http.Client] completes with an error when making a REST call, |
| 59 * this method will complete with the same error. |
| 60 */ |
| 61 async.Future delete(core.String siteUrl, core.String feedpath) { |
| 62 var _url = null; |
| 63 var _queryParams = new core.Map(); |
| 64 var _uploadMedia = null; |
| 65 var _uploadOptions = null; |
| 66 var _downloadOptions = common.DownloadOptions.Metadata; |
| 67 var _body = null; |
| 68 |
| 69 if (siteUrl == null) { |
| 70 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 71 } |
| 72 if (feedpath == null) { |
| 73 throw new core.ArgumentError("Parameter feedpath is required."); |
| 74 } |
| 75 |
| 76 _downloadOptions = null; |
| 77 |
| 78 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl') + '/site
maps/' + common_internal.Escaper.ecapeVariable('$feedpath'); |
| 79 |
| 80 var _response = _requester.request(_url, |
| 81 "DELETE", |
| 82 body: _body, |
| 83 queryParams: _queryParams, |
| 84 uploadOptions: _uploadOptions, |
| 85 uploadMedia: _uploadMedia, |
| 86 downloadOptions: _downloadOptions); |
| 87 return _response.then((data) => null); |
| 88 } |
| 89 |
| 90 /** |
| 91 * Retrieves information about a specific sitemap. |
| 92 * |
| 93 * Request parameters: |
| 94 * |
| 95 * [siteUrl] - The site's URL, including protocol, for example |
| 96 * 'http://www.example.com/' |
| 97 * |
| 98 * [feedpath] - The URL of the actual sitemap (for example |
| 99 * http://www.example.com/sitemap.xml). |
| 100 * |
| 101 * Completes with a [WmxSitemap]. |
| 102 * |
| 103 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 104 * error. |
| 105 * |
| 106 * If the used [http.Client] completes with an error when making a REST call, |
| 107 * this method will complete with the same error. |
| 108 */ |
| 109 async.Future<WmxSitemap> get(core.String siteUrl, core.String feedpath) { |
| 110 var _url = null; |
| 111 var _queryParams = new core.Map(); |
| 112 var _uploadMedia = null; |
| 113 var _uploadOptions = null; |
| 114 var _downloadOptions = common.DownloadOptions.Metadata; |
| 115 var _body = null; |
| 116 |
| 117 if (siteUrl == null) { |
| 118 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 119 } |
| 120 if (feedpath == null) { |
| 121 throw new core.ArgumentError("Parameter feedpath is required."); |
| 122 } |
| 123 |
| 124 |
| 125 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl') + '/site
maps/' + common_internal.Escaper.ecapeVariable('$feedpath'); |
| 126 |
| 127 var _response = _requester.request(_url, |
| 128 "GET", |
| 129 body: _body, |
| 130 queryParams: _queryParams, |
| 131 uploadOptions: _uploadOptions, |
| 132 uploadMedia: _uploadMedia, |
| 133 downloadOptions: _downloadOptions); |
| 134 return _response.then((data) => new WmxSitemap.fromJson(data)); |
| 135 } |
| 136 |
| 137 /** |
| 138 * Lists sitemaps uploaded to the site. |
| 139 * |
| 140 * Request parameters: |
| 141 * |
| 142 * [siteUrl] - The site's URL, including protocol, for example |
| 143 * 'http://www.example.com/' |
| 144 * |
| 145 * [sitemapIndex] - A URL of a site's sitemap index. |
| 146 * |
| 147 * Completes with a [SitemapsListResponse]. |
| 148 * |
| 149 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 150 * error. |
| 151 * |
| 152 * If the used [http.Client] completes with an error when making a REST call, |
| 153 * this method will complete with the same error. |
| 154 */ |
| 155 async.Future<SitemapsListResponse> list(core.String siteUrl, {core.String site
mapIndex}) { |
| 156 var _url = null; |
| 157 var _queryParams = new core.Map(); |
| 158 var _uploadMedia = null; |
| 159 var _uploadOptions = null; |
| 160 var _downloadOptions = common.DownloadOptions.Metadata; |
| 161 var _body = null; |
| 162 |
| 163 if (siteUrl == null) { |
| 164 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 165 } |
| 166 if (sitemapIndex != null) { |
| 167 _queryParams["sitemapIndex"] = [sitemapIndex]; |
| 168 } |
| 169 |
| 170 |
| 171 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl') + '/site
maps'; |
| 172 |
| 173 var _response = _requester.request(_url, |
| 174 "GET", |
| 175 body: _body, |
| 176 queryParams: _queryParams, |
| 177 uploadOptions: _uploadOptions, |
| 178 uploadMedia: _uploadMedia, |
| 179 downloadOptions: _downloadOptions); |
| 180 return _response.then((data) => new SitemapsListResponse.fromJson(data)); |
| 181 } |
| 182 |
| 183 /** |
| 184 * Submits a sitemap for a site. |
| 185 * |
| 186 * Request parameters: |
| 187 * |
| 188 * [siteUrl] - The site's URL, including protocol, for example |
| 189 * 'http://www.example.com/' |
| 190 * |
| 191 * [feedpath] - The URL of the sitemap to add. |
| 192 * |
| 193 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 194 * error. |
| 195 * |
| 196 * If the used [http.Client] completes with an error when making a REST call, |
| 197 * this method will complete with the same error. |
| 198 */ |
| 199 async.Future submit(core.String siteUrl, core.String feedpath) { |
| 200 var _url = null; |
| 201 var _queryParams = new core.Map(); |
| 202 var _uploadMedia = null; |
| 203 var _uploadOptions = null; |
| 204 var _downloadOptions = common.DownloadOptions.Metadata; |
| 205 var _body = null; |
| 206 |
| 207 if (siteUrl == null) { |
| 208 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 209 } |
| 210 if (feedpath == null) { |
| 211 throw new core.ArgumentError("Parameter feedpath is required."); |
| 212 } |
| 213 |
| 214 _downloadOptions = null; |
| 215 |
| 216 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl') + '/site
maps/' + common_internal.Escaper.ecapeVariable('$feedpath'); |
| 217 |
| 218 var _response = _requester.request(_url, |
| 219 "PUT", |
| 220 body: _body, |
| 221 queryParams: _queryParams, |
| 222 uploadOptions: _uploadOptions, |
| 223 uploadMedia: _uploadMedia, |
| 224 downloadOptions: _downloadOptions); |
| 225 return _response.then((data) => null); |
| 226 } |
| 227 |
| 228 } |
| 229 |
| 230 |
| 231 /** Not documented yet. */ |
| 232 class SitesResourceApi { |
| 233 final common_internal.ApiRequester _requester; |
| 234 |
| 235 SitesResourceApi(common_internal.ApiRequester client) : |
| 236 _requester = client; |
| 237 |
| 238 /** |
| 239 * Adds a site to the set of the user's sites in Webmaster Tools. |
| 240 * |
| 241 * Request parameters: |
| 242 * |
| 243 * [siteUrl] - The URL of the site to add. |
| 244 * |
| 245 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 246 * error. |
| 247 * |
| 248 * If the used [http.Client] completes with an error when making a REST call, |
| 249 * this method will complete with the same error. |
| 250 */ |
| 251 async.Future add(core.String siteUrl) { |
| 252 var _url = null; |
| 253 var _queryParams = new core.Map(); |
| 254 var _uploadMedia = null; |
| 255 var _uploadOptions = null; |
| 256 var _downloadOptions = common.DownloadOptions.Metadata; |
| 257 var _body = null; |
| 258 |
| 259 if (siteUrl == null) { |
| 260 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 261 } |
| 262 |
| 263 _downloadOptions = null; |
| 264 |
| 265 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl'); |
| 266 |
| 267 var _response = _requester.request(_url, |
| 268 "PUT", |
| 269 body: _body, |
| 270 queryParams: _queryParams, |
| 271 uploadOptions: _uploadOptions, |
| 272 uploadMedia: _uploadMedia, |
| 273 downloadOptions: _downloadOptions); |
| 274 return _response.then((data) => null); |
| 275 } |
| 276 |
| 277 /** |
| 278 * Removes a site from the set of the user's Webmaster Tools sites. |
| 279 * |
| 280 * Request parameters: |
| 281 * |
| 282 * [siteUrl] - The site's URL, including protocol, for example |
| 283 * 'http://www.example.com/' |
| 284 * |
| 285 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 286 * error. |
| 287 * |
| 288 * If the used [http.Client] completes with an error when making a REST call, |
| 289 * this method will complete with the same error. |
| 290 */ |
| 291 async.Future delete(core.String siteUrl) { |
| 292 var _url = null; |
| 293 var _queryParams = new core.Map(); |
| 294 var _uploadMedia = null; |
| 295 var _uploadOptions = null; |
| 296 var _downloadOptions = common.DownloadOptions.Metadata; |
| 297 var _body = null; |
| 298 |
| 299 if (siteUrl == null) { |
| 300 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 301 } |
| 302 |
| 303 _downloadOptions = null; |
| 304 |
| 305 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl'); |
| 306 |
| 307 var _response = _requester.request(_url, |
| 308 "DELETE", |
| 309 body: _body, |
| 310 queryParams: _queryParams, |
| 311 uploadOptions: _uploadOptions, |
| 312 uploadMedia: _uploadMedia, |
| 313 downloadOptions: _downloadOptions); |
| 314 return _response.then((data) => null); |
| 315 } |
| 316 |
| 317 /** |
| 318 * Retrieves information about specific site. |
| 319 * |
| 320 * Request parameters: |
| 321 * |
| 322 * [siteUrl] - The site's URL, including protocol, for example |
| 323 * 'http://www.example.com/' |
| 324 * |
| 325 * Completes with a [WmxSite]. |
| 326 * |
| 327 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 328 * error. |
| 329 * |
| 330 * If the used [http.Client] completes with an error when making a REST call, |
| 331 * this method will complete with the same error. |
| 332 */ |
| 333 async.Future<WmxSite> get(core.String siteUrl) { |
| 334 var _url = null; |
| 335 var _queryParams = new core.Map(); |
| 336 var _uploadMedia = null; |
| 337 var _uploadOptions = null; |
| 338 var _downloadOptions = common.DownloadOptions.Metadata; |
| 339 var _body = null; |
| 340 |
| 341 if (siteUrl == null) { |
| 342 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 343 } |
| 344 |
| 345 |
| 346 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl'); |
| 347 |
| 348 var _response = _requester.request(_url, |
| 349 "GET", |
| 350 body: _body, |
| 351 queryParams: _queryParams, |
| 352 uploadOptions: _uploadOptions, |
| 353 uploadMedia: _uploadMedia, |
| 354 downloadOptions: _downloadOptions); |
| 355 return _response.then((data) => new WmxSite.fromJson(data)); |
| 356 } |
| 357 |
| 358 /** |
| 359 * Lists your Webmaster Tools sites. |
| 360 * |
| 361 * Request parameters: |
| 362 * |
| 363 * Completes with a [SitesListResponse]. |
| 364 * |
| 365 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 366 * error. |
| 367 * |
| 368 * If the used [http.Client] completes with an error when making a REST call, |
| 369 * this method will complete with the same error. |
| 370 */ |
| 371 async.Future<SitesListResponse> list() { |
| 372 var _url = null; |
| 373 var _queryParams = new core.Map(); |
| 374 var _uploadMedia = null; |
| 375 var _uploadOptions = null; |
| 376 var _downloadOptions = common.DownloadOptions.Metadata; |
| 377 var _body = null; |
| 378 |
| 379 |
| 380 |
| 381 _url = 'sites'; |
| 382 |
| 383 var _response = _requester.request(_url, |
| 384 "GET", |
| 385 body: _body, |
| 386 queryParams: _queryParams, |
| 387 uploadOptions: _uploadOptions, |
| 388 uploadMedia: _uploadMedia, |
| 389 downloadOptions: _downloadOptions); |
| 390 return _response.then((data) => new SitesListResponse.fromJson(data)); |
| 391 } |
| 392 |
| 393 } |
| 394 |
| 395 |
| 396 /** Not documented yet. */ |
| 397 class UrlcrawlerrorscountsResourceApi { |
| 398 final common_internal.ApiRequester _requester; |
| 399 |
| 400 UrlcrawlerrorscountsResourceApi(common_internal.ApiRequester client) : |
| 401 _requester = client; |
| 402 |
| 403 /** |
| 404 * Retrieves a time series of the number of URL crawl errors per error |
| 405 * category and platform. |
| 406 * |
| 407 * Request parameters: |
| 408 * |
| 409 * [siteUrl] - The site's URL, including protocol, for example |
| 410 * 'http://www.example.com/' |
| 411 * |
| 412 * [category] - The crawl error category, for example 'serverError'. If not |
| 413 * specified, we return results for all categories. |
| 414 * Possible string values are: |
| 415 * - "authPermissions" |
| 416 * - "manyToOneRedirect" |
| 417 * - "notFollowed" |
| 418 * - "notFound" |
| 419 * - "other" |
| 420 * - "roboted" |
| 421 * - "serverError" |
| 422 * - "soft404" |
| 423 * |
| 424 * [latestCountsOnly] - If true, returns only the latest crawl error counts. |
| 425 * |
| 426 * [platform] - The user agent type (platform) that made the request, for |
| 427 * example 'web'. If not specified, we return results for all platforms. |
| 428 * Possible string values are: |
| 429 * - "mobile" |
| 430 * - "smartphoneOnly" |
| 431 * - "web" |
| 432 * |
| 433 * Completes with a [UrlCrawlErrorsCountsQueryResponse]. |
| 434 * |
| 435 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 436 * error. |
| 437 * |
| 438 * If the used [http.Client] completes with an error when making a REST call, |
| 439 * this method will complete with the same error. |
| 440 */ |
| 441 async.Future<UrlCrawlErrorsCountsQueryResponse> query(core.String siteUrl, {co
re.String category, core.bool latestCountsOnly, core.String platform}) { |
| 442 var _url = null; |
| 443 var _queryParams = new core.Map(); |
| 444 var _uploadMedia = null; |
| 445 var _uploadOptions = null; |
| 446 var _downloadOptions = common.DownloadOptions.Metadata; |
| 447 var _body = null; |
| 448 |
| 449 if (siteUrl == null) { |
| 450 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 451 } |
| 452 if (category != null) { |
| 453 _queryParams["category"] = [category]; |
| 454 } |
| 455 if (latestCountsOnly != null) { |
| 456 _queryParams["latestCountsOnly"] = ["${latestCountsOnly}"]; |
| 457 } |
| 458 if (platform != null) { |
| 459 _queryParams["platform"] = [platform]; |
| 460 } |
| 461 |
| 462 |
| 463 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl') + '/urlC
rawlErrorsCounts/query'; |
| 464 |
| 465 var _response = _requester.request(_url, |
| 466 "GET", |
| 467 body: _body, |
| 468 queryParams: _queryParams, |
| 469 uploadOptions: _uploadOptions, |
| 470 uploadMedia: _uploadMedia, |
| 471 downloadOptions: _downloadOptions); |
| 472 return _response.then((data) => new UrlCrawlErrorsCountsQueryResponse.fromJs
on(data)); |
| 473 } |
| 474 |
| 475 } |
| 476 |
| 477 |
| 478 /** Not documented yet. */ |
| 479 class UrlcrawlerrorssamplesResourceApi { |
| 480 final common_internal.ApiRequester _requester; |
| 481 |
| 482 UrlcrawlerrorssamplesResourceApi(common_internal.ApiRequester client) : |
| 483 _requester = client; |
| 484 |
| 485 /** |
| 486 * Retrieves details about crawl errors for a site's sample URL. |
| 487 * |
| 488 * Request parameters: |
| 489 * |
| 490 * [siteUrl] - The site's URL, including protocol, for example |
| 491 * 'http://www.example.com/' |
| 492 * |
| 493 * [url] - The relative path (without the site) of the sample URL; must be one |
| 494 * of the URLs returned by list |
| 495 * |
| 496 * [category] - The crawl error category, for example 'authPermissions' |
| 497 * Possible string values are: |
| 498 * - "authPermissions" |
| 499 * - "manyToOneRedirect" |
| 500 * - "notFollowed" |
| 501 * - "notFound" |
| 502 * - "other" |
| 503 * - "roboted" |
| 504 * - "serverError" |
| 505 * - "soft404" |
| 506 * |
| 507 * [platform] - The user agent type (platform) that made the request, for |
| 508 * example 'web' |
| 509 * Possible string values are: |
| 510 * - "mobile" |
| 511 * - "smartphoneOnly" |
| 512 * - "web" |
| 513 * |
| 514 * Completes with a [UrlCrawlErrorsSample]. |
| 515 * |
| 516 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 517 * error. |
| 518 * |
| 519 * If the used [http.Client] completes with an error when making a REST call, |
| 520 * this method will complete with the same error. |
| 521 */ |
| 522 async.Future<UrlCrawlErrorsSample> get(core.String siteUrl, core.String url, c
ore.String category, core.String platform) { |
| 523 var _url = null; |
| 524 var _queryParams = new core.Map(); |
| 525 var _uploadMedia = null; |
| 526 var _uploadOptions = null; |
| 527 var _downloadOptions = common.DownloadOptions.Metadata; |
| 528 var _body = null; |
| 529 |
| 530 if (siteUrl == null) { |
| 531 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 532 } |
| 533 if (url == null) { |
| 534 throw new core.ArgumentError("Parameter url is required."); |
| 535 } |
| 536 if (category == null) { |
| 537 throw new core.ArgumentError("Parameter category is required."); |
| 538 } |
| 539 _queryParams["category"] = [category]; |
| 540 if (platform == null) { |
| 541 throw new core.ArgumentError("Parameter platform is required."); |
| 542 } |
| 543 _queryParams["platform"] = [platform]; |
| 544 |
| 545 |
| 546 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl') + '/urlC
rawlErrorsSamples/' + common_internal.Escaper.ecapeVariable('$url'); |
| 547 |
| 548 var _response = _requester.request(_url, |
| 549 "GET", |
| 550 body: _body, |
| 551 queryParams: _queryParams, |
| 552 uploadOptions: _uploadOptions, |
| 553 uploadMedia: _uploadMedia, |
| 554 downloadOptions: _downloadOptions); |
| 555 return _response.then((data) => new UrlCrawlErrorsSample.fromJson(data)); |
| 556 } |
| 557 |
| 558 /** |
| 559 * Lists a site's sample URLs for the specified crawl error category and |
| 560 * platform. |
| 561 * |
| 562 * Request parameters: |
| 563 * |
| 564 * [siteUrl] - The site's URL, including protocol, for example |
| 565 * 'http://www.example.com/' |
| 566 * |
| 567 * [category] - The crawl error category, for example 'authPermissions' |
| 568 * Possible string values are: |
| 569 * - "authPermissions" |
| 570 * - "manyToOneRedirect" |
| 571 * - "notFollowed" |
| 572 * - "notFound" |
| 573 * - "other" |
| 574 * - "roboted" |
| 575 * - "serverError" |
| 576 * - "soft404" |
| 577 * |
| 578 * [platform] - The user agent type (platform) that made the request, for |
| 579 * example 'web' |
| 580 * Possible string values are: |
| 581 * - "mobile" |
| 582 * - "smartphoneOnly" |
| 583 * - "web" |
| 584 * |
| 585 * Completes with a [UrlCrawlErrorsSamplesListResponse]. |
| 586 * |
| 587 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 588 * error. |
| 589 * |
| 590 * If the used [http.Client] completes with an error when making a REST call, |
| 591 * this method will complete with the same error. |
| 592 */ |
| 593 async.Future<UrlCrawlErrorsSamplesListResponse> list(core.String siteUrl, core
.String category, core.String platform) { |
| 594 var _url = null; |
| 595 var _queryParams = new core.Map(); |
| 596 var _uploadMedia = null; |
| 597 var _uploadOptions = null; |
| 598 var _downloadOptions = common.DownloadOptions.Metadata; |
| 599 var _body = null; |
| 600 |
| 601 if (siteUrl == null) { |
| 602 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 603 } |
| 604 if (category == null) { |
| 605 throw new core.ArgumentError("Parameter category is required."); |
| 606 } |
| 607 _queryParams["category"] = [category]; |
| 608 if (platform == null) { |
| 609 throw new core.ArgumentError("Parameter platform is required."); |
| 610 } |
| 611 _queryParams["platform"] = [platform]; |
| 612 |
| 613 |
| 614 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl') + '/urlC
rawlErrorsSamples'; |
| 615 |
| 616 var _response = _requester.request(_url, |
| 617 "GET", |
| 618 body: _body, |
| 619 queryParams: _queryParams, |
| 620 uploadOptions: _uploadOptions, |
| 621 uploadMedia: _uploadMedia, |
| 622 downloadOptions: _downloadOptions); |
| 623 return _response.then((data) => new UrlCrawlErrorsSamplesListResponse.fromJs
on(data)); |
| 624 } |
| 625 |
| 626 /** |
| 627 * Marks the provided site's sample URL as fixed, and removes it from the |
| 628 * samples list. |
| 629 * |
| 630 * Request parameters: |
| 631 * |
| 632 * [siteUrl] - The site's URL, including protocol, for example |
| 633 * 'http://www.example.com/' |
| 634 * |
| 635 * [url] - The relative path (without the site) of the sample URL; must be one |
| 636 * of the URLs returned by list |
| 637 * |
| 638 * [category] - The crawl error category, for example 'authPermissions' |
| 639 * Possible string values are: |
| 640 * - "authPermissions" |
| 641 * - "manyToOneRedirect" |
| 642 * - "notFollowed" |
| 643 * - "notFound" |
| 644 * - "other" |
| 645 * - "roboted" |
| 646 * - "serverError" |
| 647 * - "soft404" |
| 648 * |
| 649 * [platform] - The user agent type (platform) that made the request, for |
| 650 * example 'web' |
| 651 * Possible string values are: |
| 652 * - "mobile" |
| 653 * - "smartphoneOnly" |
| 654 * - "web" |
| 655 * |
| 656 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 657 * error. |
| 658 * |
| 659 * If the used [http.Client] completes with an error when making a REST call, |
| 660 * this method will complete with the same error. |
| 661 */ |
| 662 async.Future markAsFixed(core.String siteUrl, core.String url, core.String cat
egory, core.String platform) { |
| 663 var _url = null; |
| 664 var _queryParams = new core.Map(); |
| 665 var _uploadMedia = null; |
| 666 var _uploadOptions = null; |
| 667 var _downloadOptions = common.DownloadOptions.Metadata; |
| 668 var _body = null; |
| 669 |
| 670 if (siteUrl == null) { |
| 671 throw new core.ArgumentError("Parameter siteUrl is required."); |
| 672 } |
| 673 if (url == null) { |
| 674 throw new core.ArgumentError("Parameter url is required."); |
| 675 } |
| 676 if (category == null) { |
| 677 throw new core.ArgumentError("Parameter category is required."); |
| 678 } |
| 679 _queryParams["category"] = [category]; |
| 680 if (platform == null) { |
| 681 throw new core.ArgumentError("Parameter platform is required."); |
| 682 } |
| 683 _queryParams["platform"] = [platform]; |
| 684 |
| 685 _downloadOptions = null; |
| 686 |
| 687 _url = 'sites/' + common_internal.Escaper.ecapeVariable('$siteUrl') + '/urlC
rawlErrorsSamples/' + common_internal.Escaper.ecapeVariable('$url'); |
| 688 |
| 689 var _response = _requester.request(_url, |
| 690 "DELETE", |
| 691 body: _body, |
| 692 queryParams: _queryParams, |
| 693 uploadOptions: _uploadOptions, |
| 694 uploadMedia: _uploadMedia, |
| 695 downloadOptions: _downloadOptions); |
| 696 return _response.then((data) => null); |
| 697 } |
| 698 |
| 699 } |
| 700 |
| 701 |
| 702 |
| 703 /** List of sitemaps. */ |
| 704 class SitemapsListResponse { |
| 705 /** Information about a sitemap entry. */ |
| 706 core.List<WmxSitemap> sitemap; |
| 707 |
| 708 |
| 709 SitemapsListResponse(); |
| 710 |
| 711 SitemapsListResponse.fromJson(core.Map _json) { |
| 712 if (_json.containsKey("sitemap")) { |
| 713 sitemap = _json["sitemap"].map((value) => new WmxSitemap.fromJson(value)).
toList(); |
| 714 } |
| 715 } |
| 716 |
| 717 core.Map toJson() { |
| 718 var _json = new core.Map(); |
| 719 if (sitemap != null) { |
| 720 _json["sitemap"] = sitemap.map((value) => (value).toJson()).toList(); |
| 721 } |
| 722 return _json; |
| 723 } |
| 724 } |
| 725 |
| 726 |
| 727 /** List of sites with access level information. */ |
| 728 class SitesListResponse { |
| 729 /** Access level information for a Webmaster Tools site. */ |
| 730 core.List<WmxSite> siteEntry; |
| 731 |
| 732 |
| 733 SitesListResponse(); |
| 734 |
| 735 SitesListResponse.fromJson(core.Map _json) { |
| 736 if (_json.containsKey("siteEntry")) { |
| 737 siteEntry = _json["siteEntry"].map((value) => new WmxSite.fromJson(value))
.toList(); |
| 738 } |
| 739 } |
| 740 |
| 741 core.Map toJson() { |
| 742 var _json = new core.Map(); |
| 743 if (siteEntry != null) { |
| 744 _json["siteEntry"] = siteEntry.map((value) => (value).toJson()).toList(); |
| 745 } |
| 746 return _json; |
| 747 } |
| 748 } |
| 749 |
| 750 |
| 751 /** An entry in a URL crawl errors time series. */ |
| 752 class UrlCrawlErrorCount { |
| 753 /** The error count at the given timestamp. */ |
| 754 core.String count; |
| 755 |
| 756 /** The time (well, date) when errors were detected, in RFC 3339 format. */ |
| 757 core.DateTime timestamp; |
| 758 |
| 759 |
| 760 UrlCrawlErrorCount(); |
| 761 |
| 762 UrlCrawlErrorCount.fromJson(core.Map _json) { |
| 763 if (_json.containsKey("count")) { |
| 764 count = _json["count"]; |
| 765 } |
| 766 if (_json.containsKey("timestamp")) { |
| 767 timestamp = core.DateTime.parse(_json["timestamp"]); |
| 768 } |
| 769 } |
| 770 |
| 771 core.Map toJson() { |
| 772 var _json = new core.Map(); |
| 773 if (count != null) { |
| 774 _json["count"] = count; |
| 775 } |
| 776 if (timestamp != null) { |
| 777 _json["timestamp"] = (timestamp).toIso8601String(); |
| 778 } |
| 779 return _json; |
| 780 } |
| 781 } |
| 782 |
| 783 |
| 784 /** |
| 785 * Number of errors per day for a specific error type (defined by platform and |
| 786 * category). |
| 787 */ |
| 788 class UrlCrawlErrorCountsPerType { |
| 789 /** The crawl error type. */ |
| 790 core.String category; |
| 791 |
| 792 /** The error count entries time series. */ |
| 793 core.List<UrlCrawlErrorCount> entries; |
| 794 |
| 795 /** Corresponding to the user agent that made the request. */ |
| 796 core.String platform; |
| 797 |
| 798 |
| 799 UrlCrawlErrorCountsPerType(); |
| 800 |
| 801 UrlCrawlErrorCountsPerType.fromJson(core.Map _json) { |
| 802 if (_json.containsKey("category")) { |
| 803 category = _json["category"]; |
| 804 } |
| 805 if (_json.containsKey("entries")) { |
| 806 entries = _json["entries"].map((value) => new UrlCrawlErrorCount.fromJson(
value)).toList(); |
| 807 } |
| 808 if (_json.containsKey("platform")) { |
| 809 platform = _json["platform"]; |
| 810 } |
| 811 } |
| 812 |
| 813 core.Map toJson() { |
| 814 var _json = new core.Map(); |
| 815 if (category != null) { |
| 816 _json["category"] = category; |
| 817 } |
| 818 if (entries != null) { |
| 819 _json["entries"] = entries.map((value) => (value).toJson()).toList(); |
| 820 } |
| 821 if (platform != null) { |
| 822 _json["platform"] = platform; |
| 823 } |
| 824 return _json; |
| 825 } |
| 826 } |
| 827 |
| 828 |
| 829 /** |
| 830 * A time series of the number of URL crawl errors per error category and |
| 831 * platform. |
| 832 */ |
| 833 class UrlCrawlErrorsCountsQueryResponse { |
| 834 /** |
| 835 * The time series of the number of URL crawl errors for per error category |
| 836 * and platform. |
| 837 */ |
| 838 core.List<UrlCrawlErrorCountsPerType> countPerTypes; |
| 839 |
| 840 |
| 841 UrlCrawlErrorsCountsQueryResponse(); |
| 842 |
| 843 UrlCrawlErrorsCountsQueryResponse.fromJson(core.Map _json) { |
| 844 if (_json.containsKey("countPerTypes")) { |
| 845 countPerTypes = _json["countPerTypes"].map((value) => new UrlCrawlErrorCou
ntsPerType.fromJson(value)).toList(); |
| 846 } |
| 847 } |
| 848 |
| 849 core.Map toJson() { |
| 850 var _json = new core.Map(); |
| 851 if (countPerTypes != null) { |
| 852 _json["countPerTypes"] = countPerTypes.map((value) => (value).toJson()).to
List(); |
| 853 } |
| 854 return _json; |
| 855 } |
| 856 } |
| 857 |
| 858 |
| 859 /** Not documented yet. */ |
| 860 class UrlCrawlErrorsSample { |
| 861 /** The time the error was first detected, in RFC 3339 format. */ |
| 862 core.DateTime firstDetected; |
| 863 |
| 864 /** The time when the URL was last crawled, in RFC 3339 format. */ |
| 865 core.DateTime lastCrawled; |
| 866 |
| 867 /** The URL of an error, relative to the site. */ |
| 868 core.String pageUrl; |
| 869 |
| 870 /** The HTTP response code, if any. */ |
| 871 core.int responseCode; |
| 872 |
| 873 /** Additional details about the URL, set only when calling get(). */ |
| 874 UrlSampleDetails urlDetails; |
| 875 |
| 876 |
| 877 UrlCrawlErrorsSample(); |
| 878 |
| 879 UrlCrawlErrorsSample.fromJson(core.Map _json) { |
| 880 if (_json.containsKey("first_detected")) { |
| 881 firstDetected = core.DateTime.parse(_json["first_detected"]); |
| 882 } |
| 883 if (_json.containsKey("last_crawled")) { |
| 884 lastCrawled = core.DateTime.parse(_json["last_crawled"]); |
| 885 } |
| 886 if (_json.containsKey("pageUrl")) { |
| 887 pageUrl = _json["pageUrl"]; |
| 888 } |
| 889 if (_json.containsKey("responseCode")) { |
| 890 responseCode = _json["responseCode"]; |
| 891 } |
| 892 if (_json.containsKey("urlDetails")) { |
| 893 urlDetails = new UrlSampleDetails.fromJson(_json["urlDetails"]); |
| 894 } |
| 895 } |
| 896 |
| 897 core.Map toJson() { |
| 898 var _json = new core.Map(); |
| 899 if (firstDetected != null) { |
| 900 _json["first_detected"] = (firstDetected).toIso8601String(); |
| 901 } |
| 902 if (lastCrawled != null) { |
| 903 _json["last_crawled"] = (lastCrawled).toIso8601String(); |
| 904 } |
| 905 if (pageUrl != null) { |
| 906 _json["pageUrl"] = pageUrl; |
| 907 } |
| 908 if (responseCode != null) { |
| 909 _json["responseCode"] = responseCode; |
| 910 } |
| 911 if (urlDetails != null) { |
| 912 _json["urlDetails"] = (urlDetails).toJson(); |
| 913 } |
| 914 return _json; |
| 915 } |
| 916 } |
| 917 |
| 918 |
| 919 /** List of crawl error samples. */ |
| 920 class UrlCrawlErrorsSamplesListResponse { |
| 921 /** Information about the sample URL and its crawl error. */ |
| 922 core.List<UrlCrawlErrorsSample> urlCrawlErrorSample; |
| 923 |
| 924 |
| 925 UrlCrawlErrorsSamplesListResponse(); |
| 926 |
| 927 UrlCrawlErrorsSamplesListResponse.fromJson(core.Map _json) { |
| 928 if (_json.containsKey("urlCrawlErrorSample")) { |
| 929 urlCrawlErrorSample = _json["urlCrawlErrorSample"].map((value) => new UrlC
rawlErrorsSample.fromJson(value)).toList(); |
| 930 } |
| 931 } |
| 932 |
| 933 core.Map toJson() { |
| 934 var _json = new core.Map(); |
| 935 if (urlCrawlErrorSample != null) { |
| 936 _json["urlCrawlErrorSample"] = urlCrawlErrorSample.map((value) => (value).
toJson()).toList(); |
| 937 } |
| 938 return _json; |
| 939 } |
| 940 } |
| 941 |
| 942 |
| 943 /** Additional details about the URL, set only when calling get(). */ |
| 944 class UrlSampleDetails { |
| 945 /** List of sitemaps pointing at this URL. */ |
| 946 core.List<core.String> containingSitemaps; |
| 947 |
| 948 /** A sample set of URLs linking to this URL. */ |
| 949 core.List<core.String> linkedFromUrls; |
| 950 |
| 951 |
| 952 UrlSampleDetails(); |
| 953 |
| 954 UrlSampleDetails.fromJson(core.Map _json) { |
| 955 if (_json.containsKey("containingSitemaps")) { |
| 956 containingSitemaps = _json["containingSitemaps"]; |
| 957 } |
| 958 if (_json.containsKey("linkedFromUrls")) { |
| 959 linkedFromUrls = _json["linkedFromUrls"]; |
| 960 } |
| 961 } |
| 962 |
| 963 core.Map toJson() { |
| 964 var _json = new core.Map(); |
| 965 if (containingSitemaps != null) { |
| 966 _json["containingSitemaps"] = containingSitemaps; |
| 967 } |
| 968 if (linkedFromUrls != null) { |
| 969 _json["linkedFromUrls"] = linkedFromUrls; |
| 970 } |
| 971 return _json; |
| 972 } |
| 973 } |
| 974 |
| 975 |
| 976 /** Access level information for a Webmaster Tools site. */ |
| 977 class WmxSite { |
| 978 /** The user's permission level for the site. */ |
| 979 core.String permissionLevel; |
| 980 |
| 981 /** The URL of the site. */ |
| 982 core.String siteUrl; |
| 983 |
| 984 |
| 985 WmxSite(); |
| 986 |
| 987 WmxSite.fromJson(core.Map _json) { |
| 988 if (_json.containsKey("permissionLevel")) { |
| 989 permissionLevel = _json["permissionLevel"]; |
| 990 } |
| 991 if (_json.containsKey("siteUrl")) { |
| 992 siteUrl = _json["siteUrl"]; |
| 993 } |
| 994 } |
| 995 |
| 996 core.Map toJson() { |
| 997 var _json = new core.Map(); |
| 998 if (permissionLevel != null) { |
| 999 _json["permissionLevel"] = permissionLevel; |
| 1000 } |
| 1001 if (siteUrl != null) { |
| 1002 _json["siteUrl"] = siteUrl; |
| 1003 } |
| 1004 return _json; |
| 1005 } |
| 1006 } |
| 1007 |
| 1008 |
| 1009 /** Not documented yet. */ |
| 1010 class WmxSitemap { |
| 1011 /** The various content types in the sitemap. */ |
| 1012 core.List<WmxSitemapContent> contents; |
| 1013 |
| 1014 /** |
| 1015 * Number of errors in the sitemap - issues with the sitemap itself, that |
| 1016 * needs to be fixed before it can be processed correctly. |
| 1017 */ |
| 1018 core.String errors; |
| 1019 |
| 1020 /** If true, the sitemap has not been processed. */ |
| 1021 core.bool isPending; |
| 1022 |
| 1023 /** If true, the sitemap is a collection of sitemaps. */ |
| 1024 core.bool isSitemapsIndex; |
| 1025 |
| 1026 /** |
| 1027 * Date & time in which this sitemap was last downloaded. Date format is in |
| 1028 * RFC 3339 format (yyyy-mm-dd). |
| 1029 */ |
| 1030 core.DateTime lastDownloaded; |
| 1031 |
| 1032 /** |
| 1033 * Date & time in which this sitemap was submitted. Date format is in RFC 3339 |
| 1034 * format (yyyy-mm-dd). |
| 1035 */ |
| 1036 core.DateTime lastSubmitted; |
| 1037 |
| 1038 /** The url of the sitemap. */ |
| 1039 core.String path; |
| 1040 |
| 1041 /** The type of the sitemap (for example "sitemap"). */ |
| 1042 core.String type; |
| 1043 |
| 1044 /** Number of warnings for the sitemap - issues with URLs in the sitemaps. */ |
| 1045 core.String warnings; |
| 1046 |
| 1047 |
| 1048 WmxSitemap(); |
| 1049 |
| 1050 WmxSitemap.fromJson(core.Map _json) { |
| 1051 if (_json.containsKey("contents")) { |
| 1052 contents = _json["contents"].map((value) => new WmxSitemapContent.fromJson
(value)).toList(); |
| 1053 } |
| 1054 if (_json.containsKey("errors")) { |
| 1055 errors = _json["errors"]; |
| 1056 } |
| 1057 if (_json.containsKey("isPending")) { |
| 1058 isPending = _json["isPending"]; |
| 1059 } |
| 1060 if (_json.containsKey("isSitemapsIndex")) { |
| 1061 isSitemapsIndex = _json["isSitemapsIndex"]; |
| 1062 } |
| 1063 if (_json.containsKey("lastDownloaded")) { |
| 1064 lastDownloaded = core.DateTime.parse(_json["lastDownloaded"]); |
| 1065 } |
| 1066 if (_json.containsKey("lastSubmitted")) { |
| 1067 lastSubmitted = core.DateTime.parse(_json["lastSubmitted"]); |
| 1068 } |
| 1069 if (_json.containsKey("path")) { |
| 1070 path = _json["path"]; |
| 1071 } |
| 1072 if (_json.containsKey("type")) { |
| 1073 type = _json["type"]; |
| 1074 } |
| 1075 if (_json.containsKey("warnings")) { |
| 1076 warnings = _json["warnings"]; |
| 1077 } |
| 1078 } |
| 1079 |
| 1080 core.Map toJson() { |
| 1081 var _json = new core.Map(); |
| 1082 if (contents != null) { |
| 1083 _json["contents"] = contents.map((value) => (value).toJson()).toList(); |
| 1084 } |
| 1085 if (errors != null) { |
| 1086 _json["errors"] = errors; |
| 1087 } |
| 1088 if (isPending != null) { |
| 1089 _json["isPending"] = isPending; |
| 1090 } |
| 1091 if (isSitemapsIndex != null) { |
| 1092 _json["isSitemapsIndex"] = isSitemapsIndex; |
| 1093 } |
| 1094 if (lastDownloaded != null) { |
| 1095 _json["lastDownloaded"] = (lastDownloaded).toIso8601String(); |
| 1096 } |
| 1097 if (lastSubmitted != null) { |
| 1098 _json["lastSubmitted"] = (lastSubmitted).toIso8601String(); |
| 1099 } |
| 1100 if (path != null) { |
| 1101 _json["path"] = path; |
| 1102 } |
| 1103 if (type != null) { |
| 1104 _json["type"] = type; |
| 1105 } |
| 1106 if (warnings != null) { |
| 1107 _json["warnings"] = warnings; |
| 1108 } |
| 1109 return _json; |
| 1110 } |
| 1111 } |
| 1112 |
| 1113 |
| 1114 /** Information about the various content types in the sitemap. */ |
| 1115 class WmxSitemapContent { |
| 1116 /** |
| 1117 * The number of URLs from the sitemap that were indexed (of the content |
| 1118 * type). |
| 1119 */ |
| 1120 core.String indexed; |
| 1121 |
| 1122 /** The number of URLs in the sitemap (of the content type). */ |
| 1123 core.String submitted; |
| 1124 |
| 1125 /** |
| 1126 * The specific type of content in this sitemap (for example "web", "images"). |
| 1127 */ |
| 1128 core.String type; |
| 1129 |
| 1130 |
| 1131 WmxSitemapContent(); |
| 1132 |
| 1133 WmxSitemapContent.fromJson(core.Map _json) { |
| 1134 if (_json.containsKey("indexed")) { |
| 1135 indexed = _json["indexed"]; |
| 1136 } |
| 1137 if (_json.containsKey("submitted")) { |
| 1138 submitted = _json["submitted"]; |
| 1139 } |
| 1140 if (_json.containsKey("type")) { |
| 1141 type = _json["type"]; |
| 1142 } |
| 1143 } |
| 1144 |
| 1145 core.Map toJson() { |
| 1146 var _json = new core.Map(); |
| 1147 if (indexed != null) { |
| 1148 _json["indexed"] = indexed; |
| 1149 } |
| 1150 if (submitted != null) { |
| 1151 _json["submitted"] = submitted; |
| 1152 } |
| 1153 if (type != null) { |
| 1154 _json["type"] = type; |
| 1155 } |
| 1156 return _json; |
| 1157 } |
| 1158 } |
| 1159 |
| 1160 |
OLD | NEW |