github

package
v0.0.0-...-b425644 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ApiRoot     = "https://api.github.com"
	UploadsRoot = "https://uploads.github.com"
)
View Source
const (
	IssueStateClosed = "closed"
	IssueStateOpen   = "open"
	IssueStateAll    = "all"

	IssueSortCreated  = "created"
	IssueSortUpdated  = "updated"
	IssueSortComments = "comments"

	IssueAssigneeNonde = "none"
	IssueAssigneeAny   = "*"

	IssueSortDesc = "desc"
	IssueSortAsc  = "asc"
)
View Source
const (
	PullRequestStateClosed = "closed"
	PullRequestStateOpen   = "open"
	PullRequestStateAll    = "all"

	PullRequestSortCreated    = "created"
	PullRequestSortUpdated    = "updated"
	PullRequestSortPopularity = "popularity"

	PullRequestSortDesc = "desc"
	PullRequestSortAsc  = "asc"
)

Variables

This section is empty.

Functions

func NewHttpClient

func NewHttpClient(token string) *http.Client

func OauthToken

func OauthToken(clientId string, clientSecret string) (token string, e error)

Types

type Base

type Base struct {
	Label string      `json:"label"` // "new-topic",
	Ref   string      `json:"ref"`   // "new-topic",
	Sha   string      `json:"sha"`   // "6dcb09b5b57875f334f61aebed695e2e4193db5e",
	User  *User       `json:"user"`
	Repo  *Repository `json:"repo"`
}

type Branch

type Branch struct {
	Name   string  `json:"name"`
	Commit *Commit `json:"commit"`
	Links  *Links  `json:"_links"`
}

type Client

type Client struct {
	*http.Client
}

func New

func New(token string) (*Client, error)

type Commit

type Commit struct {
	Url       string         `json:"url"` // "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
	Sha       string         `json:"sha"` // "6dcb09b5b57875f334f61aebed695e2e4193db5e",
	Commit    *CommitDetails `json:"commit"`
	Author    *User          `json:"author"`
	Committer *User          `json:"committer"`
	Parents   []*Tree        `json:"parents"`
}

type CommitDetails

type CommitDetails struct {
	Url       string             `json:"url"`
	Author    *CommitUserDetails `json:"author"`
	Committer *CommitUserDetails `json:"committer"`
	Message   string             `json:"message"` // "Fix all the bugs",
	Tree      *Tree              `json:"tree"`
}

type CommitUserDetails

type CommitUserDetails struct {
	Name  string    `json:"name"`  // "Monalisa Octocat",
	Email string    `json:"email"` // "support@github.com",
	Date  time.Time `json:"date"`  // "2011-04-14T16:00:49Z"
}

type Content

type Content struct {
	Type    string `json:"type"`     // "file",
	Size    int64  `json:"size"`     // 625,
	Name    string `json:"name"`     // "octokit.rb",
	Path    string `json:"path"`     // "lib/octokit.rb",
	Sha     string `json:"sha"`      // "fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
	Url     string `json:"url"`      // "https://api.github.com/repos/pengwynn/octokit/contents/lib/octokit.rb",
	GitUrl  string `json:"git_url"`  // "https://api.github.com/repos/pengwynn/octokit/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
	HtmlUrl string `json:"html_url"` // "https://github.com/pengwynn/octokit/blob/master/lib/octokit.rb",
	Links   *Links `json:"_links"`
}

type CreateIssue

type CreateIssue struct {
	Repo      string   `json:"-"`
	Number    int      `json:"-"`
	Title     string   `json:"title,omitempty"`
	Body      string   `json:"body,omitempty"`
	Assignee  string   `json:"assignee,omitempty"`
	Milestone int      `json:"milestone,omitempty"`
	State     string   `json:"state,omitempty"`
	Labels    []string `json:"labels,omitempty"`
}

func (*CreateIssue) Create

func (c *CreateIssue) Create(client *Client) (*Issue, error)

func (*CreateIssue) Update

func (c *CreateIssue) Update(client *Client) (*Issue, error)

type GetContents

type GetContents struct {
	Owner string
	Repo  string
	Path  string
	Ref   string
}

http://developer.github.com/v3/repos/contents/#get-contents

func (*GetContents) Execute

func (action *GetContents) Execute(client *Client) ([]*Content, error)
type Head struct {
	Label string      `json:"label"` // "new-topic",
	Ref   string      `json:"ref"`   // "new-topic",
	Sha   string      `json:"sha"`   // "6dcb09b5b57875f334f61aebed695e2e4193db5e",
	User  *User       `json:"user"`
	Repo  *Repository `json:"repo"`
}

type Issue

