Skip to content

Commit

Permalink
Add missing fields to user and org types (#1548)
Browse files Browse the repository at this point in the history
  • Loading branch information
nightlark committed May 31, 2020
1 parent 407d736 commit 2c8de65
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 18 deletions.
40 changes: 40 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions github/github-stringify_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions github/orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Organization struct {
Blog *string `json:"blog,omitempty"`
Location *string `json:"location,omitempty"`
Email *string `json:"email,omitempty"`
TwitterUsername *string `json:"twitter_username,omitempty"`
Description *string `json:"description,omitempty"`
PublicRepos *int `json:"public_repos,omitempty"`
PublicGists *int `json:"public_gists,omitempty"`
Expand All @@ -45,6 +46,9 @@ type Organization struct {
Type *string `json:"type,omitempty"`
Plan *Plan `json:"plan,omitempty"`
TwoFactorRequirementEnabled *bool `json:"two_factor_requirement_enabled,omitempty"`
IsVerified *bool `json:"is_verified,omitempty"`
HasOrganizationProjects *bool `json:"has_organization_projects,omitempty"`
HasRepositoryProjects *bool `json:"has_repository_projects,omitempty"`

// DefaultRepoPermission can be one of: "read", "write", "admin", or "none". (Default: "read").
// It is only used in OrganizationsService.Edit.
Expand Down
8 changes: 8 additions & 0 deletions github/orgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ func TestOrganization_marshal(t *testing.T) {
Blog: String("https://github.com/blog"),
Company: String("GitHub"),
Email: String("support@github.com"),
TwitterUsername: String("github"),
Location: String("San Francisco"),
Name: String("github"),
Description: String("GitHub, the company."),
IsVerified: Bool(true),
HasOrganizationProjects: Bool(true),
HasRepositoryProjects: Bool(true),
DefaultRepoPermission: String("read"),
MembersCanCreateRepos: Bool(true),
MembersCanCreateInternalRepos: Bool(true),
Expand All @@ -38,9 +42,13 @@ func TestOrganization_marshal(t *testing.T) {
"blog": "https://github.com/blog",
"company": "GitHub",
"email": "support@github.com",
"twitter_username": "github",
"location": "San Francisco",
"name": "github",
"description": "GitHub, the company.",
"is_verified": true,
"has_organization_projects": true,
"has_repository_projects": true,
"default_repository_permission": "read",
"members_can_create_repositories": true,
"members_can_create_public_repositories": false,
Expand Down
1 change: 1 addition & 0 deletions github/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type User struct {
Email *string `json:"email,omitempty"`
Hireable *bool `json:"hireable,omitempty"`
Bio *string `json:"bio,omitempty"`
TwitterUsername *string `json:"twitter_username,omitempty"`
PublicRepos *int `json:"public_repos,omitempty"`
PublicGists *int `json:"public_gists,omitempty"`
Followers *int `json:"followers,omitempty"`
Expand Down
36 changes: 20 additions & 16 deletions github/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,24 @@ func TestUser_marshall(t *testing.T) {
testJSONMarshal(t, &User{}, "{}")

u := &User{
Login: String("l"),
ID: Int64(1),
URL: String("u"),
AvatarURL: String("a"),
GravatarID: String("g"),
Name: String("n"),
Company: String("c"),
Blog: String("b"),
Location: String("l"),
Email: String("e"),
Hireable: Bool(true),
PublicRepos: Int(1),
Followers: Int(1),
Following: Int(1),
CreatedAt: &Timestamp{referenceTime},
SuspendedAt: &Timestamp{referenceTime},
Login: String("l"),
ID: Int64(1),
URL: String("u"),
AvatarURL: String("a"),
GravatarID: String("g"),
Name: String("n"),
Company: String("c"),
Blog: String("b"),
Location: String("l"),
Email: String("e"),
Hireable: Bool(true),
Bio: String("b"),
TwitterUsername: String("t"),
PublicRepos: Int(1),
Followers: Int(1),
Following: Int(1),
CreatedAt: &Timestamp{referenceTime},
SuspendedAt: &Timestamp{referenceTime},
}
want := `{
"login": "l",
Expand All @@ -46,6 +48,8 @@ func TestUser_marshall(t *testing.T) {
"location": "l",
"email": "e",
"hireable": true,
"bio": "b",
"twitter_username": "t",
"public_repos": 1,
"followers": 1,
"following": 1,
Expand Down

0 comments on commit 2c8de65

Please sign in to comment.