Skip to content
Closed
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
73 changes: 73 additions & 0 deletions lib/GetStream/StreamChat/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,4 +544,77 @@ public function unmute(string $userId): StreamResponse
];
return $this->client->post("moderation/unmute/channel", $postData);
}

/** Pins the channel for the user.
* @throws StreamException
*/
public function pin(string $userId): StreamResponse
{
if (empty($userId)) {
throw new StreamException("user ID must be not empty");
}

$payload = [
"set" => [
"pinned" => true
]
];

return $this->client->patch($this->getUrl() . "/member/" . urlencode($userId), $payload);
}


/** Unpins the channel for the user.
* @throws StreamException
*/
public function unpin(string $userId): StreamResponse
{
if (empty($userId)) {
throw new StreamException("user ID must be not empty");
}

$payload = [
"set" => [
"pinned" => false
]
];

return $this->client->patch($this->getUrl() . "/member/" . urlencode($userId), $payload);
}

/** Archives the channel for the user.
* @throws StreamException
*/
public function pin(string $userId): StreamResponse
{
if (empty($userId)) {
throw new StreamException("user ID must be not empty");
}

$payload = [
"set" => [
"archived" => true
]
];

return $this->client->patch($this->getUrl() . "/member/" . urlencode($userId), $payload);
}

/** Unarchives the channel for the user.
* @throws StreamException
*/
public function pin(string $userId): StreamResponse
{
if (empty($userId)) {
throw new StreamException("user ID must be not empty");
}

$payload = [
"set" => [
"archived" => false
]
];

return $this->client->patch($this->getUrl() . "/member/" . urlencode($userId), $payload);
}
}
Loading