computeInsights method

Future<ComputeInsightsResponse> computeInsights(
  1. ComputeInsightsRequest request, {
  2. String? $fields,
})

Compute Insights RPC This method lets you retrieve insights about areas using a variaty of filter such as: area, place type, operating status, price level and ratings.

Currently "count" and "places" insights are supported. With "count" insights you can answer questions such as "How many restaurant are located in California that are operational, are inexpensive and have an average rating of at least 4 stars" (see insight enum for more details). With "places" insights, you can determine which places match the requested filter. Clients can then use those place resource names to fetch more details about each individual place using the Places API.

request - The metadata request object.

Request parameters:

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

Completes with a ComputeInsightsResponse.

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

  const url_ = 'v1:computeInsights';

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