list method

Future<ListAnswersResponse> list(
  1. String parent, {
  2. String? orderBy,
  3. int? pageSize,
  4. String? pageToken,
  5. String? $fields,
})

Returns the paginated list of answers for a specified question.

Request parameters:

parent - Required. The name of the question to fetch answers for. Value must have pattern ^locations/\[^/\]+/questions/\[^/\]+$.

orderBy - Optional. The order to return the answers. Valid options include 'update_time desc' and 'upvote_count desc', which will return the answers sorted descendingly by the requested field. The default sort order is 'update_time desc'.

pageSize - Optional. How many answers to fetch per page. The default and maximum page_size values are 10.

pageToken - Optional. If specified, the next page of answers is retrieved.

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

Completes with a ListAnswersResponse.

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<ListAnswersResponse> list(
  core.String parent, {
  core.String? orderBy,
  core.int? pageSize,
  core.String? pageToken,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (orderBy != null) 'orderBy': [orderBy],
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/answers';

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