forked from tangled.org/core
Monorepo for Tangled — https://tangled.org
at master 782 B view raw
1package models 2 3import "fmt" 4 5type RefKind int 6 7const ( 8 RefKindIssue RefKind = iota 9 RefKindPull 10) 11 12func (k RefKind) String() string { 13 if k == RefKindIssue { 14 return "issues" 15 } else { 16 return "pulls" 17 } 18} 19 20// /@alice.com/cool-proj/issues/123 21// /@alice.com/cool-proj/issues/123#comment-321 22type ReferenceLink struct { 23 Handle string 24 Repo string 25 Kind RefKind 26 SubjectId int 27 CommentId *int 28} 29 30func (l ReferenceLink) String() string { 31 comment := "" 32 if l.CommentId != nil { 33 comment = fmt.Sprintf("#comment-%d", *l.CommentId) 34 } 35 return fmt.Sprintf("/%s/%s/%s/%d%s", 36 l.Handle, 37 l.Repo, 38 l.Kind.String(), 39 l.SubjectId, 40 comment, 41 ) 42} 43 44type RichReferenceLink struct { 45 ReferenceLink 46 Title string 47 // reusing PullState for both issue & PR 48 State PullState 49}