patch method

Future<Post> patch(
  1. Post request,
  2. String blogId,
  3. String postId, {
  4. bool? fetchBody,
  5. bool? fetchImages,
  6. int? maxComments,
  7. bool? publish_1,
  8. bool? revert_1,
  9. String? $fields,
})

Patches a post.

request - The metadata request object.

Request parameters:

blogId - null

postId - null

fetchBody - null

fetchImages - null

maxComments - null

publish_1 - null

revert_1 - null

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

Completes with a Post.

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<Post> patch(
  Post request,
  core.String blogId,
  core.String postId, {
  core.bool? fetchBody,
  core.bool? fetchImages,
  core.int? maxComments,
  core.bool? publish_1,
  core.bool? revert_1,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (fetchBody != null) 'fetchBody': ['${fetchBody}'],
    if (fetchImages != null) 'fetchImages': ['${fetchImages}'],
    if (maxComments != null) 'maxComments': ['${maxComments}'],
    if (publish_1 != null) 'publish': ['${publish_1}'],
    if (revert_1 != null) 'revert': ['${revert_1}'],
    if ($fields != null) 'fields': [$fields],
  };

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

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