github

package
v0.0.0-...-a4ee06b Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2017 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

Package github provides a simple client for the GitHub API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGitHubRequest

func NewGitHubRequest(path string) *http.Request

Returns a request set up for the GitHub API

func WasMentioned

func WasMentioned(c Comment) bool

Check to see if logged in user was mentioned in comment

Types

type Comment

type Comment struct {
	Body string `json:"body"`
	User User   `json:"user"`
}

type Error

type Error struct {
	Message          string `json:"message"`
	InvalidResources []InvalidResource
}

type Event

type Event struct {
	Action      string     `json:"action"`
	Issue       Issue      `json:"issue"`
	PullRequest Issue      `json:"pull_request"`
	Comment     Comment    `json:"comment"`
	Repository  Repository `json:"repository"`
}

func (Event) String

func (e Event) String() string

type GitRef

type GitRef struct {
	Ref        string     `json:"ref"`
	Sha        string     `json:"sha"`
	Repository Repository `json:"repo"`
}

type InvalidResource

type InvalidResource struct {
	Resource string `json:"resource"`
	Field    string `json:"field"`
	Code     string `json:"code"`
}

type Issue

type Issue struct {
	Body       string     `json:"body"`
	State      string     `json:"state"`
	Title      string     `json:"title"`
	Number     int        `json:"number"`
	Head       GitRef     `json:"head"`
	Base       GitRef     `json:"base"`
	Repository Repository `json:"repository"`
}

type PullRequest

type PullRequest struct {
	Body   string `json:"body"`
	State  string `json:"state"`
	Title  string `json:"title"`
	Number int    `json:"number"`
	Head   GitRef `json:"head"`
	Base   GitRef `json:"base"`
}

func (PullRequest) PostComment

func (pr PullRequest) PostComment(msg string) (Comment, error)

PostComment posts a new comment on pull request via GitHub API

type Repository

type Repository struct {
	FullName string `json:"full_name"`
	Name     string `json:"name"`
	GitUrl   string `json:"git_url"`
	SshUrl   string `json:"ssh_url"`
	Owner    User   `json:"owner"`
}

func (Repository) FindPR

func (r Repository) FindPR(number int) (*PullRequest, error)

type User

type User struct {
	ID    int    `json:"id"`
	Login string `json:"login"`
}

Jump to

Keyboard shortcuts

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