Make link_type on issue-relations available
Created by: dse82
Currently IssueLinksService.ListIssueRelations(…) returns an []*Issue. Unfortunately this hides the information about the relation-type (relates_to, blocks,is_blocked_by) that is contained in the server-response in the field link_type.
As a workaround I created a new type IssueRelation which is basically a copy of Issue with the additional fields LinkType, LinkCreatedAt and LinkUpdatedAt:
// IssueRelation gets a relation between two issues.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/issue_links.html#list-issue-relations
type IssueRelation struct {
LinkType string `json:"link_type"`
LinkCreatedAt *time.Time `json:"link_created_at"`
LinkUpdatedAt *time.Time `json:"link_updated_at"`
ID int `json:"id"`
IID int `json:"iid"`
ExternalID string `json:"external_id"`
State string `json:"state"`
// …and so forth…
}
I am a bit unsure about this however, since it seems to me that the result we get from the server does not contain all fields of Issue. It however seems that it provides more data than is listed in the example response in the GitLab-api documentation, e.g. epic.
I created a pull request for this here: #1387