Skip to content

Commit 11a568b

Browse files
knrt10gmlewis
authored andcommitted
GitHub Repository Invitation API: Remove custom media type (google#1068)
Fixes google#708.
1 parent 787b344 commit 11a568b

9 files changed

+2
-33
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Justin Abrahms <[email protected]>
121121
Jusung Lee <[email protected]>
122122
jzhoucliqr <[email protected]>
123123
Katrina Owen <[email protected]>
124+
Kautilya Tripathi < [email protected]>
124125
Keita Urashima <[email protected]>
125126
Kevin Burke <[email protected]>
126127
Konrad Malawski <[email protected]>

github/github.go

-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ const (
6969
// https://developer.github.com/changes/2016-05-23-timeline-preview-api/
7070
mediaTypeTimelinePreview = "application/vnd.github.mockingbird-preview+json"
7171

72-
// https://developer.github.com/changes/2016-06-14-repository-invitations/
73-
mediaTypeRepositoryInvitationsPreview = "application/vnd.github.swamp-thing-preview+json"
74-
7572
// https://developer.github.com/changes/2016-07-06-github-pages-preiew-api/
7673
mediaTypePagesPreview = "application/vnd.github.mister-fantastic-preview+json"
7774

github/migrations_user.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*
193193
return s.client.Do(ctx, req, nil)
194194
}
195195

196-
// UnlockUserRepository will unlock a repo that was locked for migration.
196+
// UnlockUserRepo will unlock a repo that was locked for migration.
197197
// id is migration ID.
198198
// You should unlock each migrated repository and delete them when the migration
199199
// is complete and you no longer need the source data.

github/repos_collaborators.go

-3
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo,
120120
return nil, err
121121
}
122122

123-
// TODO: remove custom Accept header when this API fully launches.
124-
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
125-
126123
return s.client.Do(ctx, req, nil)
127124
}
128125

github/repos_collaborators_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ func TestRepositoriesService_AddCollaborator(t *testing.T) {
155155
json.NewDecoder(r.Body).Decode(v)
156156

157157
testMethod(t, r, "PUT")
158-
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
159158
if !reflect.DeepEqual(v, opt) {
160159
t.Errorf("Request body = %+v, want %+v", v, opt)
161160
}

github/repos_invitations.go

-9
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo s
4040
return nil, nil, err
4141
}
4242

43-
// TODO: remove custom Accept header when this API fully launches.
44-
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
45-
4643
invites := []*RepositoryInvitation{}
4744
resp, err := s.client.Do(ctx, req, &invites)
4845
if err != nil {
@@ -62,9 +59,6 @@ func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo
6259
return nil, err
6360
}
6461

65-
// TODO: remove custom Accept header when this API fully launches.
66-
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
67-
6862
return s.client.Do(ctx, req, nil)
6963
}
7064

@@ -85,9 +79,6 @@ func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo
8579
return nil, nil, err
8680
}
8781

88-
// TODO: remove custom Accept header when this API fully launches.
89-
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
90-
9182
invite := &RepositoryInvitation{}
9283
resp, err := s.client.Do(ctx, req, invite)
9384
if err != nil {

github/repos_invitations_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ func TestRepositoriesService_ListInvitations(t *testing.T) {
1919

2020
mux.HandleFunc("/repos/o/r/invitations", func(w http.ResponseWriter, r *http.Request) {
2121
testMethod(t, r, "GET")
22-
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
2322
testFormValues(t, r, values{"page": "2"})
2423
fmt.Fprintf(w, `[{"id":1}, {"id":2}]`)
2524
})
@@ -42,7 +41,6 @@ func TestRepositoriesService_DeleteInvitation(t *testing.T) {
4241

4342
mux.HandleFunc("/repos/o/r/invitations/2", func(w http.ResponseWriter, r *http.Request) {
4443
testMethod(t, r, "DELETE")
45-
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
4644
w.WriteHeader(http.StatusNoContent)
4745
})
4846

@@ -58,7 +56,6 @@ func TestRepositoriesService_UpdateInvitation(t *testing.T) {
5856

5957
mux.HandleFunc("/repos/o/r/invitations/2", func(w http.ResponseWriter, r *http.Request) {
6058
testMethod(t, r, "PATCH")
61-
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
6259
fmt.Fprintf(w, `{"id":1}`)
6360
})
6461

github/users.go

-9
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,6 @@ func (s *UsersService) ListInvitations(ctx context.Context, opt *ListOptions) ([
239239
return nil, nil, err
240240
}
241241

242-
// TODO: remove custom Accept header when this API fully launches.
243-
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
244-
245242
invites := []*RepositoryInvitation{}
246243
resp, err := s.client.Do(ctx, req, &invites)
247244
if err != nil {
@@ -262,9 +259,6 @@ func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64)
262259
return nil, err
263260
}
264261

265-
// TODO: remove custom Accept header when this API fully launches.
266-
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
267-
268262
return s.client.Do(ctx, req, nil)
269263
}
270264

@@ -279,8 +273,5 @@ func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int64
279273
return nil, err
280274
}
281275

282-
// TODO: remove custom Accept header when this API fully launches.
283-
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
284-
285276
return s.client.Do(ctx, req, nil)
286277
}

github/users_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ func TestUsersService_ListInvitations(t *testing.T) {
204204

205205
mux.HandleFunc("/user/repository_invitations", func(w http.ResponseWriter, r *http.Request) {
206206
testMethod(t, r, "GET")
207-
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
208207
fmt.Fprintf(w, `[{"id":1}, {"id":2}]`)
209208
})
210209

@@ -228,7 +227,6 @@ func TestUsersService_ListInvitations_withOptions(t *testing.T) {
228227
testFormValues(t, r, values{
229228
"page": "2",
230229
})
231-
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
232230
fmt.Fprintf(w, `[{"id":1}, {"id":2}]`)
233231
})
234232

@@ -243,7 +241,6 @@ func TestUsersService_AcceptInvitation(t *testing.T) {
243241

244242
mux.HandleFunc("/user/repository_invitations/1", func(w http.ResponseWriter, r *http.Request) {
245243
testMethod(t, r, "PATCH")
246-
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
247244
w.WriteHeader(http.StatusNoContent)
248245
})
249246

@@ -258,7 +255,6 @@ func TestUsersService_DeclineInvitation(t *testing.T) {
258255

259256
mux.HandleFunc("/user/repository_invitations/1", func(w http.ResponseWriter, r *http.Request) {
260257
testMethod(t, r, "DELETE")
261-
testHeader(t, r, "Accept", mediaTypeRepositoryInvitationsPreview)
262258
w.WriteHeader(http.StatusNoContent)
263259
})
264260

0 commit comments

Comments
 (0)