OLD | NEW |
1 // This is a generated file (see the discoveryapis_generator project). | 1 // This is a generated file (see the discoveryapis_generator project). |
2 | 2 |
3 library googleapis.manufacturers.v1; | 3 library googleapis.manufacturers.v1; |
4 | 4 |
5 import 'dart:core' as core; | 5 import 'dart:core' as core; |
6 import 'dart:async' as async; | 6 import 'dart:async' as async; |
7 import 'dart:convert' as convert; | 7 import 'dart:convert' as convert; |
8 | 8 |
9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; | 9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
10 import 'package:http/http.dart' as http; | 10 import 'package:http/http.dart' as http; |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 | 41 |
42 class AccountsProductsResourceApi { | 42 class AccountsProductsResourceApi { |
43 final commons.ApiRequester _requester; | 43 final commons.ApiRequester _requester; |
44 | 44 |
45 AccountsProductsResourceApi(commons.ApiRequester client) : | 45 AccountsProductsResourceApi(commons.ApiRequester client) : |
46 _requester = client; | 46 _requester = client; |
47 | 47 |
48 /** | 48 /** |
| 49 * Deletes the product from a Manufacturer Center account. |
| 50 * |
| 51 * Request parameters: |
| 52 * |
| 53 * [parent] - Parent ID in the format `accounts/{account_id}`. |
| 54 * |
| 55 * `account_id` - The ID of the Manufacturer Center account. |
| 56 * Value must have pattern "^accounts/[^/]+$". |
| 57 * |
| 58 * [name] - Name in the format |
| 59 * `{target_country}:{content_language}:{product_id}`. |
| 60 * |
| 61 * `target_country` - The target country of the product as a CLDR territory |
| 62 * code (for example, US). |
| 63 * |
| 64 * `content_language` - The content language of the product as a two-letter |
| 65 * ISO 639-1 language code (for example, en). |
| 66 * |
| 67 * `product_id` - The ID of the product. For more information, see |
| 68 * https://support.google.com/manufacturers/answer/6124116#id. |
| 69 * Value must have pattern "^[^/]+$". |
| 70 * |
| 71 * Completes with a [Empty]. |
| 72 * |
| 73 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 74 * error. |
| 75 * |
| 76 * If the used [http.Client] completes with an error when making a REST call, |
| 77 * this method will complete with the same error. |
| 78 */ |
| 79 async.Future<Empty> delete(core.String parent, core.String name) { |
| 80 var _url = null; |
| 81 var _queryParams = new core.Map(); |
| 82 var _uploadMedia = null; |
| 83 var _uploadOptions = null; |
| 84 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 85 var _body = null; |
| 86 |
| 87 if (parent == null) { |
| 88 throw new core.ArgumentError("Parameter parent is required."); |
| 89 } |
| 90 if (name == null) { |
| 91 throw new core.ArgumentError("Parameter name is required."); |
| 92 } |
| 93 |
| 94 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/products
/' + commons.Escaper.ecapeVariableReserved('$name'); |
| 95 |
| 96 var _response = _requester.request(_url, |
| 97 "DELETE", |
| 98 body: _body, |
| 99 queryParams: _queryParams, |
| 100 uploadOptions: _uploadOptions, |
| 101 uploadMedia: _uploadMedia, |
| 102 downloadOptions: _downloadOptions); |
| 103 return _response.then((data) => new Empty.fromJson(data)); |
| 104 } |
| 105 |
| 106 /** |
49 * Gets the product from a Manufacturer Center account, including product | 107 * Gets the product from a Manufacturer Center account, including product |
50 * issues. | 108 * issues. |
51 * | 109 * |
| 110 * A recently updated product takes some time to be processed before any |
| 111 * changes are visible. While some issues may be available once the product |
| 112 * has been processed, other issues may take days to appear. |
| 113 * |
52 * Request parameters: | 114 * Request parameters: |
53 * | 115 * |
54 * [parent] - Parent ID in the format `accounts/{account_id}`. | 116 * [parent] - Parent ID in the format `accounts/{account_id}`. |
55 * | 117 * |
56 * `account_id` - The ID of the Manufacturer Center account. | 118 * `account_id` - The ID of the Manufacturer Center account. |
57 * Value must have pattern "^accounts/[^/]+$". | 119 * Value must have pattern "^accounts/[^/]+$". |
58 * | 120 * |
59 * [name] - Name in the format | 121 * [name] - Name in the format |
60 * `{target_country}:{content_language}:{product_id}`. | 122 * `{target_country}:{content_language}:{product_id}`. |
61 * | 123 * |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 var _response = _requester.request(_url, | 213 var _response = _requester.request(_url, |
152 "GET", | 214 "GET", |
153 body: _body, | 215 body: _body, |
154 queryParams: _queryParams, | 216 queryParams: _queryParams, |
155 uploadOptions: _uploadOptions, | 217 uploadOptions: _uploadOptions, |
156 uploadMedia: _uploadMedia, | 218 uploadMedia: _uploadMedia, |
157 downloadOptions: _downloadOptions); | 219 downloadOptions: _downloadOptions); |
158 return _response.then((data) => new ListProductsResponse.fromJson(data)); | 220 return _response.then((data) => new ListProductsResponse.fromJson(data)); |
159 } | 221 } |
160 | 222 |
| 223 /** |
| 224 * Inserts or updates the product in a Manufacturer Center account. |
| 225 * |
| 226 * The checks at upload time are minimal. All required attributes need to be |
| 227 * present for a product to be valid. Issues may show up later |
| 228 * after the API has accepted an update for a product and it is possible to |
| 229 * overwrite an existing valid product with an invalid product. To detect |
| 230 * this, you should retrieve the product and check it for issues once the |
| 231 * updated version is available. |
| 232 * |
| 233 * Inserted or updated products first need to be processed before they can be |
| 234 * retrieved. Until then, new products will be unavailable, and retrieval |
| 235 * of updated products will return the original state of the product. |
| 236 * |
| 237 * [request] - The metadata request object. |
| 238 * |
| 239 * Request parameters: |
| 240 * |
| 241 * [parent] - Parent ID in the format `accounts/{account_id}`. |
| 242 * |
| 243 * `account_id` - The ID of the Manufacturer Center account. |
| 244 * Value must have pattern "^accounts/[^/]+$". |
| 245 * |
| 246 * [name] - Name in the format |
| 247 * `{target_country}:{content_language}:{product_id}`. |
| 248 * |
| 249 * `target_country` - The target country of the product as a CLDR territory |
| 250 * code (for example, US). |
| 251 * |
| 252 * `content_language` - The content language of the product as a two-letter |
| 253 * ISO 639-1 language code (for example, en). |
| 254 * |
| 255 * `product_id` - The ID of the product. For more information, see |
| 256 * https://support.google.com/manufacturers/answer/6124116#id. |
| 257 * Value must have pattern "^[^/]+$". |
| 258 * |
| 259 * Completes with a [Product]. |
| 260 * |
| 261 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 262 * error. |
| 263 * |
| 264 * If the used [http.Client] completes with an error when making a REST call, |
| 265 * this method will complete with the same error. |
| 266 */ |
| 267 async.Future<Product> update(Product request, core.String parent, core.String
name) { |
| 268 var _url = null; |
| 269 var _queryParams = new core.Map(); |
| 270 var _uploadMedia = null; |
| 271 var _uploadOptions = null; |
| 272 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 273 var _body = null; |
| 274 |
| 275 if (request != null) { |
| 276 _body = convert.JSON.encode((request).toJson()); |
| 277 } |
| 278 if (parent == null) { |
| 279 throw new core.ArgumentError("Parameter parent is required."); |
| 280 } |
| 281 if (name == null) { |
| 282 throw new core.ArgumentError("Parameter name is required."); |
| 283 } |
| 284 |
| 285 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$parent') + '/products
/' + commons.Escaper.ecapeVariableReserved('$name'); |
| 286 |
| 287 var _response = _requester.request(_url, |
| 288 "PUT", |
| 289 body: _body, |
| 290 queryParams: _queryParams, |
| 291 uploadOptions: _uploadOptions, |
| 292 uploadMedia: _uploadMedia, |
| 293 downloadOptions: _downloadOptions); |
| 294 return _response.then((data) => new Product.fromJson(data)); |
| 295 } |
| 296 |
161 } | 297 } |
162 | 298 |
163 | 299 |
164 | 300 |
165 /** | 301 /** |
166 * Attributes of the product. For more information, see | 302 * Attributes of the product. For more information, see |
167 * https://support.google.com/manufacturers/answer/6124116. | 303 * https://support.google.com/manufacturers/answer/6124116. |
168 */ | 304 */ |
169 class Attributes { | 305 class Attributes { |
170 /** | 306 /** |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 _json["unit"] = unit; | 728 _json["unit"] = unit; |
593 } | 729 } |
594 if (value != null) { | 730 if (value != null) { |
595 _json["value"] = value; | 731 _json["value"] = value; |
596 } | 732 } |
597 return _json; | 733 return _json; |
598 } | 734 } |
599 } | 735 } |
600 | 736 |
601 /** | 737 /** |
| 738 * A generic empty message that you can re-use to avoid defining duplicated |
| 739 * empty messages in your APIs. A typical example is to use it as the request |
| 740 * or the response type of an API method. For instance: |
| 741 * |
| 742 * service Foo { |
| 743 * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); |
| 744 * } |
| 745 * |
| 746 * The JSON representation for `Empty` is empty JSON object `{}`. |
| 747 */ |
| 748 class Empty { |
| 749 |
| 750 Empty(); |
| 751 |
| 752 Empty.fromJson(core.Map _json) { |
| 753 } |
| 754 |
| 755 core.Map<core.String, core.Object> toJson() { |
| 756 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); |
| 757 return _json; |
| 758 } |
| 759 } |
| 760 |
| 761 /** |
602 * A feature description of the product. For more information, see | 762 * A feature description of the product. For more information, see |
603 * https://support.google.com/manufacturers/answer/6124116#featuredesc. | 763 * https://support.google.com/manufacturers/answer/6124116#featuredesc. |
604 */ | 764 */ |
605 class FeatureDescription { | 765 class FeatureDescription { |
606 /** A short description of the feature. */ | 766 /** A short description of the feature. */ |
607 core.String headline; | 767 core.String headline; |
608 /** An optional image describing the feature. */ | 768 /** An optional image describing the feature. */ |
609 Image image; | 769 Image image; |
610 /** A detailed description of the feature. */ | 770 /** A detailed description of the feature. */ |
611 core.String text; | 771 core.String text; |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 } | 1176 } |
1017 if (attributeValue != null) { | 1177 if (attributeValue != null) { |
1018 _json["attributeValue"] = attributeValue; | 1178 _json["attributeValue"] = attributeValue; |
1019 } | 1179 } |
1020 if (sectionName != null) { | 1180 if (sectionName != null) { |
1021 _json["sectionName"] = sectionName; | 1181 _json["sectionName"] = sectionName; |
1022 } | 1182 } |
1023 return _json; | 1183 return _json; |
1024 } | 1184 } |
1025 } | 1185 } |
OLD | NEW |