api

package
v0.0.0-...-b903159 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitOverview

type CommitOverview struct {
	ID      string                    `json:"id"`
	Details *repository.CommitDetails `json:"details"`
}

CommitOverview encapsulates the fine-grained details of a commit.

type DiffSummary

type DiffSummary struct {
	ReviewCommits []CommitOverview `json:"reviewCommits,omitEmpty"`
	LeftHandSide  string           `json:"leftHandSide"`
	RightHandSide string           `json:"rightHandSide"`
	Contents      string           `json:"contents"`
}

DiffSummary summarizes one of the diffs included in a review.

This summary includes the list of all commits that can be used to construct such a diff.

func NewDiffSummary

func NewDiffSummary(reviewDetails *review.Review, lhs, rhs string) (*DiffSummary, error)

NewDiffSummary constructs a new instance of DiffSummary.

If the `lhs` or `rhs` arguments are empty or out of bounds, then the review's base or head commits are used instead.

type RepoCache

type RepoCache map[string]*RepoDetails

RepoCache encapsulates everything that the API server currently knows about every repository.

func (RepoCache) AddRepo

func (cache RepoCache) AddRepo(repo repository.Repo)

AddRepo adds the given repository to the cache.

func (RepoCache) ServeClosedReviewsJSON

func (cache RepoCache) ServeClosedReviewsJSON(w http.ResponseWriter, r *http.Request)

ServeClosedReviewsJSON writes a page of the closed reviews list for the given repository to the given writer.

The repository to list reviews for is given by the 'repo' URL parameter. The page of the review list to output is given by the 'page' URL parameter.

func (RepoCache) ServeEntryPointRedirect

func (cache RepoCache) ServeEntryPointRedirect(w http.ResponseWriter, r *http.Request)

ServeEntryPointRedirect writes the main redirect response to the given writer.

func (RepoCache) ServeListReposJSON

func (cache RepoCache) ServeListReposJSON(w http.ResponseWriter, r *http.Request)

ServeListReposJSON writes the list of repositories to the given writer.

func (RepoCache) ServeOpenReviewsJSON

func (cache RepoCache) ServeOpenReviewsJSON(w http.ResponseWriter, r *http.Request)

ServeOpenReviewsJSON writes a page of the open reviews list for the given repository to the given writer.

The repository to list reviews for is given by the 'repo' URL parameter. The page of the review list to output is given by the 'page' URL parameter.

func (RepoCache) ServeRepoContents

func (cache RepoCache) ServeRepoContents(w http.ResponseWriter, r *http.Request)

ServeRepoContents writes the contents of a given file at a given commit.

The repository, file, and commit are given by the 'repo', 'file' and 'commit' URL parameters.

func (RepoCache) ServeRepoSummaryJSON

func (cache RepoCache) ServeRepoSummaryJSON(w http.ResponseWriter, r *http.Request)

ServeRepoSummaryJSON writes the summary of a given repository to the given writer.

The repository to summarize is given by the 'repo' URL parameter.

func (RepoCache) ServeReviewDetailsJSON

func (cache RepoCache) ServeReviewDetailsJSON(w http.ResponseWriter, r *http.Request)

ServeReviewDetailsJSON writes the details of a review to the given writer.

The enclosing repository is given by the 'repo' URL parameter. The review to write is given by the 'review' URL parameter.

func (RepoCache) ServeReviewDiff

func (cache RepoCache) ServeReviewDiff(w http.ResponseWriter, r *http.Request)

ServeReviewDiff writes the diff summary of a review to the given writer.

The enclosing repository is given by the 'repo' URL parameter. The review to write is given by the 'review' URL parameter.

type RepoDetails

type RepoDetails struct {
	ID                string
	Repo              repository.Repo
	RepoState         string
	OpenReviewCount   int
	OpenReviews       [][]review.Summary
	ClosedReviewCount int
	ClosedReviews     [][]review.Summary
}

RepoDetails encapsulates everything the API server knows about a repository.

func NewRepoDetails

func NewRepoDetails(repo repository.Repo) *RepoDetails

NewRepoDetails constructs a RepoDetails instance from the given Repo instance.

func (*RepoDetails) GetClosedReviews

func (details *RepoDetails) GetClosedReviews(pageToken int) (*ReviewListResponse, error)

GetClosedReviews returns the given `page` of the paginated list of closed reviews.

If the page is out of bounds, then an empty response is returned.

func (*RepoDetails) GetListItem

func (details *RepoDetails) GetListItem() *RepoListItem

GetListItem constructs a concise summary of the repository suitable for including in a list of repositories.

func (*RepoDetails) GetOpenReviews

func (details *RepoDetails) GetOpenReviews(pageToken int) (*ReviewListResponse, error)

GetOpenReviews returns the given `page` of the paginated list of open reviews.

If the page is out of bounds, then an empty response is returned.

func (*RepoDetails) GetReview

func (details *RepoDetails) GetReview(reviewID string) (*review.Review, error)

GetReview loads the given review details from the repository.

func (*RepoDetails) GetSummary

func (details *RepoDetails) GetSummary() (*RepoSummary, error)

GetSummary constructs a detailed summary of the repository.

type RepoListItem

type RepoListItem struct {
	ID   string `json:"id"`
	Path string `json:"path"`
}

RepoListItem represents one entry in the result of calling the API to list repositories.

type RepoSummary

type RepoSummary struct {
	Path              string `json:"path"`
	OpenReviewCount   int    `json:"openReviewCount"`
	ClosedReviewCount int    `json:"closedReviewCount"`
}

RepoSummary is the return type for the API to summarize a repository.

type ReposList

type ReposList []*RepoListItem

ReposList is the return type for the API to list repositories.

func (ReposList) Len

func (repos ReposList) Len() int

func (ReposList) Less

func (repos ReposList) Less(i, j int) bool

func (ReposList) Swap

func (repos ReposList) Swap(i, j int)

type ReviewListResponse

type ReviewListResponse struct {
	Items         []review.Summary `json:"items"`
	NextPageToken string           `json:"nextPageToken,omitEmpty"`
}

ReviewListResponse represents a single `page` in a list of reviews.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL