upload method

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

Uploads an APK and adds to the current edit.

Request parameters:

packageName - Package name of the app.

editId - Identifier of the edit.

$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 Apk.

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<Apk> upload(
  core.String packageName,
  core.String editId, {
  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') +
        '/apks';
  } else if (uploadOptions is commons.ResumableUploadOptions) {
    url_ = '/resumable/upload/androidpublisher/v3/applications/' +
        commons.escapeVariable('$packageName') +
        '/edits/' +
        commons.escapeVariable('$editId') +
        '/apks';
  } else {
    url_ = '/upload/androidpublisher/v3/applications/' +
        commons.escapeVariable('$packageName') +
        '/edits/' +
        commons.escapeVariable('$editId') +
        '/apks';
  }

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