| @@ 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. |
|
| @@ 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 | * Update user active or inactive status. |
|
| @@ 142-153 (lines=12) @@ | ||
| 139 | * |
|
| 140 | * @return Status|ResponseInterface |
|
| 141 | */ |
|
| 142 | public function setUserActive(string $userId, bool $activeStatus) |
|
| 143 | { |
|
| 144 | if (empty($userId)) { |
|
| 145 | throw new InvalidArgumentException('User ID can not be empty'); |
|
| 146 | } |
|
| 147 | ||
| 148 | $response = $this->httpPut(sprintf('/users/%s/active', $userId), [ |
|
| 149 | 'active' => $activeStatus, |
|
| 150 | ]); |
|
| 151 | ||
| 152 | return $this->handleResponse($response, Status::class); |
|
| 153 | } |
|
| 154 | ||
| 155 | /** |
|
| 156 | * Deactivates the user by archiving its user object. |
|
| @@ 185-196 (lines=12) @@ | ||
| 182 | * |
|
| 183 | * @return Status|ResponseInterface |
|
| 184 | */ |
|
| 185 | public function updateUserRoles(string $userId, string $roles) |
|
| 186 | { |
|
| 187 | if (empty($userId)) { |
|
| 188 | throw new InvalidArgumentException('User ID can not be empty'); |
|
| 189 | } |
|
| 190 | ||
| 191 | $response = $this->httpPut(sprintf('/users/%s/roles', $userId), [ |
|
| 192 | 'roles' => $roles, |
|
| 193 | ]); |
|
| 194 | ||
| 195 | return $this->handleResponse($response, Status::class); |
|
| 196 | } |
|
| 197 | ||
| 198 | /** |
|
| 199 | * Create a user. Required parameters: 'username', 'email' and 'password'. |
|
| @@ 68-77 (lines=10) @@ | ||
| 65 | * |
|
| 66 | * @return FileInfo|ResponseInterface |
|
| 67 | */ |
|
| 68 | public function getFileInfo(string $fileId) |
|
| 69 | { |
|
| 70 | if (empty($fileId)) { |
|
| 71 | throw new InvalidArgumentException('FileID can not be empty'); |
|
| 72 | } |
|
| 73 | ||
| 74 | $response = $this->httpGet(sprintf('/files/%s/info', $fileId)); |
|
| 75 | ||
| 76 | return $this->handleResponse($response, FileInfo::class); |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * Gets a file that has been uploaded previously. |
|
| @@ 98-107 (lines=10) @@ | ||
| 95 | * |
|
| 96 | * @return Status|ResponseInterface |
|
| 97 | */ |
|
| 98 | public function pinPost($postId) |
|
| 99 | { |
|
| 100 | if (empty($postId)) { |
|
| 101 | throw new InvalidArgumentException('PostId can not be empty'); |
|
| 102 | } |
|
| 103 | ||
| 104 | $response = $this->httpPost(sprintf('/posts/%s/pin', $postId)); |
|
| 105 | ||
| 106 | return $this->handleResponse($response, Status::class); |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * Unpin a post to a channel it is in based from the provided post id string. |
|
| @@ 118-127 (lines=10) @@ | ||
| 115 | * |
|
| 116 | * @return Status|ResponseInterface |
|
| 117 | */ |
|
| 118 | public function unpinPost($postId) |
|
| 119 | { |
|
| 120 | if (empty($postId)) { |
|
| 121 | throw new InvalidArgumentException('PostId can not be empty'); |
|
| 122 | } |
|
| 123 | ||
| 124 | $response = $this->httpPost(sprintf('/posts/%s/unpin', $postId)); |
|
| 125 | ||
| 126 | return $this->handleResponse($response, Status::class); |
|
| 127 | } |
|
| 128 | ||
| 129 | /** |
|
| 130 | * Soft deletes a post, by marking the post as deleted in the database. Soft deleted posts will not be returned in post queries. |
|