report method

Future<ReportErrorEventResponse> report(
  1. ReportedErrorEvent request,
  2. String projectName, {
  3. String? $fields,
})

Report an individual error event and record the event to a log.

This endpoint accepts either an OAuth token, or an API key for authentication. To use an API key, append it to the URL as the value of a key parameter. For example: POST https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events:report?key=123ABC456 Note: Error Reporting is a global service built on Cloud Logging and doesn't analyze logs stored in regional log buckets or logs routed to other Google Cloud projects. For more information, see Using Error Reporting with regionalized logs.

request - The metadata request object.

Request parameters:

projectName - Required. The resource name of the Google Cloud Platform project. Written as projects/{projectId}, where {projectId} is the Google Cloud Platform project ID. Example: // projects/my-project-123. Value must have pattern ^projects/\[^/\]+$.

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

Completes with a ReportErrorEventResponse.

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<ReportErrorEventResponse> report(
  ReportedErrorEvent request,
  core.String projectName, {
  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 =
      'v1beta1/' + core.Uri.encodeFull('$projectName') + '/events:report';

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