github

package
v0.0.0-...-ef18f62 Latest Latest
Warning

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

Go to latest
Published: May 8, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventTypePull is a contant for Pull Request event type
	EventTypePull string = "pull"
	// EventTypePush is a contant for Push event type
	EventTypePush string = "push"
	// EventTypeTag is a contant for Tag event type
	EventTypeTag string = "tag"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client     *github.Client
	HTTPClient *http.Client
	Config     *Config
}

Client type.

func (Client) CreateHook

func (githubClient Client) CreateHook(owner, repo string) (hookID *int, err error)

CreateHook to create a hook on a repository.

func (Client) CreateStatus

func (githubClient Client) CreateStatus(owner, repo, ref, context, description, state string) error

CreateStatus creates a new status for a repository at the specified reference. The reference can be a SHA, a branch name, or a tag name.

func (Client) DeleteHook

func (githubClient Client) DeleteHook(owner, repo string, hookID int) error

DeleteHook to remove a hook on a repository.

func (Client) DownloadProjectContent

func (githubClient Client) DownloadProjectContent(owner, repo, ref string) (string, error)

DownloadProjectContent to download a whole repository with a specific reference (SHA).

func (Client) GetFileContent

func (githubClient Client) GetFileContent(owner, repo, path, ref string) ([]byte, error)

GetFileContent to download a file from a user's repository.

func (Client) GetFileSHA

func (githubClient Client) GetFileSHA(owner, repo, path, ref string) (string, error)

GetFileSHA to get the file SHA.

func (Client) GetOrganizations

func (githubClient Client) GetOrganizations() (organizations []github.Organization, err error)

GetOrganizations to retrieve the user's organizations.

func (Client) GetRepositories

func (githubClient Client) GetRepositories() (repositories []github.Repository, err error)

GetRepositories to retrieve the user's repositories.

func (Client) GetUser

func (githubClient Client) GetUser() (user *github.User, err error)

GetUser to get the user profile in GitHub.

type Config

type Config struct {
	Events    []string `json:"events"`
	EventsURL string   `json:"eventsUrl"`
}

Config type.

type Event

type Event struct {
	Type         string
	Branch       string
	Organization string
	Repository   string
	CloneURL     string
	SSHURL       string
	SHA          string
	Push         *EventPush
	Pull         *EventPull
}

Event type.

func ParseEvent

func ParseEvent(r *http.Request) (*Event, error)

ParseEvent to parse a GitHub event.

func ParsePullEvent

func ParsePullEvent(r *http.Request) (*Event, error)

ParsePullEvent to parse a pull request event.

func ParsePushEvent

func ParsePushEvent(r *http.Request) (*Event, error)

ParsePushEvent to parse a GitHub push event. It differentiates when the push corresponds to a tag.

type EventPull

type EventPull struct {
	Number  int
	HeadSHA string
}

EventPull type.

type EventPush

type EventPush struct {
}

EventPush type.

type ExtendedWebHookPayload

type ExtendedWebHookPayload struct {
	BaseRef *string        `json:"base_ref,omitempty"`
	Repo    *FixRepository `json:"repository,omitempty"`
	github.WebHookPayload
}

ExtendedWebHookPayload type.

type FixRepository

type FixRepository struct {
	Owner    *github.User `json:"owner,omitempty"`
	Name     *string      `json:"name,omitempty"`
	CloneURL *string      `json:"clone_url,omitempty"`
	SSHURL   *string      `json:"ssh_url,omitempty"`
}

FixRepository type.

See issue: https://github.com/google/go-github/issues/131

type Manager

type Manager struct {
	Config *Config
}

Manager type. Manager to use GitHub API.

func NewManager

func NewManager(config *Config) *Manager

NewManager is the constructor for a GitHug Manager.

func (Manager) NewClient

func (githubManager Manager) NewClient(httpClient *http.Client) *Client

NewClient is the constructor for a GitHub Client.

Jump to

Keyboard shortcuts

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