@@ -121,6 +121,11 @@ type Repository struct {
121121 // TextMatches is only populated from search results that request text matches
122122 // See: search.go and https://developer.github.com/v3/search/#text-match-metadata
123123 TextMatches []* TextMatch `json:"text_matches,omitempty"`
124+
125+ // Visibility is only used for Create and Edit endpoints. The visibility field
126+ // overrides the field parameter when both are used.
127+ // Can be one of public, private or internal.
128+ Visibility * string `json:"visibility,omitempty"`
124129}
125130
126131func (r Repository ) String () string {
@@ -295,11 +300,12 @@ type createRepoRequest struct {
295300 Description * string `json:"description,omitempty"`
296301 Homepage * string `json:"homepage,omitempty"`
297302
298- Private * bool `json:"private,omitempty"`
299- HasIssues * bool `json:"has_issues,omitempty"`
300- HasProjects * bool `json:"has_projects,omitempty"`
301- HasWiki * bool `json:"has_wiki,omitempty"`
302- IsTemplate * bool `json:"is_template,omitempty"`
303+ Private * bool `json:"private,omitempty"`
304+ Visibility * string `json:"visibility,omitempty"`
305+ HasIssues * bool `json:"has_issues,omitempty"`
306+ HasProjects * bool `json:"has_projects,omitempty"`
307+ HasWiki * bool `json:"has_wiki,omitempty"`
308+ IsTemplate * bool `json:"is_template,omitempty"`
303309
304310 // Creating an organization repository. Required for non-owners.
305311 TeamID * int64 `json:"team_id,omitempty"`
@@ -334,6 +340,7 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo
334340 Description : repo .Description ,
335341 Homepage : repo .Homepage ,
336342 Private : repo .Private ,
343+ Visibility : repo .Visibility ,
337344 HasIssues : repo .HasIssues ,
338345 HasProjects : repo .HasProjects ,
339346 HasWiki : repo .HasWiki ,
@@ -353,7 +360,8 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo
353360 return nil , nil , err
354361 }
355362
356- req .Header .Set ("Accept" , mediaTypeRepositoryTemplatePreview )
363+ acceptHeaders := []string {mediaTypeRepositoryTemplatePreview , mediaTypeRepositoryVisibilityPreview }
364+ req .Header .Set ("Accept" , strings .Join (acceptHeaders , ", " ))
357365 r := new (Repository )
358366 resp , err := s .client .Do (ctx , req , r )
359367 if err != nil {
@@ -469,7 +477,8 @@ func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repo
469477 return nil , nil , err
470478 }
471479
472- req .Header .Set ("Accept" , mediaTypeRepositoryTemplatePreview )
480+ acceptHeaders := []string {mediaTypeRepositoryTemplatePreview , mediaTypeRepositoryVisibilityPreview }
481+ req .Header .Set ("Accept" , strings .Join (acceptHeaders , ", " ))
473482 r := new (Repository )
474483 resp , err := s .client .Do (ctx , req , r )
475484 if err != nil {
0 commit comments