diff options
-rw-r--r-- | docs/gl_objects/snippets.py | 4 | ||||
-rw-r--r-- | docs/gl_objects/snippets.rst | 8 | ||||
-rw-r--r-- | gitlab/objects.py | 16 |
3 files changed, 13 insertions, 15 deletions
diff --git a/docs/gl_objects/snippets.py b/docs/gl_objects/snippets.py index ca316c2..e865b0a 100644 --- a/docs/gl_objects/snippets.py +++ b/docs/gl_objects/snippets.py @@ -2,6 +2,10 @@ snippets = gl.snippets.list() # end list +# public list +public_snippets = gl.snippets.public() +# nd public list + # get snippet = gl.snippets.get(snippet_id) # get the content diff --git a/docs/gl_objects/snippets.rst b/docs/gl_objects/snippets.rst index 591bc95..34c39fb 100644 --- a/docs/gl_objects/snippets.rst +++ b/docs/gl_objects/snippets.rst @@ -11,12 +11,18 @@ You can store code snippets in Gitlab. Snippets can be attached to projects Examples ======== -List snippets: +List snippets woned by the current user: .. literalinclude:: snippets.py :start-after: # list :end-before: # end list +List the public snippets: + +.. literalinclude:: snippets.py + :start-after: # public list + :end-before: # end public list + Get a snippet: .. literalinclude:: snippets.py diff --git a/gitlab/objects.py b/gitlab/objects.py index dcf5d5c..97a2165 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -1054,8 +1054,8 @@ class Snippet(GitlabObject): class SnippetManager(BaseManager): obj_cls = Snippet - def all(self, **kwargs): - """List all the snippets + def public(self, **kwargs): + """List all the public snippets. Args: all (bool): If True, return all the items, without pagination @@ -1066,18 +1066,6 @@ class SnippetManager(BaseManager): """ return self.gitlab._raw_list("/snippets/public", Snippet, **kwargs) - def owned(self, **kwargs): - """List owned snippets. - - Args: - all (bool): If True, return all the items, without pagination - **kwargs: Additional arguments to send to GitLab. - - Returns: - list(gitlab.Gitlab.Snippet): The list of owned snippets. - """ - return self.gitlab._raw_list("/snippets", Snippet, **kwargs) - class Namespace(GitlabObject): _url = '/namespaces' |