upload method
Uploads a new expansion file and attaches to the specified APK.
Request parameters:
packageName
- Package name of the app.
editId
- Identifier of the edit.
apkVersionCode
- The version code of the APK whose expansion file
configuration is being read or modified.
expansionFileType
- The file type of the expansion file configuration
which is being updated.
Possible string values are:
- "expansionFileTypeUnspecified" : Unspecified expansion file type.
- "main" : Main expansion file.
- "patch" : Patch expansion file.
$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 ExpansionFilesUploadResponse.
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<ExpansionFilesUploadResponse> upload(
core.String packageName,
core.String editId,
core.int apkVersionCode,
core.String expansionFileType, {
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/' +
commons.escapeVariable('$apkVersionCode') +
'/expansionFiles/' +
commons.escapeVariable('$expansionFileType');
} else if (uploadOptions is commons.ResumableUploadOptions) {
url_ = '/resumable/upload/androidpublisher/v3/applications/' +
commons.escapeVariable('$packageName') +
'/edits/' +
commons.escapeVariable('$editId') +
'/apks/' +
commons.escapeVariable('$apkVersionCode') +
'/expansionFiles/' +
commons.escapeVariable('$expansionFileType');
} else {
url_ = '/upload/androidpublisher/v3/applications/' +
commons.escapeVariable('$packageName') +
'/edits/' +
commons.escapeVariable('$editId') +
'/apks/' +
commons.escapeVariable('$apkVersionCode') +
'/expansionFiles/' +
commons.escapeVariable('$expansionFileType');
}
final response_ = await _requester.request(
url_,
'POST',
queryParams: queryParams_,
uploadMedia: uploadMedia,
uploadOptions: uploadOptions,
);
return ExpansionFilesUploadResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}