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: 0 additions & 1 deletion github/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID i
return nil, nil, err
}

// TODO: remove custom Accept headers when APIs fully launch.
req.Header.Set("Accept", mediaTypeContentAttachmentsPreview)

m := &Attachment{}
Expand Down
2 changes: 0 additions & 2 deletions github/codesofconduct.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Re
return nil, nil, err
}

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

var cs []*CodeOfConduct
Expand Down Expand Up @@ -67,7 +66,6 @@ func (s *CodesOfConductService) Get(ctx context.Context, key string) (*CodeOfCon
return nil, nil, err
}

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

coc := new(CodeOfConduct)
Expand Down
7 changes: 5 additions & 2 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const (
mediaTypeIssueImportAPI = "application/vnd.github.golden-comet-preview+json"
mediaTypeStarring = "application/vnd.github.star+json"

// Media Type values to access preview APIs
// Media Type values to access preview APIs.
// These media types will be added to the API request as headers
// and used to enable particular features on GitHub API that are still in preview.
// After some time, specific media types will be promoted (to a "stable" state).
Expand All @@ -71,7 +71,7 @@ const (
// versions. Additionally, non-functional (preview) headers don't create any side effects
// on GitHub Cloud version.
//
// See https://github.com/google/go-github/pull/2125 for full context.
// See https://github.com/google/go-github/pull/2125 and https://github.com/google/go-github/pull/2188 for full context.

// https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/
mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json"
Expand All @@ -91,6 +91,9 @@ const (
// https://developer.github.com/changes/2016-09-14-projects-api/
mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"

// https://developer.github.com/changes/2017-01-05-commit-search-api/
mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"

// https://developer.github.com/changes/2017-02-28-user-blocking-apis-and-webhook/
mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json"

Expand Down
3 changes: 0 additions & 3 deletions github/interactions_orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz
return nil, nil, err
}

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

organizationInteractions := new(InteractionRestriction)
Expand Down Expand Up @@ -54,7 +53,6 @@ func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, orga
return nil, nil, err
}

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

organizationInteractions := new(InteractionRestriction)
Expand All @@ -79,7 +77,6 @@ func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, org
return nil, err
}

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

return s.client.Do(ctx, req, nil)
Expand Down
3 changes: 0 additions & 3 deletions github/interactions_repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner,
return nil, nil, err
}

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

repositoryInteractions := new(InteractionRestriction)
Expand Down Expand Up @@ -54,7 +53,6 @@ func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, own
return nil, nil, err
}

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

repositoryInteractions := new(InteractionRestriction)
Expand All @@ -79,7 +77,6 @@ func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, ow
return nil, err
}

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

return s.client.Do(ctx, req, nil)
Expand Down
3 changes: 0 additions & 3 deletions github/issue_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ func (s *IssueImportService) Create(ctx context.Context, owner, repo string, iss
return nil, nil, err
}

// TODO: remove custom Accept headers when APIs fully launch.
req.Header.Set("Accept", mediaTypeIssueImportAPI)

i := new(IssueImportResponse)
Expand Down Expand Up @@ -112,7 +111,6 @@ func (s *IssueImportService) CheckStatus(ctx context.Context, owner, repo string
return nil, nil, err
}

// TODO: remove custom Accept headers when APIs fully launch.
req.Header.Set("Accept", mediaTypeIssueImportAPI)

i := new(IssueImportResponse)
Expand All @@ -136,7 +134,6 @@ func (s *IssueImportService) CheckStatusSince(ctx context.Context, owner, repo s
return nil, nil, err
}

// TODO: remove custom Accept headers when APIs fully launch.
req.Header.Set("Accept", mediaTypeIssueImportAPI)

var b bytes.Buffer
Expand Down
3 changes: 0 additions & 3 deletions github/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ func (s *IssuesService) listIssues(ctx context.Context, u string, opts *IssueLis
return nil, nil, err
}

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

var issues []*Issue
Expand Down Expand Up @@ -268,7 +267,6 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner, repo string, opts
return nil, nil, err
}

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

var issues []*Issue
Expand All @@ -292,7 +290,6 @@ func (s *IssuesService) Get(ctx context.Context, owner, repo string, number int)
return nil, nil, err
}

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

