Documentation
¶
Overview ¶
Package timeline is the conversation the issue sheet and the review sheet show: the comments, reviews, and events of an issue or a pull request, one page of entries at a time, oldest first. Entries converts what the GitHub client read into the entries the window shows, and Cut shortens their texts so a sheet's cache stays within its size.
The two sheets share it and import nothing of each other. It is a leaf: it imports the GitHub client's types, the item and clock words, and textutil, and no service or store. Each type's JSON is what the window reads and what the issue sheet's cache, written by builds before this package, already holds, so a name or a tag here never changes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
type Entry struct {
Kind Kind `json:"kind"`
ID string `json:"id"`
At string `json:"at"`
Actor string `json:"actor"`
ActorIsBot bool `json:"actorIsBot"`
Mine bool `json:"mine"`
// A comment's or a review's text, page, author's relationship to the repository, and
// when it was edited; Trimmed says the cache cut the text short. Minimized says someone
// folded it away, and MinimizedReason why, as an upper-case word. A merge's page is its
// URL too.
Body string `json:"body"`
Trimmed bool `json:"trimmed"`
URL string `json:"url"`
Association string `json:"association"`
EditedAt string `json:"editedAt"`
Minimized bool `json:"minimized"`
MinimizedReason string `json:"minimizedReason"`
// Ref is the other item an event names; WillClose a mention that closes the issue once
// merged; Commit a commit that closed it, or a merge's commit, as a short SHA;
// DuplicateOf what a close as a duplicate names.
Ref *Ref `json:"ref"`
WillClose bool `json:"willClose"`
Commit string `json:"commit"`
DuplicateOf *Ref `json:"duplicateOf"`
StateReason StateReason `json:"stateReason"`
Label *Label `json:"label"`
Assignee string `json:"assignee"`
// From and To are a rename's titles, or a force push's commits, before and after it, as
// short SHAs.
From string `json:"from"`
To string `json:"to"`
// ReviewState is a review's state, and Outdated says it was left on an earlier commit
// than the head the sheet read. LineComments are its first line comments, and
// MoreLineComments how many others it has, which GitHub shows.
ReviewState ReviewState `json:"reviewState"`
Outdated bool `json:"outdated"`
LineComments []LineComment `json:"lineComments"`
MoreLineComments int `json:"moreLineComments"`
// Reviewer is whom a review was requested of: a user's login, or a team as "org/team",
// "" for one the user can't see.
Reviewer string `json:"reviewer"`
// Branch is the branch a merge went into.
Branch string `json:"branch"`
}
Entry is one comment, review, or event. Which fields are set depends on Kind.
func Cut ¶
Cut cuts the description, body, and every text of entries, each comment's and review's and each line comment's, longer than limit bytes, marking each one cut (trimmed for the description). It returns the entries cut, a copy, leaving the ones given as they were. Each text cut keeps its page, where the whole text is; no entry is dropped.
type Kind ¶
type Kind string
Kind is what one entry of a timeline is.
const ( KindComment Kind = "comment" KindMentioned Kind = "mentioned" KindLinked Kind = "linked" KindUnlinked Kind = "unlinked" KindClosed Kind = "closed" KindReopened Kind = "reopened" KindAssigned Kind = "assigned" KindUnassigned Kind = "unassigned" KindLabeled Kind = "labeled" KindUnlabeled Kind = "unlabeled" KindRenamed Kind = "renamed" KindDuplicate Kind = "duplicate" KindReviewed Kind = "reviewed" KindMerged Kind = "merged" KindForcePushed Kind = "force_pushed" KindReviewRequested Kind = "review_requested" KindReadyForReview Kind = "ready_for_review" KindConvertedToDraft Kind = "converted_to_draft" )
The timeline's kinds: both sheets' first, then those only a pull request has.
type LineComment ¶
type LineComment struct {
ID string `json:"id"`
URL string `json:"url"`
At string `json:"at"`
Path string `json:"path"`
Line int `json:"line"`
StartLine int `json:"startLine"`
Outdated bool `json:"outdated"`
Body string `json:"body"`
Trimmed bool `json:"trimmed"`
Hunk []string `json:"hunk"`
}
LineComment is one of a review's comments on a line of the diff: the file and the lines it is on (StartLine 0 for one line), as the diff it was left on numbers them once it is Outdated, the lines having changed since; its text, which Trimmed says the cache cut short; and Hunk, the last lines of the diff up to the line, as the diff shows them.
type Page ¶
type Page struct {
Items []Entry `json:"items"`
Total int `json:"total"`
Before string `json:"before"`
}
Page is a page of a timeline, oldest first. Before is the cursor that reads the entries before it, "" when none come before it, and Total counts every entry of the whole timeline the sheet reads, so Total less the entries the sheet holds is how many it doesn't.
type Reaction ¶
Reaction counts one kind of reaction to the description, by GitHub's name for it.
func ReactionsOf ¶
ReactionsOf converts a description's reactions, never returning nil.
type Ref ¶
type Ref struct {
Kind item.Kind `json:"kind"`
Repo string `json:"repo"`
Number int `json:"number"`
Title string `json:"title"`
URL string `json:"url"`
State RefState `json:"state"`
StateReason StateReason `json:"stateReason"`
Draft bool `json:"draft"`
}
Ref is a pull request or an issue the sheet names.
type ReviewState ¶
type ReviewState string
ReviewState is a review's state, as GitHub says it.
const ( ReviewNone ReviewState = "" ReviewApproved ReviewState = "APPROVED" ReviewChangesRequested ReviewState = "CHANGES_REQUESTED" ReviewCommented ReviewState = "COMMENTED" ReviewDismissed ReviewState = "DISMISSED" )
The review states the sheet shows; a review still pending is never shown.
type StateReason ¶
type StateReason string
StateReason is why an issue is closed, or was reopened, as GitHub says it.
const ( ReasonNone StateReason = "" ReasonCompleted StateReason = "COMPLETED" ReasonNotPlanned StateReason = "NOT_PLANNED" ReasonDuplicate StateReason = "DUPLICATE" ReasonReopened StateReason = "REOPENED" )
The state reasons.