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 resource. Format:
projects/{project_number}/apps/{app_id}
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>);
}