Skip to content

Commit eba832b

Browse files
authored
Merge pull request #33 from GetStream/FEEDS-1372
fix(php): adapt feed integration tests for regenerated getActivity
2 parents 7dd98dd + ea594f6 commit eba832b

117 files changed

Lines changed: 1540 additions & 121 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Generated/ChatTrait.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@
1414
*/
1515
trait ChatTrait
1616
{
17+
/**
18+
* Creates a campaign
19+
*
20+
* @param GeneratedModels\CreateCampaignRequest $requestData
21+
* @return StreamResponse<GeneratedModels\CreateCampaignResponse>
22+
* @throws StreamException
23+
*/
24+
public function createCampaign(GeneratedModels\CreateCampaignRequest $requestData): StreamResponse {
25+
$path = '/api/v2/chat/campaigns';
26+
27+
$queryParams = [];
28+
// Use the provided request data array directly
29+
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\CreateCampaignResponse::class);
30+
}
1731
/**
1832
* Query campaigns with filter query
1933
*
@@ -28,6 +42,21 @@ public function queryCampaigns(GeneratedModels\QueryCampaignsRequest $requestDat
2842
// Use the provided request data array directly
2943
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\QueryCampaignsResponse::class);
3044
}
45+
/**
46+
* Delete campaign
47+
*
48+
* @param string $id
49+
* @return StreamResponse<GeneratedModels\DeleteCampaignResponse>
50+
* @throws StreamException
51+
*/
52+
public function deleteCampaign(string $id): StreamResponse {
53+
$path = '/api/v2/chat/campaigns/{id}';
54+
$path = str_replace('{id}', (string) $id, $path);
55+
56+
$queryParams = [];
57+
$requestData = null;
58+
return StreamResponse::fromJson($this->makeRequest('DELETE', $path, $queryParams, $requestData), GeneratedModels\DeleteCampaignResponse::class);
59+
}
3160
/**
3261
* Get campaign by ID.
3362
*
@@ -55,6 +84,22 @@ public function getCampaign(string $id, string $prev, string $next, int $limit):
5584
$requestData = null;
5685
return StreamResponse::fromJson($this->makeRequest('GET', $path, $queryParams, $requestData), GeneratedModels\GetCampaignResponse::class);
5786
}
87+
/**
88+
* Updates a campaign
89+
*
90+
* @param string $id
91+
* @param GeneratedModels\UpdateCampaignRequest $requestData
92+
* @return StreamResponse<GeneratedModels\CampaignResponse>
93+
* @throws StreamException
94+
*/
95+
public function updateCampaign(string $id, GeneratedModels\UpdateCampaignRequest $requestData): StreamResponse {
96+
$path = '/api/v2/chat/campaigns/{id}';
97+
$path = str_replace('{id}', (string) $id, $path);
98+
99+
$queryParams = [];
100+
// Use the provided request data array directly
101+
return StreamResponse::fromJson($this->makeRequest('PUT', $path, $queryParams, $requestData), GeneratedModels\CampaignResponse::class);
102+
}
58103
/**
59104
* Starts or schedules a campaign
60105
*
@@ -158,6 +203,20 @@ public function markDelivered(string $userID, GeneratedModels\MarkDeliveredReque
158203
// Use the provided request data array directly
159204
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\MarkDeliveredResponse::class);
160205
}
206+
/**
207+
* Query channels grouped into predefined buckets. Only available for enterprise apps.
208+
*
209+
* @param GeneratedModels\GroupedQueryChannelsRequest $requestData
210+
* @return StreamResponse<GeneratedModels\GroupedQueryChannelsResponse>
211+
* @throws StreamException
212+
*/
213+
public function groupedQueryChannels(GeneratedModels\GroupedQueryChannelsRequest $requestData): StreamResponse {
214+
$path = '/api/v2/chat/channels/grouped';
215+
216+
$queryParams = [];
217+
// Use the provided request data array directly
218+
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\GroupedQueryChannelsResponse::class);
219+
}
161220
/**
162221
* Marks channels as read up to the specific message. If no channels is given, mark all channel as read
163222
* Sends events:

src/Generated/FeedMethods.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ public function pinActivity(
8383
string $activityID, GeneratedModels\PinActivityRequest $requestData): StreamResponse {
8484
return $this->feedsV3Client->pinActivity($this->feedGroup, $this->feedId, $activityID, $requestData);
8585
}
86+
/**
87+
* Changes the visibility of an existing feed. Follow reconciliation (rewriting pending follows on loosening, or removing disallowed follows/members on tightening) runs asynchronously in the background; the response returns optimistically with the intended visibility.
88+
*
89+
* @param GeneratedModels\ChangeFeedVisibilityRequest $requestData
90+
* @return StreamResponse<GeneratedModels\ChangeFeedVisibilityResponse>
91+
* @throws StreamException
92+
*/
93+
public function changeFeedVisibility(
94+
GeneratedModels\ChangeFeedVisibilityRequest $requestData): StreamResponse {
95+
return $this->feedsV3Client->changeFeedVisibility($this->feedGroup, $this->feedId, $requestData);
96+
}
8697
/**
8798
* Add, remove, or set members for a feed
8899
*

src/Generated/FeedsTrait.php

Lines changed: 107 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,26 @@ public function deleteActivity(string $id, bool $hardDelete, bool $deleteNotific
306306
* Returns activity by ID
307307
*
308308
* @param string $id
309+
* @param string $commentSort
310+
* @param int $commentLimit
311+
* @param string $userID
309312
* @return StreamResponse<GeneratedModels\GetActivityResponse>
310313
* @throws StreamException
311314
*/
312-
public function getActivity(string $id): StreamResponse {
315+
public function getActivity(string $id, string $commentSort, int $commentLimit, string $userID): StreamResponse {
313316
$path = '/api/v2/feeds/activities/{id}';
314317
$path = str_replace('{id}', (string) $id, $path);
315318

316319
$queryParams = [];
320+
if ($commentSort !== null) {
321+
$queryParams['comment_sort'] = $commentSort;
322+
}
323+
if ($commentLimit !== null) {
324+
$queryParams['comment_limit'] = $commentLimit;
325+
}
326+
if ($userID !== null) {
327+
$queryParams['user_id'] = $userID;
328+
}
317329
$requestData = null;
318330
return StreamResponse::fromJson($this->makeRequest('GET', $path, $queryParams, $requestData), GeneratedModels\GetActivityResponse::class);
319331
}
@@ -354,7 +366,7 @@ public function updateActivity(string $id, GeneratedModels\UpdateActivityRequest
354366
return StreamResponse::fromJson($this->makeRequest('PUT', $path, $queryParams, $requestData), GeneratedModels\UpdateActivityResponse::class);
355367
}
356368
/**
357-
* Restores a soft-deleted activity by its ID. Only the activity owner can restore their own activities.
369+
* Restores a soft-deleted, moderation-removed, or shadow-blocked activity by its ID. Deleted activities can be restored by the owner (client-side). Moderation-blocked activities can only be restored server-side.
358370
*
359371
* @param string $id
360372
* @param bool $enrichOwnFields
@@ -621,6 +633,61 @@ public function queryComments(GeneratedModels\QueryCommentsRequest $requestData)
621633
// Use the provided request data array directly
622634
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\QueryCommentsResponse::class);
623635
}
636+
/**
637+
* Deletes a bookmark from a comment
638+
*
639+
* @param string $commentID
640+
* @param string $folderID
641+
* @param string $userID
642+
* @return StreamResponse<GeneratedModels\DeleteCommentBookmarkResponse>
643+
* @throws StreamException
644+
*/
645+
public function deleteCommentBookmark(string $commentID, string $folderID, string $userID): StreamResponse {
646+
$path = '/api/v2/feeds/comments/{comment_id}/bookmarks';
647+
$path = str_replace('{comment_id}', (string) $commentID, $path);
648+
649+
$queryParams = [];
650+
if ($folderID !== null) {
651+
$queryParams['folder_id'] = $folderID;
652+
}
653+
if ($userID !== null) {
654+
$queryParams['user_id'] = $userID;
655+
}
656+
$requestData = null;
657+
return StreamResponse::fromJson($this->makeRequest('DELETE', $path, $queryParams, $requestData), GeneratedModels\DeleteCommentBookmarkResponse::class);
658+
}
659+
/**
660+
* Updates a bookmark for a comment
661+
*
662+
* @param string $commentID
663+
* @param GeneratedModels\UpdateCommentBookmarkRequest $requestData
664+
* @return StreamResponse<GeneratedModels\UpdateCommentBookmarkResponse>
665+
* @throws StreamException
666+
*/
667+
public function updateCommentBookmark(string $commentID, GeneratedModels\UpdateCommentBookmarkRequest $requestData): StreamResponse {
668+
$path = '/api/v2/feeds/comments/{comment_id}/bookmarks';
669+
$path = str_replace('{comment_id}', (string) $commentID, $path);
670+
671+
$queryParams = [];
672+
// Use the provided request data array directly
673+
return StreamResponse::fromJson($this->makeRequest('PATCH', $path, $queryParams, $requestData), GeneratedModels\UpdateCommentBookmarkResponse::class);
674+
}
675+
/**
676+
* Adds a bookmark to a comment
677+
*
678+
* @param string $commentID
679+
* @param GeneratedModels\AddCommentBookmarkRequest $requestData
680+
* @return StreamResponse<GeneratedModels\AddCommentBookmarkResponse>
681+
* @throws StreamException
682+
*/
683+
public function addCommentBookmark(string $commentID, GeneratedModels\AddCommentBookmarkRequest $requestData): StreamResponse {
684+
$path = '/api/v2/feeds/comments/{comment_id}/bookmarks';
685+
$path = str_replace('{comment_id}', (string) $commentID, $path);
686+
687+
$queryParams = [];
688+
// Use the provided request data array directly
689+
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\AddCommentBookmarkResponse::class);
690+
}
624691
/**
625692
* Deletes a comment from an object (e.g., activity) and broadcasts appropriate events
626693
*
@@ -648,14 +715,18 @@ public function deleteComment(string $id, bool $hardDelete, bool $deleteNotifica
648715
* Get a comment by ID
649716
*
650717
* @param string $id
718+
* @param string $userID
651719
* @return StreamResponse<GeneratedModels\GetCommentResponse>
652720
* @throws StreamException
653721
*/
654-
public function getComment(string $id): StreamResponse {
722+
public function getComment(string $id, string $userID): StreamResponse {
655723
$path = '/api/v2/feeds/comments/{id}';
656724
$path = str_replace('{id}', (string) $id, $path);
657725

658726
$queryParams = [];
727+
if ($userID !== null) {
728+
$queryParams['user_id'] = $userID;
729+
}
659730
$requestData = null;
660731
return StreamResponse::fromJson($this->makeRequest('GET', $path, $queryParams, $requestData), GeneratedModels\GetCommentResponse::class);
661732
}
@@ -799,7 +870,7 @@ public function getCommentReplies(string $id, int $depth, string $sort, int $rep
799870
return StreamResponse::fromJson($this->makeRequest('GET', $path, $queryParams, $requestData), GeneratedModels\GetCommentRepliesResponse::class);
800871
}
801872
/**
802-
* Restores a soft-deleted comment by its ID. The comment and all its descendants are restored. Requires moderator permissions.
873+
* Restores a soft-deleted, moderation-removed, or shadow-blocked comment by its ID. The comment and all its descendants are restored. Deleted comments can be restored client-side. Moderation-blocked comments can only be restored server-side.
803874
*
804875
* @param string $id
805876
* @param GeneratedModels\RestoreCommentRequest $requestData
@@ -967,6 +1038,24 @@ public function pinActivity(string $feedGroupID, string $feedID, string $activit
9671038
// Use the provided request data array directly
9681039
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\PinActivityResponse::class);
9691040
}
1041+
/**
1042+
* Changes the visibility of an existing feed. Follow reconciliation (rewriting pending follows on loosening, or removing disallowed follows/members on tightening) runs asynchronously in the background; the response returns optimistically with the intended visibility.
1043+
*
1044+
* @param string $feedGroupID
1045+
* @param string $feedID
1046+
* @param GeneratedModels\ChangeFeedVisibilityRequest $requestData
1047+
* @return StreamResponse<GeneratedModels\ChangeFeedVisibilityResponse>
1048+
* @throws StreamException
1049+
*/
1050+
public function changeFeedVisibility(string $feedGroupID, string $feedID, GeneratedModels\ChangeFeedVisibilityRequest $requestData): StreamResponse {
1051+
$path = '/api/v2/feeds/feed_groups/{feed_group_id}/feeds/{feed_id}/change_visibility';
1052+
$path = str_replace('{feed_group_id}', (string) $feedGroupID, $path);
1053+
$path = str_replace('{feed_id}', (string) $feedID, $path);
1054+
1055+
$queryParams = [];
1056+
// Use the provided request data array directly
1057+
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\ChangeFeedVisibilityResponse::class);
1058+
}
9701059
/**
9711060
* Add, remove, or set members for a feed
9721061
*
@@ -1574,6 +1663,20 @@ public function updateMembershipLevel(string $id, GeneratedModels\UpdateMembersh
15741663
// Use the provided request data array directly
15751664
return StreamResponse::fromJson($this->makeRequest('PATCH', $path, $queryParams, $requestData), GeneratedModels\UpdateMembershipLevelResponse::class);
15761665
}
1666+
/**
1667+
* Queries revision history for activities and comments
1668+
*
1669+
* @param GeneratedModels\QueryRevisionHistoryRequest $requestData
1670+
* @return StreamResponse<GeneratedModels\QueryRevisionHistoryResponse>
1671+
* @throws StreamException
1672+
*/
1673+
public function queryRevisionHistory(GeneratedModels\QueryRevisionHistoryRequest $requestData): StreamResponse {
1674+
$path = '/api/v2/feeds/revisions/query';
1675+
1676+
$queryParams = [];
1677+
// Use the provided request data array directly
1678+
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\QueryRevisionHistoryResponse::class);
1679+
}
15771680
/**
15781681
* Retrieve usage statistics for feeds including activity count, follow count, and API request count.
15791682
* Returns data aggregated by day with pagination support via from/to date parameters.

0 commit comments

Comments
 (0)