diff --git a/github/github-accessors.go b/github/github-accessors.go index f94c75708e1..1e909793815 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -40686,6 +40686,14 @@ func (t *TaskStep) GetStatus() string { return *t.Status } +// GetAccessSource returns the AccessSource field if it's non-nil, zero value otherwise. +func (t *Team) GetAccessSource() string { + if t == nil || t.AccessSource == nil { + return "" + } + return *t.AccessSource +} + // GetAssignment returns the Assignment field if it's non-nil, zero value otherwise. func (t *Team) GetAssignment() string { if t == nil || t.Assignment == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 0d74567ba6c..90d7e917e97 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -50977,6 +50977,17 @@ func TestTaskStep_GetStatus(tt *testing.T) { t.GetStatus() } +func TestTeam_GetAccessSource(tt *testing.T) { + tt.Parallel() + var zeroValue string + t := &Team{AccessSource: &zeroValue} + t.GetAccessSource() + t = &Team{} + t.GetAccessSource() + t = nil + t.GetAccessSource() +} + func TestTeam_GetAssignment(tt *testing.T) { tt.Parallel() var zeroValue string diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 0063cf44cb2..a91eeb40cfd 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -2295,8 +2295,9 @@ func TestTeam_String(t *testing.T) { LDAPDN: Ptr(""), Assignment: Ptr(""), Type: Ptr(""), + AccessSource: Ptr(""), } - 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:"", Type:""}` + 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:"", Type:"", AccessSource:""}` 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 b108137a9a3..d247693c57c 100644 --- a/github/teams.go +++ b/github/teams.go @@ -64,6 +64,11 @@ type Team struct { // Type identifies the ownership type of the team // Possible values are: "organization", "enterprise". Type *string `json:"type,omitempty"` + + // AccessSource identifies the source of the team's access to a specific + // repository. Possible values are: "direct", "organization" or "enterprise". + // This is only populated when calling [RepositoriesService.ListTeams]. + AccessSource *string `json:"access_source,omitempty"` } func (t Team) String() string {