Documentation
¶
Overview ¶
Package change provides a change service definition.
Index ¶
- type Change
- type ClosedEvent
- type Comment
- type CommentRequest
- type Commit
- type CommitEvent
- type DeletedEvent
- type Edited
- type GetDiffOptions
- type InlineComment
- type LabeledEvent
- type ListOptions
- type ListTimelineOptions
- type MergedEvent
- type RenamedEvent
- type ReopenedEvent
- type Review
- type ReviewRequestRemovedEvent
- type ReviewRequestedEvent
- type Service
- type State
- type StateFilter
- type TimelineItem
- type UnlabeledEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
ID uint64
State State
Title string
Labels []issues.Label
Author users.User
CreatedAt time.Time
Replies int // Number of replies to this change (not counting the mandatory change description comment).
Commits int // Number of commits (not populated during list operation).
ChangedFiles int // Number of changed files (not populated during list operation).
}
Change represents a change in a repository.
type ClosedEvent ¶
type ClosedEvent struct {
Closer interface{} // Change (with State, Title), Commit (with SHA, Message, Author.AvatarURL), nil.
CloserHTMLURL string // If Closer is not nil.
}
ClosedEvent is when a change is closed.
type Comment ¶
type Comment struct {
ID string
User users.User
CreatedAt time.Time
Edited *Edited // Edited is nil if the comment hasn't been edited.
Body string
Reactions []reactions.Reaction
Editable bool // Editable represents whether the current user (if any) can perform edit operations on this comment.
}
Comment represents a comment left on a change. TODO: Consider removing in favor of Review with commented state and no inline comments.
type CommentRequest ¶
type CommentRequest struct {
ID string
Reaction *reactions.EmojiID // If not nil, toggle this reaction.
}
CommentRequest is a request to edit a comment.
type CommitEvent ¶
CommitEvent is when a change gets a new commit.
type DeletedEvent ¶
DeletedEvent is a delete event. THINK: Merge with "github.com/shurcooL/events/event".Delete?
type GetDiffOptions ¶
type GetDiffOptions struct {
// Commit is the commit ID of the commit to fetch.
Commit string
}
type InlineComment ¶
type InlineComment struct {
ID string
File string
Line int
Body string
Reactions []reactions.Reaction
}
InlineComment represents an inline comment that was left as part of a review.
type LabeledEvent ¶
LabeledEvent is when a change is labeled.
type ListOptions ¶
type ListOptions struct {
Filter StateFilter
}
ListOptions are options for list and count operations.
type ListTimelineOptions ¶
type ListTimelineOptions struct {
// Start is the index of first result to retrieve, zero-indexed.
Start int
// Length is the number of results to include.
Length int
}
ListTimelineOptions controls pagination.
type MergedEvent ¶
type RenamedEvent ¶
RenamedEvent is when a change is renamed.
type Review ¶
type Review struct {
ID string
User users.User
CreatedAt time.Time
Edited *Edited // Edited is nil if the review hasn't been edited.
State state.Review
Body string // Optional.
Reactions []reactions.Reaction
Editable bool // Editable represents whether the current user (if any) can perform edit operations on this review.
Comments []InlineComment
}
Review represents a review left on a change.
type ReviewRequestedEvent ¶
type Service ¶
type Service interface {
// List changes.
List(ctx context.Context, repo string, opt ListOptions) ([]Change, error)
// Count changes.
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 (change.Comment, change.Review, change.TimelineItem) for specified change id.
ListTimeline(ctx context.Context, repo string, id uint64, opt *ListTimelineOptions) ([]interface{}, error)
// ListCommits lists change commits, from first to last.
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)
// EditComment edits a comment.
EditComment(ctx context.Context, repo string, id uint64, cr CommentRequest) (Comment, error)
}
Service defines methods of a change tracking service.
type StateFilter ¶
type StateFilter string
StateFilter is a filter by state.
const ( // FilterOpen is a state filter that includes open changes. FilterOpen StateFilter = "open" // FilterClosedMerged is a state filter that includes closed and merged changes. FilterClosedMerged StateFilter = "closed|merged" // FilterAll is a state filter that includes all changes. FilterAll StateFilter = "all" )
type TimelineItem ¶
type TimelineItem struct {
ID string // TODO: See if this belongs here.
Actor users.User
CreatedAt time.Time
// Payload specifies the event type. It's one of:
// ClosedEvent, ReopenedEvent, ..., MergedEvent, DeletedEvent.
Payload interface{}
}
TimelineItem represents a timeline item.
type UnlabeledEvent ¶
UnlabeledEvent is when a change is unlabeled.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fs will implement change.Service using a virtual filesystem, once change.Service API is finalized.
|
Package fs will implement change.Service using a virtual filesystem, once change.Service API is finalized. |
|
Package gerritapi implements a read-only change.Service using Gerrit API client.
|
Package gerritapi implements a read-only change.Service using Gerrit API client. |
|
Package githubapi implements a change.Service using GitHub API clients.
|
Package githubapi implements a change.Service using GitHub API clients. |
|
Package httpclient contains change.Service implementation over HTTP.
|
Package httpclient contains change.Service implementation over HTTP. |
|
Package httphandler contains an API handler for change.Service.
|
Package httphandler contains an API handler for change.Service. |
|
Package httproute contains route paths for httpclient, httphandler.
|
Package httproute contains route paths for httpclient, httphandler. |
|
Package maintner implements a read-only change.Service using a x/build/maintner corpus.
|
Package maintner implements a read-only change.Service using a x/build/maintner corpus. |