Total Complexity | 3 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class Comment |
||
13 | { |
||
14 | /** |
||
15 | * @var Client |
||
16 | */ |
||
17 | private $client; |
||
18 | |||
19 | 1 | public function __construct(Client $client) |
|
22 | } |
||
23 | |||
24 | /** |
||
25 | * Post record comment |
||
26 | * https://cybozudev.zendesk.com/hc/ja/articles/209758903 |
||
27 | * |
||
28 | * @param integer $appId |
||
29 | * @param integer $record |
||
30 | * @param string $comment |
||
31 | * @param array $mentions |
||
32 | * @param integer $guestSpaceId |
||
33 | * @return array |
||
34 | */ |
||
35 | 2 | public function post($appId, $record, $comment, array $mentions = [], $guestSpaceId = null): array |
|
36 | { |
||
37 | 2 | $options = ['json' => [ |
|
38 | 2 | 'app' => $appId, |
|
39 | 2 | 'record' => $record, |
|
40 | 2 | 'comment' => [ |
|
41 | 2 | 'text' => $comment, |
|
42 | 2 | 'mentions' => $mentions |
|
43 | 2 | ] |
|
44 | 2 | ]]; |
|
45 | |||
46 | /** @var JsonStream $stream */ |
||
47 | 2 | $stream = $this->client |
|
48 | 2 | ->post(KintoneApi::generateUrl('record/comment.json', $guestSpaceId), $options) |
|
49 | 2 | ->getBody(); |
|
50 | |||
51 | 2 | return $stream->jsonSerialize(); |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * Delete record comment |
||
56 | * https://cybozudev.zendesk.com/hc/ja/articles/209758703 |
||
57 | * |
||
58 | * @param integer $appId |
||
59 | * @param integer $recordId |
||
60 | * @param integer $id |
||
61 | * @param integer $guestSpaceId |
||
62 | * @return array |
||
63 | */ |
||
64 | 2 | public function delete($appId, $recordId, $id, $guestSpaceId = null): array |
|
78 | } |
||
79 | } |
||
80 |