gadon78921/comment-client-drom

评论服务抽象客户端

1.0.2 2021-01-10 09:24 UTC

This package is auto-updated.

Last update: 2024-09-10 17:37:05 UTC


README

安装

composer require gadon78921/comment-client-drom

使用

$httpClient = HttpClient::create();
$mapper = new CommentMapper();
$commentApiHttp = new CommentApiHttp($httpClient, $mapper, 'http://example.com');
$response = $commentApiHttp->list($limit, $offset);

获取评论列表

$response = $commentApiHttp->list($limit, $offset);

添加评论

$comment = new Comment();
$comment->setName('Ivan');
$comment->setText('Comment_text');
$response = $commentApiHttp->add($comment);

更新评论

$comment = new Comment();
$comment->setId(5);
$comment->setName('Ivan');
$comment->setText('Comment_text');
$response = $commentApiHttp->update($comment);