public function HttpServiceApiWrapperPosts::createPost in HTTP Client Manager 8.2
Create Post.
Parameters
string $title: The Post title.
mixed $body: The Post body.
Return value
array The service response array.
File
- modules/
http_client_manager_example/ src/ Plugin/ HttpServiceApiWrapper/ HttpServiceApiWrapperPosts.php, line 33
Class
- HttpServiceApiWrapperPosts
- Class HttpServiceApiWrapperPosts.
Namespace
Drupal\http_client_manager_example\Plugin\HttpServiceApiWrapperCode
public function createPost($title, $body) {
$args = [
'userId' => $this->currentUser
->id(),
'title' => $title,
'body' => $body,
];
return $this
->call(Posts::CREATE_POST, $args)
->toArray();
}