| @@ 113-131 (lines=19) @@ | ||
| 110 | * |
|
| 111 | * @return array |
|
| 112 | */ |
|
| 113 | public function invite($id, $email, $fullName, $role = 'normal') |
|
| 114 | { |
|
| 115 | $roles = array('normal', 'observer', 'admin'); |
|
| 116 | ||
| 117 | if (!in_array($role, $roles)) { |
|
| 118 | throw new InvalidArgumentException(sprintf( |
|
| 119 | 'The "role" parameter must be one of "%s".', |
|
| 120 | implode(", ", $roles) |
|
| 121 | )); |
|
| 122 | } |
|
| 123 | ||
| 124 | $params = array( |
|
| 125 | 'email' => $email, |
|
| 126 | 'fullName' => $fullName, |
|
| 127 | 'type' => $role, |
|
| 128 | ); |
|
| 129 | ||
| 130 | return $this->put($this->getPath($id), $params); |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * Get members invited to a given board |
|
| @@ 172-189 (lines=18) @@ | ||
| 169 | * |
|
| 170 | * @return array |
|
| 171 | */ |
|
| 172 | public function setRole($id, $memberOrOrganization, $role) |
|
| 173 | { |
|
| 174 | $roles = array('normal', 'observer', 'admin'); |
|
| 175 | ||
| 176 | if (!in_array($role, $roles)) { |
|
| 177 | throw new InvalidArgumentException(sprintf( |
|
| 178 | 'The "role" parameter must be one of "%s".', |
|
| 179 | implode(", ", $roles) |
|
| 180 | )); |
|
| 181 | } |
|
| 182 | ||
| 183 | $params = array( |
|
| 184 | 'idMember' => $memberOrOrganization, |
|
| 185 | 'type' => $role, |
|
| 186 | ); |
|
| 187 | ||
| 188 | return $this->post($this->getPath($id).'/'.rawurlencode($memberOrOrganization), $params); |
|
| 189 | } |
|
| 190 | } |
|
| 191 | ||