-
Notifications
You must be signed in to change notification settings - Fork 0
/
github_account.go
36 lines (31 loc) · 1.02 KB
/
github_account.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package github
import (
"fmt"
)
type searchResult struct {
Items []Account `json:"items"`
}
//Account defines properties an account on github has
type Account struct {
ID int `json:"id,omitempty"`
Login string `json:"login,omitempty"`
Name string `json:"name,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
Type string `json:"type,omitempty"`
}
//Team defines properties a team on github has
type Team struct {
ID int `json:"id,omitempty"`
Organization map[string]interface{} `json:"organization,omitempty"`
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
}
func (t *Team) toGithubAccount(url string, account *Account) {
account.ID = t.ID
account.Name = t.Name
orgLogin := (t.Organization["login"]).(string)
account.AvatarURL = t.Organization["avatar_url"].(string)
account.HTMLURL = fmt.Sprintf(url, orgLogin, t.Slug)
account.Login = t.Slug
}