diff --git a/github/copilot_test.go b/github/copilot_test.go index 82e8a770455..6a2f1703d37 100644 --- a/github/copilot_test.go +++ b/github/copilot_test.go @@ -515,18 +515,19 @@ func TestCopilotService_ListCopilotSeats(t *testing.T) { SiteAdmin: Ptr(false), }, AssigningTeam: &Team{ - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VGVhbTE="), - URL: Ptr("https://api.github.com/teams/1"), - HTMLURL: Ptr("https://github.com/orgs/github/teams/justice-league"), - Name: Ptr("Justice League"), - Slug: Ptr("justice-league"), - Description: Ptr("A great team."), - Privacy: Ptr("closed"), - Permission: Ptr("admin"), - MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), - Parent: nil, + ID: Ptr(int64(1)), + NodeID: Ptr("MDQ6VGVhbTE="), + URL: Ptr("https://api.github.com/teams/1"), + HTMLURL: Ptr("https://github.com/orgs/github/teams/justice-league"), + Name: Ptr("Justice League"), + Slug: Ptr("justice-league"), + Description: Ptr("A great team."), + Privacy: Ptr("closed"), + Permission: Ptr("admin"), + NotificationSetting: Ptr("notifications_enabled"), + MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), + Parent: nil, }, CreatedAt: &createdAt1, UpdatedAt: &updatedAt1, @@ -765,18 +766,19 @@ func TestCopilotService_ListCopilotEnterpriseSeats(t *testing.T) { SiteAdmin: Ptr(false), }, AssigningTeam: &Team{ - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VGVhbTE="), - URL: Ptr("https://api.github.com/teams/1"), - HTMLURL: Ptr("https://github.com/orgs/github/teams/justice-league"), - Name: Ptr("Justice League"), - Slug: Ptr("justice-league"), - Description: Ptr("A great team."), - Privacy: Ptr("closed"), - Permission: Ptr("admin"), - MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), - Parent: nil, + ID: Ptr(int64(1)), + NodeID: Ptr("MDQ6VGVhbTE="), + URL: Ptr("https://api.github.com/teams/1"), + HTMLURL: Ptr("https://github.com/orgs/github/teams/justice-league"), + Name: Ptr("Justice League"), + Slug: Ptr("justice-league"), + Description: Ptr("A great team."), + Privacy: Ptr("closed"), + NotificationSetting: Ptr("notifications_enabled"), + Permission: Ptr("admin"), + MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), + Parent: nil, }, CreatedAt: &createdAt1, UpdatedAt: &updatedAt1, @@ -1087,18 +1089,19 @@ func TestCopilotService_GetSeatDetails(t *testing.T) { SiteAdmin: Ptr(false), }, AssigningTeam: &Team{ - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VGVhbTE="), - URL: Ptr("https://api.github.com/teams/1"), - HTMLURL: Ptr("https://github.com/orgs/github/teams/justice-league"), - Name: Ptr("Justice League"), - Slug: Ptr("justice-league"), - Description: Ptr("A great team."), - Privacy: Ptr("closed"), - Permission: Ptr("admin"), - MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), - Parent: nil, + ID: Ptr(int64(1)), + NodeID: Ptr("MDQ6VGVhbTE="), + URL: Ptr("https://api.github.com/teams/1"), + HTMLURL: Ptr("https://github.com/orgs/github/teams/justice-league"), + Name: Ptr("Justice League"), + Slug: Ptr("justice-league"), + Description: Ptr("A great team."), + Privacy: Ptr("closed"), + NotificationSetting: Ptr("notifications_enabled"), + Permission: Ptr("admin"), + MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), + Parent: nil, }, CreatedAt: &createdAt, UpdatedAt: &updatedAt, diff --git a/github/github-accessors.go b/github/github-accessors.go index 448154a47f4..ec7ac4f7b20 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -24046,6 +24046,14 @@ func (t *Team) GetNodeID() string { return *t.NodeID } +// GetNotificationSetting returns the NotificationSetting field if it's non-nil, zero value otherwise. +func (t *Team) GetNotificationSetting() string { + if t == nil || t.NotificationSetting == nil { + return "" + } + return *t.NotificationSetting +} + // GetOrganization returns the Organization field. func (t *Team) GetOrganization() *Organization { if t == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 1e2a53f1601..dca95aba16e 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -30794,6 +30794,17 @@ func TestTeam_GetNodeID(tt *testing.T) { t.GetNodeID() } +func TestTeam_GetNotificationSetting(tt *testing.T) { + tt.Parallel() + var zeroValue string + t := &Team{NotificationSetting: &zeroValue} + t.GetNotificationSetting() + t = &Team{} + t.GetNotificationSetting() + t = nil + t.GetNotificationSetting() +} + func TestTeam_GetOrganization(tt *testing.T) { tt.Parallel() t := &Team{} diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 6fda6a907c7..881e279f942 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1930,25 +1930,26 @@ func TestSourceImportAuthor_String(t *testing.T) { func TestTeam_String(t *testing.T) { t.Parallel() v := Team{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), - Name: Ptr(""), - Description: Ptr(""), - URL: Ptr(""), - Slug: Ptr(""), - Permission: Ptr(""), - Privacy: Ptr(""), - MembersCount: Ptr(0), - ReposCount: Ptr(0), - Organization: &Organization{}, - HTMLURL: Ptr(""), - MembersURL: Ptr(""), - RepositoriesURL: Ptr(""), - Parent: &Team{}, - LDAPDN: Ptr(""), - Assignment: Ptr(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), + Name: Ptr(""), + Description: Ptr(""), + URL: Ptr(""), + Slug: Ptr(""), + Permission: Ptr(""), + Privacy: Ptr(""), + NotificationSetting: Ptr(""), + MembersCount: Ptr(0), + ReposCount: Ptr(0), + Organization: &Organization{}, + HTMLURL: Ptr(""), + MembersURL: Ptr(""), + RepositoriesURL: Ptr(""), + Parent: &Team{}, + LDAPDN: Ptr(""), + Assignment: Ptr(""), } - want := `github.Team{ID:0, NodeID:"", Name:"", Description:"", URL:"", Slug:"", Permission:"", Privacy:"", MembersCount:0, ReposCount:0, Organization:github.Organization{}, HTMLURL:"", MembersURL:"", RepositoriesURL:"", Parent:github.Team{}, LDAPDN:"", Assignment:""}` + want := `github.Team{ID:0, NodeID:"", Name:"", Description:"", URL:"", Slug:"", Permission:"", Privacy:"", NotificationSetting:"", MembersCount:0, ReposCount:0, Organization:github.Organization{}, HTMLURL:"", MembersURL:"", RepositoriesURL:"", Parent:github.Team{}, LDAPDN:"", Assignment:""}` if got := v.String(); got != want { t.Errorf("Team.String = %v, want %v", got, want) } diff --git a/github/teams.go b/github/teams.go index 579e5b828b5..d334110f4a7 100644 --- a/github/teams.go +++ b/github/teams.go @@ -37,6 +37,9 @@ type Team struct { // Default is "secret". Privacy *string `json:"privacy,omitempty"` + // NotificationSetting can be one of: "notifications_enabled", "notifications_disabled". + NotificationSetting *string `json:"notification_setting,omitempty"` + MembersCount *int `json:"members_count,omitempty"` ReposCount *int `json:"repos_count,omitempty"` Organization *Organization `json:"organization,omitempty"`