search method

Future<PostList> search(
  1. String blogId,
  2. String q, {
  3. bool? fetchBodies,
  4. String? orderBy,
  5. String? $fields,
})

Searches for posts matching given query terms in the specified blog.

Request parameters:

blogId - null

q - null

fetchBodies - null

orderBy - null Possible string values are:

  • "ORDER_BY_UNSPECIFIED"
  • "PUBLISHED"
  • "UPDATED"

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

Completes with a PostList.

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<PostList> search(
  core.String blogId,
  core.String q, {
  core.bool? fetchBodies,
  core.String? orderBy,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'q': [q],
    if (fetchBodies != null) 'fetchBodies': ['${fetchBodies}'],
    if (orderBy != null) 'orderBy': [orderBy],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ =
      'v3/blogs/' + commons.escapeVariable('$blogId') + '/posts/search';

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