Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 56 additions & 23 deletions src/Generated/ChatTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function deleteCampaign(string $id): StreamResponse {
* @return StreamResponse<GeneratedModels\GetCampaignResponse>
* @throws StreamException
*/
public function getCampaign(string $id, string $prev, string $next, int $limit): StreamResponse {
public function getCampaign(string $id, ?string $prev = null, ?string $next = null, ?int $limit = null): StreamResponse {
$path = '/api/v2/chat/campaigns/{id}';
$path = str_replace('{id}', (string) $id, $path);

Expand Down Expand Up @@ -193,7 +193,7 @@ public function deleteChannels(GeneratedModels\DeleteChannelsRequest $requestDat
* @return StreamResponse<GeneratedModels\MarkDeliveredResponse>
* @throws StreamException
*/
public function markDelivered(string $userID, GeneratedModels\MarkDeliveredRequest $requestData): StreamResponse {
public function markDelivered(GeneratedModels\MarkDeliveredRequest $requestData, ?string $userID = null): StreamResponse {
$path = '/api/v2/chat/channels/delivered';

$queryParams = [];
Expand Down Expand Up @@ -266,7 +266,7 @@ public function getOrCreateDistinctChannel(string $type, GeneratedModels\Channel
* @return StreamResponse<GeneratedModels\DeleteChannelResponse>
* @throws StreamException
*/
public function deleteChannel(string $type, string $id, bool $hardDelete): StreamResponse {
public function deleteChannel(string $type, string $id, ?bool $hardDelete = null): StreamResponse {
$path = '/api/v2/chat/channels/{type}/{id}';
$path = str_replace('{type}', (string) $type, $path);
$path = str_replace('{id}', (string) $id, $path);
Expand All @@ -278,6 +278,39 @@ public function deleteChannel(string $type, string $id, bool $hardDelete): Strea
$requestData = null;
return StreamResponse::fromJson($this->makeRequest('DELETE', $path, $queryParams, $requestData), GeneratedModels\DeleteChannelResponse::class);
}
/**
* Returns a channel by its CID without creating it. Responds with 404 when the channel does not exist, so it doubles as an existence check. Pass state=true to also load messages, read state and watchers.
*
* @param string $type
* @param string $id
* @param bool $state
* @param int $messagesLimit
* @param int $membersLimit
* @param int $watchersLimit
* @return StreamResponse<GeneratedModels\ChannelStateResponse>
* @throws StreamException
*/
public function getChannel(string $type, string $id, ?bool $state = null, ?int $messagesLimit = null, ?int $membersLimit = null, ?int $watchersLimit = null): StreamResponse {
$path = '/api/v2/chat/channels/{type}/{id}';
$path = str_replace('{type}', (string) $type, $path);
$path = str_replace('{id}', (string) $id, $path);

$queryParams = [];
if ($state !== null) {
$queryParams['state'] = $state;
}
if ($messagesLimit !== null) {
$queryParams['messages_limit'] = $messagesLimit;
}
if ($membersLimit !== null) {
$queryParams['members_limit'] = $membersLimit;
}
if ($watchersLimit !== null) {
$queryParams['watchers_limit'] = $watchersLimit;
}
$requestData = null;
return StreamResponse::fromJson($this->makeRequest('GET', $path, $queryParams, $requestData), GeneratedModels\ChannelStateResponse::class);
}
/**
* Updates certain fields of the channel
* Sends events:
Expand Down Expand Up @@ -334,7 +367,7 @@ public function updateChannel(string $type, string $id, GeneratedModels\UpdateCh
* @return StreamResponse<GeneratedModels\Response>
* @throws StreamException
*/
public function deleteDraft(string $type, string $id, string $parentID, string $userID): StreamResponse {
public function deleteDraft(string $type, string $id, ?string $parentID = null, ?string $userID = null): StreamResponse {
$path = '/api/v2/chat/channels/{type}/{id}/draft';
$path = str_replace('{type}', (string) $type, $path);
$path = str_replace('{id}', (string) $id, $path);
Expand All @@ -359,7 +392,7 @@ public function deleteDraft(string $type, string $id, string $parentID, string $
* @return StreamResponse<GeneratedModels\GetDraftResponse>
* @throws StreamException
*/
public function getDraft(string $type, string $id, string $parentID, string $userID): StreamResponse {
public function getDraft(string $type, string $id, ?string $parentID = null, ?string $userID = null): StreamResponse {
$path = '/api/v2/chat/channels/{type}/{id}/draft';
$path = str_replace('{type}', (string) $type, $path);
$path = str_replace('{id}', (string) $id, $path);
Expand Down Expand Up @@ -401,7 +434,7 @@ public function sendEvent(string $type, string $id, GeneratedModels\SendEventReq
* @return StreamResponse<GeneratedModels\Response>
* @throws StreamException
*/
public function deleteChannelFile(string $type, string $id, string $url): StreamResponse {
public function deleteChannelFile(string $type, string $id, ?string $url = null): StreamResponse {
$path = '/api/v2/chat/channels/{type}/{id}/file';
$path = str_replace('{type}', (string) $type, $path);
$path = str_replace('{id}', (string) $id, $path);
Expand Down Expand Up @@ -460,7 +493,7 @@ public function hideChannel(string $type, string $id, GeneratedModels\HideChanne
* @return StreamResponse<GeneratedModels\Response>
* @throws StreamException
*/
public function deleteChannelImage(string $type, string $id, string $url): StreamResponse {
public function deleteChannelImage(string $type, string $id, ?string $url = null): StreamResponse {
$path = '/api/v2/chat/channels/{type}/{id}/image';
$path = str_replace('{type}', (string) $type, $path);
$path = str_replace('{id}', (string) $id, $path);
Expand Down Expand Up @@ -499,7 +532,7 @@ public function uploadChannelImage(string $type, string $id, GeneratedModels\Upl
* @return StreamResponse<GeneratedModels\UpdateMemberPartialResponse>
* @throws StreamException
*/
public function updateMemberPartial(string $type, string $id, string $userID, GeneratedModels\UpdateMemberPartialRequest $requestData): StreamResponse {
public function updateMemberPartial(string $type, string $id, GeneratedModels\UpdateMemberPartialRequest $requestData, ?string $userID = null): StreamResponse {
$path = '/api/v2/chat/channels/{type}/{id}/member';
$path = str_replace('{type}', (string) $type, $path);
$path = str_replace('{id}', (string) $id, $path);
Expand Down Expand Up @@ -836,7 +869,7 @@ public function exportChannels(GeneratedModels\ExportChannelsRequest $requestDat
* @return StreamResponse<GeneratedModels\MembersResponse>
* @throws StreamException
*/
public function queryMembers(GeneratedModels\QueryMembersPayload $payload): StreamResponse {
public function queryMembers(?GeneratedModels\QueryMembersPayload $payload = null): StreamResponse {
$path = '/api/v2/chat/members';

$queryParams = [];
Expand Down Expand Up @@ -876,7 +909,7 @@ public function queryMessageHistory(GeneratedModels\QueryMessageHistoryRequest $
* @return StreamResponse<GeneratedModels\DeleteMessageResponse>
* @throws StreamException
*/
public function deleteMessage(string $id, bool $hard, string $deletedBy, bool $deleteForMe): StreamResponse {
public function deleteMessage(string $id, ?bool $hard = null, ?string $deletedBy = null, ?bool $deleteForMe = null): StreamResponse {
$path = '/api/v2/chat/messages/{id}';
$path = str_replace('{id}', (string) $id, $path);

Expand All @@ -901,7 +934,7 @@ public function deleteMessage(string $id, bool $hard, string $deletedBy, bool $d
* @return StreamResponse<GeneratedModels\GetMessageResponse>
* @throws StreamException
*/
public function getMessage(string $id, bool $showDeletedMessage): StreamResponse {
public function getMessage(string $id, ?bool $showDeletedMessage = null): StreamResponse {
$path = '/api/v2/chat/messages/{id}';
$path = str_replace('{id}', (string) $id, $path);

Expand Down Expand Up @@ -1033,7 +1066,7 @@ public function sendReaction(string $id, GeneratedModels\SendReactionRequest $re
* @return StreamResponse<GeneratedModels\DeleteReactionResponse>
* @throws StreamException
*/
public function deleteReaction(string $id, string $type, string $userID): StreamResponse {
public function deleteReaction(string $id, string $type, ?string $userID = null): StreamResponse {
$path = '/api/v2/chat/messages/{id}/reaction/{type}';
$path = str_replace('{id}', (string) $id, $path);
$path = str_replace('{type}', (string) $type, $path);
Expand All @@ -1054,7 +1087,7 @@ public function deleteReaction(string $id, string $type, string $userID): Stream
* @return StreamResponse<GeneratedModels\GetReactionsResponse>
* @throws StreamException
*/
public function getReactions(string $id, int $limit, int $offset): StreamResponse {
public function getReactions(string $id, ?int $limit = null, ?int $offset = null): StreamResponse {
$path = '/api/v2/chat/messages/{id}/reactions';
$path = str_replace('{id}', (string) $id, $path);

Expand Down Expand Up @@ -1158,7 +1191,7 @@ public function castPollVote(string $messageID, string $pollID, GeneratedModels\
* @return StreamResponse<GeneratedModels\PollVoteResponse>
* @throws StreamException
*/
public function deletePollVote(string $messageID, string $pollID, string $voteID, string $userID): StreamResponse {
public function deletePollVote(string $messageID, string $pollID, string $voteID, ?string $userID = null): StreamResponse {
$path = '/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote/{vote_id}';
$path = str_replace('{message_id}', (string) $messageID, $path);
$path = str_replace('{poll_id}', (string) $pollID, $path);
Expand All @@ -1181,7 +1214,7 @@ public function deletePollVote(string $messageID, string $pollID, string $voteID
* @return StreamResponse<GeneratedModels\DeleteReminderResponse>
* @throws StreamException
*/
public function deleteReminder(string $messageID, string $userID): StreamResponse {
public function deleteReminder(string $messageID, ?string $userID = null): StreamResponse {
$path = '/api/v2/chat/messages/{message_id}/reminders';
$path = str_replace('{message_id}', (string) $messageID, $path);

Expand Down Expand Up @@ -1242,7 +1275,7 @@ public function createReminder(string $messageID, GeneratedModels\CreateReminder
* @return StreamResponse<GeneratedModels\GetRepliesResponse>
* @throws StreamException
*/
public function getReplies(string $parentID, int $limit, string $idGte, string $idGt, string $idLte, string $idLt, string $idAround, array $sort): StreamResponse {
public function getReplies(string $parentID, ?int $limit = null, ?string $idGte = null, ?string $idGt = null, ?string $idLte = null, ?string $idLt = null, ?string $idAround = null, ?array $sort = null): StreamResponse {
$path = '/api/v2/chat/messages/{parent_id}/replies';
$path = str_replace('{parent_id}', (string) $parentID, $path);

Expand Down Expand Up @@ -1278,7 +1311,7 @@ public function getReplies(string $parentID, int $limit, string $idGte, string $
* @return StreamResponse<GeneratedModels\QueryMessageFlagsResponse>
* @throws StreamException
*/
public function queryMessageFlags(GeneratedModels\QueryMessageFlagsPayload $payload): StreamResponse {
public function queryMessageFlags(?GeneratedModels\QueryMessageFlagsPayload $payload = null): StreamResponse {
$path = '/api/v2/chat/moderation/flags/message';

$queryParams = [];
Expand Down Expand Up @@ -1331,7 +1364,7 @@ public function unmuteChannel(GeneratedModels\UnmuteChannelRequest $requestData)
* @return StreamResponse<GeneratedModels\QueryBannedUsersResponse>
* @throws StreamException
*/
public function queryBannedUsers(GeneratedModels\QueryBannedUsersPayload $payload): StreamResponse {
public function queryBannedUsers(?GeneratedModels\QueryBannedUsersPayload $payload = null): StreamResponse {
$path = '/api/v2/chat/query_banned_users';

$queryParams = [];
Expand All @@ -1352,7 +1385,7 @@ public function queryBannedUsers(GeneratedModels\QueryBannedUsersPayload $payloa
* @return StreamResponse<GeneratedModels\QueryFutureChannelBansResponse>
* @throws StreamException
*/
public function queryFutureChannelBans(GeneratedModels\QueryFutureChannelBansPayload $payload): StreamResponse {
public function queryFutureChannelBans(?GeneratedModels\QueryFutureChannelBansPayload $payload = null): StreamResponse {
$path = '/api/v2/chat/query_future_channel_bans';

$queryParams = [];
Expand Down Expand Up @@ -1442,7 +1475,7 @@ public function getRetentionPolicyRuns(GeneratedModels\GetRetentionPolicyRunsReq
* @return StreamResponse<GeneratedModels\SearchResponse>
* @throws StreamException
*/
public function search(GeneratedModels\SearchPayload $payload): StreamResponse {
public function search(?GeneratedModels\SearchPayload $payload = null): StreamResponse {
$path = '/api/v2/chat/search';

$queryParams = [];
Expand Down Expand Up @@ -1639,7 +1672,7 @@ public function queryThreads(GeneratedModels\QueryThreadsRequest $requestData):
* @return StreamResponse<GeneratedModels\GetThreadResponse>
* @throws StreamException
*/
public function getThread(string $messageID, int $replyLimit, int $participantLimit, int $memberLimit): StreamResponse {
public function getThread(string $messageID, ?int $replyLimit = null, ?int $participantLimit = null, ?int $memberLimit = null): StreamResponse {
$path = '/api/v2/chat/threads/{message_id}';
$path = str_replace('{message_id}', (string) $messageID, $path);

Expand Down Expand Up @@ -1681,7 +1714,7 @@ public function updateThreadPartial(string $messageID, GeneratedModels\UpdateThr
* @return StreamResponse<GeneratedModels\WrappedUnreadCountsResponse>
* @throws StreamException
*/
public function unreadCounts(string $userID): StreamResponse {
public function unreadCounts(?string $userID = null): StreamResponse {
$path = '/api/v2/chat/unread';

$queryParams = [];
Expand Down Expand Up @@ -1723,4 +1756,4 @@ public function sendUserCustomEvent(string $userID, GeneratedModels\SendUserCust
// Use the provided request data array directly
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\Response::class);
}
}
}
Loading
Loading