insert method

Future<Item> insert({
  1. String? publisherEmail,
  2. String? $fields,
  3. Media? uploadMedia,
})

Inserts a new item.

Request parameters:

publisherEmail - The email of the publisher who owns the items. Defaults to the caller's email address.

$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> insert({
  core.String? publisherEmail,
  core.String? $fields,
  commons.Media? uploadMedia,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'publisherEmail': ?publisherEmail == null ? null : [publisherEmail],
    'fields': ?$fields == null ? null : [$fields],
  };

  core.String url_;
  if (uploadMedia == null) {
    url_ = 'chromewebstore/v1.1/items';
  } else {
    url_ = '/upload/chromewebstore/v1.1/items';
  }

  final response_ = await _requester.request(
    url_,
    'POST',
    queryParams: queryParams_,
    uploadMedia: uploadMedia,
    uploadOptions: commons.UploadOptions.defaultOptions,
  );
  return Item.fromJson(response_ as core.Map<core.String, core.dynamic>);
}