Skip to content

Commit 724ab9e

Browse files
committed
Fix "get*" functions
1 parent e7f2e94 commit 724ab9e

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

api.php

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ public function getProfile($userId) {
7474

7575
$context = stream_context_create(array(
7676
"http" => array(
77-
"method" => "POST",
77+
"method" => "GET",
7878
"header" => implode("\r\n", $header),
79-
"content" => "[]",
8079
),
8180
));
8281

@@ -96,9 +95,8 @@ public function getGroupMemberInfo($groupId, $userId) {
9695

9796
$context = stream_context_create(array(
9897
"http" => array(
99-
"method" => "POST",
98+
"method" => "GET",
10099
"header" => implode("\r\n", $header),
101-
"content" => "[]",
102100
),
103101
));
104102

@@ -111,20 +109,25 @@ public function getGroupMemberInfo($groupId, $userId) {
111109
}
112110
}
113111

114-
public function getGroupMemberIds($groupId) {
112+
public function getGroupMemberIds($groupId, $continuationToken = null) {
113+
if ($continuationToken != null) {
114+
$next = "?start=".$continuationToken;
115+
}else{
116+
$next = "";
117+
}
118+
115119
$header = array(
116120
'Authorization: Bearer ' . $this->channelAccessToken,
117121
);
118122

119123
$context = stream_context_create(array(
120124
"http" => array(
121-
"method" => "POST",
125+
"method" => "GET",
122126
"header" => implode("\r\n", $header),
123-
"content" => "[]",
124127
),
125128
));
126129

127-
$response = file_get_contents($this->host.'/v2/bot/group/'.urlencode($groupId).'/member/ids', false, $context);
130+
$response = file_get_contents($this->host.'/v2/bot/group/'.urlencode($groupId).'/member/ids'.$next, false, $context);
128131
if (strpos($http_response_header[0], '200') === false) {
129132
http_response_code(500);
130133
error_log("Request failed: " . $response);
@@ -160,9 +163,8 @@ public function getRoomMemberInfo($roomId, $userId) {
160163

161164
$context = stream_context_create(array(
162165
"http" => array(
163-
"method" => "POST",
166+
"method" => "GET",
164167
"header" => implode("\r\n", $header),
165-
"content" => "[]",
166168
),
167169
));
168170

@@ -175,20 +177,25 @@ public function getRoomMemberInfo($roomId, $userId) {
175177
}
176178
}
177179

178-
public function getRoomMemberIds($roomId) {
180+
public function getRoomMemberIds($roomId, $continuationToken = null) {
181+
if ($continuationToken != null) {
182+
$next = "?start=".$continuationToken;
183+
}else{
184+
$next = "";
185+
}
186+
179187
$header = array(
180188
'Authorization: Bearer ' . $this->channelAccessToken,
181189
);
182190

183191
$context = stream_context_create(array(
184192
"http" => array(
185-
"method" => "POST",
193+
"method" => "GET",
186194
"header" => implode("\r\n", $header),
187-
"content" => "[]",
188195
),
189196
));
190197

191-
$response = file_get_contents($this->host.'/v2/bot/room/'.urlencode($roomId).'/member/ids', false, $context);
198+
$response = file_get_contents($this->host.'/v2/bot/room/'.urlencode($roomId).'/member/ids'.$next, false, $context);
192199
if (strpos($http_response_header[0], '200') === false) {
193200
http_response_code(500);
194201
error_log("Request failed: " . $response);
@@ -440,4 +447,4 @@ public function Flex($url, $contents = null) {
440447
}
441448
}
442449

443-
?>
450+
?>

0 commit comments

Comments
 (0)