vcs

package
v0.0.0-...-6045d70 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GithubClient

type GithubClient struct {
	*github.Client
}

GithubClient is a wrapper around the github.client instance. It allows addition of custom method to the instance

func NewGithubClient

func NewGithubClient(token string) *GithubClient

NewGithubClient creates a new GithubClient with the given token The given token is passed to the underlying github.Client initialization

func (*GithubClient) IsRepoSubscribed

func (client *GithubClient) IsRepoSubscribed(params GithubRequestParams) bool

IsRepoSubscribed checks if the given repo has the sicuro webhook set

func (*GithubClient) Repo

func (client *GithubClient) Repo(params GithubRequestParams) (repo *github.Repository, err error)

Repo fetches and returns the github repo with the given params

func (*GithubClient) Subscribe

func (client *GithubClient) Subscribe(params GithubRequestParams) error

Subscribe adds the sicuro webhook to the given repo TODO: save the access token of the user subscribing a repo to the database to use for offline actions such as build status update

func (*GithubClient) UpdateBuildStatus

func (client *GithubClient) UpdateBuildStatus(params GithubRequestParams) func(string)

UpdateBuildStatus returns a function that when executed updates the repo status with the given status it takes the repo, owner and ref as args

func (*GithubClient) UserRepos

func (client *GithubClient) UserRepos() []*github.Repository

UserRepos returns a list of the github repos belongs to the user The user here refers to the owner of the access token used for the github client Although the github api allows to explicitly specify a user, For now let it default to the user owning the access token

type GithubRequestParams

type GithubRequestParams struct {
	// Repo is the request target repo
	Repo string
	// Owner refers to the owner of the request target repo
	Owner string
	// Ref is the target sha ref on the repo
	Ref string
	// Callback is a URL linking back to the site
	CallbackURL string
	// Creds is any credential or secret required for the request
	Creds string
}

GithubRequestParams is a collection of common params required by github related methods in this this package

Jump to

Keyboard shortcuts

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