@@ -19,7 +19,7 @@ public PipelineClient(API api, ProjectId projectId)
1919 {
2020 _api = api ;
2121 _projectPath = $ "{ Project . Url } /{ projectId . ValueAsUriParameter ( ) } ";
22- _pipelinesPath = $ " { _projectPath } /pipelines" ;
22+ _pipelinesPath = _projectPath + PipelineBasic . Url ;
2323 }
2424
2525 public IEnumerable < PipelineBasic > All => _api . Get ( ) . GetAll < PipelineBasic > ( _pipelinesPath ) ;
@@ -134,34 +134,24 @@ private string CreateSearchUrl(PipelineQuery query)
134134 if ( query == null )
135135 throw new ArgumentNullException ( nameof ( query ) ) ;
136136
137- var queryEntries = new Dictionary < string , string > ( StringComparer . Ordinal ) ;
138- if ( query . Scope . HasValue )
139- queryEntries . Add ( "scope" , query . Scope . Value . ToString ( ) ) ;
137+ var url = _pipelinesPath ;
138+ url = Utils . AddParameter ( url , "scope" , query . Scope ) ;
140139 if ( query . Status . HasValue )
141- queryEntries . Add ( "status" , query . Status . Value . ToString ( ) . ToLowerInvariant ( ) ) ;
142- if ( ! string . IsNullOrWhiteSpace ( query . Ref ) )
143- queryEntries . Add ( "ref" , query . Ref ) ;
144- if ( ! string . IsNullOrWhiteSpace ( query . Sha ) )
145- queryEntries . Add ( "sha" , query . Sha ) ;
146- if ( query . YamlErrors . HasValue )
147- queryEntries . Add ( "yaml_errors" , query . YamlErrors . Value . ToString ( ) ) ;
148- if ( ! string . IsNullOrWhiteSpace ( query . Name ) )
149- queryEntries . Add ( "name" , query . Name ) ;
150- if ( ! string . IsNullOrWhiteSpace ( query . Username ) )
151- queryEntries . Add ( "username" , query . Username ) ;
152- if ( query . UpdatedAfter . HasValue )
153- queryEntries . Add ( "updated_after" , query . UpdatedAfter . Value . ToString ( "O" ) ) ;
154- if ( query . UpdatedBefore . HasValue )
155- queryEntries . Add ( "updated_before" , query . UpdatedBefore . Value . ToString ( "O" ) ) ;
156- if ( query . OrderBy . HasValue )
157- queryEntries . Add ( "order_by" , query . OrderBy . Value . ToString ( ) ) ;
158- if ( query . Sort . HasValue )
159- queryEntries . Add ( "sort" , query . Sort . Value . ToString ( ) ) ;
160- if ( query . PerPage . HasValue )
161- queryEntries . Add ( "per_page" , query . PerPage . Value . ToString ( ) ) ;
162-
163- var stringQuery = string . Join ( "&" , queryEntries . Select ( kp => $ "{ kp . Key } ={ kp . Value } ") ) ;
164- var url = $ "{ _projectPath } /pipelines{ ( queryEntries . Count != 0 ? $ "?{ stringQuery } " : string . Empty ) } ";
140+ {
141+ url = Utils . AddParameter ( url , "status" , query . Status . Value . ToString ( ) . ToLowerInvariant ( ) ) ;
142+ }
143+
144+ url = Utils . AddParameter ( url , "ref" , query . Ref ) ;
145+ url = Utils . AddParameter ( url , "sha" , query . Sha ) ;
146+ url = Utils . AddParameter ( url , "yaml_errors" , query . YamlErrors ) ;
147+ url = Utils . AddParameter ( url , "name" , query . Name ) ;
148+ url = Utils . AddParameter ( url , "username" , query . Username ) ;
149+ url = Utils . AddParameter ( url , "updated_after" , query . UpdatedAfter ) ;
150+ url = Utils . AddParameter ( url , "updated_before" , query . UpdatedBefore ) ;
151+ url = Utils . AddParameter ( url , "order_by" , query . OrderBy ) ;
152+ url = Utils . AddParameter ( url , "sort" , query . Sort ) ;
153+ url = Utils . AddParameter ( url , "per_page" , query . PerPage ) ;
154+ url = Utils . AddParameter ( url , "source" , query . Source ) ;
165155 return url ;
166156 }
167157
@@ -172,22 +162,22 @@ public void Delete(long pipelineId)
172162
173163 public IEnumerable < PipelineVariable > GetVariables ( long pipelineId )
174164 {
175- return _api . Get ( ) . GetAll < PipelineVariable > ( $ "{ _projectPath } /pipelines /{ pipelineId . ToStringInvariant ( ) } /variables") ;
165+ return _api . Get ( ) . GetAll < PipelineVariable > ( $ "{ _pipelinesPath } /{ pipelineId . ToStringInvariant ( ) } /variables") ;
176166 }
177167
178168 public GitLabCollectionResponse < PipelineVariable > GetVariablesAsync ( long pipelineId )
179169 {
180- return _api . Get ( ) . GetAllAsync < PipelineVariable > ( $ "{ _projectPath } /pipelines /{ pipelineId . ToStringInvariant ( ) } /variables") ;
170+ return _api . Get ( ) . GetAllAsync < PipelineVariable > ( $ "{ _pipelinesPath } /{ pipelineId . ToStringInvariant ( ) } /variables") ;
181171 }
182172
183173 public TestReport GetTestReports ( long pipelineId )
184174 {
185- return _api . Get ( ) . To < TestReport > ( $ "{ _projectPath } /pipelines /{ pipelineId . ToStringInvariant ( ) } /test_report") ;
175+ return _api . Get ( ) . To < TestReport > ( $ "{ _pipelinesPath } /{ pipelineId . ToStringInvariant ( ) } /test_report") ;
186176 }
187177
188178 public TestReportSummary GetTestReportsSummary ( long pipelineId )
189179 {
190- return _api . Get ( ) . To < TestReportSummary > ( $ "{ _projectPath } /pipelines /{ pipelineId . ToStringInvariant ( ) } /test_report_summary") ;
180+ return _api . Get ( ) . To < TestReportSummary > ( $ "{ _pipelinesPath } /{ pipelineId . ToStringInvariant ( ) } /test_report_summary") ;
191181 }
192182
193183 public GitLabCollectionResponse < Bridge > GetBridgesAsync ( PipelineBridgeQuery query )
0 commit comments