upload method

Future<ImagesUploadResponse> upload(
  1. String packageName,
  2. String editId,
  3. String language,
  4. String imageType, {
  5. String? $fields,
  6. UploadOptions uploadOptions = commons.UploadOptions.defaultOptions,
  7. Media? uploadMedia,
})

Uploads an image of the specified language and image type, and adds to the edit.

Request parameters:

packageName - Package name of the app.

editId - Identifier of the edit.

language - Language localization code (a BCP-47 language tag; for example, "de-AT" for Austrian German). Providing a language that is not supported by the App is a no-op.

imageType - Type of the Image. Possible string values are:

  • "appImageTypeUnspecified" : Unspecified type. Do not use.
  • "phoneScreenshots" : Phone screenshot.
  • "sevenInchScreenshots" : Seven inch screenshot.
  • "tenInchScreenshots" : Ten inch screenshot.
  • "tvScreenshots" : TV screenshot.
  • "wearScreenshots" : Wear screenshot.
  • "icon" : Icon.
  • "featureGraphic" : Feature graphic.
  • "tvBanner" : TV banner.

$fields - Selector specifying which fields to include in a partial response.

uploadMedia - The media to upload.

uploadOptions - Options for the media upload. Streaming Media without the length being known ahead of time is only supported via resumable uploads.

Completes with a ImagesUploadResponse.

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<ImagesUploadResponse> upload(
  core.String packageName,
  core.String editId,
  core.String language,
  core.String imageType, {
  core.String? $fields,
  commons.UploadOptions uploadOptions = commons.UploadOptions.defaultOptions,
  commons.Media? uploadMedia,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  core.String url_;
  if (uploadMedia == null) {
    url_ = 'androidpublisher/v3/applications/' +
        commons.escapeVariable('$packageName') +
        '/edits/' +
        commons.escapeVariable('$editId') +
        '/listings/' +
        commons.escapeVariable('$language') +
        '/' +
        commons.escapeVariable('$imageType');
  } else if (uploadOptions is commons.ResumableUploadOptions) {
    url_ = '/resumable/upload/androidpublisher/v3/applications/' +
        commons.escapeVariable('$packageName') +
        '/edits/' +
        commons.escapeVariable('$editId') +
        '/listings/' +
        commons.escapeVariable('$language') +
        '/' +
        commons.escapeVariable('$imageType');
  } else {
    url_ = '/upload/androidpublisher/v3/applications/' +
        commons.escapeVariable('$packageName') +
        '/edits/' +
        commons.escapeVariable('$editId') +
        '/listings/' +
        commons.escapeVariable('$language') +
        '/' +
        commons.escapeVariable('$imageType');
  }

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