OLD | NEW |
(Empty) | |
| 1 library googleapis.siteVerification.v1; |
| 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 programatically verify ownership of websites or domains with Google. |
| 18 */ |
| 19 class SiteVerificationApi { |
| 20 /** Manage the list of sites and domains you control */ |
| 21 static const SiteverificationScope = "https://www.googleapis.com/auth/siteveri
fication"; |
| 22 |
| 23 /** Manage your new site verifications with Google */ |
| 24 static const SiteverificationVerifyOnlyScope = "https://www.googleapis.com/aut
h/siteverification.verify_only"; |
| 25 |
| 26 |
| 27 final common_internal.ApiRequester _requester; |
| 28 |
| 29 WebResourceResourceApi get webResource => new WebResourceResourceApi(_requeste
r); |
| 30 |
| 31 SiteVerificationApi(http.Client client) : |
| 32 _requester = new common_internal.ApiRequester(client, "https://www.googlea
pis.com/", "/siteVerification/v1/"); |
| 33 } |
| 34 |
| 35 |
| 36 /** Not documented yet. */ |
| 37 class WebResourceResourceApi { |
| 38 final common_internal.ApiRequester _requester; |
| 39 |
| 40 WebResourceResourceApi(common_internal.ApiRequester client) : |
| 41 _requester = client; |
| 42 |
| 43 /** |
| 44 * Relinquish ownership of a website or domain. |
| 45 * |
| 46 * Request parameters: |
| 47 * |
| 48 * [id] - The id of a verified site or domain. |
| 49 * |
| 50 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 51 * error. |
| 52 * |
| 53 * If the used [http.Client] completes with an error when making a REST call, |
| 54 * this method will complete with the same error. |
| 55 */ |
| 56 async.Future delete(core.String id) { |
| 57 var _url = null; |
| 58 var _queryParams = new core.Map(); |
| 59 var _uploadMedia = null; |
| 60 var _uploadOptions = null; |
| 61 var _downloadOptions = common.DownloadOptions.Metadata; |
| 62 var _body = null; |
| 63 |
| 64 if (id == null) { |
| 65 throw new core.ArgumentError("Parameter id is required."); |
| 66 } |
| 67 |
| 68 _downloadOptions = null; |
| 69 |
| 70 _url = 'webResource/' + common_internal.Escaper.ecapeVariable('$id'); |
| 71 |
| 72 var _response = _requester.request(_url, |
| 73 "DELETE", |
| 74 body: _body, |
| 75 queryParams: _queryParams, |
| 76 uploadOptions: _uploadOptions, |
| 77 uploadMedia: _uploadMedia, |
| 78 downloadOptions: _downloadOptions); |
| 79 return _response.then((data) => null); |
| 80 } |
| 81 |
| 82 /** |
| 83 * Get the most current data for a website or domain. |
| 84 * |
| 85 * Request parameters: |
| 86 * |
| 87 * [id] - The id of a verified site or domain. |
| 88 * |
| 89 * Completes with a [SiteVerificationWebResourceResource]. |
| 90 * |
| 91 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 92 * error. |
| 93 * |
| 94 * If the used [http.Client] completes with an error when making a REST call, |
| 95 * this method will complete with the same error. |
| 96 */ |
| 97 async.Future<SiteVerificationWebResourceResource> get(core.String id) { |
| 98 var _url = null; |
| 99 var _queryParams = new core.Map(); |
| 100 var _uploadMedia = null; |
| 101 var _uploadOptions = null; |
| 102 var _downloadOptions = common.DownloadOptions.Metadata; |
| 103 var _body = null; |
| 104 |
| 105 if (id == null) { |
| 106 throw new core.ArgumentError("Parameter id is required."); |
| 107 } |
| 108 |
| 109 |
| 110 _url = 'webResource/' + common_internal.Escaper.ecapeVariable('$id'); |
| 111 |
| 112 var _response = _requester.request(_url, |
| 113 "GET", |
| 114 body: _body, |
| 115 queryParams: _queryParams, |
| 116 uploadOptions: _uploadOptions, |
| 117 uploadMedia: _uploadMedia, |
| 118 downloadOptions: _downloadOptions); |
| 119 return _response.then((data) => new SiteVerificationWebResourceResource.from
Json(data)); |
| 120 } |
| 121 |
| 122 /** |
| 123 * Get a verification token for placing on a website or domain. |
| 124 * |
| 125 * [request] - The metadata request object. |
| 126 * |
| 127 * Request parameters: |
| 128 * |
| 129 * Completes with a [SiteVerificationWebResourceGettokenResponse]. |
| 130 * |
| 131 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 132 * error. |
| 133 * |
| 134 * If the used [http.Client] completes with an error when making a REST call, |
| 135 * this method will complete with the same error. |
| 136 */ |
| 137 async.Future<SiteVerificationWebResourceGettokenResponse> getToken(SiteVerific
ationWebResourceGettokenRequest request) { |
| 138 var _url = null; |
| 139 var _queryParams = new core.Map(); |
| 140 var _uploadMedia = null; |
| 141 var _uploadOptions = null; |
| 142 var _downloadOptions = common.DownloadOptions.Metadata; |
| 143 var _body = null; |
| 144 |
| 145 if (request != null) { |
| 146 _body = convert.JSON.encode((request).toJson()); |
| 147 } |
| 148 |
| 149 |
| 150 _url = 'token'; |
| 151 |
| 152 var _response = _requester.request(_url, |
| 153 "POST", |
| 154 body: _body, |
| 155 queryParams: _queryParams, |
| 156 uploadOptions: _uploadOptions, |
| 157 uploadMedia: _uploadMedia, |
| 158 downloadOptions: _downloadOptions); |
| 159 return _response.then((data) => new SiteVerificationWebResourceGettokenRespo
nse.fromJson(data)); |
| 160 } |
| 161 |
| 162 /** |
| 163 * Attempt verification of a website or domain. |
| 164 * |
| 165 * [request] - The metadata request object. |
| 166 * |
| 167 * Request parameters: |
| 168 * |
| 169 * [verificationMethod] - The method to use for verifying a site or domain. |
| 170 * |
| 171 * Completes with a [SiteVerificationWebResourceResource]. |
| 172 * |
| 173 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 174 * error. |
| 175 * |
| 176 * If the used [http.Client] completes with an error when making a REST call, |
| 177 * this method will complete with the same error. |
| 178 */ |
| 179 async.Future<SiteVerificationWebResourceResource> insert(SiteVerificationWebRe
sourceResource request, core.String verificationMethod) { |
| 180 var _url = null; |
| 181 var _queryParams = new core.Map(); |
| 182 var _uploadMedia = null; |
| 183 var _uploadOptions = null; |
| 184 var _downloadOptions = common.DownloadOptions.Metadata; |
| 185 var _body = null; |
| 186 |
| 187 if (request != null) { |
| 188 _body = convert.JSON.encode((request).toJson()); |
| 189 } |
| 190 if (verificationMethod == null) { |
| 191 throw new core.ArgumentError("Parameter verificationMethod is required."); |
| 192 } |
| 193 _queryParams["verificationMethod"] = [verificationMethod]; |
| 194 |
| 195 |
| 196 _url = 'webResource'; |
| 197 |
| 198 var _response = _requester.request(_url, |
| 199 "POST", |
| 200 body: _body, |
| 201 queryParams: _queryParams, |
| 202 uploadOptions: _uploadOptions, |
| 203 uploadMedia: _uploadMedia, |
| 204 downloadOptions: _downloadOptions); |
| 205 return _response.then((data) => new SiteVerificationWebResourceResource.from
Json(data)); |
| 206 } |
| 207 |
| 208 /** |
| 209 * Get the list of your verified websites and domains. |
| 210 * |
| 211 * Request parameters: |
| 212 * |
| 213 * Completes with a [SiteVerificationWebResourceListResponse]. |
| 214 * |
| 215 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 216 * error. |
| 217 * |
| 218 * If the used [http.Client] completes with an error when making a REST call, |
| 219 * this method will complete with the same error. |
| 220 */ |
| 221 async.Future<SiteVerificationWebResourceListResponse> list() { |
| 222 var _url = null; |
| 223 var _queryParams = new core.Map(); |
| 224 var _uploadMedia = null; |
| 225 var _uploadOptions = null; |
| 226 var _downloadOptions = common.DownloadOptions.Metadata; |
| 227 var _body = null; |
| 228 |
| 229 |
| 230 |
| 231 _url = 'webResource'; |
| 232 |
| 233 var _response = _requester.request(_url, |
| 234 "GET", |
| 235 body: _body, |
| 236 queryParams: _queryParams, |
| 237 uploadOptions: _uploadOptions, |
| 238 uploadMedia: _uploadMedia, |
| 239 downloadOptions: _downloadOptions); |
| 240 return _response.then((data) => new SiteVerificationWebResourceListResponse.
fromJson(data)); |
| 241 } |
| 242 |
| 243 /** |
| 244 * Modify the list of owners for your website or domain. This method supports |
| 245 * patch semantics. |
| 246 * |
| 247 * [request] - The metadata request object. |
| 248 * |
| 249 * Request parameters: |
| 250 * |
| 251 * [id] - The id of a verified site or domain. |
| 252 * |
| 253 * Completes with a [SiteVerificationWebResourceResource]. |
| 254 * |
| 255 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 256 * error. |
| 257 * |
| 258 * If the used [http.Client] completes with an error when making a REST call, |
| 259 * this method will complete with the same error. |
| 260 */ |
| 261 async.Future<SiteVerificationWebResourceResource> patch(SiteVerificationWebRes
ourceResource request, core.String id) { |
| 262 var _url = null; |
| 263 var _queryParams = new core.Map(); |
| 264 var _uploadMedia = null; |
| 265 var _uploadOptions = null; |
| 266 var _downloadOptions = common.DownloadOptions.Metadata; |
| 267 var _body = null; |
| 268 |
| 269 if (request != null) { |
| 270 _body = convert.JSON.encode((request).toJson()); |
| 271 } |
| 272 if (id == null) { |
| 273 throw new core.ArgumentError("Parameter id is required."); |
| 274 } |
| 275 |
| 276 |
| 277 _url = 'webResource/' + common_internal.Escaper.ecapeVariable('$id'); |
| 278 |
| 279 var _response = _requester.request(_url, |
| 280 "PATCH", |
| 281 body: _body, |
| 282 queryParams: _queryParams, |
| 283 uploadOptions: _uploadOptions, |
| 284 uploadMedia: _uploadMedia, |
| 285 downloadOptions: _downloadOptions); |
| 286 return _response.then((data) => new SiteVerificationWebResourceResource.from
Json(data)); |
| 287 } |
| 288 |
| 289 /** |
| 290 * Modify the list of owners for your website or domain. |
| 291 * |
| 292 * [request] - The metadata request object. |
| 293 * |
| 294 * Request parameters: |
| 295 * |
| 296 * [id] - The id of a verified site or domain. |
| 297 * |
| 298 * Completes with a [SiteVerificationWebResourceResource]. |
| 299 * |
| 300 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 301 * error. |
| 302 * |
| 303 * If the used [http.Client] completes with an error when making a REST call, |
| 304 * this method will complete with the same error. |
| 305 */ |
| 306 async.Future<SiteVerificationWebResourceResource> update(SiteVerificationWebRe
sourceResource request, core.String id) { |
| 307 var _url = null; |
| 308 var _queryParams = new core.Map(); |
| 309 var _uploadMedia = null; |
| 310 var _uploadOptions = null; |
| 311 var _downloadOptions = common.DownloadOptions.Metadata; |
| 312 var _body = null; |
| 313 |
| 314 if (request != null) { |
| 315 _body = convert.JSON.encode((request).toJson()); |
| 316 } |
| 317 if (id == null) { |
| 318 throw new core.ArgumentError("Parameter id is required."); |
| 319 } |
| 320 |
| 321 |
| 322 _url = 'webResource/' + common_internal.Escaper.ecapeVariable('$id'); |
| 323 |
| 324 var _response = _requester.request(_url, |
| 325 "PUT", |
| 326 body: _body, |
| 327 queryParams: _queryParams, |
| 328 uploadOptions: _uploadOptions, |
| 329 uploadMedia: _uploadMedia, |
| 330 downloadOptions: _downloadOptions); |
| 331 return _response.then((data) => new SiteVerificationWebResourceResource.from
Json(data)); |
| 332 } |
| 333 |
| 334 } |
| 335 |
| 336 |
| 337 |
| 338 /** The site for which a verification token will be generated. */ |
| 339 class SiteVerificationWebResourceGettokenRequestSite { |
| 340 /** |
| 341 * The site identifier. If the type is set to SITE, the identifier is a URL. |
| 342 * If the type is set to INET_DOMAIN, the site identifier is a domain name. |
| 343 */ |
| 344 core.String identifier; |
| 345 |
| 346 /** |
| 347 * The type of resource to be verified. Can be SITE or INET_DOMAIN (domain |
| 348 * name). |
| 349 */ |
| 350 core.String type; |
| 351 |
| 352 |
| 353 SiteVerificationWebResourceGettokenRequestSite(); |
| 354 |
| 355 SiteVerificationWebResourceGettokenRequestSite.fromJson(core.Map _json) { |
| 356 if (_json.containsKey("identifier")) { |
| 357 identifier = _json["identifier"]; |
| 358 } |
| 359 if (_json.containsKey("type")) { |
| 360 type = _json["type"]; |
| 361 } |
| 362 } |
| 363 |
| 364 core.Map toJson() { |
| 365 var _json = new core.Map(); |
| 366 if (identifier != null) { |
| 367 _json["identifier"] = identifier; |
| 368 } |
| 369 if (type != null) { |
| 370 _json["type"] = type; |
| 371 } |
| 372 return _json; |
| 373 } |
| 374 } |
| 375 |
| 376 |
| 377 /** Not documented yet. */ |
| 378 class SiteVerificationWebResourceGettokenRequest { |
| 379 /** The site for which a verification token will be generated. */ |
| 380 SiteVerificationWebResourceGettokenRequestSite site; |
| 381 |
| 382 /** |
| 383 * The verification method that will be used to verify this site. For sites, |
| 384 * 'FILE' or 'META' methods may be used. For domains, only 'DNS' may be used. |
| 385 */ |
| 386 core.String verificationMethod; |
| 387 |
| 388 |
| 389 SiteVerificationWebResourceGettokenRequest(); |
| 390 |
| 391 SiteVerificationWebResourceGettokenRequest.fromJson(core.Map _json) { |
| 392 if (_json.containsKey("site")) { |
| 393 site = new SiteVerificationWebResourceGettokenRequestSite.fromJson(_json["
site"]); |
| 394 } |
| 395 if (_json.containsKey("verificationMethod")) { |
| 396 verificationMethod = _json["verificationMethod"]; |
| 397 } |
| 398 } |
| 399 |
| 400 core.Map toJson() { |
| 401 var _json = new core.Map(); |
| 402 if (site != null) { |
| 403 _json["site"] = (site).toJson(); |
| 404 } |
| 405 if (verificationMethod != null) { |
| 406 _json["verificationMethod"] = verificationMethod; |
| 407 } |
| 408 return _json; |
| 409 } |
| 410 } |
| 411 |
| 412 |
| 413 /** Not documented yet. */ |
| 414 class SiteVerificationWebResourceGettokenResponse { |
| 415 /** |
| 416 * The verification method to use in conjunction with this token. For FILE, |
| 417 * the token should be placed in the top-level directory of the site, stored |
| 418 * inside a file of the same name. For META, the token should be placed in the |
| 419 * HEAD tag of the default page that is loaded for the site. For DNS, the |
| 420 * token should be placed in a TXT record of the domain. |
| 421 */ |
| 422 core.String method; |
| 423 |
| 424 /** |
| 425 * The verification token. The token must be placed appropriately in order for |
| 426 * verification to succeed. |
| 427 */ |
| 428 core.String token; |
| 429 |
| 430 |
| 431 SiteVerificationWebResourceGettokenResponse(); |
| 432 |
| 433 SiteVerificationWebResourceGettokenResponse.fromJson(core.Map _json) { |
| 434 if (_json.containsKey("method")) { |
| 435 method = _json["method"]; |
| 436 } |
| 437 if (_json.containsKey("token")) { |
| 438 token = _json["token"]; |
| 439 } |
| 440 } |
| 441 |
| 442 core.Map toJson() { |
| 443 var _json = new core.Map(); |
| 444 if (method != null) { |
| 445 _json["method"] = method; |
| 446 } |
| 447 if (token != null) { |
| 448 _json["token"] = token; |
| 449 } |
| 450 return _json; |
| 451 } |
| 452 } |
| 453 |
| 454 |
| 455 /** Not documented yet. */ |
| 456 class SiteVerificationWebResourceListResponse { |
| 457 /** The list of sites that are owned by the authenticated user. */ |
| 458 core.List<SiteVerificationWebResourceResource> items; |
| 459 |
| 460 |
| 461 SiteVerificationWebResourceListResponse(); |
| 462 |
| 463 SiteVerificationWebResourceListResponse.fromJson(core.Map _json) { |
| 464 if (_json.containsKey("items")) { |
| 465 items = _json["items"].map((value) => new SiteVerificationWebResourceResou
rce.fromJson(value)).toList(); |
| 466 } |
| 467 } |
| 468 |
| 469 core.Map toJson() { |
| 470 var _json = new core.Map(); |
| 471 if (items != null) { |
| 472 _json["items"] = items.map((value) => (value).toJson()).toList(); |
| 473 } |
| 474 return _json; |
| 475 } |
| 476 } |
| 477 |
| 478 |
| 479 /** The address and type of a site that is verified or will be verified. */ |
| 480 class SiteVerificationWebResourceResourceSite { |
| 481 /** |
| 482 * The site identifier. If the type is set to SITE, the identifier is a URL. |
| 483 * If the type is set to INET_DOMAIN, the site identifier is a domain name. |
| 484 */ |
| 485 core.String identifier; |
| 486 |
| 487 /** The site type. Can be SITE or INET_DOMAIN (domain name). */ |
| 488 core.String type; |
| 489 |
| 490 |
| 491 SiteVerificationWebResourceResourceSite(); |
| 492 |
| 493 SiteVerificationWebResourceResourceSite.fromJson(core.Map _json) { |
| 494 if (_json.containsKey("identifier")) { |
| 495 identifier = _json["identifier"]; |
| 496 } |
| 497 if (_json.containsKey("type")) { |
| 498 type = _json["type"]; |
| 499 } |
| 500 } |
| 501 |
| 502 core.Map toJson() { |
| 503 var _json = new core.Map(); |
| 504 if (identifier != null) { |
| 505 _json["identifier"] = identifier; |
| 506 } |
| 507 if (type != null) { |
| 508 _json["type"] = type; |
| 509 } |
| 510 return _json; |
| 511 } |
| 512 } |
| 513 |
| 514 |
| 515 /** Not documented yet. */ |
| 516 class SiteVerificationWebResourceResource { |
| 517 /** |
| 518 * The string used to identify this site. This value should be used in the |
| 519 * "id" portion of the REST URL for the Get, Update, and Delete operations. |
| 520 */ |
| 521 core.String id; |
| 522 |
| 523 /** The email addresses of all verified owners. */ |
| 524 core.List<core.String> owners; |
| 525 |
| 526 /** The address and type of a site that is verified or will be verified. */ |
| 527 SiteVerificationWebResourceResourceSite site; |
| 528 |
| 529 |
| 530 SiteVerificationWebResourceResource(); |
| 531 |
| 532 SiteVerificationWebResourceResource.fromJson(core.Map _json) { |
| 533 if (_json.containsKey("id")) { |
| 534 id = _json["id"]; |
| 535 } |
| 536 if (_json.containsKey("owners")) { |
| 537 owners = _json["owners"]; |
| 538 } |
| 539 if (_json.containsKey("site")) { |
| 540 site = new SiteVerificationWebResourceResourceSite.fromJson(_json["site"])
; |
| 541 } |
| 542 } |
| 543 |
| 544 core.Map toJson() { |
| 545 var _json = new core.Map(); |
| 546 if (id != null) { |
| 547 _json["id"] = id; |
| 548 } |
| 549 if (owners != null) { |
| 550 _json["owners"] = owners; |
| 551 } |
| 552 if (site != null) { |
| 553 _json["site"] = (site).toJson(); |
| 554 } |
| 555 return _json; |
| 556 } |
| 557 } |
| 558 |
| 559 |
OLD | NEW |