list method

Future<PostList> list(
  1. String blogId, {
  2. String? endDate,
  3. bool? fetchBodies,
  4. bool? fetchImages,
  5. String? labels,
  6. int? maxResults,
  7. String? orderBy,
  8. String? pageToken,
  9. String? sortOption,
  10. String? startDate,
  11. List<String>? status,
  12. String? view,
  13. String? $fields,
})

Lists posts.

Request parameters:

blogId - null

endDate - null

fetchBodies - null

fetchImages - null

labels - null

maxResults - null

orderBy - null Possible string values are:

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

pageToken - null

sortOption - Sort direction applied to post list. Possible string values are:

  • "SORT_OPTION_UNSPECIFIED" : The unspecified sort option.
  • "DESCENDING" : The option to sort posts in descending order in time.
  • "ASCENDING" : The option to sort posts in ascending order in time.

startDate - null

status - null

view - null Possible string values are:

  • "VIEW_TYPE_UNSPECIFIED"
  • "READER"
  • "AUTHOR"
  • "ADMIN"

$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> list(
  core.String blogId, {
  core.String? endDate,
  core.bool? fetchBodies,
  core.bool? fetchImages,
  core.String? labels,
  core.int? maxResults,
  core.String? orderBy,
  core.String? pageToken,
  core.String? sortOption,
  core.String? startDate,
  core.List<core.String>? status,
  core.String? view,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (endDate != null) 'endDate': [endDate],
    if (fetchBodies != null) 'fetchBodies': ['${fetchBodies}'],
    if (fetchImages != null) 'fetchImages': ['${fetchImages}'],
    if (labels != null) 'labels': [labels],
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (orderBy != null) 'orderBy': [orderBy],
    if (pageToken != null) 'pageToken': [pageToken],
    if (sortOption != null) 'sortOption': [sortOption],
    if (startDate != null) 'startDate': [startDate],
    if (status != null) 'status': status,
    if (view != null) 'view': [view],
    if ($fields != null) 'fields': [$fields],
  };

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

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