Skip to content

Commit 7453895

Browse files
author
Gauvain Pocentek
committed
SnippetManager: all() -> public()
Rename the method to make what it does more explicit.
1 parent bd7d2f6 commit 7453895

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

docs/gl_objects/snippets.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
snippets = gl.snippets.list()
33
# end list
44

5+
# public list
6+
public_snippets = gl.snippets.public()
7+
# nd public list
8+
59
# get
610
snippet = gl.snippets.get(snippet_id)
711
# get the content

docs/gl_objects/snippets.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ You can store code snippets in Gitlab. Snippets can be attached to projects
1111
Examples
1212
========
1313

14-
List snippets:
14+
List snippets woned by the current user:
1515

1616
.. literalinclude:: snippets.py
1717
:start-after: # list
1818
:end-before: # end list
1919

20+
List the public snippets:
21+
22+
.. literalinclude:: snippets.py
23+
:start-after: # public list
24+
:end-before: # end public list
25+
2026
Get a snippet:
2127

2228
.. literalinclude:: snippets.py

gitlab/objects.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,8 +1054,8 @@ def content(self, streamed=False, action=None, chunk_size=1024, **kwargs):
10541054
class SnippetManager(BaseManager):
10551055
obj_cls = Snippet
10561056

1057-
def all(self, **kwargs):
1058-
"""List all the snippets
1057+
def public(self, **kwargs):
1058+
"""List all the public snippets.
10591059
10601060
Args:
10611061
all (bool): If True, return all the items, without pagination
@@ -1066,18 +1066,6 @@ def all(self, **kwargs):
10661066
"""
10671067
return self.gitlab._raw_list("/snippets/public", Snippet, **kwargs)
10681068

1069-
def owned(self, **kwargs):
1070-
"""List owned snippets.
1071-
1072-
Args:
1073-
all (bool): If True, return all the items, without pagination
1074-
**kwargs: Additional arguments to send to GitLab.
1075-
1076-
Returns:
1077-
list(gitlab.Gitlab.Snippet): The list of owned snippets.
1078-
"""
1079-
return self.gitlab._raw_list("/snippets", Snippet, **kwargs)
1080-
10811069

10821070
class Namespace(GitlabObject):
10831071
_url = '/namespaces'

0 commit comments

Comments
 (0)