upload method
Future<GoogleLongrunningOperation>
upload(
- GoogleFirebaseAppdistroV1UploadReleaseRequest request,
- String app, {
- String? $fields,
- Media? uploadMedia,
Uploads a binary.
Uploading a binary can result in a new release being created, an update to an existing release, or a no-op if a release with the same binary already exists.
request
- The metadata request object.
Request parameters:
app
- The name of the app. Format:
projects/{project_number}/apps/{app}
Value must have pattern ^projects/\[^/\]+/apps/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
uploadMedia
- The media to upload.
Completes with a GoogleLongrunningOperation.
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<GoogleLongrunningOperation> upload(
GoogleFirebaseAppdistroV1UploadReleaseRequest request,
core.String app, {
core.String? $fields,
commons.Media? uploadMedia,
}) async {
final _body = convert.json.encode(request);
final _queryParams = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
core.String _url;
if (uploadMedia == null) {
_url = 'v1/' + core.Uri.encodeFull('$app') + '/releases:upload';
} else {
_url = '/upload/v1/' + core.Uri.encodeFull('$app') + '/releases:upload';
}
final _response = await _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadMedia: uploadMedia,
uploadOptions: commons.UploadOptions.defaultOptions,
);
return GoogleLongrunningOperation.fromJson(
_response as core.Map<core.String, core.dynamic>);
}