github

package
v0.0.0-...-e115b17 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2016 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHook

func CreateHook(client *github.Client, owner, name, url string) (*github.Hook, error)

CreateHook is a heper function that creates a post-commit hook for the specified repository.

func DeleteHook

func DeleteHook(client *github.Client, owner, name, url string) error

func GetFile

func GetFile(client *github.Client, owner, name, path, ref string) ([]byte, error)

GetFile is a heper function that retrieves a file from GitHub and returns its contents in byte array format.

func GetHook

func GetHook(client *github.Client, owner, name, rawurl string) (*github.Hook, error)

GetHook is a heper function that retrieves a hook by hostname. To do this, it will retrieve a list of all hooks and iterate through the list.

func GetUserRepos

func GetUserRepos(client *github.Client) ([]github.Repository, error)

GetUserRepos is a helper function that returns a list of all user repositories. Paginated results are aggregated into a single list.

Types

type Branch

type Branch struct {
	Protection struct {
		Enabled bool `json:"enabled"`
		Checks  struct {
			Enforcement string   `json:"enforcement_level"`
			Contexts    []string `json:"contexts"`
		} `json:"required_status_checks"`
	} `json:"protection"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(uri string) *Client

NewClient returns a client at the specified url.

func NewClientToken

func NewClientToken(uri, token string) *Client

NewClientToken returns a client at the specified url that authenticates all outbound requests with the given token.

func (*Client) Branch

func (c *Client) Branch(owner, name, branch string) (*Branch, error)

func (*Client) BranchProtect

func (c *Client) BranchProtect(owner, name, branch string, in *Branch) error

func (*Client) SetClient

func (c *Client) SetClient(client *http.Client)

SetClient sets the default http client. This should be used in conjunction with golang.org/x/oauth2 to authenticate requests to the server.

type Error

type Error struct {
	Message string `json:"message"`
}

func (Error) Error

func (e Error) Error() string

func (Error) String

func (e Error) String() string

type Github

type Github struct {
	URL    string
	API    string
	Client string
	Secret string
	Scopes []string
}

func (*Github) DelHook

func (g *Github) DelHook(user *model.User, repo *model.Repo, link string) error

func (*Github) GetComments

func (g *Github) GetComments(u *model.User, r *model.Repo, num int) ([]*model.Comment, error)

func (*Github) GetContents

func (g *Github) GetContents(u *model.User, r *model.Repo, path string) ([]byte, error)

func (*Github) GetHook

func (g *Github) GetHook(r *http.Request) (*model.Hook, error)

func (*Github) GetMembers

func (g *Github) GetMembers(user *model.User, team string) ([]*model.Member, error)

func (*Github) GetPerm

func (g *Github) GetPerm(user *model.User, owner, name string) (*model.Perm, error)

func (*Github) GetRepo

func (g *Github) GetRepo(user *model.User, owner, name string) (*model.Repo, error)

func (*Github) GetRepos

func (g *Github) GetRepos(u *model.User) ([]*model.Repo, error)

func (*Github) GetTeams

func (g *Github) GetTeams(user *model.User) ([]*model.Team, error)

func (*Github) GetUser

func (g *Github) GetUser(res http.ResponseWriter, req *http.Request) (*model.User, error)

func (*Github) GetUserToken

func (g *Github) GetUserToken(token string) (string, error)

func (*Github) SetHook

func (g *Github) SetHook(user *model.User, repo *model.Repo, link string) error

func (*Github) SetStatus

func (g *Github) SetStatus(u *model.User, r *model.Repo, num, granted, required int) error

Jump to

Keyboard shortcuts

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