summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects.py
diff options
context:
space:
mode:
authorDavid Guest <owmtia@gmail.com>2018-07-26 15:18:38 +1000
committerGauvain Pocentek <gauvain@pocentek.net>2018-07-26 07:18:38 +0200
commitb325bd73400e3806e6ede59cc10011fbf138b877 (patch)
tree82cc2d5dba5954df5dedfe9bdbc53c2c47ad6eaa /gitlab/v4/objects.py
parent35c8c8298392188c51e5956dd2eb90bb3d81a301 (diff)
downloadgitlab-b325bd73400e3806e6ede59cc10011fbf138b877.tar.gz
Added support for listing forks of a project (#562)
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r--gitlab/v4/objects.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index 508ca7c..7438655 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -1645,7 +1645,7 @@ class ProjectFork(RESTObject):
pass
-class ProjectForkManager(CreateMixin, RESTManager):
+class ProjectForkManager(CreateMixin, ListMixin, RESTManager):
_path = '/projects/%(project_id)s/fork'
_obj_cls = ProjectFork
_from_parent_attrs = {'project_id': 'id'}
@@ -1655,6 +1655,28 @@ class ProjectForkManager(CreateMixin, RESTManager):
'with_merge_requests_enabled')
_create_attrs = (tuple(), ('namespace', ))
+ def list(self, **kwargs):
+ """Retrieve a list of objects.
+
+ Args:
+ all (bool): If True, return all the items, without pagination
+ per_page (int): Number of items to retrieve per request
+ page (int): ID of the page to return (starts with page 1)
+ as_list (bool): If set to False and no pagination option is
+ defined, return a generator instead of a list
+ **kwargs: Extra options to send to the server (e.g. sudo)
+
+ Returns:
+ list: The list of objects, or a generator if `as_list` is False
+
+ Raises:
+ GitlabAuthenticationError: If authentication is not correct
+ GitlabListError: If the server cannot perform the request
+ """
+
+ path = self._compute_path('/projects/%(project_id)s/forks')
+ return ListMixin.list(self, path=path, **kwargs)
+
class ProjectHook(SaveMixin, ObjectDeleteMixin, RESTObject):
_short_print_attr = 'url'