Skip to content

Commit 025030e

Browse files
authored
Return back preview headers for search; remove TODOs for custom headers (#3824)
1 parent 8657c38 commit 025030e

29 files changed

+31
-111
lines changed

github/apps.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID i
434434
return nil, nil, err
435435
}
436436

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

440439
m := &Attachment{}

github/codesofconduct.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Re
3636
return nil, nil, err
3737
}
3838

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

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

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

7371
coc := new(CodeOfConduct)

github/github.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const (
5656
mediaTypeIssueImportAPI = "application/vnd.github.golden-comet-preview+json"
5757
mediaTypeStarring = "application/vnd.github.star+json"
5858

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

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

94+
// https://developer.github.com/changes/2017-01-05-commit-search-api/
95+
mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"
96+
9497
// https://developer.github.com/changes/2017-02-28-user-blocking-apis-and-webhook/
9598
mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json"
9699

github/interactions_orgs.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz
2222
return nil, nil, err
2323
}
2424

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

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

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

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

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

8582
return s.client.Do(ctx, req, nil)

github/interactions_repos.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner,
2222
return nil, nil, err
2323
}
2424

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

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

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

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

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

8582
return s.client.Do(ctx, req, nil)

github/issue_import.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ func (s *IssueImportService) Create(ctx context.Context, owner, repo string, iss
8181
return nil, nil, err
8282
}
8383

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

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

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

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

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

142139
var b bytes.Buffer

github/issues.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ func (s *IssuesService) listIssues(ctx context.Context, u string, opts *IssueLis
195195
return nil, nil, err
196196
}
197197

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

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

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

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

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

298295
issue := new(Issue)

github/issues_comments.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ func (s *IssuesService) ListComments(ctx context.Context, owner, repo string, nu
7676
return nil, nil, err
7777
}
7878

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

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

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

107105
comment := new(IssueComment)

github/issues_timeline.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo strin
188188
return nil, nil, err
189189
}
190190

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

github/migrations.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos
109109
return nil, nil, err
110110
}
111111

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

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

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

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

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

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

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

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

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

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

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

257251
return s.client.Do(ctx, req, nil)

0 commit comments

Comments
 (0)