type Issue struct {
	Url         string       `json:"url,omitempty"`      // "https://api.github.com/repos/octocat/Hello-World/issues/1347",
	HtmlUrl     string       `json:"html_url,omitempty"` // "https://github.com/octocat/Hello-World/issues/1347",
	Number      int          `json:"number,omitempty"`   // 1347,
	State       string       `json:"state,omitempty"`    // "open",
	Title       string       `json:"title,omitempty"`    // "Found a bug",
	Body        string       `json:"body,omitempty"`     // "I'm having a problem with this.",
	User        *User        `json:"user,omitempty"`
	Assignee    *User        `json:"assignee,omitempty"`
	Labels      []*Label     `json:"labels,omitempty"`
	Milestone   *Milestone   `json:"milestone,omitempty"`
	Commens     int          `json:"comments,omitempty"`
	PullRequest *PullRequest `json:"pull_request,omitempty"`
	ClosedAt    string       `json:"closed_at,omitempty"`  // null,
	CreatedAt   string       `json:"created_at,omitempty"` // "2011-04-22T13:33:48Z",
	UpdatedAt   string       `json:"updated_at,omitempty"` // "2011-04-22T13:33:48Z"
}

func (*Issue) Repo

func (i *Issue) Repo() (string, string, error)

type Label

type Label struct {
	Url   string `json:"url"`   // "https://api.github.com/repos/octocat/Hello-World/labels/bug",
	Name  string `json:"name"`  // "bug",
	Color string `json:"color"` // "f29513"
}
type Link struct {
	Last  string
	Next  string
	Prev  string
	First string
}
func ParseLink(s string) *Link
type Links struct {
	Html string `json:"html"`
	Self string `json:"self"`
}

type ListCommits

type ListCommits struct {
	Org    string
	Repo   string
	Sha    string
	Path   string
	Author string
	Since  time.Time
	Until  time.Time
}

func (*ListCommits) Execute

func (a *ListCommits) Execute(client *Client) ([]*Commit, error)

type ListIssues

type ListIssues struct {
	Repo      string // orga/repo
	Milestone int
	State     string
	Assignee  string
	Creator   string
	Mentioned string
	Labels    []string
	Sort      string
	Direction string
	Since     time.Time
}

func (*ListIssues) Execute

func (a *ListIssues) Execute(client *Client) ([]*Issue, error)

type ListPullRequests

type ListPullRequests struct {
	Org       string
	Repo      string
	State     string
	Sort      string
	Direction string
}

func (*ListPullRequests) Execute

func (a *ListPullRequests) Execute(client *Client) ([]*PullRequest, error)

type LoadIssue

type LoadIssue struct {
	Repo   string
	Number int
}

func (*LoadIssue) Execute

func (i *LoadIssue) Execute(client *Client) (*Issue, error)

type Milestone

type Milestone struct {
	Url          string `json:"url"`         // "https://api.github.com/repos/octocat/Hello-World/milestones/1",
	Number       int    `json:"number"`      // 1,
	State        string `json:"state"`       // "open",
	Title        string `json:"title"`       // "v1.0",
	Description  string `json:"description"` // "",
	Creator      *User  `json:"creator"`
	OpenIssues   int    `json:"open_issues"`          // 4,
	ClosedIssues int    `json:"closed_issues"`        // 8,
	CreatedAt    string `json:"created_at,omitempty"` // "2011-04-10T20:09:31Z",
	UpdatedAt    string `json:"updated_at,omitempty"` // "2014-03-03T18:58:10Z",
	DueOn        string `json:"due_on,omitempty"`     // null
}

type PullRequest

type PullRequest struct {
	Url               string     `json:"url"`                  // "https://api.github.com/repos/octocat/Hello-World/pulls/1",
	HtmlUrl           string     `json:"html_url"`             // "https://github.com/octocat/Hello-World/pull/1",
	DiffUrl           string     `json:"diff_url"`             // "https://github.com/octocat/Hello-World/pulls/1.diff",
	PatchUrl          string     `json:"patch_url"`            // "https://github.com/octocat/Hello-World/pulls/1.patch"
	IssueUrl          string     `json:"issue_url"`            // "https://api.github.com/repos/octocat/Hello-World/issues/1"
	CommitsUrl        string     `json:"commits_url"`          // "https://api.github.com/repos/octocat/Hello-World/pulls/1/commits"
	ReviewCommentsUrl string     `json:"review_comments_url"`  //  "https://api.github.com/repos/octocat/Hello-World/pulls/1/comments"
	ReviewCommentUrl  string     `json:"review_comment_url"`   // "https://api.github.com/repos/octocat/Hello-World/pulls/comments/{number}"
	CommentsUrl       string     `json:"comments_url"`         // "https://api.github.com/repos/octocat/Hello-World/issues/1/comments"
	StatusesUrl       string     `json:"statuses_url"`         // "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
	Number            int        `json:"number"`               // "1"
	State             string     `json:"state"`                // "open"
	Title             string     `json:"title"`                // "new-feature"
	Body              string     `json:"body"`                 // "Please pull these awesome changes"
	CreatedAt         *time.Time `json:"created_at,omitempty"` // "2011-01-26T19:01:12Z",
	UpdatedAt         *time.Time `json:"updated_at,omitempty"` // "2011-01-26T19:14:43Z",
	ClosedAt          *time.Time `json:"closed_at,omitempty"`  // "2011-01-26T19:06:43Z",
	MergedAt          *time.Time `json:"merged_at,omitempty"`  // "2011-01-26T19:06:43Z",
}

