Skip to content

Commit ac26680

Browse files
authored
feat: add filter tags support on channels (#149)
1 parent c8c38de commit ac26680

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

lib/GetStream/StreamChat/Channel.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,19 @@ public function deleteReaction(string $messageId, string $reactionType, string $
139139

140140
/** Creates or returns an existing channel.
141141
* @link https://getstream.io/chat/docs/php/creating_channels/?language=php
142+
* @param string $userId The creating user id
143+
* @param array|null $members Optional list of member user ids
144+
* @param array|null $filterTags Optional list of filter tags to associate with the channel
142145
* @throws StreamException
143146
*/
144-
public function create(string $userId, ?array $members = null): StreamResponse
147+
public function create(string $userId, ?array $members = null, ?array $filterTags = null): StreamResponse
145148
{
146149
$this->customData['created_by'] = ["id" => $userId];
150+
151+
if ($filterTags !== null) {
152+
$this->customData['filter_tags'] = $filterTags;
153+
}
154+
147155
$response = $this->query([
148156
"watch" => false,
149157
"state" => false,
@@ -685,4 +693,28 @@ public function getDraft(string $userId, ?string $parentId = null): StreamRespon
685693
}
686694
return $this->client->get($this->getUrl() . "/draft", $params);
687695
}
696+
697+
/** Adds filter tags to the channel.
698+
* @link https://getstream.io/chat/docs/php/channel_update/?language=php
699+
* @throws StreamException
700+
*/
701+
public function addFilterTags(array $tags): StreamResponse
702+
{
703+
$payload = [
704+
"add_filter_tags" => $tags
705+
];
706+
return $this->update(null, null, $payload);
707+
}
708+
709+
/** Removes filter tags from the channel.
710+
* @link https://getstream.io/chat/docs/php/channel_update/?language=php
711+
* @throws StreamException
712+
*/
713+
public function removeFilterTags(array $tags): StreamResponse
714+
{
715+
$payload = [
716+
"remove_filter_tags" => $tags
717+
];
718+
return $this->update(null, null, $payload);
719+
}
688720
}

0 commit comments

Comments
 (0)