create method

Future<AlertFeedback> create(
  1. AlertFeedback request,
  2. String alertId, {
  3. String? customerId,
  4. String? $fields,
})

Creates new feedback for an alert.

Attempting to create a feedback for a non-existent alert returns `NOT_FOUND` error. Attempting to create a feedback for an alert that is marked for deletion returns `FAILED_PRECONDITION' error.

request - The metadata request object.

Request parameters:

alertId - Required. The identifier of the alert this feedback belongs to.

customerId - Optional. The unique identifier of the Google Workspace organization account of the customer the alert is associated with. Inferred from the caller identity if not provided.

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

Completes with a AlertFeedback.

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<AlertFeedback> create(
  AlertFeedback request,
  core.String alertId, {
  core.String? customerId,
  core.String? $fields,
}) async {
  final _body = convert.json.encode(request);
  final _queryParams = <core.String, core.List<core.String>>{
    if (customerId != null) 'customerId': [customerId],
    if ($fields != null) 'fields': [$fields],
  };

  final _url =
      'v1beta1/alerts/' + commons.escapeVariable('$alertId') + '/feedback';

  final _response = await _requester.request(
    _url,
    'POST',
    body: _body,
    queryParams: _queryParams,
  );
  return AlertFeedback.fromJson(
      _response as core.Map<core.String, core.dynamic>);
}