Browse Source

remove org permission preview media type

These changes are now official, so the custom media type is no longer
needed.  This does go ahead and remove RepositoryListOptions.IncludeOrg
which was being used to trigger the custom media type.  Even though this
is a breaking change, it was only in for a month and I don't think it
was too widely used during that time.

Fixes #219
/cc @captncraig who may have been using this

Change-Id: Ib54ced78c51a9c4e54e470136d36f91bf4716e8c
Will Norris 11 years ago
parent
commit
e48043c53c
3 changed files with 1 additions and 14 deletions
  1. +0
    -3
      github/github.go
  2. +0
    -9
      github/repos.go
  3. +1
    -2
      github/repos_test.go

+ 0
- 3
github/github.go View File

@ -42,9 +42,6 @@ const (
// https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/
mediaTypeStarringPreview = "application/vnd.github.v3.star+json"
// https://developer.github.com/changes/2014-12-08-organization-permissions-api-preview/
mediaTypeOrganizationsPreview = "application/vnd.github.moondragon+json"
)
// A Client manages communication with the GitHub API.


+ 0
- 9
github/repos.go View File

@ -122,11 +122,6 @@ type RepositoryListOptions struct {
// Default is "asc" when sort is "full_name", otherwise default is "desc".
Direction string `url:"direction,omitempty"`
// Include orginization repositories the user has access to.
// This will become the default behavior in the future, but is opt-in for now.
// See https://developer.github.com/changes/2015-01-07-prepare-for-organization-permissions-changes/
IncludeOrg bool `url:"-"`
ListOptions
}
@ -151,10 +146,6 @@ func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]R
return nil, nil, err
}
if opt != nil && opt.IncludeOrg {
req.Header.Set("Accept", mediaTypeOrganizationsPreview)
}
repos := new([]Repository)
resp, err := s.client.Do(req, repos)
if err != nil {


+ 1
- 2
github/repos_test.go View File

@ -45,11 +45,10 @@ func TestRepositoriesService_List_specifiedUser(t *testing.T) {
"direction": "asc",
"page": "2",
})
testHeader(t, r, "Accept", mediaTypeOrganizationsPreview)
fmt.Fprint(w, `[{"id":1}]`)
})
opt := &RepositoryListOptions{"owner", "created", "asc", true, ListOptions{Page: 2}}
opt := &RepositoryListOptions{"owner", "created", "asc", ListOptions{Page: 2}}
repos, _, err := client.Repositories.List("u", opt)
if err != nil {
t.Errorf("Repositories.List returned error: %v", err)


Loading…
Cancel
Save