@@ -182,6 +182,7 @@ public function unarchive($project_id)
182182 * @var string $scope The scope of pipelines, one of: running, pending, finished, branches, tags.
183183 * @var string $status The status of pipelines, one of: running, pending, success, failed, canceled, skipped.
184184 * @var string $ref The ref of pipelines.
185+ * @var string $sha The sha of pipelines.
185186 * @var bool $yaml_errors Returns pipelines with invalid configurations.
186187 * @var string $name The name of the user who triggered pipelines.
187188 * @var string $username The username of the user who triggered pipelines.
@@ -204,6 +205,7 @@ public function pipelines($project_id, array $parameters = [])
204205 ->setAllowedValues ('status ' , ['running ' , 'pending ' , 'success ' , 'failed ' , 'canceled ' , 'skipped ' ])
205206 ;
206207 $ resolver ->setDefined ('ref ' );
208+ $ resolver ->setDefined ('sha ' );
207209 $ resolver ->setDefined ('yaml_errors ' )
208210 ->setAllowedTypes ('yaml_errors ' , 'bool ' )
209211 ->setNormalizer ('yaml_errors ' , $ booleanNormalizer )
@@ -233,12 +235,26 @@ public function pipeline($project_id, $pipeline_id)
233235 /**
234236 * @param int $project_id
235237 * @param string $commit_ref
238+ * @param array $variables (
239+ * @var array (
240+ * @var string $key The name of the variable
241+ * @var mixed $value The value of the variable
242+ * @var string $variable_type env_var (default) or file
243+ * )
244+ * )
236245 * @return mixed
237246 */
238- public function createPipeline ($ project_id , $ commit_ref )
247+ public function createPipeline ($ project_id , $ commit_ref, $ variables = null )
239248 {
240- return $ this ->post ($ this ->getProjectPath ($ project_id , 'pipeline ' ), array (
241- 'ref ' => $ commit_ref ));
249+ $ parameters = array (
250+ 'ref ' => $ commit_ref ,
251+ );
252+
253+ if ($ variables !== null ) {
254+ $ parameters ['variables ' ] = $ variables ;
255+ }
256+
257+ return $ this ->post ($ this ->getProjectPath ($ project_id , 'pipeline ' ), $ parameters );
242258 }
243259
244260 /**
@@ -260,7 +276,17 @@ public function cancelPipeline($project_id, $pipeline_id)
260276 {
261277 return $ this ->post ($ this ->getProjectPath ($ project_id , 'pipelines/ ' .$ this ->encodePath ($ pipeline_id )).'/cancel ' );
262278 }
263-
279+
280+ /**
281+ * @param $project_id
282+ * @param $pipeline_id
283+ * @return mixed
284+ */
285+ public function deletePipeline ($ project_id , $ pipeline_id )
286+ {
287+ return $ this ->delete ($ this ->getProjectPath ($ project_id , 'pipelines/ ' .$ this ->encodePath ($ pipeline_id )));
288+ }
289+
264290 /**
265291 * @param integer $project_id
266292 * @param array $parameters
@@ -374,6 +400,24 @@ public function hook($project_id, $hook_id)
374400 return $ this ->get ($ this ->getProjectPath ($ project_id , 'hooks/ ' .$ this ->encodePath ($ hook_id )));
375401 }
376402
403+ /**
404+ * Get project users.
405+ *
406+ * See https://docs.gitlab.com/ee/api/projects.html#get-project-users for more info.
407+ *
408+ * @param int $project_id
409+ * Project id.
410+ * @param array $parameters
411+ * Url parameters.
412+ *
413+ * @return array
414+ * List of project users.
415+ */
416+ public function users ($ project_id , array $ parameters = [])
417+ {
418+ return $ this ->get ($ this ->getProjectPath ($ project_id , 'users ' ), $ parameters );
419+ }
420+
377421 /**
378422 * Get project issues.
379423 *
@@ -816,7 +860,7 @@ public function addShare($project_id, array $parameters = [])
816860 */
817861 public function removeShare ($ project_id , $ group_id )
818862 {
819- return $ this ->delete ($ this ->getProjectPath ($ project_id , 'services/ ' . $ group_id ));
863+ return $ this ->delete ($ this ->getProjectPath ($ project_id , 'share/ ' . $ group_id ));
820864 }
821865
822866 /**
@@ -866,6 +910,17 @@ public function removeBadge($project_id, $badge_id)
866910 */
867911 public function updateBadge ($ project_id , $ badge_id , array $ params = array ())
868912 {
869- return $ this ->put ($ this ->getProjectPath ($ project_id , 'badges/ ' . $ this ->encodePath ($ badge_id )));
913+ return $ this ->put ($ this ->getProjectPath ($ project_id , 'badges/ ' . $ this ->encodePath ($ badge_id )), $ params );
914+ }
915+
916+
917+ /**
918+ * @param int $project_id
919+ * @param array $params
920+ * @return mixed
921+ */
922+ public function addProtectedBranch ($ project_id , array $ params = [])
923+ {
924+ return $ this ->post ($ this ->getProjectPath ($ project_id , 'protected_branches ' ), $ params );
870925 }
871926}
0 commit comments