github.com/crosbymichael/octokat@v0.0.0-20160826194511-076a32289ed5/statistics.go (about) 1 package octokat 2 3 import ( 4 "fmt" 5 ) 6 7 type Contributor struct { 8 Total int `json:"total,omitempty"` 9 Weeks []struct { 10 WeekStart int `json:"w,omitempty"` 11 Additions int `json:"a,omitempty"` 12 Deletions int `json:"d,omitempty"` 13 Commits int `json:"c,omitempty"` 14 } `json:"weeks,omitempty"` 15 Author struct { 16 Login string `json:"login,omitempty"` 17 Id int `json:"id,omitempty"` 18 AvatarURL string `json:"avatar_url,omitempty"` 19 GravatarID string `json:"gravatar_id,omitempty"` 20 URL string `json:"url,omitempty"` 21 HTMLURL string `json:"html_url,omitempty"` 22 FollowersURL string `json:"followers_url,omitempty"` 23 FollowingURL string `json:"following_url,omitempty"` 24 GistsURL string `json:"gists_url,omitempty"` 25 StarredURL string `json:"starred_url,omitempty"` 26 SubscriptionsURL string `json:"subscriptions_url,omitempty"` 27 OrganizationsURL string `json:"organizations_url,omitempty"` 28 ReposURL string `json:"repos_url,omitempty"` 29 EventsURL string `json:"events_url,omitempty"` 30 ReceivedEventsURL string `json:"received_events_url,omitempty"` 31 Type string `json:"type,omitempty"` 32 SiteAdmin bool `json:"site_admin,omitempty"` 33 } `json:"author,omitempty"` 34 } 35 36 // Get a list of contributors 37 // 38 //http://developer.github.com/v3/repos/statistics/#contributors 39 func (c *Client) Contributors(repo Repo, options *Options) (contributors []*Contributor, err error) { 40 path := fmt.Sprintf("repos/%s/stats/contributors", repo) 41 err = c.jsonGet(path, options, &contributors) 42 return 43 }