DoubanDiscussion.php
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* @file DoubanDiscussion.php
* @brief 豆瓣论坛API接口
* @author JonChou <ilorn.mc@gmail.com>
* @date 2012-12-05
*/
class DoubanDiscussion extends DoubanBase {
/**
* @brief 构造函数,初始设置clientId
*
* @param string $clientId
*
* @return void
*/
public function __construct($clientId)
{
$this->clientId = $clientId;
}
public function getDiscussion($id)
{
$this->uri = '/v2/discussion/'.$id;
$this->type = 'GET';
return $this;
}
public function editDiscussion($id)
{
$this->uri = '/v2/discussion/'.$id;
$this->type = 'PUT';
return $this;
}
public function deleteDiscussion($id)
{
$this->uri = '/v2/discussion/'.$id;
$this->type = 'DELETE';
return $this;
}
public function addDiscussion($target, $id)
{
$this->uri = '/v2/'.$target.'/'.$id.'/discussions';
$this->type = 'POST';
return $this;
}
public function getDiscussionsList($target, $id)
{
$this->uri = '/v2/'.$target.'/'.$id.'/discussions';
$this->type = 'GET';
return $this;
}
}