issue := new(Issue)
Expand Down
2 changes: 0 additions & 2 deletions github/issues_comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func (s *IssuesService) ListComments(ctx context.Context, owner, repo string, nu
return nil, nil, err
}

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

var comments []*IssueComment
Expand All @@ -101,7 +100,6 @@ func (s *IssuesService) GetComment(ctx context.Context, owner, repo string, comm
return nil, nil, err
}

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

comment := new(IssueComment)
Expand Down
1 change: 0 additions & 1 deletion github/issues_timeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo strin
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
acceptHeaders := []string{mediaTypeTimelinePreview, mediaTypeProjectCardDetailsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))

Expand Down
6 changes: 0 additions & 6 deletions github/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos
return nil, nil, err
}

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

m := &Migration{}
Expand Down Expand Up @@ -138,7 +137,6 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts
return nil, nil, err
}

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

var m []*Migration
Expand All @@ -164,7 +162,6 @@ func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id i
return nil, nil, err
}

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

m := &Migration{}
Expand All @@ -190,7 +187,6 @@ func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string,
return "", err
}

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

s.client.clientMu.Lock()
Expand Down Expand Up @@ -229,7 +225,6 @@ func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id i
return nil, err
}

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

return s.client.Do(ctx, req, nil)
Expand All @@ -251,7 +246,6 @@ func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64,
return nil, err
}

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

return s.client.Do(ctx, req, nil)
Expand Down
6 changes: 0 additions & 6 deletions github/migrations_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin
return nil, nil, err
}

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

m := &UserMigration{}
Expand Down Expand Up @@ -113,7 +112,6 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOpt
return nil, nil, err
}

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

var m []*UserMigration
Expand All @@ -139,7 +137,6 @@ func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*
return nil, nil, err
}

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

m := &UserMigration{}
Expand All @@ -165,7 +162,6 @@ func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64
return "", err
}

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

m := &UserMigration{}
Expand Down Expand Up @@ -201,7 +197,6 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*
return nil, err
}

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

return s.client.Do(ctx, req, nil)
Expand All @@ -223,7 +218,6 @@ func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo st
return nil, err
}

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

return s.client.Do(ctx, req, nil)
Expand Down
2 changes: 0 additions & 2 deletions github/orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ 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)
Expand Down Expand Up @@ -281,7 +280,6 @@ func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organ
return nil, nil, err
}

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

o := new(Organization)
Expand Down
4 changes: 0 additions & 4 deletions github/orgs_users_blocking.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string,
return nil, nil, err
}

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

var blockedUsers []*User
Expand All @@ -52,7 +51,6 @@ func (s *OrganizationsService) IsBlocked(ctx context.Context, org, user string)
return false, nil, err
}

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

resp, err := s.client.Do(ctx, req, nil)
Expand All @@ -73,7 +71,6 @@ func (s *OrganizationsService) BlockUser(ctx context.Context, org, user string)
return nil, err
}

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

return s.client.Do(ctx, req, nil)
Expand All @@ -92,7 +89,6 @@ func (s *OrganizationsService) UnblockUser(ctx context.Context, org, user string
return nil, err
}

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

return s.client.Do(ctx, req, nil)
Expand Down
2 changes: 0 additions & 2 deletions github/pulls.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview)
var pulls []*PullRequest
resp, err := s.client.Do(ctx, req, &pulls)
Expand Down Expand Up @@ -332,7 +331,6 @@ func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo stri
return nil, nil, err
}

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

p := new(PullRequestBranchUpdateResponse)
Expand Down
3 changes: 0 additions & 3 deletions github/pulls_comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))

Expand All @@ -119,7 +118,6 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))

Expand All @@ -143,7 +141,6 @@ func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo str
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept headers when their respective API fully launches.
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))

Expand Down
1 change: 0 additions & 1 deletion github/pulls_comments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ func TestPullRequestsService_CreateComment(t *testing.T) {
v := new(PullRequestComment)
assertNilError(t, json.NewDecoder(r.Body).Decode(v))

// TODO: remove custom Accept header assertion when the API fully launches.
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testMethod(t, r, "POST")
if !cmp.Equal(v, input) {
Expand Down
Loading
Loading