Documentation ¶
Index ¶
- Constants
- Variables
- type EmailSearchParam
- type EmailSearchResult
- type Follower
- type GitHub
- func (g *GitHub) AddEmails(emails []string) (err error)
- func (g GitHub) AddPublicKey(title, key string) (id int, err error)
- func (g *GitHub) DeleteEmails(emails []string) (err error)
- func (g *GitHub) Do(v interface{}, method string, uriParts ...string) (err error)
- func (g *GitHub) Emails() (emails []string, err error)
- func (g GitHub) Follow(user string) (err error)
- func (g *GitHub) GetCurrentUser() (*User, error)
- func (g *GitHub) GetOrganization(name string) (org *Organization, err error)
- func (g GitHub) GetPublicKey(id int) (key PublicKey, err error)
- func (g *GitHub) GetUser(login string) (*User, error)
- func (g GitHub) IsFollowing(anotherUser string) (following bool, err error)
- func (g *GitHub) Organizations() (orgs []Organization, err error)
- func (g GitHub) PublicKeys() (keys []PublicKey, err error)
- func (g GitHub) RemovePublicKey(id int) (err error)
- func (g GitHub) Repositories(options ...int) (repositories []Repository, err error)
- func (g *GitHub) SearchEmail(p *EmailSearchParam) (*EmailSearchResult, error)
- func (g *GitHub) SearchIssues(p *IssuesSearchParam) ([]*IssuesSearchResult, error)
- func (g *GitHub) SearchRepositories(p *RepositoriesSearchParam) ([]*RepositoriesSearchResult, error)
- func (g *GitHub) SearchUsers(p *UsersSearchParam) ([]*UsersSearchResult, error)
- func (g GitHub) Unfollow(user string) (err error)
- type IssuesSearchParam
- type IssuesSearchResult
- type Organization
- type OrganizationPlan
- type PublicKey
- type RepositoriesSearchParam
- type RepositoriesSearchResult
- type Repository
- type RepositoryOwner
- type RepositoryPermissions
- type User
- func (u User) GetFollowers() (followers []Follower, err error)
- func (u User) GetFollowing() (following []Follower, err error)
- func (u User) GetPublicKeys() (keys []PublicKey, err error)
- func (u *User) Organizations() (orgs []Organization, err error)
- func (u User) Repositories(options ...int) (repositories []Repository, err error)
- type UsersSearchParam
- type UsersSearchResult
Constants ¶
const ( GitHubUrl string = "https://api.github.com" DefaultPageSize int = 30 AcceptHeader string = "application/vnd.github.beta+json" )
The HTTP host that we will hit to use the GitHub API.
Variables ¶
var ( ErrRateLimitReached = errors.New("Rate limit reached") ErrNoJSON = errors.New("GitHub did not return a JSON response") )
var ( ErrSearchInvalidParam = errors.New("Invalid parameter for search") ErrSearchOmitParam = errors.New("Omit mandatory paramter for search") )
Functions ¶
This section is empty.
Types ¶
type EmailSearchParam ¶
type EmailSearchParam struct { Email string // contains filtered or unexported fields }
Types which represents result for search email http://developer.github.com/v3/search/#email-users
type EmailSearchResult ¶
type EmailSearchResult struct { PublicRepoCount int `json:"public_repo_count"` PublicGistCount int `json:"public_gist_count"` FollowersCount int `json:"followers_count"` FollowingCount int `json:"following_count"` Created time.Time `json:"created"` CreatedAt time.Time `json:"created_at"` Name string `json:"name"` Company string `json:"company"` BLog string `json:"blog"` Location string `json:"location"` Email string `json:"email"` Id int `json:"id"` Login string `json:"login"` Type string `json:"type"` GravatarId string `json:"gravatar_id"` }
type Follower ¶
type Follower struct { Login string `json:"login"` Id int `json:"id"` AvatarUrl string `json:"avatar_url"` GravatarId string `json:"gravatar_id"` Url string `json:"url"` HtmlUrl string `json:"html_url"` FollowersUrl string `json:"followers_url"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` OrganizationsUrl string `json:"organizations_url"` ReposUrl string `json:"repos_url"` EventsUrl string `json:"events_url"` ReceivedEventsUrl string `json:"received_events_url"` Type string `json:"type"` }
A minimized form of the User struct, for holding information about a follower.
type GitHub ¶
type GitHub struct { Authorization string RateLimit int RateLimitRemaining int // contains filtered or unexported fields }
The GitHub struct represents an active session to the GitHub API.
func BasicLogin ¶
Log in to GitHub using basic, username/password authentication.
func (*GitHub) AddEmails ¶
Associate a list of emails with the currently-authenticated user's account.
func (GitHub) AddPublicKey ¶
Add a public key to your account.
When the creation of your new key is successful, this function will return the new ID of the key, which will be retrievable at:
https://api.github.com/user/keys/:id
func (*GitHub) DeleteEmails ¶
Disassociate a list of emails from the currently-authenticated user's account.
func (*GitHub) Do ¶
Calls the specified GitHub endpoint, with the provided HTTP method, and unmarshals the JSON response (if there is one) into the provided interface{} v.
You can use this function to interact with a majority of the GitHub v3 endpoints.
func (*GitHub) Emails ¶
Returns a list of the email accounts associated with the currently- authenticated user.
func (*GitHub) GetCurrentUser ¶
Returns the currently-authenticated user, as a pointer to a User struct.
func (*GitHub) GetOrganization ¶
func (g *GitHub) GetOrganization(name string) (org *Organization, err error)
Returns a complete Organization struct.
func (GitHub) GetPublicKey ¶
Fetch a singular public SSH key.
func (*GitHub) GetUser ¶
Returns the details of a single user, as specified by their "login".
The term "login" is synonymous with "username":
https://github.com/<login>
func (GitHub) IsFollowing ¶
Check to see whether or not the current user `u` is following another user.
func (*GitHub) Organizations ¶
func (g *GitHub) Organizations() (orgs []Organization, err error)
List all of the organizations the currently-authenticated user is a member of.
Please be aware that this method does not return a complete Organization struct; for that, please refer to the (*GitHub).GetOrganization() method.
func (GitHub) PublicKeys ¶
Fetch a listing of the currently-authenticated user's public SSH keys.
func (GitHub) RemovePublicKey ¶
Removes a public key from your account.
func (GitHub) Repositories ¶
func (g GitHub) Repositories(options ...int) (repositories []Repository, err error)
Get the currently-authenticated user's repositories.
func (*GitHub) SearchEmail ¶
func (g *GitHub) SearchEmail(p *EmailSearchParam) (*EmailSearchResult, error)
Find user by email address. This API call is added for compatibility reasons only. There’s no guarantee that full email searches will always be available.
func (*GitHub) SearchIssues ¶
func (g *GitHub) SearchIssues(p *IssuesSearchParam) ([]*IssuesSearchResult, error)
Find issues by state and keyword.
func (*GitHub) SearchRepositories ¶
func (g *GitHub) SearchRepositories(p *RepositoriesSearchParam) ([]*RepositoriesSearchResult, error)
Find repositories by keyword. This method returns up to 100 results per page and pages can be fetched using the start_page parameter.
func (*GitHub) SearchUsers ¶
func (g *GitHub) SearchUsers(p *UsersSearchParam) ([]*UsersSearchResult, error)
Find users by state and keyword.
type IssuesSearchParam ¶
type IssuesSearchParam struct { Owner string Repository string State string // open or close Keyword string // contains filtered or unexported fields }
Types which represents params and result for search issues http://developer.github.com/v3/search/#search-issues
type IssuesSearchResult ¶
type IssuesSearchResult struct { GravatarId string `json:"gravatar_id"` Position int `json:"position"` Number int `json:"number"` Votes int `json:"votes"` CreatedAt time.Time `json:"created_at"` Comments int `json:"comments"` Body string `json:"body"` Title string `json:"title"` UpdatedAt time.Time `json:"updated_at"` HtmlUrl string `json:"html_url"` User string `json:"user"` Labels []string `json:"labels"` State string `json:"state"` }
type Organization ¶
type Organization struct { AvatarUrl string `json:"avatar_url"` BillingEmail string `json:"billing_email"` Blog string `json:"blog"` Collaborators int `json:"collaborators"` Company string `json:"company"` CreatedAt time.Time `json:"created_at"` DiskUsage int `json:"disk_usage"` Email string `json:"email"` EventsUrl string `json:"events_url"` Followers int `json:"followers"` Following int `json:"following"` HtmlUrl string `json:"html_url"` Id int `json:"id"` Location string `json:"location"` Login string `json:"login"` MembersUrl string `json:"members_url"` Name string `json:"name"` OwnedPrivateRepos int `json:"owned_private_repos"` Plan OrganizationPlan `json:"plan"` PrivateGists int `json:"private_gists"` PublicGists int `json:"public_gists"` PublicMembersUrl string `json:"public_members_url"` PublicRepos int `json:"public_repos"` ReposUrl string `json:"repos_url"` TotalPrivateRepos int `json:"total_private_repos"` Type string `json:"type"` UpdatedAt time.Time `json:"updated_at"` Url string `json:"url"` // contains filtered or unexported fields }
type OrganizationPlan ¶
type PublicKey ¶
type PublicKey struct { Id int `json:"id,omitempty"` Key string `json:"key"` Url string `json:"url,omitempty"` Title string `json:"title"` }
Holds information about user's public SSH keys that they have provided to GitHub.
type RepositoriesSearchParam ¶
type RepositoriesSearchParam struct { Keyword string Language string // optional: StartPage uint // optional: Sort string // optional: stars, forks or update Order string // optional: asc or desc // contains filtered or unexported fields }
Types which represents params and result for search repositories http://developer.github.com/v3/search/#search-repositories
type RepositoriesSearchResult ¶
type RepositoriesSearchResult struct { Type string `json:"type"` Created time.Time `json:"created"` Watchers int `json:"watchers"` HasDownloads bool `json:"has_downloads"` Username string `json:"username"` Homepage string `json:"homepage"` Url string `json:"url"` Fork bool `json:"fork"` HasIssues bool `json:"has_issues"` HasWiki bool `json:"has_wiki"` Forks int `json:"forks"` Size int `json:"size"` Private bool `json:"private"` Followers int `json:"followers"` Name string `json:"name"` Owner string `json:"owner"` OpenIssues int `json:"open_issues"` PushedAt time.Time `json:"pushed_at"` Score float32 `json:"score"` Pushed time.Time `json:"pushed"` Description string `json:"description"` Language string `json:"language"` CreatedAt time.Time `json:"created_at"` }
type Repository ¶
type Repository struct { ArchiveUrl string `json:"archive_url"` AssigneesUrl string `json:"assignees_url"` BlobsUrl string `json:"blobs_url"` CloneUrl string `json:"clone_url"` CollaboratorsUrl string `json:"collaborators_url"` CommentsUrl string `json:"comments_url"` CommitsUrl string `json:"comments_url"` CompareUrl string `json:"compare_url"` ContentsUrl string `json:"contentsUrl"` ContributorsUrl string `json:"contributors_url"` CreatedAt time.Time `json:"created_at"` DefaultBranch string `json:"default_branch"` Description string `json:"description"` DownloadsUrl string `json:"downloads_url"` EventsUrl string `json:"events_url"` Fork bool `json:"fork"` Forks int `json:"forks"` ForksCount int `json:"forks_count"` ForksUrl string `json:"forks_url"` FullName string `json:"full_name"` GitCommitsUrl string `json:"git_commits_url"` GitRefsUrl string `json:"git_refs_url"` GitTagsUrl string `json:"git_tags_url"` GitUrl string `json:"git_url"` HasDownloads bool `json:"has_downloads"` HasIssues bool `json:"has_issues"` HasWiki bool `json:"has_wiki"` Homepage string `json:"homepage"` HooksUrl string `json:"hooks_url"` HtmlUrl string `json:"html_url"` Id int `json:"id"` IssueCommentUrl string `json:"issue_comment_url"` IssueEventsUrl string `json:"issue_events_url"` IssuesUrl string `json:"issues_url"` KeysUrl string `json:"keys_url"` LabelsUrl string `json:"labels_url"` Language string `json:"language"` LanguagesUrl string `json:"languages_url"` MasterBranch string `json:"master_branch"` MergesUrl string `json:"merges_url"` MilestonesUrl string `json:"milestones_url"` MirrorUrl string `json:"mirror_url"` Name string `json:"name"` NotificationsUrl string `json:"notifications_url"` OpenIssues int `json:"open_issues"` OpenIssuesCount int `json:"open_issues_count"` Owner RepositoryOwner `json:"owner"` Permissions RepositoryPermissions `json:"permissions"` Private bool `json:"private"` PullsUrl string `json:"pulls_url"` PushedAt time.Time `json:"pushed_at"` Size int `json:"size"` SshUrl string `json:"ssh_url"` StargazersUrl string `json:"stargazers_url"` StatusesUrl string `json:"statuses_url"` SubscribersUrl string `json:"subscribers_url"` SubscriptionUrl string `json:"subscription_url"` SvnUrl string `json:"svn_url"` TagsUrl string `json:"tags_url"` TeamsUrl string `json:"teams_url"` TreesUrl string `json:"trees_url"` UpdatedAt time.Time `json:"updated_at"` Url string `json:"url"` Watchers int `json:"watchers"` WatchersCount int `json:"watchers_count"` }
type RepositoryOwner ¶
type RepositoryOwner struct { AvatarUrl string `json:"avatar_url"` EventsUrl string `json:"events_url"` FollowersUrl string `json:"followers_url"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` GravatarId string `json:"gravatar_id"` HtmlUrl string `json:"html_url"` Id int `json:"id"` Login string `json:"login"` OrganizationsUrl string `json:"organizations_url"` ReposUrl string `json:"repos_url"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` Type string `json:"type"` Url string `json:"url"` }
type RepositoryPermissions ¶
type User ¶
type User struct { Login string `json:"login"` Id int `json:"id"` AvatarUrl string `json:"avatar_url"` GravatarId string `json:"gravatar_id"` Url string `json:"url"` Name string `json:"name"` Company string `json:"company"` Blog string `json:"blog"` Location string `json:"location"` Email string `json:"email"` Hireable bool `json:"hireable"` Bio string `json:"bio"` PublicRepos int `json:"public_repos"` PublicGists int `json:"public_gists"` Followers int `json:"followers"` Following int `json:"following"` HtmlUrl string `json:"html_url"` CreatedAt time.Time `json:"created_at"` Type string `json:"type"` // contains filtered or unexported fields }
Represents information about a user's account as defined here: http://developer.github.com/v3/users/#get-a-single-user
Please take note that you cannot use the User struct to modify the details of a user's account. To do this, please look at the CurrentUser struct.
func (User) GetFollowers ¶
Gets a detailed list of a user's followers.
func (User) GetFollowing ¶
Gets a list of users the user is following.
func (User) GetPublicKeys ¶
Gets the verified public SSH keys for a user.
func (*User) Organizations ¶
func (u *User) Organizations() (orgs []Organization, err error)
List all of the organizations the user is a member of.
Please be aware that this method does not return a complete Organization struct; for that, please refer to the (*GitHub).GetOrganization() method.
func (User) Repositories ¶
func (u User) Repositories(options ...int) (repositories []Repository, err error)
Get the user's repositories.
type UsersSearchParam ¶
type UsersSearchParam struct { Keyword string StartPage uint // optional: Sort string // optional: start, forks or update Order string // optional: asc or desc // contains filtered or unexported fields }
Types which represents params and result for search users http://developer.github.com/v3/search/#search-users
type UsersSearchResult ¶
type UsersSearchResult struct { GravatarId string `json:"gravatar_id"` Name string `json:"name"` CreatedAt time.Time `json:"created_at"` Location string `json:"location"` PublicRepoCount int `json:"public_repo_count"` Followers int `json:"followers"` Language string `json:"language"` Fullname string `json:"fullname"` Username string `json:"username"` Id string `json:"id"` Repos int `json:"repos"` Type string `json:"type"` FollowersCount int `json:"followers_count"` Login string `json:"login"` Score float32 `json:"score"` Created time.Time `json:"created"` }