Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api/discussions.md')
-rw-r--r--doc/api/discussions.md56
1 files changed, 36 insertions, 20 deletions
diff --git a/doc/api/discussions.md b/doc/api/discussions.md
index d88d4780e65..6d0c5afa35d 100644
--- a/doc/api/discussions.md
+++ b/doc/api/discussions.md
@@ -15,7 +15,7 @@ Discussions are a set of related notes on:
- Merge requests
- Commits
-This includes system notes, which are notes about changes to the object (for example, when a milestone changes, there will be a corresponding system note). Label notes are not part of this API, but recorded as separate events in [resource label events](resource_label_events.md).
+This includes system notes, which are notes about changes to the object (for example, when a milestone changes, a corresponding system note is added). Label notes are not part of this API, but recorded as separate events in [resource label events](resource_label_events.md).
## Discussions pagination
@@ -839,7 +839,7 @@ a note but other comments (replies) can be added to it later.
POST /projects/:id/merge_requests/:merge_request_iid/discussions
```
-Parameters:
+Parameters for all comments:
| Attribute | Type | Required | Description |
| ---------------------------------------- | -------------- | -------- | ----------- |
@@ -852,27 +852,43 @@ Parameters:
| `position[base_sha]` | string | yes | Base commit SHA in the source branch |
| `position[start_sha]` | string | yes | SHA referencing commit in target branch |
| `position[head_sha]` | string | yes | SHA referencing HEAD of this merge request |
-| `position[position_type]` | string | yes | Type of the position reference', allowed values: 'text' or 'image' |
+| `position[position_type]` | string | yes | Type of the position reference', allowed values: `text` or `image` |
| `position[new_path]` | string | no | File path after change |
-| `position[new_line]` | integer | no | Line number after change (for 'text' diff notes) |
+| `position[new_line]` | integer | no | Line number after change (for `text` diff notes) |
| `position[old_path]` | string | no | File path before change |
-| `position[old_line]` | integer | no | Line number before change (for 'text' diff notes) |
+| `position[old_line]` | integer | no | Line number before change (for `text` diff notes) |
| `position[line_range]` | hash | no | Line range for a multi-line diff note |
-| `position[line_range][start]` | hash | no | Multiline note starting line |
-| `position[line_range][start][line_code]` | string | yes | Line code for the start line |
-| `position[line_range][start][type]` | string | yes | Line type for the start line |
-| `position[line_range][end]` | hash | no | Multiline note ending line |
-| `position[line_range][end][line_code]` | string | yes | Line code for the end line |
-| `position[line_range][end][type]` | string | yes | Line type for the end line |
-| `position[width]` | integer | no | Width of the image (for 'image' diff notes) |
-| `position[height]` | integer | no | Height of the image (for 'image' diff notes) |
-| `position[x]` | integer | no | X coordinate (for 'image' diff notes) |
-| `position[y]` | integer | no | Y coordinate (for 'image' diff notes) |
+| `position[width]` | integer | no | Width of the image (for `image` diff notes) |
+| `position[height]` | integer | no | Height of the image (for `image` diff notes) |
+| `position[x]` | integer | no | X coordinate (for `image` diff notes) |
+| `position[y]` | integer | no | Y coordinate (for `image` diff notes) |
```shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions?body=comment"
```
+Parameters for multiline comments only:
+
+| Attribute | Type | Required | Description |
+| ---------------------------------------- | -------------- | -------- | ----------- |
+| `position[line_range][start]` | hash | no | Multiline note starting line |
+| `position[line_range][start][line_code]` | string | yes | [Line code](#line-code) for the start line |
+| `position[line_range][start][type]` | string | yes | Use `new` for lines added by this commit, otherwise `old`. |
+| `position[line_range][end]` | hash | no | Multiline note ending line |
+| `position[line_range][end][line_code]` | string | yes | [Line code](#line-code) for the end line |
+| `position[line_range][end][type]` | string | yes | Use `new` for lines added by this commit, otherwise `old`. |
+
+#### Line code
+
+A line code is of the form `<SHA>_<old>_<new>`:
+
+- `<SHA>` is the SHA1 hash of the filename.
+- `<old>` is the line number before the change.
+- `<new>` is the line number after the change.
+
+For example, when commenting on an added line number 5, the line code
+looks like `adc83b19e793491b1c6ea0fd8b46cd9f32e292fc_5_5`.
+
### Resolve a merge request thread
Resolve/unresolve whole thread of a merge request.
@@ -1152,15 +1168,15 @@ Parameters:
| `position[base_sha]` | string | yes | Base commit SHA in the source branch |
| `position[start_sha]` | string | yes | SHA referencing commit in target branch |
| `position[head_sha]` | string | yes | SHA referencing HEAD of this commit |
-| `position[position_type]` | string | yes | Type of the position reference', allowed values: 'text' or 'image' |
+| `position[position_type]` | string | yes | Type of the position reference', allowed values: `text` or `image` |
| `position[new_path]` | string | no | File path after change |
| `position[new_line]` | integer | no | Line number after change |
| `position[old_path]` | string | no | File path before change |
| `position[old_line]` | integer | no | Line number before change |
-| `position[width]` | integer | no | Width of the image (for 'image' diff notes) |
-| `position[height]` | integer | no | Height of the image (for 'image' diff notes) |
-| `position[x]` | integer | no | X coordinate (for 'image' diff notes) |
-| `position[y]` | integer | no | Y coordinate (for 'image' diff notes) |
+| `position[width]` | integer | no | Width of the image (for `image` diff notes) |
+| `position[height]` | integer | no | Height of the image (for `image` diff notes) |
+| `position[x]` | integer | no | X coordinate (for `image` diff notes) |
+| `position[y]` | integer | no | Y coordinate (for `image` diff notes) |
```shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/commits/11/discussions?body=comment"