| @@ 135-144 (lines=10) @@ | ||
| 132 | * |
|
| 133 | * @return Channel|ResponseInterface |
|
| 134 | */ |
|
| 135 | public function restoreChannel($channelId) |
|
| 136 | { |
|
| 137 | if (empty($channelId)) { |
|
| 138 | throw new InvalidArgumentException('ChannelId can not be empty'); |
|
| 139 | } |
|
| 140 | ||
| 141 | $response = $this->httpPost(sprintf('/channels/%s/restore', $channelId)); |
|
| 142 | ||
| 143 | return $this->handleResponse($response, Channel::class); |
|
| 144 | } |
|
| 145 | ||
| 146 | /** |
|
| 147 | * Patch a channel. |
|
| @@ 97-106 (lines=10) @@ | ||
| 94 | * |
|
| 95 | * @return Status|ResponseInterface |
|
| 96 | */ |
|
| 97 | public function pinPost($postId) |
|
| 98 | { |
|
| 99 | if (empty($postId)) { |
|
| 100 | throw new InvalidArgumentException('PostId can not be empty'); |
|
| 101 | } |
|
| 102 | ||
| 103 | $response = $this->httpPost(sprintf('/posts/%s/pin', $postId)); |
|
| 104 | ||
| 105 | return $this->handleResponse($response, Status::class); |
|
| 106 | } |
|
| 107 | ||
| 108 | /** |
|
| 109 | * Unpin a post to a channel it is in based from the provided post id string. |
|
| @@ 117-126 (lines=10) @@ | ||
| 114 | * |
|
| 115 | * @return Status|ResponseInterface |
|
| 116 | */ |
|
| 117 | public function unpinPost($postId) |
|
| 118 | { |
|
| 119 | if (empty($postId)) { |
|
| 120 | throw new InvalidArgumentException('PostId can not be empty'); |
|
| 121 | } |
|
| 122 | ||
| 123 | $response = $this->httpPost(sprintf('/posts/%s/unpin', $postId)); |
|
| 124 | ||
| 125 | return $this->handleResponse($response, Status::class); |
|
| 126 | } |
|
| 127 | ||
| 128 | /** |
|
| 129 | * Soft deletes a post, by marking the post as deleted in the database. Soft deleted posts will not be returned in post queries. |
|
| @@ 71-80 (lines=10) @@ | ||
| 68 | * |
|
| 69 | * @return UsersCollection|ResponseInterface |
|
| 70 | */ |
|
| 71 | public function getUsersByIds(array $userIds) |
|
| 72 | { |
|
| 73 | if (empty($userIds)) { |
|
| 74 | throw new InvalidArgumentException('UserIDs can not be empty'); |
|
| 75 | } |
|
| 76 | ||
| 77 | $response = $this->httpPost('/users/ids', $userIds); |
|
| 78 | ||
| 79 | return $this->handleResponse($response, UsersCollection::class); |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Returns a collection of users. |
|
| @@ 123-132 (lines=10) @@ | ||
| 120 | * |
|
| 121 | * @return UsersCollection|ResponseInterface |
|
| 122 | */ |
|
| 123 | public function getUsersByUsernames(array $userNames) |
|
| 124 | { |
|
| 125 | if (empty($userNames)) { |
|
| 126 | throw new InvalidArgumentException('Usernames can not be empty'); |
|
| 127 | } |
|
| 128 | ||
| 129 | $response = $this->httpPost('/users/usernames', $userNames); |
|
| 130 | ||
| 131 | return $this->handleResponse($response, UsersCollection::class); |
|
| 132 | } |
|
| 133 | ||
| 134 | /** |
|
| 135 | * Deactivate a user. |
|
| @@ 72-81 (lines=10) @@ | ||
| 69 | * |
|
| 70 | * @return FileMetadata|ResponseInterface |
|
| 71 | */ |
|
| 72 | public function getFileMetadata(string $fileId) |
|
| 73 | { |
|
| 74 | if (empty($fileId)) { |
|
| 75 | throw new InvalidArgumentException('FileID can not be empty'); |
|
| 76 | } |
|
| 77 | ||
| 78 | $response = $this->httpGet(sprintf('/files/%s', $fileId)); |
|
| 79 | ||
| 80 | return $this->handleResponse($response, FileMetadata::class); |
|
| 81 | } |
|
| 82 | } |
|
| 83 | ||