diff --git a/github/github-accessors.go b/github/github-accessors.go index 37801159bdc..f925dff0d29 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -39982,6 +39982,14 @@ func (u *User) GetBlog() string { return *u.Blog } +// GetBusinessPlus returns the BusinessPlus field if it's non-nil, zero value otherwise. +func (u *User) GetBusinessPlus() bool { + if u == nil || u.BusinessPlus == nil { + return false + } + return *u.BusinessPlus +} + // GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise. func (u *User) GetCollaborators() int { if u == nil || u.Collaborators == nil { @@ -40150,6 +40158,14 @@ func (u *User) GetNodeID() string { return *u.NodeID } +// GetNotificationEmail returns the NotificationEmail field if it's non-nil, zero value otherwise. +func (u *User) GetNotificationEmail() string { + if u == nil || u.NotificationEmail == nil { + return "" + } + return *u.NotificationEmail +} + // GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. func (u *User) GetOrganizationsURL() string { if u == nil || u.OrganizationsURL == nil { @@ -40318,6 +40334,14 @@ func (u *User) GetURL() string { return *u.URL } +// GetUserViewType returns the UserViewType field if it's non-nil, zero value otherwise. +func (u *User) GetUserViewType() string { + if u == nil || u.UserViewType == nil { + return "" + } + return *u.UserViewType +} + // GetApp returns the App field. func (u *UserAuthorization) GetApp() *OAuthAPP { if u == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index b1dc2e00138..2b556a2ccce 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -50240,6 +50240,17 @@ func TestUser_GetBlog(tt *testing.T) { u.GetBlog() } +func TestUser_GetBusinessPlus(tt *testing.T) { + tt.Parallel() + var zeroValue bool + u := &User{BusinessPlus: &zeroValue} + u.GetBusinessPlus() + u = &User{} + u.GetBusinessPlus() + u = nil + u.GetBusinessPlus() +} + func TestUser_GetCollaborators(tt *testing.T) { tt.Parallel() var zeroValue int @@ -50471,6 +50482,17 @@ func TestUser_GetNodeID(tt *testing.T) { u.GetNodeID() } +func TestUser_GetNotificationEmail(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &User{NotificationEmail: &zeroValue} + u.GetNotificationEmail() + u = &User{} + u.GetNotificationEmail() + u = nil + u.GetNotificationEmail() +} + func TestUser_GetOrganizationsURL(tt *testing.T) { tt.Parallel() var zeroValue string @@ -50696,6 +50718,17 @@ func TestUser_GetURL(tt *testing.T) { u.GetURL() } +func TestUser_GetUserViewType(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &User{UserViewType: &zeroValue} + u.GetUserViewType() + u = &User{} + u.GetUserViewType() + u = nil + u.GetUserViewType() +} + func TestUserAuthorization_GetApp(tt *testing.T) { tt.Parallel() u := &UserAuthorization{} diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 98cdbbf9d0c..ab026ade256 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -2373,6 +2373,7 @@ func TestUser_String(t *testing.T) { v := User{ Login: Ptr(""), ID: Ptr(int64(0)), + UserViewType: Ptr(""), NodeID: Ptr(""), AvatarURL: Ptr(""), HTMLURL: Ptr(""), @@ -2382,6 +2383,7 @@ func TestUser_String(t *testing.T) { Blog: Ptr(""), Location: Ptr(""), Email: Ptr(""), + NotificationEmail: Ptr(""), Hireable: Ptr(false), Bio: Ptr(""), TwitterUsername: Ptr(""), @@ -2401,6 +2403,7 @@ func TestUser_String(t *testing.T) { Collaborators: Ptr(0), TwoFactorAuthentication: Ptr(false), Plan: &Plan{}, + BusinessPlus: Ptr(false), LdapDn: Ptr(""), URL: Ptr(""), EventsURL: Ptr(""), @@ -2416,7 +2419,7 @@ func TestUser_String(t *testing.T) { RoleName: Ptr(""), Assignment: Ptr(""), } - want := `github.User{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", GravatarID:"", Name:"", Company:"", Blog:"", Location:"", Email:"", Hireable:false, Bio:"", TwitterUsername:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, SuspendedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Type:"", SiteAdmin:false, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, TwoFactorAuthentication:false, Plan:github.Plan{}, LdapDn:"", URL:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:"", Permissions:github.RepositoryPermissions{}, RoleName:"", Assignment:""}` + want := `github.User{Login:"", ID:0, UserViewType:"", NodeID:"", AvatarURL:"", HTMLURL:"", GravatarID:"", Name:"", Company:"", Blog:"", Location:"", Email:"", NotificationEmail:"", Hireable:false, Bio:"", TwitterUsername:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, SuspendedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Type:"", SiteAdmin:false, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, TwoFactorAuthentication:false, Plan:github.Plan{}, BusinessPlus:false, LdapDn:"", URL:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:"", Permissions:github.RepositoryPermissions{}, RoleName:"", Assignment:""}` if got := v.String(); got != want { t.Errorf("User.String = %v, want %v", got, want) } diff --git a/github/users.go b/github/users.go index 0799395987d..7e6cd10c687 100644 --- a/github/users.go +++ b/github/users.go @@ -20,6 +20,7 @@ type UsersService service type User struct { Login *string `json:"login,omitempty"` ID *int64 `json:"id,omitempty"` + UserViewType *string `json:"user_view_type,omitempty"` NodeID *string `json:"node_id,omitempty"` AvatarURL *string `json:"avatar_url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` @@ -29,6 +30,7 @@ type User struct { Blog *string `json:"blog,omitempty"` Location *string `json:"location,omitempty"` Email *string `json:"email,omitempty"` + NotificationEmail *string `json:"notification_email,omitempty"` Hireable *bool `json:"hireable,omitempty"` Bio *string `json:"bio,omitempty"` TwitterUsername *string `json:"twitter_username,omitempty"` @@ -48,6 +50,7 @@ type User struct { Collaborators *int `json:"collaborators,omitempty"` TwoFactorAuthentication *bool `json:"two_factor_authentication,omitempty"` Plan *Plan `json:"plan,omitempty"` + BusinessPlus *bool `json:"business_plus,omitempty"` LdapDn *string `json:"ldap_dn,omitempty"` // API URLs diff --git a/github/users_test.go b/github/users_test.go index 17901935c1b..3cfa7151bfa 100644 --- a/github/users_test.go +++ b/github/users_test.go @@ -19,28 +19,32 @@ func TestUser_Marshal(t *testing.T) { testJSONMarshal(t, &User{}, "{}") u := &User{ - Login: Ptr("l"), - ID: Ptr(int64(1)), - URL: Ptr("u"), - AvatarURL: Ptr("a"), - GravatarID: Ptr("g"), - Name: Ptr("n"), - Company: Ptr("c"), - Blog: Ptr("b"), - Location: Ptr("l"), - Email: Ptr("e"), - Hireable: Ptr(true), - Bio: Ptr("b"), - TwitterUsername: Ptr("t"), - PublicRepos: Ptr(1), - Followers: Ptr(1), - Following: Ptr(1), - CreatedAt: &Timestamp{referenceTime}, - SuspendedAt: &Timestamp{referenceTime}, + Login: Ptr("l"), + ID: Ptr(int64(1)), + UserViewType: Ptr("public"), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + NotificationEmail: Ptr("ne"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), + CreatedAt: &Timestamp{referenceTime}, + SuspendedAt: &Timestamp{referenceTime}, + BusinessPlus: Ptr(true), } want := `{ "login": "l", "id": 1, + "user_view_type": "public", "avatar_url": "a", "gravatar_id": "g", "name": "n", @@ -48,6 +52,7 @@ func TestUser_Marshal(t *testing.T) { "blog": "b", "location": "l", "email": "e", + "notification_email": "ne", "hireable": true, "bio": "b", "twitter_username": "t", @@ -56,6 +61,7 @@ func TestUser_Marshal(t *testing.T) { "following": 1, "created_at": ` + referenceTimeStr + `, "suspended_at": ` + referenceTimeStr + `, + "business_plus": true, "url": "u" }` testJSONMarshal(t, u, want)