type Repository

type Repository struct {
	Id          int    `json:"id"`
	Owner       *User  `json:"owner"`
	Name        string `json:"name"`        // "Hello-World",
	FullName    string `json:"full_name"`   // "octocat/Hello-World",
	Description string `json:"description"` // "This your first repo!",
	Private     bool   `json:"private"`     // false,
	Fork        bool   `json:"fork"`        // false,
	Url         string `json:"url"`         // "https://api.github.com/repos/octocat/Hello-World",
	HtmlUrl     string `json:"html_url"`    // "https://github.com/octocat/Hello-World",
	CloneUrl    string `json:"clone_url"`   // "https://github.com/octocat/Hello-World.git",
	GitUrl      string `json:"git_url"`     // "git://github.com/octocat/Hello-World.git",
	SshUrl      string `json:"ssh_url"`     // "git@github.com:octocat/Hello-World.git",
	SvnUrl      string `json:"svn_url"`     // "https://svn.github.com/octocat/Hello-World",
	MirrorUrl   string `json:"mirror_url"`  // "git://git.example.com/octocat/Hello-World",
	Homepage    string `json:"homepage"`    // "https://github.com",
	//Language        string `json:"language"`          // null,
	ForksCount      int             `json:"forks_count"`          // 9,
	StargazersCount int             `json:"stargazers_count"`     // 80,
	WatchersCount   int             `json:"watchers_count"`       // 80,
	Size            int             `json:"size"`                 // 108,
	DefaultBranch   string          `json:"default_branch"`       // "master",
	OpenIssuesCount int             `json:"open_issues_count"`    // 0,
	HasIssues       bool            `json:"has_issues"`           // true,
	HasWiki         bool            `json:"has_wiki"`             // true,
	HasDownloads    bool            `json:"has_downloads"`        // true,
	PushedAt        string          `json:"pushed_at,omitempty"`  // "2011-01-26T19:06:43Z",
	CreatedAt       string          `json:"created_at,omitempty"` // "2011-01-26T19:01:12Z",
	UpdatedAt       string          `json:"updated_at,omitempty"` // "2011-01-26T19:14:43Z",
	Permissions     map[string]bool `json:"permissions"`
}

type Tree

type Tree struct {
	Url string `json:"url"` // "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
	Sha string `json:"sha"` // "6dcb09b5b57875f334f61aebed695e2e4193db5e"
}

type User

type User struct {
	Login             string `json:"login"`               // "octocat",
	Id                int64  `json:"id"`                  // 1,
	AvatarUrl         string `json:"avatar_url"`          // "https://github.com/images/error/octocat_happy.gif",
	GravatarId        string `json:"gravatar_id"`         // "somehexcode",
	Url               string `json:"url"`                 // "https://api.github.com/users/octocat",
	HtmlUrl           string `json:"html_url"`            // "https://github.com/octocat",
	FollowersUrl      string `json:"followers_url"`       // "https://api.github.com/users/octocat/followers",
	FollowingUrl      string `json:"following_url"`       // "https://api.github.com/users/octocat/following{/other_user}",
	GistsUrl          string `json:"gists_url"`           // "https://api.github.com/users/octocat/gists{/gist_id}",
	StarredUrl        string `json:"starred_url"`         // "https://api.github.com/users/octocat/starred{/owner}{/repo}",
	SubscriptionsUrl  string `json:"subscriptions_url"`   // "https://api.github.com/users/octocat/subscriptions",
	OrganizationsUrl  string `json:"organizations_url"`   // "https://api.github.com/users/octocat/orgs",
	ReposUrl          string `json:"repos_url"`           // "https://api.github.com/users/octocat/repos",
	EventsUrl         string `json:"events_url"`          // "https://api.github.com/users/octocat/events{/privacy}",
	ReceivedEventsUrl string `json:"received_events_url"` // "https://api.github.com/users/octocat/received_events",
	Type              string `json:"type"`                // "User",
	SiteAdmin         bool   `json:"site_admin"`          // false
	Name              string `json:"name"`                // "monalisa octocat",
	Company           string `json:"company"`             // "GitHub",
	Blog              string `json:"blog"`                // "https://github.com/blog",
	Location          string `json:"location"`            // "San Francisco",
	Email             string `json:"email"`               // "octocat@github.com",
	Hireable          bool   `json:"hireable"`            // false,
	Bio               string `json:"bio"`                 // "There once was...",
	PublicRepos       int    `json:"public_repos"`        // 2,
	PublicGists       int    `json:"public_gists"`        // 1,
	Followers         int    `json:"followers"`           // 20,
	Following         int    `json:"following"`           // 0,
	CreatedAt         string `json:"created_at"`          // "2008-01-14T04:33:35Z",
	UpdatedAt         string `json:"updated_at"`          // "2008-01-14T04:33:35Z"
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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