Skip to content

Commit db7b961

Browse files
feat: added updateMemberPartial
1 parent 0323702 commit db7b961

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/GetStream/StreamChat/Channel.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ public function unmute(string $userId): StreamResponse
546546
}
547547

548548
/** Pins the channel for the user.
549+
* @link https://getstream.io/chat/docs/php/channel_update/#pinning-a-channel?language=php
549550
* @throws StreamException
550551
*/
551552
public function pin(string $userId): StreamResponse
@@ -565,6 +566,7 @@ public function pin(string $userId): StreamResponse
565566

566567

567568
/** Unpins the channel for the user.
569+
* @link https://getstream.io/chat/docs/php/channel_update/#pinning-a-channel?language=php
568570
* @throws StreamException
569571
*/
570572
public function unpin(string $userId): StreamResponse
@@ -583,6 +585,7 @@ public function unpin(string $userId): StreamResponse
583585
}
584586

585587
/** Archives the channel for the user.
588+
* @link https://getstream.io/chat/docs/php/channel_update/#archiving-a-channel?language=php
586589
* @throws StreamException
587590
*/
588591
public function archive(string $userId): StreamResponse
@@ -601,6 +604,7 @@ public function archive(string $userId): StreamResponse
601604
}
602605

603606
/** Unarchives the channel for the user.
607+
* @link https://getstream.io/chat/docs/php/channel_update/#archiving-a-channel?language=php
604608
* @throws StreamException
605609
*/
606610
public function unarchive(string $userId): StreamResponse
@@ -617,4 +621,23 @@ public function unarchive(string $userId): StreamResponse
617621

618622
return $this->client->patch($this->getUrl() . "/member/" . urlencode($userId), $payload);
619623
}
624+
625+
/** Update channel member partially.
626+
* @link https://getstream.io/chat/docs/php/channel_member/#update-channel-members?language=php
627+
* @throws StreamException
628+
*/
629+
public function updateMemberPartial(string $userId, ?array $set = null, ?array $unset = null): StreamResponse
630+
{
631+
if (empty($userId)) {
632+
throw new StreamException("user ID must be not empty");
633+
}
634+
if ($set === null && $unset === null) {
635+
throw new StreamException("set or unset is required");
636+
}
637+
$update = [
638+
"set" => $set,
639+
"unset" => $unset
640+
];
641+
return $this->client->patch($this->getUrl() . "/member/" . urlencode($userId), $update);
642+
}
620643
}

0 commit comments

Comments
 (0)