@@ -29,13 +29,6 @@ use BuildQuery;
2929
3030// FIXME: Use a type for the project id.
3131
32- #[ derive( Debug , Copy , Clone ) ]
33- pub enum ListingVisibility {
34- Public ,
35- Internal ,
36- Private ,
37- }
38-
3932
4033#[ derive( Debug , Copy , Clone ) ]
4134pub enum ListingOrderBy {
@@ -48,25 +41,18 @@ pub enum ListingOrderBy {
4841}
4942
5043
51- #[ derive( Debug , Copy , Clone ) ]
52- pub enum ListingSort {
53- Asc ,
54- Desc ,
55- }
56-
57-
5844#[ derive( Default , Debug , Clone ) ]
5945pub struct Listing {
6046 /// Group Id.
6147 id : i64 ,
6248 /// Limit by archived status.
6349 archived : Option < bool > ,
6450 /// Limit by visibility
65- visibility : Option < ListingVisibility > ,
51+ visibility : Option < :: ListingVisibility > ,
6652 /// Return requests ordered by. Default is `ListingOrderBy::CreatedAt`.
6753 order_by : Option < ListingOrderBy > ,
68- /// Return requests sorted. Default is `ListingSort::Desc`.
69- sort : Option < ListingSort > ,
54+ /// Return requests sorted. Default is `:: ListingSort::Desc`.
55+ sort : Option < :: ListingSort > ,
7056 /// Return list of authorized projects according to a search criteria.
7157 search : String ,
7258 /// Return projects ordered by `ci_enabled` flag. Projects with enabled GitLab CI go first.
@@ -82,15 +68,15 @@ impl Listing {
8268 self . archived = Some ( archived) ;
8369 self
8470 }
85- pub fn visibility ( & mut self , visibility : ListingVisibility ) -> & mut Listing {
71+ pub fn visibility ( & mut self , visibility : :: ListingVisibility ) -> & mut Listing {
8672 self . visibility = Some ( visibility) ;
8773 self
8874 }
8975 pub fn order_by ( & mut self , order_by : ListingOrderBy ) -> & mut Listing {
9076 self . order_by = Some ( order_by) ;
9177 self
9278 }
93- pub fn sort ( & mut self , sort : ListingSort ) -> & mut Listing {
79+ pub fn sort ( & mut self , sort : :: ListingSort ) -> & mut Listing {
9480 self . sort = Some ( sort) ;
9581 self
9682 }
@@ -141,9 +127,9 @@ impl BuildQuery for Listing {
141127
142128 query. push_str ( "visibility=" ) ;
143129 query. push_str ( match visibility {
144- ListingVisibility :: Public => "public" ,
145- ListingVisibility :: Internal => "internal" ,
146- ListingVisibility :: Private => "private" ,
130+ :: ListingVisibility :: Public => "public" ,
131+ :: ListingVisibility :: Internal => "internal" ,
132+ :: ListingVisibility :: Private => "private" ,
147133 } ) ;
148134 } ) ;
149135
@@ -168,8 +154,8 @@ impl BuildQuery for Listing {
168154
169155 query. push_str ( "sort=" ) ;
170156 query. push_str ( match sort {
171- ListingSort :: Asc => "asc" ,
172- ListingSort :: Desc => "desc" ,
157+ :: ListingSort :: Asc => "asc" ,
158+ :: ListingSort :: Desc => "desc" ,
173159 } ) ;
174160 } ) ;
175161
@@ -232,19 +218,19 @@ mod tests {
232218 fn groups_build_query_visibility ( ) {
233219 let expected_string = format ! ( "groups/{}/projects?visibility=public" , TEST_PROJECT_ID ) ;
234220 let query = Listing :: new ( TEST_PROJECT_ID . clone ( ) )
235- . visibility ( ListingVisibility :: Public )
221+ . visibility ( :: ListingVisibility :: Public )
236222 . build_query ( ) ;
237223 assert_eq ! ( query, expected_string) ;
238224
239225 let expected_string = format ! ( "groups/{}/projects?visibility=internal" , TEST_PROJECT_ID ) ;
240226 let query = Listing :: new ( TEST_PROJECT_ID . clone ( ) )
241- . visibility ( ListingVisibility :: Internal )
227+ . visibility ( :: ListingVisibility :: Internal )
242228 . build_query ( ) ;
243229 assert_eq ! ( query, expected_string) ;
244230
245231 let expected_string = format ! ( "groups/{}/projects?visibility=private" , TEST_PROJECT_ID ) ;
246232 let query = Listing :: new ( TEST_PROJECT_ID . clone ( ) )
247- . visibility ( ListingVisibility :: Private )
233+ . visibility ( :: ListingVisibility :: Private )
248234 . build_query ( ) ;
249235 assert_eq ! ( query, expected_string) ;
250236 }
@@ -289,11 +275,11 @@ mod tests {
289275 #[ test]
290276 fn groups_build_query_sort ( ) {
291277 let expected_string = format ! ( "groups/{}/projects?sort=asc" , TEST_PROJECT_ID ) ;
292- let query = Listing :: new ( TEST_PROJECT_ID . clone ( ) ) . sort ( ListingSort :: Asc ) . build_query ( ) ;
278+ let query = Listing :: new ( TEST_PROJECT_ID . clone ( ) ) . sort ( :: ListingSort :: Asc ) . build_query ( ) ;
293279 assert_eq ! ( query, expected_string) ;
294280
295281 let expected_string = format ! ( "groups/{}/projects?sort=desc" , TEST_PROJECT_ID ) ;
296- let query = Listing :: new ( TEST_PROJECT_ID . clone ( ) ) . sort ( ListingSort :: Desc ) . build_query ( ) ;
282+ let query = Listing :: new ( TEST_PROJECT_ID . clone ( ) ) . sort ( :: ListingSort :: Desc ) . build_query ( ) ;
297283 assert_eq ! ( query, expected_string) ;
298284 }
299285
0 commit comments