From c27344979f7c30dcbe477d869d117332095877ef Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Fri, 10 Apr 2026 15:40:03 +0300 Subject: [PATCH 1/3] fix: Add missing `User` fields --- github/github-accessors.go | 16 +++++++++++++ github/github-accessors_test.go | 22 ++++++++++++++++++ github/github-stringify_test.go | 4 +++- github/users.go | 2 ++ github/users_test.go | 40 ++++++++++++++++++--------------- 5 files changed, 65 insertions(+), 19 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 37801159bdc..9be5bfa102b 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -40150,6 +40150,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 +40326,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..0dba4f8e696 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -50471,6 +50471,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 +50707,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..beb5c2ac2c9 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(""), @@ -2416,7 +2418,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{}, 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..ce614881b77 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"` diff --git a/github/users_test.go b/github/users_test.go index 17901935c1b..0308c30d136 100644 --- a/github/users_test.go +++ b/github/users_test.go @@ -19,28 +19,31 @@ 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}, } want := `{ "login": "l", "id": 1, + "user_view_type": "public", "avatar_url": "a", "gravatar_id": "g", "name": "n", @@ -48,6 +51,7 @@ func TestUser_Marshal(t *testing.T) { "blog": "b", "location": "l", "email": "e", + "notification_email": "ne", "hireable": true, "bio": "b", "twitter_username": "t", From 340254d58bc35c4cf011fa1eecbd32f1881f8564 Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Fri, 10 Apr 2026 20:54:32 +0300 Subject: [PATCH 2/3] add business_plus --- github/users.go | 1 + github/users_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/github/users.go b/github/users.go index ce614881b77..7e6cd10c687 100644 --- a/github/users.go +++ b/github/users.go @@ -50,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 0308c30d136..3cfa7151bfa 100644 --- a/github/users_test.go +++ b/github/users_test.go @@ -39,6 +39,7 @@ func TestUser_Marshal(t *testing.T) { Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, + BusinessPlus: Ptr(true), } want := `{ "login": "l", @@ -60,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) From 3e4f3e27670a41547f4c47024f9c8b65edb8e83a Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Fri, 10 Apr 2026 20:55:06 +0300 Subject: [PATCH 3/3] go generate ./... --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 11 +++++++++++ github/github-stringify_test.go | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 9be5bfa102b..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 { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 0dba4f8e696..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 diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index beb5c2ac2c9..ab026ade256 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -2403,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(""), @@ -2418,7 +2419,7 @@ func TestUser_String(t *testing.T) { RoleName: Ptr(""), Assignment: Ptr(""), } - 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{}, 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) }