Documentation ¶
Overview ¶
Package issues provides an issues service definition.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Close ¶
type Close struct {
Closer interface{} // Change, Commit, nil.
}
Close provides details for a Closed event.
type Comment ¶
type Comment struct { ID uint64 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 (or the encompassing issue). }
Comment represents a comment left on an issue.
type CommentRequest ¶
type CommentRequest struct { ID uint64 Body *string // If not nil, set the body. Reaction *reactions.EmojiID // If not nil, toggle this reaction. }
CommentRequest is a request to edit a comment.
func (CommentRequest) Validate ¶
func (cr CommentRequest) Validate() (requiresEdit bool, err error)
Validate validates the comment edit request, returning an non-nil error if it's invalid. requiresEdit reports if the edit request needs edit rights or if it can be done by anyone that can react.
type Event ¶
type Event struct { ID uint64 Actor users.User CreatedAt time.Time Type EventType Close Close // Close is only specified for Closed events. Rename *Rename // Rename is only provided for Renamed events. Label *Label // Label is only provided for Labeled and Unlabeled events. }
Event represents an event that occurred around an issue.
type EventType ¶
type EventType string
EventType is the type of an event.
const ( // Reopened is when an issue is reopened. Reopened EventType = "reopened" // Closed is when an issue is closed. Closed EventType = "closed" // Renamed is when an issue is renamed. Renamed EventType = "renamed" // Labeled is when an issue is labeled. Labeled EventType = "labeled" // Unlabeled is when an issue is unlabeled. Unlabeled EventType = "unlabeled" // CommentDeleted is when an issue comment is deleted. CommentDeleted EventType = "comment_deleted" )
type Issue ¶
type Issue struct { ID uint64 State state.Issue Title string Labels []Label Comment Replies int // Number of replies to this issue (not counting the mandatory issue description comment). }
Issue represents an issue on a repository.
type IssueListOptions ¶
type IssueListOptions struct {
State StateFilter
}
IssueListOptions are options for list operations.
type IssueRequest ¶
IssueRequest is a request to edit an issue. To edit the body, use EditComment with comment ID 0.
func (IssueRequest) Validate ¶
func (ir IssueRequest) Validate() error
Validate returns non-nil error if the issue request is invalid.
type ListOptions ¶
type ListOptions struct { // Start is the index of first result to retrieve, zero-indexed. Start int // Length is the number of results to include. Length int }
ListOptions controls pagination.
type RGB ¶
type RGB struct {
R, G, B uint8
}
TODO: Dedup.
RGB represents a 24-bit color without alpha channel.
type RepoSpec ¶
type RepoSpec struct {
URI string // URI is clean '/'-separated URI. E.g., "example.com/user/repo".
}
RepoSpec is a specification for a repository.
type Service ¶
type Service interface { // List issues. List(ctx context.Context, repo RepoSpec, opt IssueListOptions) ([]Issue, error) // Count issues. Count(ctx context.Context, repo RepoSpec, opt IssueListOptions) (uint64, error) // Get an issue. Get(ctx context.Context, repo RepoSpec, id uint64) (Issue, error) // ListTimeline lists timeline items (Comment, Event) for specified issue id // in chronological order. The issue description comes first in a timeline. ListTimeline(ctx context.Context, repo RepoSpec, id uint64, opt *ListOptions) ([]interface{}, error) // Create a new issue. Create(ctx context.Context, repo RepoSpec, issue Issue) (Issue, error) // CreateComment creates a new comment for specified issue id. CreateComment(ctx context.Context, repo RepoSpec, id uint64, comment Comment) (Comment, error) // Edit the specified issue id. Edit(ctx context.Context, repo RepoSpec, id uint64, ir IssueRequest) (Issue, []Event, error) // EditComment edits comment of specified issue id. EditComment(ctx context.Context, repo RepoSpec, id uint64, cr CommentRequest) (Comment, error) // ThreadType reports the notification thread type for this service in repo. ThreadType(ctx context.Context, repo RepoSpec) (string, error) }
Service defines methods of an issue tracking service.
type StateFilter ¶
StateFilter is a filter by state.
const ( // AllStates is a state filter that includes all issues. AllStates StateFilter = "all" )
Directories ¶
Path | Synopsis |
---|---|
Package fs implements issues.Service using a virtual filesystem.
|
Package fs implements issues.Service using a virtual filesystem. |
Package githubapi implements issues.Service using GitHub API clients.
|
Package githubapi implements issues.Service using GitHub API clients. |
Package httpclient contains issues.Service implementation over HTTP.
|
Package httpclient contains issues.Service implementation over HTTP. |
Package httphandler contains an API handler for issues.Service.
|
Package httphandler contains an API handler for issues.Service. |
Package httproute contains route paths for httpclient, httphandler.
|
Package httproute contains route paths for httpclient, httphandler. |