remote

package
v0.0.0-...-a41bcb6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelHook

func DelHook(c context.Context, u *model.User, r *model.Repo, hook string) error

DelHook deletes a webhook from the remote repository.

func GetComments

func GetComments(c context.Context, u *model.User, r *model.Repo, num int) ([]*model.Comment, error)

GetComments gets pull request comments from the remote system.

func GetCommentsSinceHead

func GetCommentsSinceHead(c context.Context, u *model.User, r *model.Repo, num int) ([]*model.Comment, error)

GetCommentsSinceHead gets pull request comments from the remote system since the head commit was committed

func GetContents

func GetContents(c context.Context, u *model.User, r *model.Repo, path string) ([]byte, error)

GetContents gets the file contents from the remote system.

func GetHook

func GetHook(c context.Context, r *http.Request) (*model.Hook, error)

GetHook gets the hook from the http Request.

func GetMembers

func GetMembers(c context.Context, u *model.User, team string) ([]*model.Member, error)

GetMembers gets a team members list from the remote system.

func GetPRHook

func GetPRHook(c context.Context, r *http.Request) (*model.PRHook, error)

GetPRHook gets the pull request hook from the http Request.

func GetPerm

func GetPerm(c context.Context, u *model.User, owner, name string) (*model.Perm, error)

GetPerm gets a repository permission from the remote system.

func GetPullRequestsForCommit

func GetPullRequestsForCommit(c context.Context, u *model.User, r *model.Repo, sha *string) ([]model.PullRequest, error)

func GetRepo

func GetRepo(c context.Context, u *model.User, owner, name string) (*model.Repo, error)

GetRepo gets a repository from the remote system.

func GetRepos

func GetRepos(c context.Context, u *model.User) ([]*model.Repo, error)

GetRepos gets a repository list from the remote system.

func GetStatusHook

func GetStatusHook(c context.Context, r *http.Request) (*model.StatusHook, error)

GetStatusHook gets the status hook from the http Request.

func GetTeams

func GetTeams(c context.Context, u *model.User) ([]*model.Team, error)

GetTeams gets a team list from the remote system.

func GetUser

GetUser authenticates a user with the remote system.

func GetUserToken

func GetUserToken(c context.Context, token string) (string, error)

GetUserToken authenticates a user with the remote system using the remote systems OAuth token.

func ListTags

func ListTags(c context.Context, u *model.User, r *model.Repo) ([]model.Tag, error)

func MergePR

func MergePR(c context.Context, u *model.User, r *model.Repo, pullRequest model.PullRequest, approvers []*model.Person) (*string, error)

func ScheduleDeployment

func ScheduleDeployment(c context.Context, u *model.User, r *model.Repo, d model.DeploymentInfo) error

func SetHook

func SetHook(c context.Context, u *model.User, r *model.Repo, hook string) error

SetHook adds a webhook to the remote repository.

func SetStatus

func SetStatus(c context.Context, u *model.User, r *model.Repo, num int, ok bool) error

SetStatus adds or updates the pull request status in the remote system.

func Tag

func Tag(c context.Context, u *model.User, r *model.Repo, version *string, sha *string) error

func ToContext

func ToContext(c Setter, client Remote)

ToContext adds the Remote client to this context if it supports the Setter interface.

func WriteComment

func WriteComment(c context.Context, u *model.User, r *model.Repo, num int, message string) error

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 Comment

type Comment struct {
	Author string `json:"author"`
	Body   string `json:"body"`
}

Comment represents a user comment on an issue or pull request.

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 {
	// GetUser authenticates a user with the remote system.
	GetUser(http.ResponseWriter, *http.Request) (*model.User, error)

	// GetUserToken authenticates a user with the remote system using
	// the remote systems OAuth token.
	GetUserToken(string) (string, error)

	// GetTeams gets a team list from the remote system.
	GetTeams(*model.User) ([]*model.Team, error)

	// GetMembers gets a team member list from the remote system.
	GetMembers(*model.User, string) ([]*model.Member, error)

	// GetRepo gets a repository from the remote system.
	GetRepo(*model.User, string, string) (*model.Repo, error)

	// GetPerm gets a repository permission from the remote system.
	GetPerm(*model.User, string, string) (*model.Perm, error)

	// GetRepo gets a repository list from the remote system.
	GetRepos(*model.User) ([]*model.Repo, error)

	// SetHook adds a webhook to the remote repository.
	SetHook(*model.User, *model.Repo, string) error

	// DelHook deletes a webhook from the remote repository.
	DelHook(*model.User, *model.Repo, string) error

	// GetComments gets pull request comments from the remote system.
	GetComments(*model.User, *model.Repo, int) ([]*model.Comment, error)

	// GetComments gets pull request comments from the remote system since the head commit was committed.
	GetCommentsSinceHead(*model.User, *model.Repo, int) ([]*model.Comment, error)

	// GetContents gets the file contents from the remote system.
	GetContents(*model.User, *model.Repo, string) ([]byte, error)

	// SetStatus adds or updates the pull request status in the remote system.
	SetStatus(*model.User, *model.Repo, int, bool) error

	// GetHook gets the hook from the http Request.
	GetHook(r *http.Request) (*model.Hook, error)

	// GetStatusHook gets the status hook from the http Request.
	GetStatusHook(r *http.Request) (*model.StatusHook, error)

	// GetPRHook gets the pull request hook from the http Request.
	GetPRHook(r *http.Request) (*model.PRHook, error)

	// MergePR merges the named pull request from the remote system
	MergePR(u *model.User, r *model.Repo, pullRequest model.PullRequest, approvers []*model.Person) (*string, error)

	// GetMaxExistingTag finds the highest version across all tags
	ListTags(u *model.User, r *model.Repo) ([]model.Tag, error)

	// Tag applies a tag with the specified version to the specified sha
	Tag(u *model.User, r *model.Repo, version *string, sha *string) error

	// GetPullRequestsForCommit returns all pull requests associated with a commit SHA
	GetPullRequestsForCommit(u *model.User, r *model.Repo, sha *string) ([]model.PullRequest, error)

	// WriteComment puts a new comment from LGTM into the PR
	WriteComment(u *model.User, r *model.Repo, num int, message string) error

	ScheduleDeployment(u *model.User, r *model.Repo, d model.DeploymentInfo) error
}

func FromContext

func FromContext(c context.Context) Remote

FromContext returns the Remote client associated with this context.

type Setter

type Setter interface {
	Set(string, interface{})
}

Setter defines a context that enables setting values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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