| @@ 120-135 (lines=16) @@ | ||
| 117 | * |
|
| 118 | * @return TeamMember|ResponseInterface |
|
| 119 | */ |
|
| 120 | public function addTeamMember($teamId, $userId, $roles = '', $pathParams = []) |
|
| 121 | { |
|
| 122 | if (empty($teamId) || empty($userId)) { |
|
| 123 | throw new InvalidArgumentException('Team ID or user ID can not be empty'); |
|
| 124 | } |
|
| 125 | ||
| 126 | $body = [ |
|
| 127 | 'team_id' => $teamId, |
|
| 128 | 'user_id' => $userId, |
|
| 129 | 'roles' => $roles, |
|
| 130 | ]; |
|
| 131 | ||
| 132 | $response = $this->httpPost(sprintf('/teams/%s/members', $teamId), $body, $pathParams); |
|
| 133 | ||
| 134 | return $this->handleResponse($response, TeamMember::class); |
|
| 135 | } |
|
| 136 | ||
| 137 | /** |
|
| 138 | * Return the team members. |
|
| @@ 197-212 (lines=16) @@ | ||
| 194 | * |
|
| 195 | * @return ChannelMember|ResponseInterface |
|
| 196 | */ |
|
| 197 | public function addChannelMember(string $channelId, string $userId, string $roles = '') |
|
| 198 | { |
|
| 199 | if (empty($channelId) || empty($userId)) { |
|
| 200 | throw new InvalidArgumentException('Channel ID or user ID can not be empty'); |
|
| 201 | } |
|
| 202 | ||
| 203 | $body = [ |
|
| 204 | 'channel_id' => $channelId, |
|
| 205 | 'user_id' => $userId, |
|
| 206 | 'roles' => $roles, |
|
| 207 | ]; |
|
| 208 | ||
| 209 | $response = $this->httpPost(sprintf('/channels/%s/members', $channelId), $body); |
|
| 210 | ||
| 211 | return $this->handleResponse($response, ChannelMember::class); |
|
| 212 | } |
|
| 213 | ||
| 214 | /** |
|
| 215 | * Remove a user from a channel. |
|