ShareService.php
4.59 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
class ShareService extends RennServiceBase {
/**
* 分享人人网内部UGC资源,例如:日志、照片、相册、分享(基于已有分享再次进行分享)
* <br />对应API:{$link //dev.renren.com/API/v2/share/ugc/put }
* @param Long $ugcOwnerId UGC所有者的用户ID
* @param String $comment 分享时用户的评论,评论字数不能超过500字符
* @param Long $ugcId UGC的ID
* @param UGCType $ugcType UGC的类型。
* @return Share 分享
*/
function putShareUgc($ugcOwnerId, $comment, $ugcId, $ugcType) {
$params = array();
$bodyParams = array();
$fileParams = array();
if (isset($ugcOwnerId)) {
$params ['ugcOwnerId'] = $ugcOwnerId;
}
if (isset($comment)) {
$params ['comment'] = $comment;
}
if (isset($ugcId)) {
$params ['ugcId'] = $ugcId;
}
if (isset($ugcType)) {
$params ['ugcType'] = $ugcType;
}
return $this->client->execute('/v2/share/ugc/put', 'POST', $params, $bodyParams, $fileParams);
}
/**
* 获取人人推荐资源
* <br />对应API:{$link //dev.renren.com/API/v2/share/hot/list }
* @param Integer $pageSize 页面大小。取值范围1-50,默认大小20
* @param Integer $pageNumber 页码。取值大于零,默认值为1
* @param ShareType $shareType 分享类型
* @return Share 分享
*/
function listShareHot($pageSize, $pageNumber, $shareType) {
$params = array();
$bodyParams = array();
$fileParams = array();
if (isset($pageSize)) {
$params ['pageSize'] = $pageSize;
}
if (isset($pageNumber)) {
$params ['pageNumber'] = $pageNumber;
}
if (isset($shareType)) {
$params ['shareType'] = $shareType;
}
return $this->client->execute('/v2/share/hot/list', 'GET', $params, $bodyParams, $fileParams);
}
/**
* 分享人人网外部资源,例如:视频、图片等<br> 如果要分享一张本地照片到人人网(即上传),建议使用[//wiki.dev.renren.com/wiki/v2/photo/upload /v2/photo/upload]接口
* <br />对应API:{$link //dev.renren.com/API/v2/share/url/put }
* @param String $comment 分享时用户的评论,评论字数不能超过500个字符
* @param String $url 分享资源的URL
* @return Share 分享
*/
function putShareUrl($comment, $url) {
$params = array();
$bodyParams = array();
$fileParams = array();
if (isset($comment)) {
$params ['comment'] = $comment;
}
if (isset($url)) {
$params ['url'] = $url;
}
return $this->client->execute('/v2/share/url/put', 'POST', $params, $bodyParams, $fileParams);
}
/**
* 获取某个用户的某个分享
* <br />对应API:{$link //dev.renren.com/API/v2/share/get }
* @param Long $shareId 分享ID
* @param Long $ownerId 分享所有者ID
* @return Share 分享
*/
function getShare($shareId, $ownerId) {
$params = array();
$bodyParams = array();
$fileParams = array();
if (isset($shareId)) {
$params ['shareId'] = $shareId;
}
if (isset($ownerId)) {
$params ['ownerId'] = $ownerId;
}
return $this->client->execute('/v2/share/get', 'GET', $params, $bodyParams, $fileParams);
}
/**
* 以分页的方式获取某个用户的分享列表
* <br />对应API:{$link //dev.renren.com/API/v2/share/list }
* @param Long $ownerId 分享所有者ID
* @param Integer $pageSize 页面大小。取值范围1-100,默认大小20
* @param Integer $pageNumber 页码。取值大于零,默认值为1
* @return Share 分享
*/
function listShare($ownerId, $pageSize, $pageNumber) {
$params = array();
$bodyParams = array();
$fileParams = array();
if (isset($ownerId)) {
$params ['ownerId'] = $ownerId;
}
if (isset($pageSize)) {
$params ['pageSize'] = $pageSize;
}
if (isset($pageNumber)) {
$params ['pageNumber'] = $pageNumber;
}
return $this->client->execute('/v2/share/list', 'GET', $params, $bodyParams, $fileParams);
}
}
?>