File: draft_notes.rst

package info (click to toggle)
python-gitlab 1%3A8.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,884 kB
  • sloc: python: 25,823; makefile: 171; ruby: 27; javascript: 3
file content (58 lines) | stat: -rw-r--r-- 1,465 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.. _draft-notes:

###########
Draft Notes
###########

Draft notes are pending, unpublished comments on merge requests.
They can be either start a discussion, or be associated with an existing discussion as a reply.
They are viewable only by the author until they are published. 

Reference
---------

* v4 API:

  + :class:`gitlab.v4.objects.ProjectMergeRequestDraftNote`
  + :class:`gitlab.v4.objects.ProjectMergeRequestDraftNoteManager`
  + :attr:`gitlab.v4.objects.ProjectMergeRequest.draft_notes`


* GitLab API: https://docs.gitlab.com/api/draft_notes

Examples
--------

List all draft notes for a merge request::

    draft_notes = merge_request.draft_notes.list(get_all=True)

Get a draft note for a merge request by ID::

    draft_note = merge_request.draft_notes.get(note_id)

.. warning::

   When creating or updating draft notes, you can provide a complex nested ``position`` argument as a dictionary.
   Please consult the upstream API documentation linked above for the exact up-to-date attributes.

Create a draft note for a merge request::

    draft_note = merge_request.draft_notes.create({'note': 'note content'})

Update an existing draft note::

    draft_note.note = 'updated note content'
    draft_note.save()

Delete an existing draft note::

    draft_note.delete()

Publish an existing draft note::

    draft_note.publish()

Publish all existing draft notes for a merge request in bulk::

    merge_request.draft_notes.bulk_publish()