|
|
|
@ -10,6 +10,7 @@ import ( |
|
|
|
"fmt" |
|
|
|
"net/url" |
|
|
|
"strconv" |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
|
// UsersService handles communication with the user related
|
|
|
|
@ -21,20 +22,21 @@ type UsersService struct { |
|
|
|
} |
|
|
|
|
|
|
|
type User struct { |
|
|
|
Login string `json:"login,omitempty"` |
|
|
|
ID int `json:"id,omitempty"` |
|
|
|
URL string `json:"url,omitempty"` |
|
|
|
AvatarURL string `json:"avatar_url,omitempty"` |
|
|
|
GravatarID string `json:"gravatar_id,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"` |
|
|
|
PublicRepos int `json:"public_repos,omitempty"` |
|
|
|
Followers int `json:"followers,omitempty"` |
|
|
|
Following int `json:"following,omitempty"` |
|
|
|
Login string `json:"login,omitempty"` |
|
|
|
ID int `json:"id,omitempty"` |
|
|
|
URL string `json:"url,omitempty"` |
|
|
|
AvatarURL string `json:"avatar_url,omitempty"` |
|
|
|
GravatarID string `json:"gravatar_id,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"` |
|
|
|
PublicRepos int `json:"public_repos,omitempty"` |
|
|
|
Followers int `json:"followers,omitempty"` |
|
|
|
Following int `json:"following,omitempty"` |
|
|
|
CreatedAt *time.Time `json:"created_at,omitempty"` |
|
|
|
} |
|
|
|
|
|
|
|
// Get fetches a user. Passing the empty string will fetch the authenticated
|
|
|
|
@ -77,7 +79,7 @@ type UserListOptions struct { |
|
|
|
} |
|
|
|
|
|
|
|
// List all users.
|
|
|
|
func (s *UsersService) List(opt *UserListOptions) ([]User, error) { |
|
|
|
func (s *UsersService) ListAll(opt *UserListOptions) ([]User, error) { |
|
|
|
url_ := "users" |
|
|
|
if opt != nil { |
|
|
|
params := url.Values{ |
|
|
|
|