OLD | NEW |
(Empty) | |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
| 3 library googleapis.manufacturers.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 manufacturers/v1'; |
| 16 |
| 17 /** Public API for managing Manufacturer Center related data. */ |
| 18 class ManufacturersApi { |
| 19 /** Manage your product listings for Google Manufacturer Center */ |
| 20 static const ManufacturercenterScope = "https://www.googleapis.com/auth/manufa
cturercenter"; |
| 21 |
| 22 |
| 23 final commons.ApiRequester _requester; |
| 24 |
| 25 AccountsResourceApi get accounts => new AccountsResourceApi(_requester); |
| 26 |
| 27 ManufacturersApi(http.Client client, {core.String rootUrl: "https://manufactur
ers.googleapis.com/", core.String servicePath: ""}) : |
| 28 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
| 29 } |
| 30 |
| 31 |
| 32 class AccountsResourceApi { |
| 33 final commons.ApiRequester _requester; |
| 34 |
| 35 AccountsProductsResourceApi get products => new AccountsProductsResourceApi(_r
equester); |
| 36 |
| 37 AccountsResourceApi(commons.ApiRequester client) : |
| 38 _requester = client; |
| 39 } |
| 40 |
| 41 |
| 42 class AccountsProductsResourceApi { |
| 43 final commons.ApiRequester _requester; |
| 44 |
| 45 AccountsProductsResourceApi(commons.ApiRequester client) : |
| 46 _requester = client; |
| 47 |
| 48 /** |
| 49 * Gets the product from a Manufacturer Center account, including product |
| 50 * issues. |
| 51 * |
| 52 * Request parameters: |
| 53 * |
| 54 * [parent] - Parent ID in the format `accounts/{account_id}`. |
| 55 * |
| 56 * `account_id` - The ID of the Manufacturer Center account. |
| 57 * Value must have pattern "^accounts/[^/]+$". |
| 58 * |
| 59 * [name] - Name in the format |
| 60 * `{target_country}:{content_language}:{product_id}`. |
| 61 * |
| 62 * `target_country` - The target country of the product as a CLDR territory |
| 63 * code (for example, US). |
| 64 * |
| 65 * `content_language` - The content language of the product as a two-letter |
| 66 * ISO 639-1 language code (for example, en). |
| 67 * |
| 68 * `product_id` - The ID of the product. For more information, see |
| 69 * https://support.google.com/manufacturers/answer/6124116#id. |
| 70 * Value must have pattern "^[^/]+$". |
| 71 * |
| 72 * Completes with a [Product]. |
| 73 * |
| 74 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 75 * error. |
| 76 * |
| 77 * If the used [http.Client] completes with an error when making a REST call, |
| 78 * this method will complete with the same error. |
| 79 */ |
| 80 async.Future<Product> get(core.String parent, core.String name) { |
| 81 var _url = null; |
| 82 var _queryParams = new core.Map(); |
| 83 var _uploadMedia = null; |
| 84 var _uploadOptions = null; |
| 85 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 86 var _body = null; |
| 87 |
| 88 if (parent == null) { |
| 89 throw new core.ArgumentError("Parameter parent is required."); |
| 90 } |
| 91 if (name == null) { |
| 92 throw new core.ArgumentError("Parameter name is required."); |
| 93 } |
| 94 |
| 95 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/products
/' + commons.Escaper.ecapeVariableReserved('$name'); |
| 96 |
| 97 var _response = _requester.request(_url, |
| 98 "GET", |
| 99 body: _body, |
| 100 queryParams: _queryParams, |
| 101 uploadOptions: _uploadOptions, |
| 102 uploadMedia: _uploadMedia, |
| 103 downloadOptions: _downloadOptions); |
| 104 return _response.then((data) => new Product.fromJson(data)); |
| 105 } |
| 106 |
| 107 /** |
| 108 * Lists all the products in a Manufacturer Center account. |
| 109 * |
| 110 * Request parameters: |
| 111 * |
| 112 * [parent] - Parent ID in the format `accounts/{account_id}`. |
| 113 * |
| 114 * `account_id` - The ID of the Manufacturer Center account. |
| 115 * Value must have pattern "^accounts/[^/]+$". |
| 116 * |
| 117 * [pageSize] - Maximum number of product statuses to return in the response, |
| 118 * used for |
| 119 * paging. |
| 120 * |
| 121 * [pageToken] - The token returned by the previous request. |
| 122 * |
| 123 * Completes with a [ListProductsResponse]. |
| 124 * |
| 125 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 126 * error. |
| 127 * |
| 128 * If the used [http.Client] completes with an error when making a REST call, |
| 129 * this method will complete with the same error. |
| 130 */ |
| 131 async.Future<ListProductsResponse> list(core.String parent, {core.int pageSize
, core.String pageToken}) { |
| 132 var _url = null; |
| 133 var _queryParams = new core.Map(); |
| 134 var _uploadMedia = null; |
| 135 var _uploadOptions = null; |
| 136 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 137 var _body = null; |
| 138 |
| 139 if (parent == null) { |
| 140 throw new core.ArgumentError("Parameter parent is required."); |
| 141 } |
| 142 if (pageSize != null) { |
| 143 _queryParams["pageSize"] = ["${pageSize}"]; |
| 144 } |
| 145 if (pageToken != null) { |
| 146 _queryParams["pageToken"] = [pageToken]; |
| 147 } |
| 148 |
| 149 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/products
'; |
| 150 |
| 151 var _response = _requester.request(_url, |
| 152 "GET", |
| 153 body: _body, |
| 154 queryParams: _queryParams, |
| 155 uploadOptions: _uploadOptions, |
| 156 uploadMedia: _uploadMedia, |
| 157 downloadOptions: _downloadOptions); |
| 158 return _response.then((data) => new ListProductsResponse.fromJson(data)); |
| 159 } |
| 160 |
| 161 } |
| 162 |
| 163 |
| 164 |
| 165 /** |
| 166 * Attributes of the product. For more information, see |
| 167 * https://support.google.com/manufacturers/answer/6124116. |
| 168 */ |
| 169 class Attributes { |
| 170 /** |
| 171 * The brand name of the product. For more information, see |
| 172 * https://support.google.com/manufacturers/answer/6124116#brand. |
| 173 */ |
| 174 core.String brand; |
| 175 /** |
| 176 * The Global Trade Item Number (GTIN) of the product. For more information, |
| 177 * see https://support.google.com/manufacturers/answer/6124116#gtin. |
| 178 */ |
| 179 core.List<core.String> gtin; |
| 180 /** |
| 181 * The Manufacturer Part Number (MPN) of the product. For more information, |
| 182 * see https://support.google.com/manufacturers/answer/6124116#mpn. |
| 183 */ |
| 184 core.String mpn; |
| 185 /** |
| 186 * The name of the group of products related to the product. For more |
| 187 * information, see |
| 188 * https://support.google.com/manufacturers/answer/6124116#productline. |
| 189 */ |
| 190 core.String productLine; |
| 191 /** |
| 192 * The canonical name of the product. For more information, see |
| 193 * https://support.google.com/manufacturers/answer/6124116#productname. |
| 194 */ |
| 195 core.String productName; |
| 196 /** |
| 197 * The URL of the manufacturer's detail page of the product. For more |
| 198 * information, see |
| 199 * https://support.google.com/manufacturers/answer/6124116#productpage. |
| 200 */ |
| 201 core.String productPageUrl; |
| 202 /** |
| 203 * The manufacturer's category of the product. For more information, see |
| 204 * https://support.google.com/manufacturers/answer/6124116#producttype. |
| 205 */ |
| 206 core.List<core.String> productType; |
| 207 /** |
| 208 * The title of the product. For more information, see |
| 209 * https://support.google.com/manufacturers/answer/6124116#title. |
| 210 */ |
| 211 core.String title; |
| 212 |
| 213 Attributes(); |
| 214 |
| 215 Attributes.fromJson(core.Map _json) { |
| 216 if (_json.containsKey("brand")) { |
| 217 brand = _json["brand"]; |
| 218 } |
| 219 if (_json.containsKey("gtin")) { |
| 220 gtin = _json["gtin"]; |
| 221 } |
| 222 if (_json.containsKey("mpn")) { |
| 223 mpn = _json["mpn"]; |
| 224 } |
| 225 if (_json.containsKey("productLine")) { |
| 226 productLine = _json["productLine"]; |
| 227 } |
| 228 if (_json.containsKey("productName")) { |
| 229 productName = _json["productName"]; |
| 230 } |
| 231 if (_json.containsKey("productPageUrl")) { |
| 232 productPageUrl = _json["productPageUrl"]; |
| 233 } |
| 234 if (_json.containsKey("productType")) { |
| 235 productType = _json["productType"]; |
| 236 } |
| 237 if (_json.containsKey("title")) { |
| 238 title = _json["title"]; |
| 239 } |
| 240 } |
| 241 |
| 242 core.Map toJson() { |
| 243 var _json = new core.Map(); |
| 244 if (brand != null) { |
| 245 _json["brand"] = brand; |
| 246 } |
| 247 if (gtin != null) { |
| 248 _json["gtin"] = gtin; |
| 249 } |
| 250 if (mpn != null) { |
| 251 _json["mpn"] = mpn; |
| 252 } |
| 253 if (productLine != null) { |
| 254 _json["productLine"] = productLine; |
| 255 } |
| 256 if (productName != null) { |
| 257 _json["productName"] = productName; |
| 258 } |
| 259 if (productPageUrl != null) { |
| 260 _json["productPageUrl"] = productPageUrl; |
| 261 } |
| 262 if (productType != null) { |
| 263 _json["productType"] = productType; |
| 264 } |
| 265 if (title != null) { |
| 266 _json["title"] = title; |
| 267 } |
| 268 return _json; |
| 269 } |
| 270 } |
| 271 |
| 272 /** Product issue. */ |
| 273 class Issue { |
| 274 /** |
| 275 * If present, the attribute that triggered the issue. For more information |
| 276 * about attributes, see |
| 277 * https://support.google.com/manufacturers/answer/6124116. |
| 278 */ |
| 279 core.String attribute; |
| 280 /** Description of the issue. */ |
| 281 core.String description; |
| 282 /** |
| 283 * The severity of the issue. |
| 284 * Possible string values are: |
| 285 * - "SEVERITY_UNSPECIFIED" : Unspecified severity, never used. |
| 286 * - "ERROR" : Error severity. The issue prevents the usage of the whole item. |
| 287 * - "WARNING" : Warning severity. The issue is either one that prevents the |
| 288 * usage of the |
| 289 * attribute that triggered it or one that will soon prevent the usage of |
| 290 * the whole item. |
| 291 * - "INFO" : Info severity. The issue is one that doesn't require immediate |
| 292 * attention. |
| 293 * It is, for example, used to communicate which attributes are still |
| 294 * pending review. |
| 295 */ |
| 296 core.String severity; |
| 297 /** |
| 298 * The server-generated type of the issue, for example, |
| 299 * “INCORRECT_TEXT_FORMATTING”, “IMAGE_NOT_SERVEABLE”, etc. |
| 300 */ |
| 301 core.String type; |
| 302 |
| 303 Issue(); |
| 304 |
| 305 Issue.fromJson(core.Map _json) { |
| 306 if (_json.containsKey("attribute")) { |
| 307 attribute = _json["attribute"]; |
| 308 } |
| 309 if (_json.containsKey("description")) { |
| 310 description = _json["description"]; |
| 311 } |
| 312 if (_json.containsKey("severity")) { |
| 313 severity = _json["severity"]; |
| 314 } |
| 315 if (_json.containsKey("type")) { |
| 316 type = _json["type"]; |
| 317 } |
| 318 } |
| 319 |
| 320 core.Map toJson() { |
| 321 var _json = new core.Map(); |
| 322 if (attribute != null) { |
| 323 _json["attribute"] = attribute; |
| 324 } |
| 325 if (description != null) { |
| 326 _json["description"] = description; |
| 327 } |
| 328 if (severity != null) { |
| 329 _json["severity"] = severity; |
| 330 } |
| 331 if (type != null) { |
| 332 _json["type"] = type; |
| 333 } |
| 334 return _json; |
| 335 } |
| 336 } |
| 337 |
| 338 class ListProductsResponse { |
| 339 /** The token for the retrieval of the next page of product statuses. */ |
| 340 core.String nextPageToken; |
| 341 /** List of the products. */ |
| 342 core.List<Product> products; |
| 343 |
| 344 ListProductsResponse(); |
| 345 |
| 346 ListProductsResponse.fromJson(core.Map _json) { |
| 347 if (_json.containsKey("nextPageToken")) { |
| 348 nextPageToken = _json["nextPageToken"]; |
| 349 } |
| 350 if (_json.containsKey("products")) { |
| 351 products = _json["products"].map((value) => new Product.fromJson(value)).t
oList(); |
| 352 } |
| 353 } |
| 354 |
| 355 core.Map toJson() { |
| 356 var _json = new core.Map(); |
| 357 if (nextPageToken != null) { |
| 358 _json["nextPageToken"] = nextPageToken; |
| 359 } |
| 360 if (products != null) { |
| 361 _json["products"] = products.map((value) => (value).toJson()).toList(); |
| 362 } |
| 363 return _json; |
| 364 } |
| 365 } |
| 366 |
| 367 /** Product data. */ |
| 368 class Product { |
| 369 /** |
| 370 * The content language of the product as a two-letter ISO 639-1 language code |
| 371 * (for example, en). |
| 372 * @OutputOnly |
| 373 */ |
| 374 core.String contentLanguage; |
| 375 /** |
| 376 * Final attributes of the product. The final attributes are obtained by |
| 377 * overriding the uploaded attributes with the manually provided and deleted |
| 378 * attributes. Google systems only process, evaluate, review, and/or use final |
| 379 * attributes. |
| 380 * @OutputOnly |
| 381 */ |
| 382 Attributes finalAttributes; |
| 383 /** |
| 384 * A server-generated list of issues associated with the product. |
| 385 * @OutputOnly |
| 386 */ |
| 387 core.List<Issue> issues; |
| 388 /** |
| 389 * Names of the attributes of the product deleted manually via the |
| 390 * Manufacturer Center UI. |
| 391 * @OutputOnly |
| 392 */ |
| 393 core.List<core.String> manuallyDeletedAttributes; |
| 394 /** |
| 395 * Attributes of the product provided manually via the Manufacturer Center UI. |
| 396 * @OutputOnly |
| 397 */ |
| 398 Attributes manuallyProvidedAttributes; |
| 399 /** |
| 400 * Name in the format `{target_country}:{content_language}:{product_id}`. |
| 401 * |
| 402 * `target_country` - The target country of the product as a CLDR territory |
| 403 * code (for example, US). |
| 404 * |
| 405 * `content_language` - The content language of the product as a two-letter |
| 406 * ISO 639-1 language code (for example, en). |
| 407 * |
| 408 * `product_id` - The ID of the product. For more information, see |
| 409 * https://support.google.com/manufacturers/answer/6124116#id. |
| 410 * @OutputOnly |
| 411 */ |
| 412 core.String name; |
| 413 /** |
| 414 * Parent ID in the format `accounts/{account_id}`. |
| 415 * |
| 416 * `account_id` - The ID of the Manufacturer Center account. |
| 417 * @OutputOnly |
| 418 */ |
| 419 core.String parent; |
| 420 /** |
| 421 * The ID of the product. For more information, see |
| 422 * https://support.google.com/manufacturers/answer/6124116#id. |
| 423 * @OutputOnly |
| 424 */ |
| 425 core.String productId; |
| 426 /** |
| 427 * The target country of the product as a CLDR territory code (for example, |
| 428 * US). |
| 429 * @OutputOnly |
| 430 */ |
| 431 core.String targetCountry; |
| 432 /** |
| 433 * Attributes of the product uploaded via the Manufacturer Center API or via |
| 434 * feeds. |
| 435 */ |
| 436 Attributes uploadedAttributes; |
| 437 |
| 438 Product(); |
| 439 |
| 440 Product.fromJson(core.Map _json) { |
| 441 if (_json.containsKey("contentLanguage")) { |
| 442 contentLanguage = _json["contentLanguage"]; |
| 443 } |
| 444 if (_json.containsKey("finalAttributes")) { |
| 445 finalAttributes = new Attributes.fromJson(_json["finalAttributes"]); |
| 446 } |
| 447 if (_json.containsKey("issues")) { |
| 448 issues = _json["issues"].map((value) => new Issue.fromJson(value)).toList(
); |
| 449 } |
| 450 if (_json.containsKey("manuallyDeletedAttributes")) { |
| 451 manuallyDeletedAttributes = _json["manuallyDeletedAttributes"]; |
| 452 } |
| 453 if (_json.containsKey("manuallyProvidedAttributes")) { |
| 454 manuallyProvidedAttributes = new Attributes.fromJson(_json["manuallyProvid
edAttributes"]); |
| 455 } |
| 456 if (_json.containsKey("name")) { |
| 457 name = _json["name"]; |
| 458 } |
| 459 if (_json.containsKey("parent")) { |
| 460 parent = _json["parent"]; |
| 461 } |
| 462 if (_json.containsKey("productId")) { |
| 463 productId = _json["productId"]; |
| 464 } |
| 465 if (_json.containsKey("targetCountry")) { |
| 466 targetCountry = _json["targetCountry"]; |
| 467 } |
| 468 if (_json.containsKey("uploadedAttributes")) { |
| 469 uploadedAttributes = new Attributes.fromJson(_json["uploadedAttributes"]); |
| 470 } |
| 471 } |
| 472 |
| 473 core.Map toJson() { |
| 474 var _json = new core.Map(); |
| 475 if (contentLanguage != null) { |
| 476 _json["contentLanguage"] = contentLanguage; |
| 477 } |
| 478 if (finalAttributes != null) { |
| 479 _json["finalAttributes"] = (finalAttributes).toJson(); |
| 480 } |
| 481 if (issues != null) { |
| 482 _json["issues"] = issues.map((value) => (value).toJson()).toList(); |
| 483 } |
| 484 if (manuallyDeletedAttributes != null) { |
| 485 _json["manuallyDeletedAttributes"] = manuallyDeletedAttributes; |
| 486 } |
| 487 if (manuallyProvidedAttributes != null) { |
| 488 _json["manuallyProvidedAttributes"] = (manuallyProvidedAttributes).toJson(
); |
| 489 } |
| 490 if (name != null) { |
| 491 _json["name"] = name; |
| 492 } |
| 493 if (parent != null) { |
| 494 _json["parent"] = parent; |
| 495 } |
| 496 if (productId != null) { |
| 497 _json["productId"] = productId; |
| 498 } |
| 499 if (targetCountry != null) { |
| 500 _json["targetCountry"] = targetCountry; |
| 501 } |
| 502 if (uploadedAttributes != null) { |
| 503 _json["uploadedAttributes"] = (uploadedAttributes).toJson(); |
| 504 } |
| 505 return _json; |
| 506 } |
| 507 } |
OLD | NEW |