diff --git a/github/github-accessors.go b/github/github-accessors.go index 37ddb180d8f..081083415b3 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -14276,6 +14276,14 @@ func (t *Team) GetPermission() string { return *t.Permission } +// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. +func (t *Team) GetPermissions() map[string]bool { + if t == nil || t.Permissions == nil { + return map[string]bool{} + } + return *t.Permissions +} + // GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. func (t *Team) GetPrivacy() string { if t == nil || t.Privacy == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 3da8dda1037..49ceb123953 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -16730,6 +16730,16 @@ func TestTeam_GetPermission(tt *testing.T) { t.GetPermission() } +func TestTeam_GetPermissions(tt *testing.T) { + var zeroValue map[string]bool + t := &Team{Permissions: &zeroValue} + t.GetPermissions() + t = &Team{} + t.GetPermissions() + t = nil + t.GetPermissions() +} + func TestTeam_GetPrivacy(tt *testing.T) { var zeroValue string t := &Team{Privacy: &zeroValue} diff --git a/github/teams.go b/github/teams.go index 592a11fd848..2e1cd3dafe9 100644 --- a/github/teams.go +++ b/github/teams.go @@ -32,6 +32,10 @@ type Team struct { // Permission specifies the default permission for repositories owned by the team. Permission *string `json:"permission,omitempty"` + // Permissions identifies the permissions that a team has on a given + // repository. This is only populated when calling Repositories.ListTeams. + Permissions *map[string]bool `json:"permissions,omitempty"` + // Privacy identifies the level of privacy this team should have. // Possible values are: // secret - only visible to organization owners and members of this team