create method

Future<Release> create(
  1. Release request,
  2. String parent, {
  3. String? versionName,
  4. String? $fields,
})

Creates a new release, which makes the content of the specified version actively display on the appropriate URL(s).

request - The metadata request object.

Request parameters:

parent - Required. The site or channel to which the release belongs, in either of the following formats: - sites/SITE_ID - sites/SITE_ID/channels/CHANNEL_ID Value must have pattern ^projects/\[^/\]+/sites/\[^/\]+$.

versionName - The unique identifier for a version, in the format: sites/SITE_ID/versions/ VERSION_ID The SITE_ID in this version identifier must match the SITE_ID in the parent parameter. This query parameter must be empty if the type field in the request body is SITE_DISABLE.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Release.

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<Release> create(
  Release request,
  core.String parent, {
  core.String? versionName,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (versionName != null) 'versionName': [versionName],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1beta1/' + core.Uri.encodeFull('$parent') + '/releases';

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