Documentation
¶
Overview ¶
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func Capabilities(c context.Context, u *model.User) (*model.Capabilities, error)
- func CompareBranches(c context.Context, u *model.User, r *model.Repo, ref1 string, ref2 string, ...) (model.BranchCompare, error)
- func CreateEmptyCommit(c context.Context, u *model.User, r *model.Repo, sha, msg string) (string, error)
- func CreatePR(c context.Context, u *model.User, r *model.Repo, ...) (int, error)
- func CreateReference(c context.Context, u *model.User, r *model.Repo, sha, name string) (string, error)
- func CreateURLCompare(c context.Context, u *model.User, r *model.Repo, sha1, sha2 string) string
- func DelHook(c context.Context, u *model.User, r *model.Repo, hook string) error
- func DelOrgHook(c context.Context, u *model.User, o *model.OrgDb, hook string) error
- func DeleteBranch(c context.Context, u *model.User, repo *model.Repo, ref string) error
- func GetAllComments(c context.Context, u *model.User, r *model.Repo, num int) ([]*model.Comment, error)
- func GetAllReviews(c context.Context, u *model.User, r *model.Repo, num int) ([]*model.Review, error)
- func GetCollaborators(c context.Context, user *model.User, owner, name string) ([]*model.Person, error)
- func GetCommentsSinceHead(c context.Context, u *model.User, r *model.Repo, num int, noUIMerge bool) ([]*model.Comment, error)
- func GetCommits(c context.Context, u *model.User, r *model.Repo, sha string, page, perPage int) ([]string, int, error)
- func GetContents(c context.Context, u *model.User, r *model.Repo, path string) ([]byte, error)
- func GetIssue(c context.Context, u *model.User, r *model.Repo, number int) (model.Issue, error)
- func GetOrg(c context.Context, user *model.User, owner string) (*model.OrgDb, error)
- func GetOrgMembers(c context.Context, user *model.User, org string) ([]*model.Person, error)
- func GetOrgPerm(c context.Context, user *model.User, owner string) (*model.Perm, error)
- func GetOrgRepos(c context.Context, user *model.User, owner string) ([]*model.Repo, error)
- func GetOrgs(c context.Context, user *model.User) ([]*model.GitHubOrg, error)
- func GetPerm(c context.Context, user *model.User, owner, name string) (*model.Perm, error)
- func GetPerson(c context.Context, user *model.User, login string) (*model.Person, error)
- func GetPullRequest(c context.Context, u *model.User, r *model.Repo, number int) (model.PullRequest, error)
- func GetPullRequestCommits(c context.Context, u *model.User, r *model.Repo, number int) ([]model.Commit, error)
- func GetPullRequestFiles(c context.Context, u *model.User, r *model.Repo, number int) ([]model.CommitFile, error)
- func GetPullRequestsForCommit(c context.Context, u *model.User, r *model.Repo, sha *string) ([]model.PullRequest, error)
- func GetRepo(c context.Context, u *model.User, owner, name string) (*model.Repo, error)
- func GetReviewsSinceHead(c context.Context, u *model.User, r *model.Repo, num int, noUIMerge bool) ([]*model.Review, error)
- func GetStatus(c context.Context, u *model.User, r *model.Repo, sha string) (model.CombinedStatus, error)
- func GetTeamMembers(c context.Context, user *model.User, org string, team string) ([]*model.Person, error)
- func GetUser(c context.Context, w http.ResponseWriter, r *http.Request) (*model.User, error)
- func GetUserRepos(c context.Context, user *model.User) ([]*model.Repo, error)
- func GetUserToken(c context.Context, token string) (string, error)
- func HasRequiredStatus(c context.Context, u *model.User, r *model.Repo, branch, sha string) (bool, error)
- func IsHeadUIMerge(c context.Context, u *model.User, r *model.Repo, num int) (bool, error)
- func ListTags(c context.Context, u *model.User, r *model.Repo) ([]model.Tag, error)
- func ListTeams(c context.Context, user *model.User, org string) (set.Set, error)
- func MergePR(c context.Context, u *model.User, r *model.Repo, pullRequest model.PullRequest, ...) (string, error)
- func RevokeAuthorization(c context.Context, user *model.User) error
- func ScheduleDeployment(c context.Context, u *model.User, r *model.Repo, d model.DeploymentInfo) error
- func SetHook(c context.Context, u *model.User, r *model.Repo, hook string) error
- func SetOrgHook(c context.Context, u *model.User, o *model.OrgDb, hook string) error
- func SetStatus(c context.Context, u *model.User, r *model.Repo, ...) error
- func Tag(c context.Context, u *model.User, r *model.Repo, tag string, sha string) error
- func ToContext(c Setter, client Remote)
- func WriteComment(c context.Context, u *model.User, r *model.Repo, num int, message string) error
- type Account
- type Comment
- type Issue
- type Remote
- type Setter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capabilities ¶
Capabilities generates the user's capabilities
func CompareBranches ¶
func CreateEmptyCommit ¶
func CreateEmptyCommit(c context.Context, u *model.User, r *model.Repo, sha, msg string) (string, error)
CreateEmptyCommit creates an empty commit from the provided parent sha.
func CreatePR ¶
func CreatePR(c context.Context, u *model.User, r *model.Repo, title, head, base, body string) (int, error)
CreatePR creates a new pull request
func CreateReference ¶
func CreateReference(c context.Context, u *model.User, r *model.Repo, sha, name string) (string, error)
CreateReference creates a reference pointing to the provided commit
func CreateURLCompare ¶
CreateURLCompare creates a URL that prepares a diff of two commits
func DelOrgHook ¶
DelOrgHook deletes a webhook from the remote organization.
func DeleteBranch ¶
func GetAllComments ¶
func GetAllComments(c context.Context, u *model.User, r *model.Repo, num int) ([]*model.Comment, error)
GetAllComments gets pull request comments from the remote system.
func GetAllReviews ¶
func GetAllReviews(c context.Context, u *model.User, r *model.Repo, num int) ([]*model.Review, error)
GetAllReviews gets pull request reviews from the remote system.
func GetCollaborators ¶
func GetCollaborators(c context.Context, user *model.User, owner, name string) ([]*model.Person, error)
GetCollaborators gets an collaborators member list from the remote system. Looks for information about each person in the long term cache.
func GetCommentsSinceHead ¶
func GetCommentsSinceHead(c context.Context, u *model.User, r *model.Repo, num int, noUIMerge bool) ([]*model.Comment, error)
GetCommentsSinceHead gets pull request comments from the remote system since the head commit was committed
func GetCommits ¶
func GetCommits(c context.Context, u *model.User, r *model.Repo, sha string, page, perPage int) ([]string, int, error)
GetCommits gets one page of git commits
func GetContents ¶
GetContents gets the file contents from the remote system.
func GetOrgMembers ¶
GetOrgMembers gets an organization member list from the remote system. Looks for information about each person in the long term cache.
func GetOrgPerm ¶
func GetOrgRepos ¶
func GetOrgs ¶
GetOrgs returns the list of user organizations from the cache associated with the current context.
func GetPerm ¶
GetPerm returns the user permissions repositories from the cache associated with the current repository.
func GetPullRequest ¶
func GetPullRequestCommits ¶
func GetPullRequestFiles ¶
func GetReviewsSinceHead ¶
func GetReviewsSinceHead(c context.Context, u *model.User, r *model.Repo, num int, noUIMerge bool) ([]*model.Review, error)
GetReviewsSinceHead gets pull request reviews from the remote system since the head commit was committed
func GetStatus ¶
func GetStatus(c context.Context, u *model.User, r *model.Repo, sha string) (model.CombinedStatus, error)
GetStatus gets the commit statuses in the remote system.
func GetTeamMembers ¶
func GetTeamMembers(c context.Context, user *model.User, org string, team string) ([]*model.Person, error)
GetTeamMembers gets an repo's team members list from the remote system. Looks for information about each person in the long term cache.
func GetUserToken ¶
GetUserToken authenticates a user with the remote system using the remote systems OAuth token.
func HasRequiredStatus ¶
func HasRequiredStatus(c context.Context, u *model.User, r *model.Repo, branch, sha string) (bool, error)
HasRequiredStatus tests whether the required commit statuses are passing.
func IsHeadUIMerge ¶
IsHeadUIMerge tests whether the HEAD of the pull request is a user interface merge.
func ListTeams ¶
ListTeams returns the list of team names from the cache associated with the current context.
func RevokeAuthorization ¶
RevokeAuthorization revokes the OAuth token
func ScheduleDeployment ¶
func SetOrgHook ¶
SetOrgHook adds a webhook to the remote organization.
func SetStatus ¶
func SetStatus(c context.Context, u *model.User, r *model.Repo, sha, context, status, desc string) error
SetStatus adds or updates the commit status in the remote system.
Types ¶
type Account ¶
type Account struct {
Login string `json:"login"`
Avatar string `json:"avatar"`
Kind string `json:"type"`
}
Account represents a user or team account.
type Issue ¶
type Issue struct {
Number int `json:"issue"`
Title string `json:"title"`
Author string `json:"author"`
}
Issue represents an issue or pull request.
type Remote ¶
type Remote interface {
// Capabilities generates the user's capabilities
Capabilities(context.Context, *model.User) (*model.Capabilities, error)
// GetUser authenticates a user with the remote system.
GetUser(context.Context, http.ResponseWriter, *http.Request) (*model.User, error)
// GetUserToken authenticates a user with the remote system using
// the remote systems OAuth token.
GetUserToken(context.Context, string) (string, error)
// RevokeAuthorization revokes the OAuth token
RevokeAuthorization(c context.Context, user *model.User) error
// GetPerson retrieves metadata information about a user with the remote system.
GetPerson(c context.Context, user *model.User, login string) (*model.Person, error)
// GetOrgs gets a organization list from the remote system.
GetOrgs(context.Context, *model.User) ([]*model.GitHubOrg, error)
// ListTeams gets the repo's list of team names
ListTeams(c context.Context, user *model.User, org string) (set.Set, error)
// GetOrgMembers gets an organization member list from the remote system.
GetOrgMembers(context.Context, *model.User, string) (set.Set, error)
// GetTeamMembers gets an org's team members list from the remote system.
GetTeamMembers(c context.Context, user *model.User, org string, team string) (set.Set, error)
// GetCollaborators gets a collaborators list from the remote system.
GetCollaborators(context.Context, *model.User, string, string) (set.Set, error)
// GetRepo gets a repository from the remote system.
GetRepo(context.Context, *model.User, string, string) (*model.Repo, error)
// GetPerm gets a repository permission from the remote system.
GetPerm(context.Context, *model.User, string, string) (*model.Perm, error)
// SetHook adds a webhook to the remote repository.
SetHook(context.Context, *model.User, *model.Repo, string) error
// DelHook deletes a webhook from the remote repository.
DelHook(context.Context, *model.User, *model.Repo, string) error
// GetAllComments gets pull request comments from the remote system.
GetAllComments(context.Context, *model.User, *model.Repo, int) ([]*model.Comment, error)
// GetCommentsSinceHead gets pull request comments from the remote system since the head commit was committed.
GetCommentsSinceHead(context.Context, *model.User, *model.Repo, int, bool) ([]*model.Comment, error)
// GetAllReviews gets pull request reviews from the remote system.
GetAllReviews(context.Context, *model.User, *model.Repo, int) ([]*model.Review, error)
// GetReviewsSinceHead gets pull request reviews from the remote system since the head commit was committed.
GetReviewsSinceHead(context.Context, *model.User, *model.Repo, int, bool) ([]*model.Review, error)
// IsHeadUIMerge tests whether the HEAD of the pull request is a user interface merge.
IsHeadUIMerge(c context.Context, u *model.User, r *model.Repo, num int) (bool, error)
// CreateCompareURL creates a URL that prepares a diff of two commits
CreateURLCompare(c context.Context, u *model.User, r *model.Repo, sha1, sha2 string) string
// GetCommits gets one page of git commits
GetCommits(context.Context, *model.User, *model.Repo, string, int, int) ([]string, int, error)
// GetContents gets the file contents from the remote system.
GetContents(context.Context, *model.User, *model.Repo, string) ([]byte, error)
// GetStatus gets the commit statuses in the remote system.
GetStatus(c context.Context, u *model.User, r *model.Repo, sha string) (model.CombinedStatus, error)
// HasRequiredStatus tests whether the required commit statuses are passing.
HasRequiredStatus(c context.Context, u *model.User, r *model.Repo, branch, sha string) (bool, error)
// SetStatus adds or updates the commit status in the remote system.
SetStatus(c context.Context, u *model.User, r *model.Repo, sha, context, status, desc string) error
// CreateEmptyCommit creates an empty commit from the provided parent sha.
CreateEmptyCommit(c context.Context, u *model.User, r *model.Repo, sha, msg string) (string, error)
// CreateReference creates a reference pointing to the provided commit
CreateReference(ctx context.Context, u *model.User, r *model.Repo, sha, name string) (string, error)
// CreatePR creates a new pull request
CreatePR(c context.Context, u *model.User, r *model.Repo, title, head, base, body string) (int, error)
// MergePR merges the named pull request from the remote system
MergePR(c context.Context, u *model.User, r *model.Repo, pullRequest model.PullRequest, approvers []*model.Person, message string, mergeMethod string) (string, error)
// CompareBranches compares two branches for changes
CompareBranches(c context.Context, u *model.User, repo *model.Repo, base string, head string, owner string) (model.BranchCompare, error)
// DeleteBranch deletes a branch with the given reference
DeleteBranch(c context.Context, u *model.User, repo *model.Repo, ref string) error
// GetMaxExistingTag finds the highest tag across all tags
ListTags(c context.Context, u *model.User, r *model.Repo) ([]model.Tag, error)
// Tag applies a tag with the specified string to the specified sha
Tag(c context.Context, u *model.User, r *model.Repo, tag string, sha string) error
// GetPullRequest returns the pull request associated with a pull request number
GetPullRequest(c context.Context, u *model.User, r *model.Repo, number int) (model.PullRequest, error)
// GetPullRequestFiles returns the changed files associated with a pull request number
GetPullRequestFiles(c context.Context, u *model.User, r *model.Repo, number int) ([]model.CommitFile, error)
// GetPullRequestCommits returns the commits associated with a pull request number
GetPullRequestCommits(c context.Context, u *model.User, r *model.Repo, number int) ([]model.Commit, error)
// GetPullRequestsForCommit returns all pull requests associated with a commit SHA
GetPullRequestsForCommit(c context.Context, u *model.User, r *model.Repo, sha *string) ([]model.PullRequest, error)
// GetIssue returns the issue associated with a issue number
GetIssue(c context.Context, u *model.User, r *model.Repo, number int) (model.Issue, error)
// WriteComment puts a new comment into the PR
WriteComment(c context.Context, u *model.User, r *model.Repo, num int, message string) error
ScheduleDeployment(c context.Context, u *model.User, r *model.Repo, d model.DeploymentInfo) error
GetOrgPerm(c context.Context, user *model.User, owner string) (*model.Perm, error)
// SetOrgHook adds a webhook to the remote organization.
SetOrgHook(context.Context, *model.User, *model.OrgDb, string) error
// DelOrgHook deletes a webhook from the remote organization.
DelOrgHook(context.Context, *model.User, *model.OrgDb, string) error
GetOrg(c context.Context, user *model.User, owner string) (*model.OrgDb, error)
// GetOrgRepos gets the organization repository list from the remote system.
GetOrgRepos(c context.Context, u *model.User, owner string) ([]*model.Repo, error)
// GetUserRepos gets the user repository list from the remote system.
GetUserRepos(context.Context, *model.User) ([]*model.Repo, error)
}
func FromContext ¶
FromContext returns the Remote client associated with this context.
Directories
¶
| Path | Synopsis |
|---|---|
|
SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. |