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 ^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>);
}