octokat

package module
v0.0.0-...-076a322 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2016 License: MIT Imports: 12 Imported by: 32

README

Octokat Build Status

Simple Go wrapper for the GitHub API. It's extracted from my other project. The API is inspired by octokit.rb.

GoDoc

https://godoc.org/github.com/crosbymichael/octokat

Example

Show a user

package main

import "github.com/crosbymichael/octokat"

func main() {
    client := octokat.NewClient()
    user, err := client.User("jingweno", nil)
    // Do something with user
}

List authorizations

package main

import "github.com/crosbymichael/octokat"

func main() {
    client := octokat.NewClient().WithLogin("LOGIN", "PASSWORD")
    authorizations, err := client.Authorizations(nil)
    // Do something with authorizations
}

Create a pull request

package main

import "github.com/crosbymichael/octokat"

func main() {
    client := octokat.NewClient().WithToken("OAUTH_TOKEN")
    repo := octokat.Repo{Name: "octokat", UserName: "jingweno"}
    params := octokat.PullRequestParams{Base: "master", Head: "feature", Title: "A pull request", Body: "A body"}
    options := octokat.Options{Params: params}
    pullRequest, err := client.CreatePullRequest(repo, &options)
    // Do something with pullRequest
}

Release Notes

See Releases.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

octokat is released under the MIT license. See LICENSE.md.

Documentation

Index

Constants

View Source
const (
	GitHubURL          = "https://github.com"
	GitHubAPIURL       = "https://api.github.com"
	UserAgent          = "Octokat Go " + Version
	MediaType          = "application/vnd.github.beta+json"
	DefaultContentType = "application/json"
	PreviewMediaType   = "application/vnd.github.manifold-preview"
	Version            = "0.3.0"
)

Variables

View Source
var ErrInvalidPostReceiveHook = errors.New("Invalid Post Receive Hook")

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	Token     string `json:"access_token,omitempty"`
	TokenType string `json:"token_type,omitempty"`
}

func CreateAccessToken

func CreateAccessToken(options *Options) (accessToken *AccessToken, err error)

type AccessTokenParams

type AccessTokenParams struct {
	ClientID     string `json:"client_id,omitempty"`
	ClientSecret string `json:"client_secret,omitempty"`
	Code         string `json:"code,omitempty"`
	RedirectURI  string `json:"redirect_uri,omitempty"`
}

type App

type App struct {
	ClientID string `json:"client_id,omitempty"`
	URL      string `json:"url,omitempty"`
	Name     string `json:"name,omitempty"`
}

type Asset

type Asset struct {
	ID            int       `json:"id,omitempty"`
	Name          string    `json:"name,omitempty"`
	Label         string    `json:"label,omitempty"`
	ContentType   string    `json:"content_type,omitempty"`
	State         string    `json:"state,omitempty"`
	Size          int       `json:"size,omitempty"`
	DownloadCount int       `json:"download_count,omitempty"`
	URL           string    `json:"url,omitempty"`
	CreatedAt     time.Time `json:"created_at,omitempty"`
	UpdatedAt     time.Time `json:"updated_at,omitempty"`
}

type Authorization

