草稿备注 API

草稿备注是合并请求的未决、未发表的评论。他们可以开始讨论,也可以作为回复与现有讨论相关联。在发布之前,只有作者可以查看。

列出所有合并请求草稿备注

获取单个合并请求的所有草稿备注的列表。

GET /projects/:id/merge_requests/:merge_request_iid/draft_notes
Attribute Type Required Description
id integer or string yes The ID or URL-encoded path of the project
merge_request_iid integer yes The IID of a project merge request
[{
  id: 5,
  author_id: 23,
  merge_request_id: 11,
  resolve_discussion: false,
  discussion_id: nil,
  note: "Example title",
  commit_id: nil,
  line_code: nil,
  position:
  {
    base_sha: nil,
    start_sha: nil,
    head_sha: nil,
    old_path: nil,
    new_path: nil,
    position_type: "text",
    old_line: nil,
    new_line: nil,
    line_range: nil
  }
}]
curl --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/projects/14/merge_requests/11/draft_notes"

获取单个草稿备注

返回给定合并请求的单个草稿备注。

GET /projects/:id/merge_requests/:merge_request_iid/draft_notes/:draft_note_id
参数 类型 是否必需 描述
id integer or string yes ID 或 URL 编码的项目路径
draft_note_id integer yes 草稿备注的 ID
merge_request_iid integer yes 项目合并请求的 IID
{
  id: 5,
  author_id: 23,
  merge_request_id: 11,
  resolve_discussion: false,
  discussion_id: nil,
  note: "Example title",
  commit_id: nil,
  line_code: nil,
  position:
  {
    base_sha: nil,
    start_sha: nil,
    head_sha: nil,
    old_path: nil,
    new_path: nil,
    position_type: "text",
    old_line: nil,
    new_line: nil,
    line_range: nil
  }
}
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/14/merge_requests/11/draft_notes/5"

删除草稿备注

删除给定合并请求的现有草稿备注。

DELETE /projects/:id/merge_requests/:merge_request_iid/draft_notes/:draft_note_id
参数 类型 是否必需 描述
draft_note_id integer yes 草稿备注的 ID
id integer or string yes ID 或 URL 编码的项目路径
merge_request_iid integer yes 项目合并请求的 IID
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/14/merge_requests/11/draft_notes/5"

发布草稿备注

为给定的合并请求发布现有草稿备注。

PUT /projects/:id/merge_requests/:merge_request_iid/draft_notes/:draft_note_id/publish
参数 类型 是否必需 描述
draft_note_id integer yes 草稿备注的 ID
id integer or string yes ID 或 URL 编码的项目路径
merge_request_iid integer yes 项目合并请求的 IID
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/14/merge_requests/11/draft_notes/5/publish"