@@ 94-112 (lines=19) @@ | ||
91 | * |
|
92 | * @return array |
|
93 | */ |
|
94 | public function invite($id, $email, $fullName, $role = 'normal') |
|
95 | { |
|
96 | $roles = array('normal', 'observer', 'admin'); |
|
97 | ||
98 | if (!in_array($role, $roles)) { |
|
99 | throw new InvalidArgumentException(sprintf( |
|
100 | 'The "role" parameter must be one of "%s".', |
|
101 | implode(", ", $roles) |
|
102 | )); |
|
103 | } |
|
104 | ||
105 | $params = array( |
|
106 | 'email' => $email, |
|
107 | 'fullName' => $fullName, |
|
108 | 'type' => $role, |
|
109 | ); |
|
110 | ||
111 | return $this->put($this->getPath($id), $params); |
|
112 | } |
|
113 | ||
114 | /** |
|
115 | * Get members invited to a given board |
|
@@ 153-170 (lines=18) @@ | ||
150 | * |
|
151 | * @return array |
|
152 | */ |
|
153 | public function setRole($id, $memberOrOrganization, $role) |
|
154 | { |
|
155 | $roles = array('normal', 'observer', 'admin'); |
|
156 | ||
157 | if (!in_array($role, $roles)) { |
|
158 | throw new InvalidArgumentException(sprintf( |
|
159 | 'The "role" parameter must be one of "%s".', |
|
160 | implode(", ", $roles) |
|
161 | )); |
|
162 | } |
|
163 | ||
164 | $params = array( |
|
165 | 'idMember' => $memberOrOrganization, |
|
166 | 'type' => $role, |
|
167 | ); |
|
168 | ||
169 | return $this->post($this->getPath($id).'/'.rawurlencode($memberOrOrganization), $params); |
|
170 | } |
|
171 | } |
|
172 |