Completed
Push — comment-api ( 9d46a8 )
by Yuichi
09:33
created

Comments::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 14
ccs 9
cts 9
cp 1
rs 9.4285
cc 1
eloc 10
nc 1
nop 6
crap 1
1
<?php
2
3
namespace CybozuHttp\Api\Kintone;
4
5
use CybozuHttp\Client;
6
use CybozuHttp\Api\KintoneApi;
7
8
/**
9
 * @author ochi51 <[email protected]>
10
 */
11
class Comments
12
{
13
    /**
14
     * @var Client
15
     */
16
    private $client;
17
18 1
    public function __construct(Client $client)
19
    {
20 1
        $this->client = $client;
21 1
    }
22
23
    /**
24
     * Get record comments
25
     * https://cybozudev.zendesk.com/hc/ja/articles/208242326
26
     *
27
     * @param int $appId
28
     * @param int $recordId
29
     * @param string $order "asc" or "desc"
30
     * @param int $offset
31
     * @param int $limit Max = 10
32
     * @param int $guestSpaceId
33
     * @return array
34
     */
35 2
    public function get($appId, $recordId, $order = 'desc', $offset = 0, $limit = 10, $guestSpaceId = null)
36
    {
37
        $options = ['json' => [
38 2
            'app' => $appId,
39 2
            'record' => $recordId,
40 2
            'order' => $order,
41 2
            'offset' => $offset,
42
            'limit' => $limit
43 2
        ]];
44
45 2
        return $this->client
46 2
            ->get(KintoneApi::generateUrl('record/comments.json', $guestSpaceId), $options)
47 2
            ->json()['comments'];
48
    }
49
}