@@ -148,44 +148,45 @@ public function unarchive($project_id){
148148 }
149149
150150 /**
151- * @param int $project_id
152- * @param array $scope
153- * @return mixed
154- */
155- public function builds ($ project_id , $ scope = null )
156- {
157- return $ this ->get ($ this ->getProjectPath ($ project_id , 'builds ' ), array (
158- 'scope ' => $ scope
159- ));
160- }
161-
162- /**
163- * @param int $project_id
164- * @param int $build_id
151+ * @param int $project_id
152+ * @param array $parameters (
153+ *
154+ * @var string $scope The scope of pipelines, one of: running, pending, finished, branches, tags.
155+ * @var string $status The status of pipelines, one of: running, pending, success, failed, canceled, skipped.
156+ * @var string $ref The ref of pipelines.
157+ * @var bool $yaml_errors Returns pipelines with invalid configurations.
158+ * @var string $name The name of the user who triggered pipelines.
159+ * @var string $username The username of the user who triggered pipelines.
160+ * @var string $order_by Order pipelines by id, status, ref, or user_id (default: id).
161+ * @var string $order Sort pipelines in asc or desc order (default: desc).
162+ * )
165163 * @return mixed
166164 */
167- public function build ($ project_id , $ build_id )
165+ public function pipelines ($ project_id , array $ parameters = [] )
168166 {
169- return $ this ->get ($ this ->getProjectPath ($ project_id , 'builds/ ' .$ this ->encodePath ($ build_id )));
170- }
167+ $ resolver = $ this ->createOptionsResolver ();
168+ $ booleanNormalizer = function ($ value ) {
169+ return $ value ? 'true ' : 'false ' ;
170+ };
171171
172- /**
173- * @param int $project_id
174- * @param int $build_id
175- * @return mixed
176- */
177- public function trace ($ project_id , $ build_id )
178- {
179- return $ this ->get ($ this ->getProjectPath ($ project_id , 'builds/ ' .$ this ->encodePath ($ build_id ).'/trace ' ));
180- }
172+ $ resolver ->setDefined ('scope ' )
173+ ->setAllowedValues ('scope ' , ['running ' , 'pending ' , 'finished ' , 'branches ' , 'tags ' ])
174+ ;
175+ $ resolver ->setDefined ('status ' )
176+ ->setAllowedValues ('status ' , ['running ' , 'pending ' , 'success ' , 'failed ' , 'canceled ' , 'skipped ' ])
177+ ;
178+ $ resolver ->setDefined ('ref ' );
179+ $ resolver ->setDefined ('yaml_errors ' )
180+ ->setAllowedTypes ('yaml_errors ' , 'bool ' )
181+ ->setNormalizer ('yaml_errors ' , $ booleanNormalizer )
182+ ;
183+ $ resolver ->setDefined ('name ' );
184+ $ resolver ->setDefined ('username ' );
185+ $ resolver ->setDefined ('order_by ' )
186+ ->setAllowedValues ('order_by ' , ['id ' , 'status ' , 'ref ' , 'user_id ' ])
187+ ;
181188
182- /**
183- * @param int $project_id
184- * @return mixed
185- */
186- public function pipelines ($ project_id )
187- {
188- return $ this ->get ($ this ->getProjectPath ($ project_id , 'pipelines ' ));
189+ return $ this ->get ($ this ->getProjectPath ($ project_id , 'pipelines ' ), $ resolver ->resolve ($ parameters ));
189190 }
190191
191192 /**
0 commit comments