update method
Updates an existing item.
request - The metadata request object.
Request parameters:
itemId - The ID of the item to upload.
$fields - Selector specifying which fields to include in a partial
response.
uploadMedia - The media to upload.
Completes with a Item.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<Item> update(
Item request,
core.String itemId, {
core.String? $fields,
commons.Media? uploadMedia,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
core.String url_;
if (uploadMedia == null) {
url_ = 'chromewebstore/v1.1/items/' + commons.escapeVariable('$itemId');
} else {
url_ =
'/upload/chromewebstore/v1.1/items/' +
commons.escapeVariable('$itemId');
}
final response_ = await _requester.request(
url_,
'PUT',
body: body_,
queryParams: queryParams_,
uploadMedia: uploadMedia,
uploadOptions: commons.UploadOptions.defaultOptions,
);
return Item.fromJson(response_ as core.Map<core.String, core.dynamic>);
}