type Authorization struct {
	ID        int       `json:"id,omitempty"`
	URL       string    `json:"url,omitempty"`
	App       App       `json:"app,omitempty"`
	Token     string    `json:"token,omitempty"`
	Note      string    `json:"note,omitempty"`
	NoteURL   string    `json:"note_url,omitempty"`
	Scopes    []string  `json:"scopes,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

type AuthorizationParams

type AuthorizationParams struct {
	Scopes       []string `json:"scopes,omitempty"`
	Note         string   `json:"note,omitempty"`
	NoteURL      string   `json:"note_url,omitempty"`
	ClientID     string   `json:"client_id,omitempty"`
	ClientSecret string   `json:"client_secret,omitempty"`
}

type Client

type Client struct {
	BaseURL  string
	Login    string
	Password string
	Token    string
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) AddComment

func (c *Client) AddComment(repo Repo, number, body string) (comment Comment, err error)

Add a comment to an issue or pull request

See http://developer.github.com/v3/issues/comments/#create-a-comment

func (*Client) ApplyLabel

func (c *Client) ApplyLabel(repo Repo, issue *Issue, labels []string) error

func (*Client) Authorizations

func (c *Client) Authorizations(options *Options) (auths []Authorization, err error)

List the authenticated user's authorizations

API for users to manage their own tokens. You can only access your own tokens, and only through Basic Authentication.

See http://developer.github.com/v3/oauth/#list-your-authorizations

func (*Client) CombinedStatus

func (c *Client) CombinedStatus(repo Repo, sha string, options *Options) (status CombinedStatus, err error)

func (*Client) Comments

func (c *Client) Comments(repo Repo, number string, options *Options) (comments []Comment, err error)

Get comments for an issue for pull request

See http://developer.github.com/v3/pulls/comments/

func (*Client) Commit

func (c *Client) Commit(repo Repo, ref string, options *Options) (commit Commit, err error)

func (*Client) Commits

func (c *Client) Commits(repo Repo, number string, options *Options) (commits []Commit, err error)

func (*Client) Contributors

func (c *Client) Contributors(repo Repo, options *Options) (contributors []*Contributor, err error)

Get a list of contributors

http://developer.github.com/v3/repos/statistics/#contributors

func (*Client) CreateAuthorization

func (c *Client) CreateAuthorization(options *Options) (auth *Authorization, err error)

Create an authorization for the authenticated user.

You can create your own tokens, and only through Basic Authentication.

See http://developer.github.com/v3/oauth/#scopes Available scopes See http://developer.github.com/v3/oauth/#create-a-new-authorization

func (*Client) CreateGist

func (c *Client) CreateGist(desc string, public bool, files map[string]File) (gist Gist, err error)

func (*Client) CreateRelease

func (c *Client) CreateRelease(repo Repo, options *Options) (release *Release, err error)

Create a release

See http://developer.github.com/v3/repos/releases/#create-a-release

func (*Client) CreateRepository

func (c *Client) CreateRepository(org string, options *Options) (repository *Repository, err error)

Create a repository for a user or organization

If org is not specified, create a repository for current user.

See http://developer.github.com/v3/repos/#create

func (*Client) Fork

func (c *Client) Fork(repo Repo, options *Options) (repository *Repository, err error)

Fork a repository

See http://developer.github.com/v3/repos/forks/#create-a-fork

func (*Client) Issue

func (c *Client) Issue(repo Repo, number int, options *Options) (issue *Issue, err error)

Fetch a single issue

See http://developer.github.com/v3/issues/#get-a-single-issue

func (*Client) Issues

func (c *Client) Issues(repo Repo, options *Options) (issues []*Issue, err error)

List issues

See http://developer.github.com/v3/issues/#list-issues-for-a-repository

func (*Client) Labels

func (c *Client) Labels(repo Repo) (labels []*Label, err error)

func (*Client) MergePullRequest

func (c *Client) MergePullRequest(repo Repo, number string, options *Options) (merge Merge, err error)

Merge a pull request

See http://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade

func (*Client) OrganizationRepositories

func (c *Client) OrganizationRepositories(org string, options *Options) (repos []Repository, err error)

func (*Client) Organizations

func (c *Client) Organizations(user string, options *Options) (orgs []Organization, err error)

func (*Client) PatchComment

func (c *Client) PatchComment(repo Repo, number, body string) (comment Comment, err error)

Add a comment to an issue or pull request

See https://developer.github.com/v3/issues/comments/#edit-a-comment

func (*Client) PatchIssue

func (c *Client) PatchIssue(repo Repo, number string, options *Options) (patchedIssue *Issue, err error)

Edit an issue

See http://developer.github.com/v3/issues/#edit-an-issue

func (*Client) PullRequest

func (c *Client) PullRequest(repo Repo, number string, options *Options) (pr *PullRequest, err error)

Get a pull request

See http://developer.github.com/v3/pulls/#get-a-single-pull-request

func (*Client) PullRequestFiles

func (c *Client) PullRequestFiles(repo Repo, number string, options *Options) (prfs []*PullRequestFile, err error)

Get all pull request files

See http://developer.github.com/v3/pulls/#list-pull-requests-files

func (*Client) PullRequests

func (c *Client) PullRequests(repo Repo, options *Options) (prs []*PullRequest, err error)

Get all pull requests

See http://developer.github.com/v3/pulls/#list-pull-requests

func (*Client) Releases

func (c *Client) Releases(repo Repo, options *Options) (releases []Release, err error)

List releases for a repository

http://developer.github.com/v3/repos/releases/#list-releases-for-a-repository

func (*Client) RemoveComment

func (c *Client) RemoveComment(repo Repo, commentId int) error

func (*Client) RemoveLabel

func (c *Client) RemoveLabel(repo Repo, issue *Issue, label string) error

func (*Client) Repositories

func (c *Client) Repositories(username string, options *Options) (repositories []Repository, err error)

List repositories

If username is not supplied, repositories for the current authenticated user are returned

See http://developer.github.com/v3/repos/#list-your-repositories

func (*Client) Repository

func (c *Client) Repository(repo Repo, options *Options) (repository *Repository, err error)

Get a single repository

See http://developer.github.com/v3/repos/#get

func (*Client) Root

func (c *Client) Root(options *Options) (root *Root, err error)

func (*Client) SearchIssues

func (c *Client) SearchIssues(query string, options *Options) (issues []*SearchItem, err error)

Search issues

See http://developer.github.com/v3/search/#search-issues

func (*Client) SetStatus

func (c *Client) SetStatus(repo Repo, sha string, options *StatusOptions) (status *Status, err error)

Set a status for a given sha

See https://developer.github.com/v3/repos/statuses/#create-a-status

func (*Client) Statuses

func (c *Client) Statuses(repo Repo, sha string, options *Options) (statuses []Status, err error)

List all statuses for a given commit

See http://developer.github.com/v3/repos/statuses

func (*Client) User

func (c *Client) User(login string, options *Options) (user *User, err error)

func (*Client) WithHTTPClient

func (c *Client) WithHTTPClient(httpClient *http.Client) *Client

func (*Client) WithLogin

func (c *Client) WithLogin(login, password string) *Client

func (*Client) WithToken

func (c *Client) WithToken(token string) *Client

type CombinedStatus

type CombinedStatus struct {
	State      string   `json:"state"`
	Sha        string   `json:"sha"`
	TotalCount int      `json:"total_count"`
	Statuses   []Status `json:"statuses"`
}

type Comment

type Comment struct {
	Url       string    `json:"url,omitempty,omitempty"`
	Id        int       `json:"id,omitempty"`
	Body      string    `json:"body,omitempty"`
	Path      string    `json:"path,omitempty"`
	Position  int       `json:"position,omitempty"`
	User      User      `json:"user,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

type Commit

type Commit struct {
	Label       string        `json:"label,omitempty"`
	Ref         string        `json:"ref,omitempty"`
	User        User          `json:"user,omitempty"`
	Repo        Repository    `json:"repo,omitempty"`
	CommentsURL string        `json:"comments_url,omitempty"`
	Commit      *CommitCommit `json:"commit,omitempty"`
	Files       []CommitFile  `json:"files,omitempty"`
	HtmlURL     string        `json:"html_url,omitempty"`
	Parents     []Commit      `json:"parents,omitempty"`
	Sha         string        `json:"sha,omitempty"`
	Stats       CommitStats   `json:"stats,omitempty"`
	URL         string        `json:"url,omitempty"`
}

type CommitCommit

type CommitCommit struct {
	Author struct {
		Date  *time.Time `json:"date,omitempty"`
		Email string     `json:"email,omitempty"`
		Name  string     `json:"name,omitempty"`
	} `json:"author,omitempty"`
	CommentCount int `json:"comment_count,omitempty"`
	Committer    struct {
		Date  *time.Time `json:"date,omitempty"`
		Email string     `json:"email,omitempty"`
		Name  string     `json:"name,omitempty"`
	} `json:"committer,omitempty"`
	Message string `json:"message,omitempty"`
	Tree    struct {
		Sha string `json:"sha,omitempty"`
		URL string `json:"url,omitempty"`
	} `json:"tree,omitempty"`
	URL string `json:"url,omitempty"`
}

type CommitFile

type CommitFile struct {
	Additions   int    `json:"additions,omitempty"`
	BlobURL     string `json:"blob_url,omitempty"`
	Changes     int    `json:"changes,omitempty"`
	ContentsURL string `json:"contents_url,omitempty"`
	Deletions   int    `json:"deletions,omitempty"`
	Filename    string `json:"filename,omitempty"`
	Patch       string `json:"patch,omitempty"`
	RawURL      string `json:"raw_url,omitempty"`
	Sha         string `json:"sha,omitempty"`
	Status      string `json:"status,omitempty"`
}

type CommitStats

type CommitStats struct {
	Additions int `json:"additions,omitempty"`
	Deletions int `json:"deletions,omitempty"`
	Total     int `json:"total,omitempty"`
}

type Contributor

type Contributor struct {
	Total int `json:"total,omitempty"`
	Weeks []struct {
		WeekStart int `json:"w,omitempty"`
		Additions int `json:"a,omitempty"`
		Deletions int `json:"d,omitempty"`
		Commits   int `json:"c,omitempty"`
	} `json:"weeks,omitempty"`
	Author struct {
		Login             string `json:"login,omitempty"`
		Id                int    `json:"id,omitempty"`
		AvatarURL         string `json:"avatar_url,omitempty"`
		GravatarID        string `json:"gravatar_id,omitempty"`
		URL               string `json:"url,omitempty"`
		HTMLURL           string `json:"html_url,omitempty"`
		FollowersURL      string `json:"followers_url,omitempty"`
		FollowingURL      string `json:"following_url,omitempty"`
		GistsURL          string `json:"gists_url,omitempty"`
		StarredURL        string `json:"starred_url,omitempty"`
		SubscriptionsURL  string `json:"subscriptions_url,omitempty"`
		OrganizationsURL  string `json:"organizations_url,omitempty"`
		ReposURL          string `json:"repos_url,omitempty"`
		EventsURL         string `json:"events_url,omitempty"`
		ReceivedEventsURL string `json:"received_events_url,omitempty"`
		Type              string `json:"type,omitempty"`
		SiteAdmin         bool   `json:"site_admin,omitempty"`
	} `json:"author,omitempty"`
}

type File

type File struct {
	Filename string `json:"filename,omitempty"`
	RawUrl   string `json:"raw_url,omitempty"`
	Type     string `json:"type,omitempty"`
	Language string `json:"language,omitempty"`
	Size     int64  `json:"size,omitempty"`
	Content  string `json:"content,omitempty"`
}

type Gist

type Gist struct {
	Id          string    `json:"id,omitempty"`
	Public      bool      `json:"public,omitempty"`
	Description string    `json:"description,omitempty"`
	HtmlUrl     string    `json:"html_url,omitempty"`
	Url         string    `json:"url,omitempty"`
	Files       File      `json:"files,omitempty"`
	User        User      `json:"user,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
}

type Headers

type Headers map[string]string
type Hyperlink struct {
	Rel  string
	Href string
	// contains filtered or unexported fields
}

func (*Hyperlink) Get

func (l *Hyperlink) Get(v interface{}, options *Options) (err error)

type Issue

type Issue struct {
	URL       string   `json:"url,omitempty,omitempty"`
	HTMLURL   string   `json:"html_url,omitempty,omitempty"`
	Number    int      `json:"number,omitempty"`
	State     string   `json:"state,omitempty"`
	Title     string   `json:"title,omitempty"`
	Body      string   `json:"body,omitempty"`
	User      User     `json:"user,omitempty"`
	Labels    []*Label `json:"labels,omitempty"`
	Assignee  User     `json:"assignee,omitempty"`
	Milestone struct {
		URL          string     `json:"url,omitempty"`
		Number       int        `json:"number,omitempty"`
		State        string     `json:"state,omitempty"`
		Title        string     `json:"title,omitempty"`
		Description  string     `json:"description,omitempty"`
		Creator      User       `json:"creator,omitempty"`
		OpenIssues   int        `json:"open_issues,omitempty"`
		ClosedIssues int        `json:"closed_issues,omitempty"`
		CreatedAt    time.Time  `json:"created_at,omitempty"`
		DueOn        *time.Time `json:"due_on,omitempty"`
	}
	Comments    int `json:"comments,omitempty"`
	PullRequest struct {
		HTMLURL  string `json:"html_url,omitempty"`
		DiffURL  string `json:"diff_url,omitempty"`
		PatchURL string `json:"patch_url,omitempty"`
	} `json:"pull_request,omitempty"`
	CreatedAt time.Time  `json:"created_at,omitempty"`
	ClosedAt  *time.Time `json:"closed_at,omitempty"`
	UpdatedAt time.Time  `json:"updated_at,omitempty"`
}

type IssueHook

type IssueHook struct {
	Action  string      `json:"action"`
	Sender  *User       `json:"sender"`
	Repo    *Repository `json:"repository"`
	Issue   *Issue      `json:"issue"`
	Comment *Comment    `json:"comment, omitempty"`
}

func ParseIssueHook

func ParseIssueHook(raw []byte) (*IssueHook, error)

func (*IssueHook) IsComment

func (h *IssueHook) IsComment() bool

we will know if it is a comment if the Action is "created" since with NSQ we can't parse the headers

func (*IssueHook) IsOpened

func (h *IssueHook) IsOpened() bool

type Label

type Label struct {
	URL   string `json:"url,omitempty"`
	Name  string `json:"name,omitempty"`
	Color string `json:"color,omitempty"`
}

type Merge

type Merge struct {
	Sha     string `json:"sha,omitempty"`
	Merged  bool   `json:"merged,omitempty"`
	Message string `json:"message,omitempty"`
}

type Options

type Options struct {
	Headers     Headers
	Params      interface{}
	QueryParams map[string]string
}

type Organization

type Organization struct {
	AvatarURL        string `json:"avatar_url,omitempty"`
	PublicMembersURL string `json:"public_member_url,omitempty"`
	MembersURL       string `json:"members_url,omitempty"`
	EventsURL        string `json:"events_url,omitempty"`
	ReposURL         string `json:"repos_url,omitempty"`
	URL              string `json:"url,omitempty"`
	ID               int    `json:"id,omitempty"`
	Login            string `json:"login,omitempty"`
}

type Params

type Params map[string]interface{}

func (Params) Delete

func (p Params) Delete(key string) interface{}

func (Params) Put

func (p Params) Put(key string, value interface{}) interface{}

func (Params) Require

func (p Params) Require(fields ...string) error

func (Params) Size

func (p Params) Size() int

type PostReceiveHook

type PostReceiveHook struct {
	Before  string      `json:"before"`
	After   string      `json:"after"`
	Ref     string      `json:"ref"`
	Repo    *Repository `json:"repository"`
	Commits []*Commit   `json:"commits"`
	Head    *Commit     `json:"head_commit"`
	Deleted bool        `json:"deleted"`
}

func ParseHook

func ParseHook(raw []byte) (*PostReceiveHook, error)

func (*PostReceiveHook) Branch

func (h *PostReceiveHook) Branch() string

func (*PostReceiveHook) IsDeleted

func (h *PostReceiveHook) IsDeleted() bool

func (*PostReceiveHook) IsGithubPages

func (h *PostReceiveHook) IsGithubPages() bool

func (*PostReceiveHook) IsHead

func (h *PostReceiveHook) IsHead() bool

func (*PostReceiveHook) IsTag

func (h *PostReceiveHook) IsTag() bool

type PullRequest

type PullRequest struct {
	URL               string     `json:"url,omitempty"`
	ID                int        `json:"id,omitempty"`
	HTMLURL           string     `json:"html_url,omitempty"`
	DiffURL           string     `json:"diff_url,omitempty"`
	PatchURL          string     `json:"patch_url,omitempty"`
	IssueURL          string     `json:"issue_url,omitempty"`
	Number            int        `json:"number,omitempty"`
	State             string     `json:"state,omitempty"`
	Title             string     `json:"title,omitempty"`
	User              User       `json:"user,omitempty"`
	Body              string     `json:"body,omitempty"`
	CreatedAt         time.Time  `json:"created_at,omitempty"`
	UpdatedAt         time.Time  `json:"updated_at,omitempty"`
	ClosedAt          *time.Time `json:"closed_at,omitempty"`
	MergedAt          *time.Time `json:"merged_at,omitempty"`
	MergeCommitSha    string     `json:"merge_commit_sha,omitempty"`
	Assignee          *User      `json:"assignee,omitempty"`
	CommitsURL        string     `json:"commits_url,omitempty"`
	ReviewCommentsURL string     `json:"review_comments_url,omitempty"`
	ReviewCommentURL  string     `json:"review_comment_url,omitempty"`
	CommentsURL       string     `json:"comments_url,omitempty"`
	Head              Commit     `json:"head,omitempty"`
	Base              Commit     `json:"base,omitempty"`
	Merged            bool       `json:"merged,omitempty"`
	MergedBy          User       `json:"merged_by,omitempty"`
	Comments          int        `json:"comments,omitempty"`
	ReviewComments    int        `json:"review_comments,omitempty"`
	Commits           int        `json:"commits,omitempty"`
	Additions         int        `json:"additions,omitempty"`
	Deletions         int        `json:"deletions,omitempty"`
	ChangedFiles      int        `json:"changed_files,omitempty"`
	Mergeable         *bool      `json:"mergeable,omitempty"`
	CommentsBody      []Comment  `json:"-"`
}

type PullRequestFile

type PullRequestFile struct {
	FileName    string `json:"filename,omitempty"`
	Sha         string `json:"sha,omitempty"`
	Status      string `json:"status,omitempty"`
	Additions   int    `json:"additions,omitempty"`
	Deletions   int    `json:"deletions,omitempty"`
	Changes     int    `json:"changes,omitempty"`
	BlobUrl     string `json:"blob_url,omitempty"`
	RawUrl      string `json:"raw_url,omitempty"`
	ContentsUrl string `json:"contents_url,omitempty"`
	Patch       string `json:"patch,omitempty"`
}

type PullRequestForIssueParams

type PullRequestForIssueParams struct {
	Base  string `json:"base,omitempty"`
	Head  string `json:"head,omitempty"`
	Issue string `json:"issue,omitempty"`
}

type PullRequestHook

type PullRequestHook struct {
	Action      string       `json:"action"`
	Number      int          `json:"number"`
	Sender      *User        `json:"sender"`
	Repo        *Repository  `json:"repository"`
	PullRequest *PullRequest `json:"pull_request"`
}

func ParsePullRequestHook

func ParsePullRequestHook(raw []byte) (*PullRequestHook, error)

func (*PullRequestHook) IsOpened

func (h *PullRequestHook) IsOpened() bool

func (*PullRequestHook) IsSynchronize

func (h *PullRequestHook) IsSynchronize() bool

type PullRequestParams

type PullRequestParams struct {
	Base  string `json:"base,omitempty"`
	Head  string `json:"head,omitempty"`
	Title string `json:"title,omitempty"`
	Body  string `json:"body,omitempty"`
}

type Release

type Release struct {
	ID             int       `json:"id,omitempty"`
	URL            string    `json:"url,omitempty"`
	HTMLURL        string    `json:"html_url,omitempty"`
	AssetsURL      string    `json:"assets_url,omitempty"`
	UploadURL      string    `json:"upload_url,omitempty"`
	TagName        string    `json:"tag_name,omitempty"`
	TargetCommitsh string    `json:"target_commitish,omitempty"`
	Name           string    `json:"name,omitempty"`
	Body           string    `json:"body,omitempty"`
	Draft          bool      `json:"draft,omitempty"`
	Prerelease     bool      `json:"prerelease,omitempty"`
	CreatedAt      time.Time `json:"created_at,omitempty"`
	PublishedAt    time.Time `json:"published_at,omitempty"`
	Assets         []Asset   `json:"assets,omitempty"`
}

type ReleaseParams

type ReleaseParams struct {
	TagName         string `json:"tag_name,omitempty"`
	TargetCommitish string `json:"target_commitish,omitempty"`
	Name            string `json:"name,omitempty"`
	Body            string `json:"body,omitempty"`
	Draft           bool   `json:"draft,omitempty"`
	Prerelease      bool   `json:"prerelease,omitempty"`
}

type Repo

type Repo struct {
	Name     string
	UserName string
}

func (Repo) String

func (r Repo) String() string

type Repository

type Repository struct {
	ID            int           `json:"id,omitempty"`
	Owner         User          `json:"owner,omitempty"`
	Name          string        `json:"name,omitempty"`
	FullName      string        `json:"full_name,omitempty"`
	Description   string        `json:"description,omitempty"`
	Private       bool          `json:"private,omitempty"`
	Fork          bool          `json:"fork,omitempty"`
	URL           string        `json:"url,omitempty"`
	HTMLURL       string        `json:"html_url,omitempty"`
	CloneURL      string        `json:"clone_url,omitempty"`
	GitURL        string        `json:"git_url,omitempty"`
	SSHURL        string        `json:"ssh_url,omitempty"`
	SVNURL        string        `json:"svn_url,omitempty"`
	MirrorURL     string        `json:"mirror_url,omitempty"`
	Homepage      string        `json:"homepage,omitempty"`
	Language      string        `json:"language,omitempty"`
	Forks         int           `json:"forks,omitempty"`
	ForksCount    int           `json:"forks_count,omitempty"`
	Watchers      int           `json:"watchers,omitempty"`
	WatchersCount int           `json:"watchers_count,omitempty"`
	Size          int           `json:"size,omitempty"`
	MasterBranch  string        `json:"master_branch,omitempty"`
	OpenIssues    int           `json:"open_issues,omitempty"`
	PushedAt      time.Time     `json:"pushed_at,omitempty"`
	CreatedAt     time.Time     `json:"created_at,omitempty"`
	UpdatedAt     time.Time     `json:"updated_at,omitempty"`
	Organization  *Organization `json:"organization,omitempty"`
	Parent        *Repository   `json:"parent,omitempty"`
	Source        *Repository   `json:"source,omitempty"`
	HasIssues     bool          `json:"has_issues,omitempty"`
	HasWiki       bool          `json:"has_wiki,omitempty"`
	HasDownloads  bool          `json:"has_downloads,omitempty"`
}

type RepositoryParams

type RepositoryParams struct {
	Name              string `json:"name,omitempty"`
	Description       string `json:"description,omitempty"`
	Homepage          string `json:"homepage,omitempty"`
	Private           bool   `json:"private,omitempty"`
	HasIssues         bool   `json:"has_issues,omitempty"`
	HasWiki           bool   `json:"has_wiki,omitempty"`
	HasDownloads      bool   `json:"has_downloads,omitempty"`
	TeamID            int    `json:"team_id,omitempty"`
	AutoInit          bool   `json:"auto_init,omitempty"`
	GitignoreTemplate string `json:"gitignore_template,omitempty"`
}

type Root

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

func (*Root) Rel

func (r *Root) Rel(rel string) *Hyperlink

func (*Root) UnmarshalJSON

func (r *Root) UnmarshalJSON(d []byte) error

type SearchIssue

type SearchIssue struct {
	TotalCount int           `json:"total_count,omitempty"`
	Items      []*SearchItem `json:"items,omitempty"`
}

type SearchItem

type SearchItem struct {
	URL         string `json:"url,omitempty,omitempty"`
	LABELSURL   string `json:"labels_url,omitempty,omitempty"`
	COMMENTSURL string `json:"comments_url,omitempty,omitempty"`
	EVENTSURL   string `json:"events_url,omitempty,omitempty"`
	HTMLURL     string `json:"html_url,omitempty,omitempty"`
	Id          int    `json:"id,omitempty"`
	Number      int    `json:"number,omitempty"`
	Title       string `json:"title,omitempty"`
	User        User   `json:"user,omitempty"`
	Labels      []struct {
		URL   string `json:"url,omitempty"`
		Name  string `json:"name,omitempty"`
		Color string `json:"color,omitempty"`
	} `json:"labels,omitempty"`
	State     string `json:"state,omitempty"`
	Assignee  User   `json:"assignee,omitempty"`
	Milestone struct {
		URL          string     `json:"url,omitempty"`
		Number       int        `json:"number,omitempty"`
		State        string     `json:"state,omitempty"`
		Title        string     `json:"title,omitempty"`
		Description  string     `json:"description,omitempty"`
		Creator      User       `json:"creator,omitempty"`
		OpenIssues   int        `json:"open_issues,omitempty"`
		ClosedIssues int        `json:"closed_issues,omitempty"`
		CreatedAt    time.Time  `json:"created_at,omitempty"`
		DueOn        *time.Time `json:"due_on,omitempty"`
	} `json:"milestone,omitempty"`
	Comments    int        `json:"comments,omitempty"`
	CreatedAt   time.Time  `json:"created_at,omitempty"`
	UpdatedAt   time.Time  `json:"updated_at,omitempty"`
	ClosedAt    *time.Time `json:"closed_at,omitempty"`
	PullRequest struct {
		HTMLURL  string `json:"html_url,omitempty"`
		DiffURL  string `json:"diff_url,omitempty"`
		PatchURL string `json:"patch_url,omitempty"`
	} `json:"pull_request,omitempty"`
	Body  string  `json:"body,omitempty"`
	Score float64 `json:"score,omitempty"`
}

type Status

type Status struct {
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	State       string    `json:"state,omitempty"`
	TargetURL   string    `json:"target_url,omitempty"`
	Description string    `json:"description,omitempty"`
	ID          int       `json:"id,omitempty"`
	URL         string    `json:"url,omitempty"`
	Creator     User      `json:"creator,omitempty"`
	Context     string    `json:"context,omitempty"`
}

type StatusOptions

type StatusOptions struct {
	State       string `json:"state"`
	Description string `json:"description"`
	URL         string `json:"target_url"`
	Context     string `json:"context"`
}

type User

type User struct {
	Login       string    `json:"login,omitempty"`
	ID          int       `json:"id,omitempty"`
	AvatarURL   string    `json:"avatar_url,omitempty"`
	GravatarID  string    `json:"gravatar_id,omitempty"`
	URL         string    `json:"url,omitempty"`
	Name        string    `json:"name,omitempty"`
	Company     string    `json:"company,omitempty"`
	Blog        string    `json:"blog,omitempty"`
	Location    string    `json:"location,omitempty"`
	Email       string    `json:"email,omitempty"`
	Hireable    bool      `json:"hireable,omitempty"`
	Bio         string    `json:"bio,omitempty"`
	PublicRepos int       `json:"public_repos,omitempty"`
	PublicGists int       `json:"public_gists,omitempty"`
	Followers   int       `json:"followers,omitempty"`
	Following   int       `json:"following,omitempty"`
	HTMLURL     string    `json:"html_url,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
	Type        string    `json:"type,omitempty"`
	// hypermedia relations
	FollowingURL      string `json:"following_url,omitempty"`
	FollowersURL      string `json:"followers_url,omitempty"`
	GistsURL          string `json:"gists_url,omitempty"`
	StarredURL        string `json:"starred_url,omitempty"`
	SubscriptionsURL  string `json:"subscriptions_url,omitempty"`
	OrganizationsURL  string `json:"organizations_url,omitempty"`
	ReposURL          string `json:"repos_url,omitempty"`
	EventsURL         string `json:"events_url,omitempty"`
	ReceivedEventsURL string `json:"received_events_url,omitempty"`
}

Jump to

Keyboard shortcuts

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