list method
Returns the paginated list of questions and some of its answers for a specified location.
This operation is only valid if the specified location is verified.
Request parameters:
parent
- Required. The name of the location to fetch questions for.
Value must have pattern ^locations/\[^/\]+/questions$
.
answersPerQuestion
- Optional. How many answers to fetch per question.
The default and maximum answers_per_question
values are 10.
filter
- Optional. A filter constraining the questions to return. The
only filter currently supported is "ignore_answered=true"
orderBy
- Optional. The order to return the questions. Valid options
include 'update_time desc' and 'upvote_count desc', which will return the
questions sorted descendingly by the requested field. The default sort
order is 'update_time desc'.
pageSize
- Optional. How many questions to fetch per page. The default
and maximum page_size
values are 10.
pageToken
- Optional. If specified, the next page of questions is
retrieved.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a ListQuestionsResponse.
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<ListQuestionsResponse> list(
core.String parent, {
core.int? answersPerQuestion,
core.String? filter,
core.String? orderBy,
core.int? pageSize,
core.String? pageToken,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (answersPerQuestion != null)
'answersPerQuestion': ['${answersPerQuestion}'],
if (filter != null) 'filter': [filter],
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');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ListQuestionsResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}