update method
Updates a post by blog id and post id.
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> update(
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_,
'PUT',
body: body_,
queryParams: queryParams_,
);
return Post.fromJson(response_ as core.Map<core.String, core.dynamic>);
}