upload method
Uploads a new Android App Bundle to this edit.
If you are using the Google API client libraries, please increase the timeout of the http request before calling this endpoint (a timeout of 2 minutes is recommended). See Timeouts and Errors for an example in java.
Request parameters:
packageName
- Package name of the app.
editId
- Identifier of the edit.
ackBundleInstallationWarning
- Must be set to true if the app bundle
installation may trigger a warning on user devices (for example, if
installation size may be over a threshold, typically 100 MB).
deviceTierConfigId
- Device tier config (DTC) to be used for generating
deliverables (APKs). Contains id of the DTC or "LATEST" for last uploaded
DTC.
$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 Bundle.
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<Bundle> upload(
core.String packageName,
core.String editId, {
core.bool? ackBundleInstallationWarning,
core.String? deviceTierConfigId,
core.String? $fields,
commons.UploadOptions uploadOptions = commons.UploadOptions.defaultOptions,
commons.Media? uploadMedia,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (ackBundleInstallationWarning != null)
'ackBundleInstallationWarning': ['${ackBundleInstallationWarning}'],
if (deviceTierConfigId != null)
'deviceTierConfigId': [deviceTierConfigId],
if ($fields != null) 'fields': [$fields],
};
core.String url_;
if (uploadMedia == null) {
url_ = 'androidpublisher/v3/applications/' +
commons.escapeVariable('$packageName') +
'/edits/' +
commons.escapeVariable('$editId') +
'/bundles';
} else if (uploadOptions is commons.ResumableUploadOptions) {
url_ = '/resumable/upload/androidpublisher/v3/applications/' +
commons.escapeVariable('$packageName') +
'/edits/' +
commons.escapeVariable('$editId') +
'/bundles';
} else {
url_ = '/upload/androidpublisher/v3/applications/' +
commons.escapeVariable('$packageName') +
'/edits/' +
commons.escapeVariable('$editId') +
'/bundles';
}
final response_ = await _requester.request(
url_,
'POST',
queryParams: queryParams_,
uploadMedia: uploadMedia,
uploadOptions: uploadOptions,
);
return Bundle.fromJson(response_ as core.Map<core.String, core.dynamic>);
}