publish method

Publish all draft changes to the Label.

Once published, the Label may not return to its draft state. See google.apps.drive.labels.v2.Lifecycle for more information. Publishing a Label will result in a new published revision. All previous draft revisions will be deleted. Previous published revisions will be kept but are subject to automated deletion as needed. Once published, some changes are no longer permitted. Generally, any change that would invalidate or cause new restrictions on existing metadata related to the Label will be rejected. For example, the following changes to a Label will be rejected after the Label is published: * The label cannot be directly deleted. It must be disabled first, then deleted. * Field.FieldType cannot be changed.

  • Changes to Field validation options cannot reject something that was previously accepted. * Reducing the max entries.

request - The metadata request object.

Request parameters:

name - Required. Label resource name. Value must have pattern ^labels/\[^/\]+$.

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

Completes with a GoogleAppsDriveLabelsV2Label.

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

  final url_ = 'v2/' + core.Uri.encodeFull('$name') + ':publish';

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