dmitri.shuralyov.com/service/change

Start ability to view individual commits.
dmitshur committed 6 years ago commit d072b8bd33fb7cf5828e26c4bc6578c5ea6a4ab0
Showing partial commit. Full Commit
Collapse all
changes.go
@@ -17,13 +17,13 @@ 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)
	// ListCommits lists change commits.
	ListCommits(ctx context.Context, repo string, id uint64) ([]Commit, error)
	ListCommits(ctx context.Context, repo string, id uint64, opt *ListCommitsOptions) ([]Commit, error)
	// Get a change diff.
	GetDiff(ctx context.Context, repo string, id uint64) ([]byte, error)
	GetDiff(ctx context.Context, repo string, id uint64, opt *ListCommitsOptions) ([]byte, error)

	// ListComments lists comments for specified change id.
	ListComments(ctx context.Context, repo string, id uint64, opt *ListCommentsOptions) ([]issues.Comment, error)
	// ListEvents lists events for specified change id.
	ListEvents(ctx context.Context, repo string, id uint64, opt *ListCommentsOptions) ([]issues.Event, error)
@@ -42,11 +42,11 @@ type Change struct {
	Commits int // Number of commits (not populated during list operation).
}

type Commit struct {
	SHA        string
	Message    string
	Message    string // TODO: Consider splitting into Subject, Body.
	Author     users.User
	AuthorTime time.Time
}

// State represents the change state.
@@ -72,10 +72,15 @@ type StateFilter State
const (
	// AllStates is a state filter that includes all issues.
	AllStates StateFilter = "all"
)

type ListCommitsOptions struct {
	// Commit is the commit ID of the commit to fetch.
	Commit string
}

// ListCommentsOptions controls pagination.
type ListCommentsOptions struct {
	// Start is the index of first result to retrieve, zero-indexed.
	Start int