github.com/nesv/gothub@v0.0.0-20140406181320-f0c824044d5f/organizations.go (about) 1 package gothub 2 3 import ( 4 "fmt" 5 "time" 6 ) 7 8 type OrganizationPlan struct { 9 Name string `json:"name"` 10 PrivateRepos int `json:"private_repos"` 11 Space int `json:"space"` 12 } 13 14 type Organization struct { 15 AvatarUrl string `json:"avatar_url"` 16 BillingEmail string `json:"billing_email"` 17 Blog string `json:"blog"` 18 Collaborators int `json:"collaborators"` 19 Company string `json:"company"` 20 CreatedAt time.Time `json:"created_at"` 21 DiskUsage int `json:"disk_usage"` 22 Email string `json:"email"` 23 EventsUrl string `json:"events_url"` 24 Followers int `json:"followers"` 25 Following int `json:"following"` 26 HtmlUrl string `json:"html_url"` 27 Id int `json:"id"` 28 Location string `json:"location"` 29 Login string `json:"login"` 30 MembersUrl string `json:"members_url"` 31 Name string `json:"name"` 32 OwnedPrivateRepos int `json:"owned_private_repos"` 33 Plan OrganizationPlan `json:"plan"` 34 PrivateGists int `json:"private_gists"` 35 PublicGists int `json:"public_gists"` 36 PublicMembersUrl string `json:"public_members_url"` 37 PublicRepos int `json:"public_repos"` 38 ReposUrl string `json:"repos_url"` 39 TotalPrivateRepos int `json:"total_private_repos"` 40 Type string `json:"type"` 41 UpdatedAt time.Time `json:"updated_at"` 42 Url string `json:"url"` 43 g *GitHub 44 } 45 46 // Returns a complete Organization struct. 47 func (g *GitHub) GetOrganization(name string) (org *Organization, err error) { 48 uri := fmt.Sprintf("/orgs/%s", name) 49 err = g.callGithubApi("GET", uri, &org) 50 org.g = g 51 return 52 } 53 54 // List all of the organizations the currently-authenticated user is a member of. 55 // 56 // Please be aware that this method does not return a complete Organization struct; 57 // for that, please refer to the (*GitHub).GetOrganization() method. 58 func (g *GitHub) Organizations() (orgs []Organization, err error) { 59 err = g.callGithubApi("GET", "/user/orgs", &orgs) 60 return 61 } 62 63 // List all of the organizations the user is a member of. 64 // 65 // Please be aware that this method does not return a complete Organization struct; 66 // for that, please refer to the (*GitHub).GetOrganization() method. 67 func (u *User) Organizations() (orgs []Organization, err error) { 68 uri := fmt.Sprintf("/users/%s/orgs", u.Login) 69 err = u.g.callGithubApi("GET", uri, &orgs) 70 return 71 }