dmitri.shuralyov.com/service/change

Improve docs; start on diff inline comments.
dmitshur committed 6 years ago commit cd2816373864bb6d6bfcb2880729493a8046751d
Showing partial commit. Full Commit
Collapse all
changes.go
@@ -17,11 +17,11 @@ type Service interface {
	Count(ctx context.Context, repo string, opt ListOptions) (uint64, error)

	// Get a change.
	Get(ctx context.Context, repo string, id uint64) (Change, error)

	// ListTimeline lists timeline items (changes.Comment, changes.TimelineItem) for specified change id.
	// ListTimeline lists timeline items (changes.Comment, changes.Review, changes.TimelineItem) for specified change id.
	ListTimeline(ctx context.Context, repo string, id uint64, opt *ListTimelineOptions) ([]interface{}, error)
	// ListCommits lists change commits.
	ListCommits(ctx context.Context, repo string, id uint64) ([]Commit, error)
	// Get a change diff.
	GetDiff(ctx context.Context, repo string, id uint64, opt *GetDiffOptions) ([]byte, error)
timeline.go
@@ -7,10 +7,11 @@ import (
	"github.com/shurcooL/reactions"
	"github.com/shurcooL/users"
)

// Comment represents a comment left on a change.
// TODO: Consider removing in favor of Review with commented state and no inline comments.
type Comment struct {
	ID        uint64
	User      users.User
	CreatedAt time.Time
	Edited    *Edited // Edited is nil if the comment hasn't been edited.
@@ -23,10 +24,11 @@ type Comment struct {
type Edited struct {
	By users.User
	At time.Time
}

// Review represents a review left on a change.
type Review struct {
	ID        uint64
	User      users.User
	CreatedAt time.Time
	Edited    *Edited // Edited is nil if the review hasn't been edited.
@@ -35,10 +37,11 @@ type Review struct {
	Reactions []reactions.Reaction
	Editable  bool // Editable represents whether the current user (if any) can perform edit operations on this review.
	Comments  []InlineComment
}

// InlineComment represents an inline comment that was left as part of a review.
type InlineComment struct {
	File string
	Line int
	Body string
}