fetchReviews method

Future<FetchItemReviewsResponse> fetchReviews(
  1. String name, {
  2. String? filter,
  3. String? orderBy,
  4. int? pageSize,
  5. String? pageToken,
  6. String? $fields,
})

Fetch user reviews for an item.

Request parameters:

name - Required. The item resource name whose reviews are being fetched. Format: publishers/{publisher_id}/items/{item_id} Value must have pattern ^publishers/\[^/\]+/items/\[^/\]+$.

filter - Optional. A filter to apply to the reviews. Only equality comparison on rating is supported, e.g. rating = 5.

orderBy - Optional. An optional comma-separated list of fields by which to sort the results. The default sort order is ascending (asc). Supported fields are: - rating: Supported orders are asc (default) and desc. - create_time: Only desc (most recent first) is supported; desc must be explicitly specified since the default is asc. Example: rating desc, create_time desc, or rating desc, create_time desc.

pageSize - Optional. The maximum number of reviews to return. The service may return fewer than this value. If unspecified, at most 50 reviews will be returned. The maximum value is 200; values above 200 will be coerced to 200.

pageToken - Optional. A page token, received from a previous FetchItemReviews call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to FetchItemReviews must match the call that provided the page token.

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

Completes with a FetchItemReviewsResponse.

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<FetchItemReviewsResponse> fetchReviews(
  core.String name, {
  core.String? filter,
  core.String? orderBy,
  core.int? pageSize,
  core.String? pageToken,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'filter': ?filter == null ? null : [filter],
    'orderBy': ?orderBy == null ? null : [orderBy],
    'pageSize': ?pageSize == null ? null : ['${pageSize}'],
    'pageToken': ?pageToken == null ? null : [pageToken],
    'fields': ?$fields == null ? null : [$fields],
  };

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

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