@@ -121,6 +121,11 @@ type Repository struct {
121
121
// TextMatches is only populated from search results that request text matches
122
122
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
123
123
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"`
124
129
}
125
130
126
131
func (r Repository ) String () string {
@@ -295,11 +300,12 @@ type createRepoRequest struct {
295
300
Description * string `json:"description,omitempty"`
296
301
Homepage * string `json:"homepage,omitempty"`
297
302
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"`
303
309
304
310
// Creating an organization repository. Required for non-owners.
305
311
TeamID * int64 `json:"team_id,omitempty"`
@@ -334,6 +340,7 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo
334
340
Description : repo .Description ,
335
341
Homepage : repo .Homepage ,
336
342
Private : repo .Private ,
343
+ Visibility : repo .Visibility ,
337
344
HasIssues : repo .HasIssues ,
338
345
HasProjects : repo .HasProjects ,
339
346
HasWiki : repo .HasWiki ,
@@ -353,7 +360,8 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo
353
360
return nil , nil , err
354
361
}
355
362
356
- req .Header .Set ("Accept" , mediaTypeRepositoryTemplatePreview )
363
+ acceptHeaders := []string {mediaTypeRepositoryTemplatePreview , mediaTypeRepositoryVisibilityPreview }
364
+ req .Header .Set ("Accept" , strings .Join (acceptHeaders , ", " ))
357
365
r := new (Repository )
358
366
resp , err := s .client .Do (ctx , req , r )
359
367
if err != nil {
@@ -469,7 +477,8 @@ func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repo
469
477
return nil , nil , err
470
478
}
471
479
472
- req .Header .Set ("Accept" , mediaTypeRepositoryTemplatePreview )
480
+ acceptHeaders := []string {mediaTypeRepositoryTemplatePreview , mediaTypeRepositoryVisibilityPreview }
481
+ req .Header .Set ("Accept" , strings .Join (acceptHeaders , ", " ))
473
482
r := new (Repository )
474
483
resp , err := s .client .Do (ctx , req , r )
475
484
if err != nil {
0 commit comments