diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2021-12-01 01:04:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-01 01:04:53 +0100 |
commit | 8d76826fa64460e504acc5924f859f8dbc246b42 (patch) | |
tree | 083fefada982c795e2415092794db429abb0c184 /docs/gl_objects/snippets.rst | |
parent | 5a1678f43184bd459132102cc13cf8426fe0449d (diff) | |
parent | 86ab04e54ea4175f10053decfad5086cda7aa024 (diff) | |
download | gitlab-master.tar.gz |
Merge pull request #1723 from python-gitlab/jlvillal/dead_mastermaster
Close-out `master` branch
Diffstat (limited to 'docs/gl_objects/snippets.rst')
-rw-r--r-- | docs/gl_objects/snippets.rst | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/docs/gl_objects/snippets.rst b/docs/gl_objects/snippets.rst deleted file mode 100644 index 1bedb07..0000000 --- a/docs/gl_objects/snippets.rst +++ /dev/null @@ -1,66 +0,0 @@ -######## -Snippets -######## - -Reference -========= - -* v4 API: - - + :class:`gitlab.v4.objects.Snippet` - + :class:`gitlab.v4.objects.SnipptManager` - + :attr:`gitlab.Gitlab.snippets` - -* GitLab API: https://docs.gitlab.com/ce/api/snippets.html - -Examples -======== - -List snippets owned by the current user:: - - snippets = gl.snippets.list() - -List the public snippets:: - - public_snippets = gl.snippets.public() - -Get a snippet:: - - snippet = gl.snippets.get(snippet_id) - # get the content - content = snippet.content() - -.. warning:: - - Blobs are entirely stored in memory unless you use the streaming feature. - See :ref:`the artifacts example <streaming_example>`. - - -Create a snippet:: - - snippet = gl.snippets.create({'title': 'snippet1', - 'file_name': 'snippet1.py', - 'content': open('snippet1.py').read()}) - -Update the snippet attributes:: - - snippet.visibility_level = gitlab.VISIBILITY_PUBLIC - snippet.save() - -To update a snippet code you need to create a ``ProjectSnippet`` object:: - - snippet = gl.snippets.get(snippet_id) - project = gl.projects.get(snippet.projec_id, lazy=True) - editable_snippet = project.snippets.get(snippet.id) - editable_snippet.code = new_snippet_content - editable_snippet.save() - -Delete a snippet:: - - gl.snippets.delete(snippet_id) - # or - snippet.delete() - -Get user agent detail (admin only):: - - detail = snippet.user_agent_detail() |