Documentation ¶
Overview ¶
Package octokit is a simple and official wrapper for the GitHub API in Go. It is a hypermedia API client using go-sawyer to allow for easy access between web resources.
Index ¶
- Variables
- type App
- type Asset
- type AuthMethod
- type Authorization
- type AuthorizationParams
- type AuthorizationsService
- type BasicAuth
- type Client
- func (c *Client) Authorizations(url *url.URL) (auths *AuthorizationsService)
- func (c *Client) Commits(url *url.URL) (commits *CommitsService)
- func (c *Client) Emails(url *url.URL) (emails *EmailsService)
- func (c *Client) Emojis(url *url.URL) (emojis *EmojisService)
- func (c *Client) Followers() (followers *FollowersService)
- func (c *Client) Gists(url *url.URL) (gists *GistsService)
- func (c *Client) GitIgnore() *GitIgnoreService
- func (c *Client) GitTrees(url *url.URL) (trees *GitTreesService)
- func (c *Client) Issues(url *url.URL) (issues *IssuesService)
- func (c *Client) NewRequest(urlStr string) (req *Request, err error)
- func (c *Client) PullRequests(url *url.URL) (pullRequests *PullRequestsService)
- func (c *Client) Rel(name string, m map[string]interface{}) (*url.URL, error)
- func (c *Client) Releases(url *url.URL) (releases *ReleasesService)
- func (c *Client) Repositories(url *url.URL) (repos *RepositoriesService)
- func (c *Client) Root(url *url.URL) (root *RootService)
- func (c *Client) Search(url *url.URL) (searches *SearchService)
- func (c *Client) Statuses(url *url.URL) (statuses *StatusesService)
- func (c *Client) Uploads(url *url.URL) (uploads *UploadsService)
- func (c *Client) Users(url *url.URL) (users *UsersService)
- type CodeFile
- type CodeSearchResults
- type Commit
- type CommitCommit
- type CommitFile
- type CommitStats
- type CommitsService
- type Email
- type EmailsService
- type EmojisService
- type ErrorObject
- type FollowersService
- func (f *FollowersService) All(uri *Hyperlink, params M) (followers []User, result *Result)
- func (f *FollowersService) Check(uri *Hyperlink, params M) (success bool, result *Result)
- func (f *FollowersService) Follow(uri *Hyperlink, params M) (success bool, result *Result)
- func (f *FollowersService) Unfollow(uri *Hyperlink, params M) (success bool, result *Result)
- type Gist
- type GistFile
- type GistsService
- type GitIgnoreService
- type GitIgnoreTemplate
- type GitTree
- type GitTreeEntry
- type GitTreesService
- type Hyperlink
- type Issue
- type IssueParams
- type IssueSearchResults
- type IssuesService
- type M
- type NetrcAuth
- type Organization
- type Permissions
- type PullRequest
- type PullRequestCommit
- type PullRequestForIssueParams
- type PullRequestParams
- type PullRequestsService
- func (p *PullRequestsService) All() (pulls []PullRequest, result *Result)
- func (p *PullRequestsService) Create(params interface{}) (pull *PullRequest, result *Result)
- func (p *PullRequestsService) Diff() (diff io.ReadCloser, result *Result)
- func (p *PullRequestsService) One() (pull *PullRequest, result *Result)
- func (p *PullRequestsService) Patch() (patch io.ReadCloser, result *Result)
- type Release
- type ReleaseParams
- type ReleasesService
- type RepositoriesService
- type Repository
- type RepositorySearchResults
- type Request
- func (r *Request) Delete(input interface{}, output interface{}) (*Response, error)
- func (r *Request) Get(output interface{}) (*Response, error)
- func (r *Request) Head(output interface{}) (*Response, error)
- func (r *Request) Options(output interface{}) (*Response, error)
- func (r *Request) Patch(input interface{}, output interface{}) (*Response, error)
- func (r *Request) Post(input interface{}, output interface{}) (*Response, error)
- func (r *Request) Put(input interface{}, output interface{}) (*Response, error)
- type Response
- type ResponseError
- type ResponseErrorType
- type Result
- type Root
- type RootService
- type SearchService
- func (g *SearchService) Code() (codeSearchResults CodeSearchResults, result *Result)
- func (g *SearchService) Issues() (issueSearchResults IssueSearchResults, result *Result)
- func (g *SearchService) Repositories() (repositorySearchResults RepositorySearchResults, result *Result)
- func (g *SearchService) Users() (userSearchResults UserSearchResults, result *Result)
- type Status
- type StatusesService
- type TokenAuth
- type UploadsService
- type User
- type UserSearchResults
- type UsersService
Constants ¶
This section is empty.
Variables ¶
var ( CurrentFollowerUrl = Hyperlink("user/followers") FollowerUrl = Hyperlink("users/{user}/followers") CurrentFollowingUrl = Hyperlink("user/following{/target}") FollowingUrl = Hyperlink("users/{user}/following{/target}") )
var ( RepositoryURL = Hyperlink("repos/{owner}/{repo}") ForksURL = Hyperlink("repos/{owner}/{repo}/forks") UserRepositoriesURL = Hyperlink("user/repos") OrgRepositoriesURL = Hyperlink("orgs/{org}/repos") )
Hyperlinks to the various repository locations on github. RepositoryURL is a template for a particular repository for a particular owner. ForksURL is a template for the forks of a user's repository. UserRepositoriesURL is the address for all user repositories. OrgRepositoriesUrl is the template for repositories within a particular organization.
var ( CurrentUserURL = Hyperlink("user") UserURL = Hyperlink("users{/user}") )
Hyperlinks to various ways of accessing users on github. CurrentUserURL is the address for the current user. UserURL is a template for the address any particular user or all users.
var AuthorizationsURL = Hyperlink("authorizations{/id}")
AuthorizationsURL is a template for accessing authorizations possibly associated with a given identification number that can be expanded to a full address.
var CommitsURL = Hyperlink("repos/{owner}/{repo}/commits{/sha}")
CommitsURL is a template for accessing commits in a specific owner's repository with a particular sha hash that can be expanded to a full address.
var (
EmailUrl = Hyperlink("user/emails")
)
var EmojisURL = Hyperlink("/emojis")
EmojisURL is an address for accessing the emojis available for use on GitHub.
var GistsURL = Hyperlink("gists{/gist_id}")
GistsURL is a template for accessing gists from GitHub possibly with a specific identification code that can be expanded to a full address.
var GitIgnoreURL = Hyperlink("/gitignore/templates{/name}")
GitIgnoreURL is an address for accessing various templates to apply to a repository upon creation.
var GitTreesURL = Hyperlink("repos/{owner}/{repo}/git/trees/{sha}{?recursive}")
GitTreesURL is a template for accessing git trees at a particular sha hash or branch of a particular repository of a particular owner. The request may be set to be recursive for a particular level of depth (0 is no recursion) to follow sub-trees from the primary repository.
var PullRequestsURL = Hyperlink("repos/{owner}/{repo}/pulls{/number}")
PullRequestsURL is a template for accessing pull requests in a particular repository for a particular owner that can be expanded to a full address.
var ReleasesURL = Hyperlink("repos/{owner}/{repo}/releases{/id}")
ReleasesURL is a template for accessing releases in a particular repository for a particular owner that can be expanded to a full address.
var RepoIssuesURL = Hyperlink("repos/{owner}/{repo}/issues{/number}")
RepoIssuesURL is a template for accessing issues in a particular repository for a particular owner that can be expanded to a full address.
var RootURL = Hyperlink("")
RootURL is simply the root GitHub address. Accessing this address provides all other accessible templates and addresses as hypermedia relations.
var SearchURL = Hyperlink("search{/type}?q={query}{&page,per_page,sort,order}")
var StatusesURL = Hyperlink("repos/{owner}/{repo}/statuses/{ref}")
StatusesURL is a template for accessing statuses, such as build state, with of a particular reference or hash in a particular repository for a particular owner that can be expanded to a full address.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { *hypermedia.HALResource ClientID string `json:"client_id,omitempty"` URL string `json:"url,omitempty"` Name string `json:"name,omitempty"` }
App is the unit holding the associated authorization
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"` }
Asset represents a piece of content produced and associated with a given released that may be downloaded
type AuthMethod ¶
AuthMethod is a general interface for possible forms of authentication. In order to act as a form of authentication, a struct must at minimum implement the String() method which produces the authentication string. See http://developer.github.com/v3/auth/ for more information
type Authorization ¶
type Authorization struct { *hypermedia.HALResource 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"` }
Authorization is a representation of an OAuth passed to or from the authorizations API
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"` }
AuthorizationParams is the set of parameters used when creating a new authorization to be posted to the API
type AuthorizationsService ¶
AuthorizationsService is a service providing access to OAuth authorizations through the authorization API
func (*AuthorizationsService) All ¶
func (a *AuthorizationsService) All() (auths []Authorization, result *Result)
All gets a list of all authorizations associated with the url of the service
func (*AuthorizationsService) Create ¶
func (a *AuthorizationsService) Create(params interface{}) (auth *Authorization, result *Result)
Create posts a new authorization to the authorizations service url
func (*AuthorizationsService) One ¶
func (a *AuthorizationsService) One() (auth *Authorization, result *Result)
One gets a specific authorization based on the url of the service
type BasicAuth ¶
BasicAuth is a form of authentication involving a simple login and password. A OneTimePassword field may be set for two-factor authentication.
type Client ¶
type Client struct { *sawyer.Client UserAgent string AuthMethod AuthMethod // contains filtered or unexported fields }
Client wraps a sawyer Client, a higher level wrapper for HttpClient, with a particular represented user agent and authentication method for GitHub. Can also store the particular hypermedia relations accessible through the root address.
func NewClient ¶
func NewClient(authMethod AuthMethod) *Client
NewClient creates a new Client using the given authorization method. Provides a very simple client for connecting to the GitHub API using Octokit.
func NewClientWith ¶
func NewClientWith(baseURL string, userAgent string, authMethod AuthMethod, httpClient *http.Client) *Client
NewClientWith creates a new Client with a particular base URL which all requests will be appended onto - often the GitHub URL - the user agent being represented, the authentication method, and a pointer to a httpClient if a particular client is being wrapped. If httpClient is nil a default httpClient will be used.
func (*Client) Authorizations ¶
func (c *Client) Authorizations(url *url.URL) (auths *AuthorizationsService)
Authorizations creates a AuthorizationsService with a base url.
func (*Client) Commits ¶
func (c *Client) Commits(url *url.URL) (commits *CommitsService)
Commits creates a CommitsService with a base url.
func (*Client) Emails ¶
func (c *Client) Emails(url *url.URL) (emails *EmailsService)
Create a EmailsService with the base url.URL
func (*Client) Emojis ¶
func (c *Client) Emojis(url *url.URL) (emojis *EmojisService)
Emojis creates an EmojisService with a base url
func (*Client) Followers ¶
func (c *Client) Followers() (followers *FollowersService)
Create a FollowersService
func (*Client) Gists ¶
func (c *Client) Gists(url *url.URL) (gists *GistsService)
Gists creates a GistsService with a base url
func (*Client) GitIgnore ¶
func (c *Client) GitIgnore() *GitIgnoreService
GitIgnore creates a GitIgnoreService to access gitignore templates
func (*Client) GitTrees ¶
func (c *Client) GitTrees(url *url.URL) (trees *GitTreesService)
GitTrees creates a GitTreesService with a base url
func (*Client) Issues ¶
func (c *Client) Issues(url *url.URL) (issues *IssuesService)
Issues creates an IssuesService with a base url
func (*Client) NewRequest ¶
NewRequest produces a simple request for the given url and applies the proper headers currently associated with the client to that request.
func (*Client) PullRequests ¶
func (c *Client) PullRequests(url *url.URL) (pullRequests *PullRequestsService)
PullRequests creates a PullRequestsService with a base url
func (*Client) Releases ¶
func (c *Client) Releases(url *url.URL) (releases *ReleasesService)
Releases creates a ReleasesService with a base url
func (*Client) Repositories ¶
func (c *Client) Repositories(url *url.URL) (repos *RepositoriesService)
Repositories creates a RepositoriesService with a base url
func (*Client) Root ¶
func (c *Client) Root(url *url.URL) (root *RootService)
Root creates a RootService with a base url
func (*Client) Statuses ¶
func (c *Client) Statuses(url *url.URL) (statuses *StatusesService)
Statuses creates a StatusesService with a base url
type CodeFile ¶
type CodeFile struct { *hypermedia.HALResource Name string `json:"name,omitempty"` Path string `json:"path,omitempty"` SHA string `json:"sha,omitempty"` URL Hyperlink `json:"url,omitempty"` GitURL Hyperlink `json:"git_url,omitempty"` HTMLURL Hyperlink `json:"html_url,omitempty"` Repository Repository `json:"repository,omitempty"` }
type CodeSearchResults ¶
type CodeSearchResults struct { *hypermedia.HALResource TotalCount int `json:"total_count,omitempty"` IncompleteResults bool `json:"incomplete_results,omitempty"` Items []CodeFile `json:"items,omitempty"` }
type Commit ¶
type Commit struct { *hypermedia.HALResource Author *User `json:"author,omitempty"` CommentsURL string `json:"comments_url,omitempty"` Commit *CommitCommit `json:"commit,omitempty"` Committer *User `json:"committer,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"` }
Commit is a representation of a full commit in git
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"` }
CommitCommit is the representation of the metadata regarding the commit as a subset of the full commit structure
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"` }
CommitFile is a representation of a file within a commit
type CommitStats ¶
type CommitStats struct { Additions int `json:"additions,omitempty"` Deletions int `json:"deletions,omitempty"` Total int `json:"total,omitempty"` }
CommitStats represents the statistics on the changes made in a commit
type CommitsService ¶
CommitsService is a service providing access to commits from a particular url
func (*CommitsService) All ¶
func (c *CommitsService) All() (commits []Commit, result *Result)
All gets a list of all commits associated with the URL of the service
func (*CommitsService) One ¶
func (c *CommitsService) One() (commit *Commit, result *Result)
One gets a specific commit based on the url of the service
func (*CommitsService) Patch ¶
func (c *CommitsService) Patch() (patch io.ReadCloser, result *Result)
Patch gets a specific commit patch based on the url of the service
type Email ¶
type Email struct { *hypermedia.HALResource Email string `json:"email,omitempty"` Verified bool `json:"verified,omitempty"` Primary bool `json:"primary,omitempty"` }
type EmailsService ¶
A service to return user emails
func (*EmailsService) All ¶
func (e *EmailsService) All() (emails []Email, result *Result)
Get a list of emails for the current user
func (*EmailsService) Create ¶
func (e *EmailsService) Create(params interface{}) (emails []Email, result *Result)
Adds a list of emails for the current user
func (*EmailsService) Delete ¶
func (e *EmailsService) Delete(params interface{}) (result *Result)
Deletes a list of emails for the current user
type EmojisService ¶
EmojisService is a service providing access to all the emojis available from a particular url
type ErrorObject ¶
type ErrorObject struct { Resource string `json:"resource,omitempty"` Code string `json:"code,omitempty"` Field string `json:"field,omitempty"` Message string `json:"message,omitempty"` }
ErrorObject represents the general structure of a possible error
func (*ErrorObject) Error ¶
func (e *ErrorObject) Error() string
Error produces a human readable string representation of a given ErrorObject
type FollowersService ¶
type FollowersService struct {
// contains filtered or unexported fields
}
A service to return user followers
func (*FollowersService) All ¶
func (f *FollowersService) All(uri *Hyperlink, params M) (followers []User, result *Result)
Get a list of followers for the user
func (*FollowersService) Check ¶
func (f *FollowersService) Check(uri *Hyperlink, params M) (success bool, result *Result)
Checks if a user is following a target user
type Gist ¶
type Gist struct { *hypermedia.HALResource ID string `json:"id,omitempty"` Comments float64 `json:"comments,omitempty"` CommentsURL string `json:"comments_url,omitempty"` CommitsURL string `json:"commits_url,omitempty"` CreatedAt string `json:"created_at,omitempty"` Description string `json:"description,omitempty"` Files map[string]*GistFile `json:"files,omitempty"` ForksURL Hyperlink `json:"forks_url,omitempty"` GitPullURL Hyperlink `json:"git_pull_url,omitempty"` GitPushURL Hyperlink `json:"git_push_url,omitempty"` HtmlURL Hyperlink `json:"html_url,omitempty"` Owner *User `json:"owner,omitempty"` Public bool `json:"public,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` URL string `json:"url,omitempty"` User *User `json:"user,omitempty"` }
Gist is a representation of a gist on github, a standalone file that acts as a sole element of its own repository
type GistFile ¶
type GistFile struct { *hypermedia.HALResource FileName string `json:"filename,omitempty"` Type string `json:"type,omitempty"` Language string `json:"language,omitempty"` RawURL string `json:"raw_url,omitempty"` Size int `json:"size,omitempty"` Truncated bool `json:"truncated,omitempty"` Content string `json:"content,omitempty"` }
GistFile is a representation of the file stored in a gist
type GistsService ¶
GistsService is a service providing access to gists from a particular url
func (*GistsService) All ¶
func (g *GistsService) All() (gists []Gist, result *Result)
All gets a list of all gists associated with the url of the service
func (*GistsService) One ¶
func (g *GistsService) One() (gist *Gist, result *Result)
One gets a specific gist based on the url of the service
func (*GistsService) Raw ¶
func (g *GistsService) Raw() (body io.ReadCloser, result *Result)
Raw gets the raw contents of first file in a specific gist
func (*GistsService) Update ¶
func (g *GistsService) Update(params interface{}) (gist *Gist, result *Result)
Update modifies a specific gist based on the url of the service
type GitIgnoreService ¶
type GitIgnoreService struct {
// contains filtered or unexported fields
}
A service to return gitignore templates
func (*GitIgnoreService) All ¶
func (s *GitIgnoreService) All(uri *Hyperlink) (templates []string, result *Result)
All gets a list all the available templates
func (*GitIgnoreService) One ¶
func (s *GitIgnoreService) One(uri *Hyperlink, params M) (template GitIgnoreTemplate, result *Result)
One gets a specific gitignore template based on the passed url
type GitIgnoreTemplate ¶
type GitIgnoreTemplate struct { Name string `json:"name,omitempty"` Source string `json:"source,omitempty"` }
GitIgnoreTemplate is a representation of a given template returned by the service
type GitTree ¶
type GitTree struct { Sha string `json:"sha,omitempty"` Tree []GitTreeEntry `json:"tree,omitempty"` Truncated bool `json:"truncated,omitempty"` URL string `json:"url,omitempty"` }
GitTree represents a tree on GitHub, a level in the GitHub equivalent of a directory structure
type GitTreeEntry ¶
type GitTreeEntry struct { Mode string `json:"mode,omitempty"` Path string `json:"path,omitempty"` Sha string `json:"sha,omitempty"` Size int `json:"size,omitempty"` Type string `json:"type,omitempty"` URL string `json:"url,omitempty"` }
GitTreeEntry represents an element within a GitTree on GitHub, which may either be another Tree or a single Blob
type GitTreesService ¶
GitTreesService is a service providing access to GitTrees from a particular url
func (*GitTreesService) One ¶
func (c *GitTreesService) One() (tree *GitTree, result *Result)
One gets a specific GitTree based on the url of the service
type Hyperlink ¶
type Hyperlink string
Hyperlink is a string url. If it is a uri template, it can be converted to a full URL with Expand().
type Issue ¶
type Issue struct { *hypermedia.HALResource 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 []struct { URL string `json:"url,omitempty"` Name string `json:"name,omitempty"` Color string `json:"color,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"` }
Issue represents an issue on GitHub with all associated fields
type IssueParams ¶
type IssueParams struct { Title string `json:"title,omitempty"` Body string `json:"body,omitempty"` Assignee string `json:"assignee,omitempty"` State string `json:"state,omitempty"` Milestone uint64 `json:"milestone,omitempty"` Labels []string `json:"labels,omitempty"` }
IssueParams represents the struture used to create or update an Issue
type IssueSearchResults ¶
type IssueSearchResults struct { *hypermedia.HALResource TotalCount int `json:"total_count,omitempty"` IncompleteResults bool `json:"incomplete_results,omitempty"` Items []Issue `json:"items,omitempty"` }
type IssuesService ¶
IssuesService is a service providing access to issues from a particular url
func (*IssuesService) All ¶
func (i *IssuesService) All() (issues []Issue, result *Result)
All gets a list of all issues associated with the url of the service
func (*IssuesService) Create ¶
func (i *IssuesService) Create(params interface{}) (issue *Issue, result *Result)
Create posts a new issue with particular parameters to the issues service url
func (*IssuesService) One ¶
func (i *IssuesService) One() (issue *Issue, result *Result)
One gets a specific issue based on the url of the service
func (*IssuesService) Update ¶
func (i *IssuesService) Update(params interface{}) (issue *Issue, result *Result)
Update modifies a specific issue given parameters on the service url
type M ¶
type M map[string]interface{}
M represents a map of values to expand a Hyperlink. The keys in M are elements of the template to be replaced with the associated value in the map.
type NetrcAuth ¶
type NetrcAuth struct {
NetrcPath string
}
NetrcAuth is a form of authentication using a .netrc file for permanent authentication by storing credentials.
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"` }
Organization is a representation of an organization on GitHub, containing all identifying information related to the specific organization.
type Permissions ¶
Permissions represent the permissions as they apply to the accessing url
type PullRequest ¶
type PullRequest struct { *hypermedia.HALResource 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"` Title string `json:"title,omitempty"` Number int `json:"number,omitempty"` State string `json:"state,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 PullRequestCommit `json:"head,omitempty"` Base PullRequestCommit `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"` }
PullRequest represents a pull request on GitHub and all associated parameters
type PullRequestCommit ¶
type PullRequestCommit struct { Label string `json:"label,omitempty"` Ref string `json:"ref,omitempty"` Sha string `json:"sha,omitempty"` User User `json:"user,omitempty"` Repo *Repository `json:"repo,omitempty"` }
PullRequestCommit represents one of the commits associated with the given pull request - the head being pulled in or the base being pulled into
type PullRequestForIssueParams ¶
type PullRequestForIssueParams struct { Base string `json:"base,omitempty"` Head string `json:"head,omitempty"` Issue string `json:"issue,omitempty"` }
PullRequestForIssueParams represent the set of parameters used to create a new pull request for a specific issue
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"` Assignee string `json:"assignee,omitempty"` }
PullRequestParams represent the set of parameters used to create a new pull request
type PullRequestsService ¶
PullRequestService is a service providing access to pull requests from a particular url
func (*PullRequestsService) All ¶
func (p *PullRequestsService) All() (pulls []PullRequest, result *Result)
All gets a list of all pull requests associated with the url of the service
func (*PullRequestsService) Create ¶
func (p *PullRequestsService) Create(params interface{}) (pull *PullRequest, result *Result)
Create posts a new pull request based on the parameters given to the pull request service url
func (*PullRequestsService) Diff ¶
func (p *PullRequestsService) Diff() (diff io.ReadCloser, result *Result)
Diff gets the difference of the data in the specific pull request to the branch that the pull request is out to be merged with
func (*PullRequestsService) One ¶
func (p *PullRequestsService) One() (pull *PullRequest, result *Result)
One gets a specific pull request based on the url of the service
func (*PullRequestsService) Patch ¶
func (p *PullRequestsService) Patch() (patch io.ReadCloser, result *Result)
Patch gets all the patches made to the specific pull request associated with the url given to the service
type Release ¶
type Release struct { *hypermedia.HALResource ID int `json:"id,omitempty"` URL string `json:"url,omitempty"` HTMLURL string `json:"html_url,omitempty"` AssetsURL string `json:"assets_url,omitempty"` UploadURL Hyperlink `json:"upload_url,omitempty"` 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"` CreatedAt *time.Time `json:"created_at,omitempty"` PublishedAt *time.Time `json:"published_at,omitempty"` Assets []Asset `json:"assets,omitempty"` }
Release is a representation of a release on GitHub. Published releases are available to everyone.
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"` }
ReleaseParams represent the parameters used to create or update a release
type ReleasesService ¶
ReleasesService is a service providing access to releases from a particular url
func (*ReleasesService) All ¶
func (r *ReleasesService) All() (releases []Release, result *Result)
One gets a specific release based on the url of the service
func (*ReleasesService) Create ¶
func (r *ReleasesService) Create(params interface{}) (release *Release, result *Result)
Create posts a new release based on the relase parameters to the releases service url
func (*ReleasesService) Update ¶
func (r *ReleasesService) Update(params interface{}) (release *Release, result *Result)
Update modifies a release based on the release parameters on the service url
type RepositoriesService ¶
RepositoriesService is a service providing access to repositories from a particular url
func (*RepositoriesService) All ¶
func (r *RepositoriesService) All() (repos []Repository, result *Result)
All gets a list of all repositories associated with the url of the service
func (*RepositoriesService) Create ¶
func (r *RepositoriesService) Create(params interface{}) (repo *Repository, result *Result)
Create posts a new repository based on parameters in a Repository struct to the respository service url
func (*RepositoriesService) One ¶
func (r *RepositoriesService) One() (repo *Repository, result *Result)
One gets a specific repository based on the url of the service
type Repository ¶
type Repository struct { *hypermedia.HALResource 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"` 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"` StargazersCount int `json:"stargazers_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"` Permissions Permissions `json:"permissions,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"` }
Repository represents a respository on GitHub with all associated metadata with respect to the particular accessing url
type RepositorySearchResults ¶
type RepositorySearchResults struct { *hypermedia.HALResource TotalCount int `json:"total_count,omitempty"` IncompleteResults bool `json:"incomplete_results,omitempty"` Items []Repository `json:"items,omitempty"` }
type Request ¶
type Request struct { *sawyer.Request // contains filtered or unexported fields }
Request wraps a sawyer Request which is a wrapper for an HttpRequest with a particular octokit Client
func (*Request) Delete ¶
Delete sends a DELETE request through the given client and returns the response and any associated errors
func (*Request) Get ¶
Get sends a GET request through the given client and returns the response and any associated errors
func (*Request) Head ¶
Head sends a HEAD request through the given client and returns the response and any associated errors
func (*Request) Options ¶
Options sends an OPTIONS request through the given client and returns the response and any associated errors
func (*Request) Patch ¶
Patch sends a PATCH request through the given client and returns the response and any associated errors
type Response ¶
type Response struct { MediaType *mediatype.MediaType MediaHeader *mediaheader.MediaHeader *http.Response }
Response is a wrapper for a HttpResponse that adds a cleaned form of the MeidaType and MediaHeader
func NewResponse ¶
NewResponse unwraps a sawyer Response, producing an error if there was one associated in the sawyer response and otherwise creating a new Response from the underlying HttpResponse, MediaType and MediaHeader
type ResponseError ¶
type ResponseError struct { Response *http.Response `json:"-"` Type ResponseErrorType `json:"-"` Message string `json:"message,omitempty"` Err string `json:"error,omitempty"` Errors []ErrorObject `json:"errors,omitempty"` DocumentationURL string `json:"documentation_url,omitempty"` }
ResponseError represents an error given as a response to a request
func NewResponseError ¶
func NewResponseError(resp *sawyer.Response) (err *ResponseError)
NewResponseError creates a ResponseError from a given sawyer response that had been produced along with an error.
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
Error produces a human readable string representation of a given ResponseError
type ResponseErrorType ¶
type ResponseErrorType int
ResponseErrorType represents an enumeration of possible response errors
const ( ErrorClientError ResponseErrorType = iota // 400-499 ErrorBadRequest ResponseErrorType = iota // 400 ErrorOneTimePasswordRequired ResponseErrorType = iota // 401 ErrorForbidden ResponseErrorType = iota // 403 ErrorTooManyRequests ResponseErrorType = iota // 403 ErrorTooManyLoginAttempts ResponseErrorType = iota // 403 ErrorNotFound ResponseErrorType = iota // 404 ErrorNotAcceptable ResponseErrorType = iota // 406 ErrorUnsupportedMediaType ResponseErrorType = iota // 414 ErrorUnprocessableEntity ResponseErrorType = iota // 422 ErrorServerError ResponseErrorType = iota // 500-599 ErrorInternalServerError ResponseErrorType = iota // 500 ErrorNotImplemented ResponseErrorType = iota // 501 ErrorBadGateway ResponseErrorType = iota // 502 ErrorMissingContentType ResponseErrorType = iota ErrorUnknownError ResponseErrorType = iota )
type Result ¶
Result is a pageable set of data, with hyperlinks to the first, last, previous, and next pages, containing a response to some request and associated error, if any
type Root ¶
type Root struct { *hypermedia.HALResource UserSearchURL hypermedia.Hyperlink `rel:"user_search" json:"user_search_url,omitempty"` UserRepositoriesURL hypermedia.Hyperlink `rel:"user_repositories" json:"user_repositories_url,omitempty"` UserOrganizationsURL hypermedia.Hyperlink `rel:"user_organizations" json:"user_organizations_url,omitempty"` UserURL hypermedia.Hyperlink `rel:"user" json:"user_url,omitempty"` TeamURL hypermedia.Hyperlink `rel:"team" json:"team_url,omitempty"` StarredGistsURL hypermedia.Hyperlink `rel:"starred_gists" json:"starred_gists_url,omitempty"` StarredURL hypermedia.Hyperlink `rel:"starred" json:"starred_url,omitempty"` CurrentUserRepositoriesURL hypermedia.Hyperlink `rel:"current_user_repositories" json:"current_user_repositories_url,omitempty"` RepositorySearchURL hypermedia.Hyperlink `rel:"repository_search" json:"repository_search_url,omitempty"` RepositoryURL hypermedia.Hyperlink `rel:"repository" json:"repository_url,omitempty"` RateLimitURL hypermedia.Hyperlink `rel:"rate_limit" json:"rate_limit_url,omitempty"` GistsURL hypermedia.Hyperlink `rel:"gists" json:"gists_url,omitempty"` FollowingURL hypermedia.Hyperlink `rel:"following" json:"following_url,omitempty"` FeedsURL hypermedia.Hyperlink `rel:"feeds" json:"feeds_url,omitempty"` EventsURL hypermedia.Hyperlink `rel:"events" json:"events_url,omitempty"` EmojisURL hypermedia.Hyperlink `rel:"emojis" json:"emojis_url,omitempty"` EmailsURL hypermedia.Hyperlink `rel:"emails" json:"emails_url,omitempty"` AuthorizationsURL hypermedia.Hyperlink `rel:"authorizations" json:"authorizations_url,omitempty"` CurrentUserURL hypermedia.Hyperlink `rel:"current_user" json:"current_user_url,omitempty"` HubURL hypermedia.Hyperlink `rel:"hub" json:"hub_url,omitempty"` IssueSearchURL hypermedia.Hyperlink `rel:"issue_search" json:"issue_search_url,omitempty"` IssuesURL hypermedia.Hyperlink `rel:"issues" json:"issues_url,omitempty"` KeysURL hypermedia.Hyperlink `rel:"keys" json:"keys_url,omitempty"` NotificationsURL hypermedia.Hyperlink `rel:"notifications" json:"notifications_url,omitempty"` OrganizationRepositoriesURL hypermedia.Hyperlink `rel:"organization_repositories" json:"organization_repositories_url,omitempty"` OrganizationURL hypermedia.Hyperlink `rel:"organization" json:"organization_url,omitempty"` PublicGistsURL hypermedia.Hyperlink `rel:"public_gists" json:"public_gists_url,omitempty"` PullsURL hypermedia.Hyperlink `rel:"pulls" json:"-"` // contains filtered or unexported fields }
Root represents the base with hyperlinks in template form to all API calls
func (*Root) Rels ¶
func (r *Root) Rels() hypermedia.Relations
Rels gets the link relations from the HALResource's Links field.
type RootService ¶
RootService is a representation of a simple service to access hyperlinks to all the other accessible URLs
func (*RootService) One ¶
func (r *RootService) One() (root *Root, result *Result)
One accesses the root URI templates and assigns them to result
type SearchService ¶
A service to return search records
func (*SearchService) Code ¶
func (g *SearchService) Code() ( codeSearchResults CodeSearchResults, result *Result)
Get the code search results based on SearchService#URL
func (*SearchService) Issues ¶
func (g *SearchService) Issues() (issueSearchResults IssueSearchResults, result *Result)
Get the issue search results based on SearchService#URL
func (*SearchService) Repositories ¶
func (g *SearchService) Repositories() ( repositorySearchResults RepositorySearchResults, result *Result)
Get the repository search results based on SearchService#URL
func (*SearchService) Users ¶
func (g *SearchService) Users() (userSearchResults UserSearchResults, result *Result)
Get the user search results based on SearchService#URL
type Status ¶
type Status struct { *hypermedia.HALResource 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"` }
Status represents a state marked from an external service regarding the current state of a commit, including success, failure, error or pending
type StatusesService ¶
StatusesService is a service providing access to status from a particular url
func (*StatusesService) All ¶
func (s *StatusesService) All() (statuses []Status, result *Result)
All gets a list of all the statuses associated with the url of the service
type TokenAuth ¶
type TokenAuth struct {
AccessToken string
}
TokenAuth is a form of authentication using an access token
type UploadsService ¶
UploadsService is a service providing access to asset uploads from a particular url
func (*UploadsService) UploadAsset ¶
func (u *UploadsService) UploadAsset(asset io.ReadCloser, contentType string, contentLength int64) (result *Result)
UploadAsset uploads a particular asset of some content type and length to the service
type User ¶
type User struct { *hypermedia.HALResource SiteAdmin bool `json:"site_admin,omitempty"` 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"` 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"` FollowingURL Hyperlink `json:"following_url,omitempty"` FollowersURL Hyperlink `json:"followers_url,omitempty"` GistsURL Hyperlink `json:"gists_url,omitempty"` StarredURL Hyperlink `json:"starred_url,omitempty"` SubscriptionsURL Hyperlink `json:"subscriptions_url,omitempty"` OrganizationsURL Hyperlink `json:"organizations_url,omitempty"` ReposURL Hyperlink `json:"repos_url,omitempty"` EventsURL Hyperlink `json:"events_url,omitempty"` ReceivedEventsURL Hyperlink `json:"received_events_url,omitempty"` }
User represents the full user record of a particular user on GitHub
type UserSearchResults ¶
type UserSearchResults struct { *hypermedia.HALResource TotalCount int `json:"total_count,omitempty"` IncompleteResults bool `json:"incomplete_results,omitempty"` Items []User `json:"items,omitempty"` }
type UsersService ¶
UsersService is a service providing access to user records from a particular url
func (*UsersService) All ¶
func (u *UsersService) All() (users []User, result *Result)
All gets a list of all user records associated with the url of the service
func (*UsersService) One ¶
func (u *UsersService) One() (user *User, result *Result)
One gets a specific user record based on the url of the service
func (*UsersService) Update ¶
func (u *UsersService) Update(params interface{}) (user *User, result *Result)
Update modifies a user record specified in the User struct as parameters on the service url
Source Files ¶
- auth_method.go
- authorizations.go
- client.go
- commits.go
- emails.go
- emojis.go
- error.go
- followers.go
- gist.go
- git_ignore.go
- git_trees.go
- hyperlink.go
- issues.go
- octokit.go
- organizations.go
- pull_requests.go
- releases.go
- repositories.go
- request.go
- response.go
- result.go
- root.go
- search.go
- statuses.go
- uploads.go
- users.go