@@ 503-517 (lines=15) @@ | ||
500 | * |
|
501 | * @throws HttpException Subscribing a user failed; access the exception for more information. |
|
502 | */ |
|
503 | public function addSubscriber ($user_id, $as_admin = null) |
|
504 | { |
|
505 | if ($user_id instanceof PulseUser) |
|
506 | { |
|
507 | $user_id = $user_id->getId(); |
|
508 | } |
|
509 | ||
510 | $url = sprintf("%s/%d/subscribers.json", parent::apiEndpoint(), $this->getId()); |
|
511 | $params = array( |
|
512 | "user_id" => $user_id |
|
513 | ); |
|
514 | ||
515 | parent::setIfNotNullOrEmpty($params, "as_admin", $as_admin); |
|
516 | parent::sendPut($url, $params); |
|
517 | } |
|
518 | ||
519 | /** |
|
520 | * Access a pulse's subscribers |
@@ 222-236 (lines=15) @@ | ||
219 | * @param int|PulseUser $user_id The user that will be subscribed to the board |
|
220 | * @param bool|null $as_admin Set to true if the user will be an admin of the board |
|
221 | */ |
|
222 | public function addSubscriber ($user_id, $as_admin = NULL) |
|
223 | { |
|
224 | if ($user_id instanceof PulseUser) |
|
225 | { |
|
226 | $user_id = $user_id->getId(); |
|
227 | } |
|
228 | ||
229 | $url = sprintf("%s/%d/subscribers.json", parent::apiEndpoint(), $this->getId()); |
|
230 | $params = array( |
|
231 | "user_id" => $user_id |
|
232 | ); |
|
233 | ||
234 | parent::setIfNotNullOrEmpty($params, "as_admin", $as_admin); |
|
235 | parent::sendPut($url, $params); |
|
236 | } |
|
237 | ||
238 | /** |
|
239 | * Unsubscribe a user from this board |