gitlab4j-api icon indicating copy to clipboard operation
gitlab4j-api copied to clipboard

Support for "link_type" in issue links

Open jmini opened this issue 3 years ago • 0 comments

According to https://docs.gitlab.com/ee/api/issue_links.html

Endpoint:

POST /projects/:id/issues/:issue_iid/links

Supports a link_type query parameter:

Type: string Required: no Description: The type of the relation (“relates_to”, “blocks”, “is_blocked_by”), defaults to “relates_to”).

So this would needs to be reflected here:

https://github.com/gitlab4j/gitlab4j-api/blob/075ce397bd03ae35acbffdcd4c5cbfaa5cb7075b/src/main/java/org/gitlab4j/api/IssuesApi.java#L847-L871

Maybe as enum?

And it needs to be present in IssueLink class (link_type attribute), when the response is parsed:

[
  {
    "id" : 84,
    "iid" : 14,
    "issue_link_id": 1,
    "project_id" : 4,
    "created_at" : "2016-01-07T12:44:33.959Z",
    "title" : "Issues with auth",
    "state" : "opened",
    "assignees" : [],
    "assignee" : null,
    "labels" : [
      "bug"
    ],
    "author" : {
      "name" : "Alexandra Bashirian",
      "avatar_url" : null,
      "state" : "active",
      "web_url" : "https://gitlab.example.com/eileen.lowe",
      "id" : 18,
      "username" : "eileen.lowe"
    },
    "description" : null,
    "updated_at" : "2016-01-07T12:44:33.959Z",
    "milestone" : null,
    "user_notes_count": 0,
    "due_date": null,
    "web_url": "http://example.com/example/example/issues/14",
    "confidential": false,
    "weight": null,
    "link_type": "relates_to",
    "link_created_at": "2016-01-07T12:44:33.959Z",
    "link_updated_at": "2016-01-07T12:44:33.959Z"
  }
]

Also the method reading the issue links GET /projects/:id/issues/:issue_iid/links should be reworked:

  • getIssueLinks(Object projectIdOrPath, Long issueIid)
  • getIssueLinks(Object projectIdOrPath, Long issueIid, int itemsPerPage)
  • getIssueLinksStream(Object projectIdOrPath, Long issueIid)

But there I am not sure to understand why the return type is not from type IssueLink

jmini avatar Jun 01 '22 14:06 jmini