Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Dave Du Cros <davidducros@gmail.com>
Dave Henderson <dhenderson@gmail.com>
David Deng <daviddengcn@gmail.com>
David Jannotta <djannotta@gmail.com>
David Ji <github.com/davidji99>
Davide Zipeto <dawez1@gmail.com>
Dennis Webb <dennis@bluesentryit.com>
Dhi Aurrahman <diorahman@rockybars.com>
Expand Down
8 changes: 8 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 37 additions & 36 deletions github/github-stringify_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ const (

// https://developer.github.com/changes/2019-06-12-team-sync/
mediaTypeTeamSyncPreview = "application/vnd.github.team-sync-preview+json"

// https://developer.github.com/v3/previews/#repository-creation-permissions
mediaTypeMemberAllowedRepoCreationTypePreview = "application/vnd.github.surtur-preview+json"
)

// A Client manages communication with the GitHub API.
Expand Down
7 changes: 7 additions & 0 deletions github/orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ type Organization struct {
// MembersCanCreateRepos default value is true and is only used in Organizations.Edit.
MembersCanCreateRepos *bool `json:"members_can_create_repositories,omitempty"`

// MembersAllowedRepositoryCreationType denotes if organization members can create repositories
// and the type of repositories they can create. Possible values are: "all", "private", or "none".
MembersAllowedRepositoryCreationType *string `json:"members_allowed_repository_creation_type,omitempty"`

// API URLs
URL *string `json:"url,omitempty"`
EventsURL *string `json:"events_url,omitempty"`
Expand Down Expand Up @@ -160,6 +164,9 @@ func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organizati
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview)

organization := new(Organization)
resp, err := s.client.Do(ctx, req, organization)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions github/orgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func TestOrganizationsService_Get(t *testing.T) {

mux.HandleFunc("/orgs/o", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeMemberAllowedRepoCreationTypePreview)
fmt.Fprint(w, `{"id":1, "login":"l", "url":"u", "avatar_url": "a", "location":"l"}`)
})

Expand Down