@@ -20,11 +20,7 @@ type Team struct {
20
20
URL * string `json:"url,omitempty"`
21
21
Slug * string `json:"slug,omitempty"`
22
22
23
- // Permission is deprecated when creating or editing a team in an org
24
- // using the new GitHub permission model. It no longer identifies the
25
- // permission a team has on its repos, but only specifies the default
26
- // permission a repo is initially added with. Avoid confusion by
27
- // specifying a permission value when calling AddTeamRepo.
23
+ // Permission specifies the default permission for repositories owned by the team.
28
24
Permission * string `json:"permission,omitempty"`
29
25
30
26
// Privacy identifies the level of privacy this team should have.
@@ -114,10 +110,41 @@ func (s *OrganizationsService) GetTeam(ctx context.Context, team int) (*Team, *R
114
110
return t , resp , nil
115
111
}
116
112
113
+ // NewTeam represents a team to be created or modified.
114
+ type NewTeam struct {
115
+ Name string `json:"name"` // Name of the team. (Required.)
116
+ Description * string `json:"description,omitempty"`
117
+ Maintainers []string `json:"maintainers,omitempty"`
118
+ RepoNames []string `json:"repo_names,omitempty"`
119
+ ParentTeamID * string `json:"parent_team_id,omitempty"`
120
+
121
+ // Deprecated: Permission is deprecated when creating or editing a team in an org
122
+ // using the new GitHub permission model. It no longer identifies the
123
+ // permission a team has on its repos, but only specifies the default
124
+ // permission a repo is initially added with. Avoid confusion by
125
+ // specifying a permission value when calling AddTeamRepo.
126
+ Permission * string `json:"permission,omitempty"`
127
+
128
+ // Privacy identifies the level of privacy this team should have.
129
+ // Possible values are:
130
+ // secret - only visible to organization owners and members of this team
131
+ // closed - visible to all members of this organization
132
+ // Default is "secret".
133
+ Privacy * string `json:"privacy,omitempty"`
134
+
135
+ // LDAPDN may be used in GitHub Enterprise when the team membership
136
+ // is synchronized with LDAP.
137
+ LDAPDN * string `json:"ldap_dn,omitempty"`
138
+ }
139
+
140
+ func (s NewTeam ) String () string {
141
+ return Stringify (s )
142
+ }
143
+
117
144
// CreateTeam creates a new team within an organization.
118
145
//
119
146
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#create-team
120
- func (s * OrganizationsService ) CreateTeam (ctx context.Context , org string , team * Team ) (* Team , * Response , error ) {
147
+ func (s * OrganizationsService ) CreateTeam (ctx context.Context , org string , team * NewTeam ) (* Team , * Response , error ) {
121
148
u := fmt .Sprintf ("orgs/%v/teams" , org )
122
149
req , err := s .client .NewRequest ("POST" , u , team )
123
150
if err != nil {
@@ -139,7 +166,7 @@ func (s *OrganizationsService) CreateTeam(ctx context.Context, org string, team
139
166
// EditTeam edits a team.
140
167
//
141
168
// GitHub API docs: https://developer.github.com/v3/orgs/teams/#edit-team
142
- func (s * OrganizationsService ) EditTeam (ctx context.Context , id int , team * Team ) (* Team , * Response , error ) {
169
+ func (s * OrganizationsService ) EditTeam (ctx context.Context , id int , team * NewTeam ) (* Team , * Response , error ) {
143
170
u := fmt .Sprintf ("teams/%v" , id )
144
171
req , err := s .client .NewRequest ("PATCH" , u , team )
145
172
if err != nil {
0 commit comments