@@ -915,20 +915,6 @@ class GroupNotificationSettingsManager(BaseManager):
915915 obj_cls = GroupNotificationSettings
916916
917917
918- class GroupProject (GitlabObject ):
919- _url = '/groups/%(group_id)s/projects'
920- canGet = 'from_list'
921- canCreate = False
922- canDelete = False
923- canUpdate = False
924- optionalListAttrs = ['archived' , 'visibility' , 'order_by' , 'sort' ,
925- 'search' , 'ci_enabled_first' ]
926-
927-
928- class GroupProjectManager (BaseManager ):
929- obj_cls = GroupProject
930-
931-
932918class GroupAccessRequest (GitlabObject ):
933919 _url = '/groups/%(group_id)s/access_requests'
934920 canGet = 'from_list'
@@ -957,64 +943,6 @@ class GroupAccessRequestManager(BaseManager):
957943 obj_cls = GroupAccessRequest
958944
959945
960- class Group (GitlabObject ):
961- _url = '/groups'
962- requiredCreateAttrs = ['name' , 'path' ]
963- optionalCreateAttrs = ['description' , 'visibility_level' ]
964- optionalUpdateAttrs = ['name' , 'path' , 'description' , 'visibility_level' ]
965- shortPrintAttr = 'name'
966- managers = (
967- ('accessrequests' , GroupAccessRequestManager , [('group_id' , 'id' )]),
968- ('members' , GroupMemberManager , [('group_id' , 'id' )]),
969- ('notificationsettings' , GroupNotificationSettingsManager ,
970- [('group_id' , 'id' )]),
971- ('projects' , GroupProjectManager , [('group_id' , 'id' )]),
972- ('issues' , GroupIssueManager , [('group_id' , 'id' )]),
973- )
974-
975- GUEST_ACCESS = gitlab .GUEST_ACCESS
976- REPORTER_ACCESS = gitlab .REPORTER_ACCESS
977- DEVELOPER_ACCESS = gitlab .DEVELOPER_ACCESS
978- MASTER_ACCESS = gitlab .MASTER_ACCESS
979- OWNER_ACCESS = gitlab .OWNER_ACCESS
980-
981- VISIBILITY_PRIVATE = gitlab .VISIBILITY_PRIVATE
982- VISIBILITY_INTERNAL = gitlab .VISIBILITY_INTERNAL
983- VISIBILITY_PUBLIC = gitlab .VISIBILITY_PUBLIC
984-
985- def transfer_project (self , id , ** kwargs ):
986- """Transfers a project to this new groups.
987-
988- Attrs:
989- id (int): ID of the project to transfer.
990-
991- Raises:
992- GitlabConnectionError: If the server cannot be reached.
993- GitlabTransferProjectError: If the server fails to perform the
994- request.
995- """
996- url = '/groups/%d/projects/%d' % (self .id , id )
997- r = self .gitlab ._raw_post (url , None , ** kwargs )
998- raise_error_from_response (r , GitlabTransferProjectError , 201 )
999-
1000-
1001- class GroupManager (BaseManager ):
1002- obj_cls = Group
1003-
1004- def search (self , query , ** kwargs ):
1005- """Searches groups by name.
1006-
1007- Args:
1008- query (str): The search string
1009- all (bool): If True, return all the items, without pagination
1010-
1011- Returns:
1012- list(Group): a list of matching groups.
1013- """
1014- url = '/groups?search=' + query
1015- return self .gitlab ._raw_list (url , self .obj_cls , ** kwargs )
1016-
1017-
1018946class Hook (GitlabObject ):
1019947 _url = '/hooks'
1020948 canUpdate = False
@@ -2703,6 +2631,81 @@ def starred(self, **kwargs):
27032631 return self .gitlab ._raw_list ("/projects/starred" , Project , ** kwargs )
27042632
27052633
2634+ class GroupProject (Project ):
2635+ _url = '/groups/%(group_id)s/projects'
2636+ canGet = 'from_list'
2637+ canCreate = False
2638+ canDelete = False
2639+ canUpdate = False
2640+ optionalListAttrs = ['archived' , 'visibility' , 'order_by' , 'sort' ,
2641+ 'search' , 'ci_enabled_first' ]
2642+
2643+ def __init__ (self , * args , ** kwargs ):
2644+ Project .__init__ (self , * args , ** kwargs )
2645+
2646+
2647+ class GroupProjectManager (BaseManager ):
2648+ obj_cls = GroupProject
2649+
2650+
2651+ class Group (GitlabObject ):
2652+ _url = '/groups'
2653+ requiredCreateAttrs = ['name' , 'path' ]
2654+ optionalCreateAttrs = ['description' , 'visibility_level' ]
2655+ optionalUpdateAttrs = ['name' , 'path' , 'description' , 'visibility_level' ]
2656+ shortPrintAttr = 'name'
2657+ managers = (
2658+ ('accessrequests' , GroupAccessRequestManager , [('group_id' , 'id' )]),
2659+ ('members' , GroupMemberManager , [('group_id' , 'id' )]),
2660+ ('notificationsettings' , GroupNotificationSettingsManager ,
2661+ [('group_id' , 'id' )]),
2662+ ('projects' , GroupProjectManager , [('group_id' , 'id' )]),
2663+ ('issues' , GroupIssueManager , [('group_id' , 'id' )]),
2664+ )
2665+
2666+ GUEST_ACCESS = gitlab .GUEST_ACCESS
2667+ REPORTER_ACCESS = gitlab .REPORTER_ACCESS
2668+ DEVELOPER_ACCESS = gitlab .DEVELOPER_ACCESS
2669+ MASTER_ACCESS = gitlab .MASTER_ACCESS
2670+ OWNER_ACCESS = gitlab .OWNER_ACCESS
2671+
2672+ VISIBILITY_PRIVATE = gitlab .VISIBILITY_PRIVATE
2673+ VISIBILITY_INTERNAL = gitlab .VISIBILITY_INTERNAL
2674+ VISIBILITY_PUBLIC = gitlab .VISIBILITY_PUBLIC
2675+
2676+ def transfer_project (self , id , ** kwargs ):
2677+ """Transfers a project to this new groups.
2678+
2679+ Attrs:
2680+ id (int): ID of the project to transfer.
2681+
2682+ Raises:
2683+ GitlabConnectionError: If the server cannot be reached.
2684+ GitlabTransferProjectError: If the server fails to perform the
2685+ request.
2686+ """
2687+ url = '/groups/%d/projects/%d' % (self .id , id )
2688+ r = self .gitlab ._raw_post (url , None , ** kwargs )
2689+ raise_error_from_response (r , GitlabTransferProjectError , 201 )
2690+
2691+
2692+ class GroupManager (BaseManager ):
2693+ obj_cls = Group
2694+
2695+ def search (self , query , ** kwargs ):
2696+ """Searches groups by name.
2697+
2698+ Args:
2699+ query (str): The search string
2700+ all (bool): If True, return all the items, without pagination
2701+
2702+ Returns:
2703+ list(Group): a list of matching groups.
2704+ """
2705+ url = '/groups?search=' + query
2706+ return self .gitlab ._raw_list (url , self .obj_cls , ** kwargs )
2707+
2708+
27062709class TeamMemberManager (BaseManager ):
27072710 obj_cls = TeamMember
27082711
0 commit comments