Skip to content

Commit c46265c

Browse files
authored
Add target feeds extra data for reactions (#105)
1 parent ecf6b7f commit c46265c

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

lib/GetStream/Stream/Reactions.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ private function doRequest($method, $endpoint, $params=null)
6767
* @param string $userId
6868
* @param array $data
6969
* @param array $targetFeeds
70+
* @param array $targetFeedsExtraData
7071
*
7172
* @return array
7273
*/
73-
public function add($kind, $activityId, $userId, array $data=null, array $targetFeeds=null)
74+
public function add($kind, $activityId, $userId, array $data=null, array $targetFeeds=null, $targetFeedsExtraData=null)
7475
{
7576
$payload = [
7677
'kind' => $kind,
@@ -83,6 +84,9 @@ public function add($kind, $activityId, $userId, array $data=null, array $target
8384
if ($targetFeeds !== null) {
8485
$payload['target_feeds'] = $targetFeeds;
8586
}
87+
if ($targetFeedsExtraData !== null) {
88+
$payload['target_feeds_extra_data'] = $targetFeedsExtraData;
89+
}
8690
$response = $this->doRequest('POST', 'reaction/', $payload);
8791
$body = $response->getBody()->getContents();
8892
return json_decode($body, true);
@@ -94,10 +98,11 @@ public function add($kind, $activityId, $userId, array $data=null, array $target
9498
* @param string $userId
9599
* @param array $data
96100
* @param array $targetFeeds
101+
* @param array $targetFeedsExtraData
97102
*
98103
* @return array
99104
*/
100-
public function addChild($kind, $parentId, $userId, array $data=null, array $targetFeeds=null)
105+
public function addChild($kind, $parentId, $userId, array $data=null, array $targetFeeds=null, $targetFeedsExtraData=null)
101106
{
102107
$payload = [
103108
'kind' => $kind,
@@ -110,6 +115,9 @@ public function addChild($kind, $parentId, $userId, array $data=null, array $tar
110115
if ($targetFeeds !== null) {
111116
$payload['target_feeds'] = $targetFeeds;
112117
}
118+
if ($targetFeedsExtraData !== null) {
119+
$payload['target_feeds_extra_data'] = $targetFeedsExtraData;
120+
}
113121
$response = $this->doRequest('POST', 'reaction/', $payload);
114122
$body = $response->getBody()->getContents();
115123
return json_decode($body, true);
@@ -180,10 +188,11 @@ public function get($reactionId)
180188
* @param string $reactionId
181189
* @param array $data
182190
* @param array $targetFeeds
191+
* @param array $targetFeedsExtraData
183192
*
184193
* @return array
185194
*/
186-
public function update($reactionId, array $data=null, array $targetFeeds=null)
195+
public function update($reactionId, array $data=null, array $targetFeeds=null, $targetFeedsExtraData=null)
187196
{
188197
$payload = [];
189198
if ($data !== null) {
@@ -192,6 +201,9 @@ public function update($reactionId, array $data=null, array $targetFeeds=null)
192201
if ($targetFeeds !== null) {
193202
$payload['target_feeds'] = $targetFeeds;
194203
}
204+
if ($targetFeedsExtraData !== null) {
205+
$payload['target_feeds_extra_data'] = $targetFeedsExtraData;
206+
}
195207
$response = $this->doRequest('PUT', 'reaction/' . $reactionId . '/', $payload);
196208
$body = $response->getBody()->getContents();
197209
return json_decode($body, true);

0 commit comments

Comments
 (0)