Reaction types
When creating a reaction, the allowed values for the content parameter are as follows (with the corresponding emoji for reference):
diff --git a/github/activity_star.go b/github/activity_star.go index ad07aac7526..2d5e7f88678 100644 --- a/github/activity_star.go +++ b/github/activity_star.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "strings" ) // StarredRepository is returned by ListStarred. @@ -38,9 +37,6 @@ func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeStarringPreview) - var stargazers []*Stargazer resp, err := s.client.Do(ctx, req, &stargazers) if err != nil { @@ -86,10 +82,6 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac return nil, nil, err } - // TODO: remove custom Accept header when APIs fully launch - acceptHeaders := []string{mediaTypeStarringPreview, mediaTypeTopicsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var repos []*StarredRepository resp, err := s.client.Do(ctx, req, &repos) if err != nil { diff --git a/github/activity_star_test.go b/github/activity_star_test.go index 122c399366d..c6809d4f427 100644 --- a/github/activity_star_test.go +++ b/github/activity_star_test.go @@ -9,7 +9,6 @@ import ( "context" "fmt" "net/http" - "strings" "testing" "time" @@ -22,7 +21,6 @@ func TestActivityService_ListStargazers(t *testing.T) { mux.HandleFunc("/repos/o/r/stargazers", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeStarringPreview) testFormValues(t, r, values{ "page": "2", }) @@ -62,7 +60,6 @@ func TestActivityService_ListStarred_authenticatedUser(t *testing.T) { mux.HandleFunc("/user/starred", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join([]string{mediaTypeStarringPreview, mediaTypeTopicsPreview}, ", ")) fmt.Fprint(w, `[{"starred_at":"2002-02-10T15:30:00Z","repo":{"id":1}}]`) }) @@ -98,7 +95,6 @@ func TestActivityService_ListStarred_specifiedUser(t *testing.T) { mux.HandleFunc("/users/u/starred", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join([]string{mediaTypeStarringPreview, mediaTypeTopicsPreview}, ", ")) testFormValues(t, r, values{ "sort": "created", "direction": "asc", diff --git a/github/apps_installation.go b/github/apps_installation.go index 521860d6ebd..b4ac5eefefd 100644 --- a/github/apps_installation.go +++ b/github/apps_installation.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "strings" ) // ListRepositories represents the response from the list repos endpoints. @@ -31,14 +30,6 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{ - mediaTypeTopicsPreview, - mediaTypeRepositoryVisibilityPreview, - mediaTypeRepositoryTemplatePreview, - } - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var r *ListRepositories resp, err := s.client.Do(ctx, req, &r) @@ -65,14 +56,6 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{ - mediaTypeTopicsPreview, - mediaTypeRepositoryVisibilityPreview, - mediaTypeRepositoryTemplatePreview, - } - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var r *ListRepositories resp, err := s.client.Do(ctx, req, &r) if err != nil { diff --git a/github/apps_installation_test.go b/github/apps_installation_test.go index 56f0ad9e81d..643a8fe0a87 100644 --- a/github/apps_installation_test.go +++ b/github/apps_installation_test.go @@ -9,7 +9,6 @@ import ( "context" "fmt" "net/http" - "strings" "testing" "github.com/google/go-cmp/cmp" @@ -19,14 +18,8 @@ func TestAppsService_ListRepos(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{ - mediaTypeTopicsPreview, - mediaTypeRepositoryVisibilityPreview, - mediaTypeRepositoryTemplatePreview, - } mux.HandleFunc("/installation/repositories", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{ "page": "1", "per_page": "2", @@ -60,14 +53,8 @@ func TestAppsService_ListUserRepos(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{ - mediaTypeTopicsPreview, - mediaTypeRepositoryVisibilityPreview, - mediaTypeRepositoryTemplatePreview, - } mux.HandleFunc("/user/installations/1/repositories", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{ "page": "1", "per_page": "2", diff --git a/github/authorizations.go b/github/authorizations.go index 76a14c3db10..94fbdb47b30 100644 --- a/github/authorizations.go +++ b/github/authorizations.go @@ -155,7 +155,6 @@ func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken if err != nil { return nil, nil, err } - req.Header.Set("Accept", mediaTypeOAuthAppPreview) a := new(Authorization) resp, err := s.client.Do(ctx, req, a) @@ -188,7 +187,6 @@ func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken if err != nil { return nil, nil, err } - req.Header.Set("Accept", mediaTypeOAuthAppPreview) a := new(Authorization) resp, err := s.client.Do(ctx, req, a) @@ -217,7 +215,6 @@ func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToke if err != nil { return nil, err } - req.Header.Set("Accept", mediaTypeOAuthAppPreview) return s.client.Do(ctx, req, nil) } @@ -238,7 +235,6 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces if err != nil { return nil, err } - req.Header.Set("Accept", mediaTypeOAuthAppPreview) return s.client.Do(ctx, req, nil) } diff --git a/github/authorizations_test.go b/github/authorizations_test.go index bd7ff29d811..a2128880bb4 100644 --- a/github/authorizations_test.go +++ b/github/authorizations_test.go @@ -21,7 +21,6 @@ func TestAuthorizationsService_Check(t *testing.T) { mux.HandleFunc("/applications/id/token", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") testBody(t, r, `{"access_token":"a"}`+"\n") - testHeader(t, r, "Accept", mediaTypeOAuthAppPreview) fmt.Fprint(w, `{"id":1}`) }) @@ -58,7 +57,6 @@ func TestAuthorizationsService_Reset(t *testing.T) { mux.HandleFunc("/applications/id/token", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") testBody(t, r, `{"access_token":"a"}`+"\n") - testHeader(t, r, "Accept", mediaTypeOAuthAppPreview) fmt.Fprint(w, `{"ID":1}`) }) @@ -95,7 +93,6 @@ func TestAuthorizationsService_Revoke(t *testing.T) { mux.HandleFunc("/applications/id/token", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testBody(t, r, `{"access_token":"a"}`+"\n") - testHeader(t, r, "Accept", mediaTypeOAuthAppPreview) w.WriteHeader(http.StatusNoContent) }) @@ -123,7 +120,6 @@ func TestDeleteGrant(t *testing.T) { mux.HandleFunc("/applications/id/grant", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testBody(t, r, `{"access_token":"a"}`+"\n") - testHeader(t, r, "Accept", mediaTypeOAuthAppPreview) }) ctx := context.Background() diff --git a/github/github.go b/github/github.go index d4d7a54a7f1..25d87a83d4b 100644 --- a/github/github.go +++ b/github/github.go @@ -49,84 +49,9 @@ const ( // Media Type values to access preview APIs - // https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/ - mediaTypeStarringPreview = "application/vnd.github.v3.star+json" - - // https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/ - mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json" - - // https://developer.github.com/changes/2016-04-06-deployment-and-deployment-status-enhancements/ - mediaTypeDeploymentStatusPreview = "application/vnd.github.ant-man-preview+json" - - // https://developer.github.com/changes/2018-10-16-deployments-environments-states-and-auto-inactive-updates/ - mediaTypeExpandDeploymentStatusPreview = "application/vnd.github.flash-preview+json" - - // https://developer.github.com/changes/2016-05-12-reactions-api-preview/ - mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview" - - // https://developer.github.com/changes/2016-05-23-timeline-preview-api/ - mediaTypeTimelinePreview = "application/vnd.github.mockingbird-preview+json" - - // 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" - // https://developer.github.com/changes/2017-05-23-coc-api/ mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json" - // https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/ - mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json" - - // https://developer.github.com/changes/2018-03-16-protected-branches-required-approving-reviews/ - mediaTypeRequiredApprovingReviewsPreview = "application/vnd.github.luke-cage-preview+json" - - // https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/ - mediaTypePreReceiveHooksPreview = "application/vnd.github.eye-scream-preview" - - // https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/ - mediaTypeSignaturePreview = "application/vnd.github.zzzax-preview+json" - - // https://developer.github.com/changes/2018-09-05-project-card-events/ - mediaTypeProjectCardDetailsPreview = "application/vnd.github.starfox-preview+json" - - // https://developer.github.com/changes/2018-12-18-interactions-preview/ - mediaTypeInteractionRestrictionsPreview = "application/vnd.github.sombra-preview+json" - - // https://developer.github.com/changes/2019-03-14-enabling-disabling-pages/ - mediaTypeEnablePagesAPIPreview = "application/vnd.github.switcheroo-preview+json" - - // https://developer.github.com/changes/2019-04-24-vulnerability-alerts/ - mediaTypeRequiredVulnerabilityAlertsPreview = "application/vnd.github.dorian-preview+json" - - // https://developer.github.com/changes/2019-06-04-automated-security-fixes/ - mediaTypeRequiredAutomatedSecurityFixesPreview = "application/vnd.github.london-preview+json" - - // https://developer.github.com/changes/2019-05-29-update-branch-api/ - mediaTypeUpdatePullRequestBranchPreview = "application/vnd.github.lydian-preview+json" - - // https://developer.github.com/changes/2019-04-11-pulls-branches-for-commit/ - mediaTypeListPullsOrBranchesForCommitPreview = "application/vnd.github.groot-preview+json" - - // https://docs.github.com/en/free-pro-team@latest/rest/reference/previews/#repository-creation-permissions - mediaTypeMemberAllowedRepoCreationTypePreview = "application/vnd.github.surtur-preview+json" - - // https://docs.github.com/en/free-pro-team@latest/rest/reference/previews/#create-and-use-repository-templates - mediaTypeRepositoryTemplatePreview = "application/vnd.github.baptiste-preview+json" - - // https://developer.github.com/changes/2019-10-03-multi-line-comments/ - mediaTypeMultiLineCommentsPreview = "application/vnd.github.comfort-fade-preview+json" - - // https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api/ - mediaTypeOAuthAppPreview = "application/vnd.github.doctor-strange-preview+json" - - // https://developer.github.com/changes/2019-12-03-internal-visibility-changes/ - mediaTypeRepositoryVisibilityPreview = "application/vnd.github.nebula-preview+json" - // https://developer.github.com/changes/2018-12-10-content-attachments-api/ mediaTypeContentAttachmentsPreview = "application/vnd.github.corsair-preview+json" ) diff --git a/github/interactions_orgs.go b/github/interactions_orgs.go index d22a9e748d7..0403c7ffe2e 100644 --- a/github/interactions_orgs.go +++ b/github/interactions_orgs.go @@ -20,9 +20,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) resp, err := s.client.Do(ctx, req, organizationInteractions) @@ -50,9 +47,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) resp, err := s.client.Do(ctx, req, organizationInteractions) @@ -73,8 +67,5 @@ 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) } diff --git a/github/interactions_orgs_test.go b/github/interactions_orgs_test.go index 9258c92f502..cef89182be7 100644 --- a/github/interactions_orgs_test.go +++ b/github/interactions_orgs_test.go @@ -21,7 +21,6 @@ func TestInteractionsService_GetRestrictionsForOrgs(t *testing.T) { mux.HandleFunc("/orgs/o/interaction-limits", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview) fmt.Fprint(w, `{"origin":"organization"}`) }) @@ -62,7 +61,6 @@ func TestInteractionsService_UpdateRestrictionsForOrg(t *testing.T) { json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -101,7 +99,6 @@ func TestInteractionsService_RemoveRestrictionsFromOrg(t *testing.T) { mux.HandleFunc("/orgs/o/interaction-limits", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview) }) ctx := context.Background() diff --git a/github/interactions_repos.go b/github/interactions_repos.go index 13fffd64c0a..b6f1c30a5c7 100644 --- a/github/interactions_repos.go +++ b/github/interactions_repos.go @@ -20,9 +20,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) resp, err := s.client.Do(ctx, req, repositoryInteractions) @@ -50,9 +47,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) resp, err := s.client.Do(ctx, req, repositoryInteractions) @@ -73,8 +67,5 @@ 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) } diff --git a/github/interactions_repos_test.go b/github/interactions_repos_test.go index 0a9f51245e4..73f14ddfb5e 100644 --- a/github/interactions_repos_test.go +++ b/github/interactions_repos_test.go @@ -21,7 +21,6 @@ func TestInteractionsService_GetRestrictionsForRepo(t *testing.T) { mux.HandleFunc("/repos/o/r/interaction-limits", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview) fmt.Fprint(w, `{"origin":"repository"}`) }) @@ -62,7 +61,6 @@ func TestInteractionsService_UpdateRestrictionsForRepo(t *testing.T) { json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -101,7 +99,6 @@ func TestInteractionsService_RemoveRestrictionsFromRepo(t *testing.T) { mux.HandleFunc("/repos/o/r/interaction-limits", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview) }) ctx := context.Background() diff --git a/github/issues.go b/github/issues.go index 46aff2954bb..e5f698b5a28 100644 --- a/github/issues.go +++ b/github/issues.go @@ -160,9 +160,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 resp, err := s.client.Do(ctx, req, &issues) if err != nil { @@ -227,9 +224,6 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - var issues []*Issue resp, err := s.client.Do(ctx, req, &issues) if err != nil { @@ -249,9 +243,6 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb return nil, nil, err } - // TODO: remove custom Accept header when this API fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - issue := new(Issue) resp, err := s.client.Do(ctx, req, issue) if err != nil { diff --git a/github/issues_comments.go b/github/issues_comments.go index 6dd6d13287c..31afb0b42c2 100644 --- a/github/issues_comments.go +++ b/github/issues_comments.go @@ -69,9 +69,6 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - var comments []*IssueComment resp, err := s.client.Do(ctx, req, &comments) if err != nil { @@ -92,9 +89,6 @@ func (s *IssuesService) GetComment(ctx context.Context, owner string, repo strin return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - comment := new(IssueComment) resp, err := s.client.Do(ctx, req, comment) if err != nil { diff --git a/github/issues_comments_test.go b/github/issues_comments_test.go index 7780676f086..75641b8b67c 100644 --- a/github/issues_comments_test.go +++ b/github/issues_comments_test.go @@ -22,7 +22,6 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/comments", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) testFormValues(t, r, values{ "sort": "updated", "direction": "desc", @@ -71,7 +70,6 @@ func TestIssuesService_ListComments_specificIssue(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/1/comments", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) fmt.Fprint(w, `[{"id":1}]`) }) @@ -116,7 +114,6 @@ func TestIssuesService_GetComment(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/comments/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) fmt.Fprint(w, `{"id":1}`) }) diff --git a/github/issues_events.go b/github/issues_events.go index 384779cfed8..928cddee419 100644 --- a/github/issues_events.go +++ b/github/issues_events.go @@ -113,8 +113,6 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, return nil, nil, err } - req.Header.Set("Accept", mediaTypeProjectCardDetailsPreview) - var events []*IssueEvent resp, err := s.client.Do(ctx, req, &events) if err != nil { diff --git a/github/issues_events_test.go b/github/issues_events_test.go index ba21565f2e8..e57e3fbce0d 100644 --- a/github/issues_events_test.go +++ b/github/issues_events_test.go @@ -20,7 +20,6 @@ func TestIssuesService_ListIssueEvents(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/1/events", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectCardDetailsPreview) testFormValues(t, r, values{ "page": "1", "per_page": "2", diff --git a/github/issues_test.go b/github/issues_test.go index 80bfb3ff6d2..6d2a168e3c4 100644 --- a/github/issues_test.go +++ b/github/issues_test.go @@ -22,7 +22,6 @@ func TestIssuesService_List_all(t *testing.T) { mux.HandleFunc("/issues", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) testFormValues(t, r, values{ "filter": "all", "state": "closed", @@ -68,7 +67,6 @@ func TestIssuesService_List_owned(t *testing.T) { mux.HandleFunc("/user/issues", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) fmt.Fprint(w, `[{"number":1}]`) }) @@ -90,7 +88,6 @@ func TestIssuesService_ListByOrg(t *testing.T) { mux.HandleFunc("/orgs/o/issues", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) fmt.Fprint(w, `[{"number":1}]`) }) @@ -135,7 +132,6 @@ func TestIssuesService_ListByRepo(t *testing.T) { mux.HandleFunc("/repos/o/r/issues", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) testFormValues(t, r, values{ "milestone": "*", "state": "closed", @@ -196,7 +192,6 @@ func TestIssuesService_Get(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) fmt.Fprint(w, `{"number":1, "author_association": "MEMBER","labels": [{"url": "u", "name": "n", "color": "c"}]}`) }) diff --git a/github/issues_timeline.go b/github/issues_timeline.go index 1fd13b128c7..374b90d1ec7 100644 --- a/github/issues_timeline.go +++ b/github/issues_timeline.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "strings" "time" ) @@ -151,10 +150,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, ", ")) - var events []*Timeline resp, err := s.client.Do(ctx, req, &events) return events, resp, err diff --git a/github/issues_timeline_test.go b/github/issues_timeline_test.go index 17ae6187beb..c7a1e14ef6a 100644 --- a/github/issues_timeline_test.go +++ b/github/issues_timeline_test.go @@ -9,7 +9,6 @@ import ( "context" "fmt" "net/http" - "strings" "testing" "github.com/google/go-cmp/cmp" @@ -19,10 +18,8 @@ func TestIssuesService_ListIssueTimeline(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeTimelinePreview, mediaTypeProjectCardDetailsPreview} mux.HandleFunc("/repos/o/r/issues/1/timeline", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{ "page": "1", "per_page": "2", diff --git a/github/migrations.go b/github/migrations.go index 7694021f1fb..4a1cb429adf 100644 --- a/github/migrations.go +++ b/github/migrations.go @@ -89,9 +89,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{} resp, err := s.client.Do(ctx, req, m) if err != nil { @@ -116,9 +113,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 resp, err := s.client.Do(ctx, req, &m) if err != nil { @@ -140,9 +134,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{} resp, err := s.client.Do(ctx, req, m) if err != nil { @@ -164,9 +155,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() defer s.client.clientMu.Unlock() @@ -201,9 +189,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) } @@ -221,8 +206,5 @@ 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) } diff --git a/github/migrations_test.go b/github/migrations_test.go index 4a5c0fc6c06..74d29140f01 100644 --- a/github/migrations_test.go +++ b/github/migrations_test.go @@ -21,7 +21,6 @@ func TestMigrationService_StartMigration(t *testing.T) { mux.HandleFunc("/orgs/o/migrations", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusCreated) w.Write(migrationJSON) @@ -61,7 +60,6 @@ func TestMigrationService_ListMigrations(t *testing.T) { mux.HandleFunc("/orgs/o/migrations", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusOK) w.Write([]byte(fmt.Sprintf("[%s]", migrationJSON))) @@ -97,7 +95,6 @@ func TestMigrationService_MigrationStatus(t *testing.T) { mux.HandleFunc("/orgs/o/migrations/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusOK) w.Write(migrationJSON) @@ -133,7 +130,6 @@ func TestMigrationService_MigrationArchiveURL(t *testing.T) { mux.HandleFunc("/orgs/o/migrations/1/archive", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) http.Redirect(w, r, "/yo", http.StatusFound) }) @@ -166,7 +162,6 @@ func TestMigrationService_DeleteMigration(t *testing.T) { mux.HandleFunc("/orgs/o/migrations/1/archive", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -193,7 +188,6 @@ func TestMigrationService_UnlockRepo(t *testing.T) { mux.HandleFunc("/orgs/o/migrations/1/repos/r/lock", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusNoContent) }) diff --git a/github/migrations_user.go b/github/migrations_user.go index 5e8aaec5aa5..48aeb0ff4d1 100644 --- a/github/migrations_user.go +++ b/github/migrations_user.go @@ -82,9 +82,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{} resp, err := s.client.Do(ctx, req, m) if err != nil { @@ -105,9 +102,6 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigra return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeMigrationsPreview) - var m []*UserMigration resp, err := s.client.Do(ctx, req, &m) if err != nil { @@ -129,9 +123,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{} resp, err := s.client.Do(ctx, req, m) if err != nil { @@ -153,9 +144,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{} var loc string @@ -187,9 +175,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) } @@ -207,8 +192,5 @@ 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) } diff --git a/github/migrations_user_test.go b/github/migrations_user_test.go index 5a8905cd116..9102d7012dc 100644 --- a/github/migrations_user_test.go +++ b/github/migrations_user_test.go @@ -21,7 +21,6 @@ func TestMigrationService_StartUserMigration(t *testing.T) { mux.HandleFunc("/user/migrations", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusCreated) w.Write(userMigrationJSON) @@ -59,7 +58,6 @@ func TestMigrationService_ListUserMigrations(t *testing.T) { mux.HandleFunc("/user/migrations", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusOK) w.Write([]byte(fmt.Sprintf("[%s]", userMigrationJSON))) @@ -92,7 +90,6 @@ func TestMigrationService_UserMigrationStatus(t *testing.T) { mux.HandleFunc("/user/migrations/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusOK) w.Write(userMigrationJSON) @@ -125,7 +122,6 @@ func TestMigrationService_UserMigrationArchiveURL(t *testing.T) { mux.HandleFunc("/user/migrations/1/archive", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) http.Redirect(w, r, "/go-github", http.StatusFound) }) @@ -154,7 +150,6 @@ func TestMigrationService_DeleteUserMigration(t *testing.T) { mux.HandleFunc("/user/migrations/1/archive", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -186,7 +181,6 @@ func TestMigrationService_UnlockUserRepo(t *testing.T) { mux.HandleFunc("/user/migrations/1/repos/r/lock", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusNoContent) }) diff --git a/github/orgs.go b/github/orgs.go index 62f6ed241ca..0cdb12b4705 100644 --- a/github/orgs.go +++ b/github/orgs.go @@ -193,9 +193,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) resp, err := s.client.Do(ctx, req, organization) if err != nil { @@ -234,9 +231,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) resp, err := s.client.Do(ctx, req, o) if err != nil { diff --git a/github/orgs_projects.go b/github/orgs_projects.go index b0c60ecb9e4..8e2bbe84391 100644 --- a/github/orgs_projects.go +++ b/github/orgs_projects.go @@ -25,9 +25,6 @@ func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opt return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - var projects []*Project resp, err := s.client.Do(ctx, req, &projects) if err != nil { @@ -47,9 +44,6 @@ func (s *OrganizationsService) CreateProject(ctx context.Context, org string, op return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - project := &Project{} resp, err := s.client.Do(ctx, req, project) if err != nil { diff --git a/github/orgs_projects_test.go b/github/orgs_projects_test.go index 390917d4fac..cf6e2ed5dd5 100644 --- a/github/orgs_projects_test.go +++ b/github/orgs_projects_test.go @@ -21,7 +21,6 @@ func TestOrganizationsService_ListProjects(t *testing.T) { mux.HandleFunc("/orgs/o/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) testFormValues(t, r, values{"state": "open", "page": "2"}) fmt.Fprint(w, `[{"id":1}]`) }) @@ -61,7 +60,6 @@ func TestOrganizationsService_CreateProject(t *testing.T) { mux.HandleFunc("/orgs/o/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectOptions{} json.NewDecoder(r.Body).Decode(v) diff --git a/github/orgs_test.go b/github/orgs_test.go index b30c48f1bce..930685ce68d 100644 --- a/github/orgs_test.go +++ b/github/orgs_test.go @@ -187,7 +187,6 @@ 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"}`) }) @@ -271,7 +270,6 @@ func TestOrganizationsService_Edit(t *testing.T) { v := new(Organization) json.NewDecoder(r.Body).Decode(v) - testHeader(t, r, "Accept", mediaTypeMemberAllowedRepoCreationTypePreview) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) diff --git a/github/orgs_users_blocking.go b/github/orgs_users_blocking.go index 2773344c9f3..072efc4a218 100644 --- a/github/orgs_users_blocking.go +++ b/github/orgs_users_blocking.go @@ -25,9 +25,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 resp, err := s.client.Do(ctx, req, &blockedUsers) if err != nil { @@ -48,9 +45,6 @@ func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user s 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) isBlocked, err := parseBoolResponse(err) return isBlocked, resp, err @@ -67,9 +61,6 @@ func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user s 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) } @@ -84,8 +75,5 @@ func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user 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) } diff --git a/github/orgs_users_blocking_test.go b/github/orgs_users_blocking_test.go index 7d5b63b3d33..9dc423d7b0f 100644 --- a/github/orgs_users_blocking_test.go +++ b/github/orgs_users_blocking_test.go @@ -20,7 +20,6 @@ func TestOrganizationsService_ListBlockedUsers(t *testing.T) { mux.HandleFunc("/orgs/o/blocks", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeBlockUsersPreview) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{ "login": "octocat" @@ -60,7 +59,6 @@ func TestOrganizationsService_IsBlocked(t *testing.T) { mux.HandleFunc("/orgs/o/blocks/u", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeBlockUsersPreview) w.WriteHeader(http.StatusNoContent) }) @@ -94,7 +92,6 @@ func TestOrganizationsService_BlockUser(t *testing.T) { mux.HandleFunc("/orgs/o/blocks/u", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeBlockUsersPreview) w.WriteHeader(http.StatusNoContent) }) @@ -121,7 +118,6 @@ func TestOrganizationsService_UnblockUser(t *testing.T) { mux.HandleFunc("/orgs/o/blocks/u", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeBlockUsersPreview) w.WriteHeader(http.StatusNoContent) }) diff --git a/github/projects.go b/github/projects.go index 12c00bc3b70..77f9dd58727 100644 --- a/github/projects.go +++ b/github/projects.go @@ -49,9 +49,6 @@ func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, * return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - project := &Project{} resp, err := s.client.Do(ctx, req, project) if err != nil { @@ -96,9 +93,6 @@ func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opts *Pro return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - project := &Project{} resp, err := s.client.Do(ctx, req, project) if err != nil { @@ -118,9 +112,6 @@ func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Respons return nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) } @@ -153,9 +144,6 @@ func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int6 return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - columns := []*ProjectColumn{} resp, err := s.client.Do(ctx, req, &columns) if err != nil { @@ -175,9 +163,6 @@ func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*Proj return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - column := &ProjectColumn{} resp, err := s.client.Do(ctx, req, column) if err != nil { @@ -205,9 +190,6 @@ func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - column := &ProjectColumn{} resp, err := s.client.Do(ctx, req, column) if err != nil { @@ -227,9 +209,6 @@ func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int6 return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - column := &ProjectColumn{} resp, err := s.client.Do(ctx, req, column) if err != nil { @@ -249,9 +228,6 @@ func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int6 return nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) } @@ -273,9 +249,6 @@ func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, return nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) } @@ -329,9 +302,6 @@ func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - cards := []*ProjectCard{} resp, err := s.client.Do(ctx, req, &cards) if err != nil { @@ -351,9 +321,6 @@ func (s *ProjectsService) GetProjectCard(ctx context.Context, cardID int64) (*Pr return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - card := &ProjectCard{} resp, err := s.client.Do(ctx, req, card) if err != nil { @@ -389,9 +356,6 @@ func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - card := &ProjectCard{} resp, err := s.client.Do(ctx, req, card) if err != nil { @@ -411,9 +375,6 @@ func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, o return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - card := &ProjectCard{} resp, err := s.client.Do(ctx, req, card) if err != nil { @@ -433,9 +394,6 @@ func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int64) ( return nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) } @@ -461,9 +419,6 @@ func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opt return nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) } @@ -491,9 +446,6 @@ func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64, return nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) } @@ -508,9 +460,6 @@ func (s *ProjectsService) RemoveProjectCollaborator(ctx context.Context, id int6 return nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - return s.client.Do(ctx, req, nil) } @@ -549,9 +498,6 @@ func (s *ProjectsService) ListProjectCollaborators(ctx context.Context, id int64 return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - var users []*User resp, err := s.client.Do(ctx, req, &users) if err != nil { @@ -582,9 +528,6 @@ func (s *ProjectsService) ReviewProjectCollaboratorPermission(ctx context.Contex return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - ppl := new(ProjectPermissionLevel) resp, err := s.client.Do(ctx, req, ppl) if err != nil { diff --git a/github/projects_test.go b/github/projects_test.go index 6960ce90213..11c3ebeb8bb 100644 --- a/github/projects_test.go +++ b/github/projects_test.go @@ -10,7 +10,6 @@ import ( "encoding/json" "fmt" "net/http" - "strings" "testing" "github.com/google/go-cmp/cmp" @@ -99,7 +98,6 @@ func TestProjectsService_UpdateProject(t *testing.T) { mux.HandleFunc("/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectOptions{} json.NewDecoder(r.Body).Decode(v) @@ -142,7 +140,6 @@ func TestProjectsService_GetProject(t *testing.T) { mux.HandleFunc("/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) fmt.Fprint(w, `{"id":1}`) }) @@ -178,7 +175,6 @@ func TestProjectsService_DeleteProject(t *testing.T) { mux.HandleFunc("/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) }) ctx := context.Background() @@ -202,10 +198,8 @@ func TestProjectsService_ListProjectColumns(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/projects/1/columns", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{"id":1}]`) }) @@ -243,7 +237,6 @@ func TestProjectsService_GetProjectColumn(t *testing.T) { mux.HandleFunc("/projects/columns/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) fmt.Fprint(w, `{"id":1}`) }) @@ -281,7 +274,6 @@ func TestProjectsService_CreateProjectColumn(t *testing.T) { mux.HandleFunc("/projects/1/columns", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectColumnOptions{} json.NewDecoder(r.Body).Decode(v) @@ -326,7 +318,6 @@ func TestProjectsService_UpdateProjectColumn(t *testing.T) { mux.HandleFunc("/projects/columns/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectColumnOptions{} json.NewDecoder(r.Body).Decode(v) @@ -369,7 +360,6 @@ func TestProjectsService_DeleteProjectColumn(t *testing.T) { mux.HandleFunc("/projects/columns/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) }) ctx := context.Background() @@ -397,7 +387,6 @@ func TestProjectsService_MoveProjectColumn(t *testing.T) { mux.HandleFunc("/projects/columns/1/moves", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectColumnMoveOptions{} json.NewDecoder(r.Body).Decode(v) @@ -429,7 +418,6 @@ func TestProjectsService_ListProjectCards(t *testing.T) { mux.HandleFunc("/projects/columns/1/cards", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) testFormValues(t, r, values{ "archived_state": "all", "page": "2"}) @@ -471,7 +459,6 @@ func TestProjectsService_GetProjectCard(t *testing.T) { mux.HandleFunc("/projects/columns/cards/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) fmt.Fprint(w, `{"id":1}`) }) @@ -512,7 +499,6 @@ func TestProjectsService_CreateProjectCard(t *testing.T) { mux.HandleFunc("/projects/columns/1/cards", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectCardOptions{} json.NewDecoder(r.Body).Decode(v) @@ -560,7 +546,6 @@ func TestProjectsService_UpdateProjectCard(t *testing.T) { mux.HandleFunc("/projects/columns/cards/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectCardOptions{} json.NewDecoder(r.Body).Decode(v) @@ -603,7 +588,6 @@ func TestProjectsService_DeleteProjectCard(t *testing.T) { mux.HandleFunc("/projects/columns/cards/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) }) ctx := context.Background() @@ -631,7 +615,6 @@ func TestProjectsService_MoveProjectCard(t *testing.T) { mux.HandleFunc("/projects/columns/cards/1/moves", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectCardMoveOptions{} json.NewDecoder(r.Body).Decode(v) @@ -667,7 +650,6 @@ func TestProjectsService_AddProjectCollaborator(t *testing.T) { mux.HandleFunc("/projects/1/collaborators/u", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectCollaboratorOptions{} json.NewDecoder(r.Body).Decode(v) @@ -710,7 +692,6 @@ func TestProjectsService_RemoveCollaborator(t *testing.T) { mux.HandleFunc("/projects/1/collaborators/u", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -746,7 +727,6 @@ func TestProjectsService_ListCollaborators(t *testing.T) { mux.HandleFunc("/projects/1/collaborators", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) testFormValues(t, r, values{"page": "2"}) fmt.Fprintf(w, `[{"id":1}, {"id":2}]`) }) @@ -786,7 +766,6 @@ func TestProjectsService_ListCollaborators_withAffiliation(t *testing.T) { mux.HandleFunc("/projects/1/collaborators", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) testFormValues(t, r, values{"affiliation": "all", "page": "2"}) fmt.Fprintf(w, `[{"id":1}, {"id":2}]`) }) @@ -813,7 +792,6 @@ func TestProjectsService_ReviewProjectCollaboratorPermission(t *testing.T) { mux.HandleFunc("/projects/1/collaborators/u/permission", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) fmt.Fprintf(w, `{"permission":"admin","user":{"login":"u"}}`) }) diff --git a/github/pulls.go b/github/pulls.go index 6c866ea8840..b35a2e263f9 100644 --- a/github/pulls.go +++ b/github/pulls.go @@ -182,8 +182,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) if err != nil { @@ -301,9 +299,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) resp, err := s.client.Do(ctx, req, p) if err != nil { diff --git a/github/pulls_comments.go b/github/pulls_comments.go index 5078bab1d04..ea3323b5619 100644 --- a/github/pulls_comments.go +++ b/github/pulls_comments.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "strings" "time" ) @@ -85,10 +84,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, ", ")) - var comments []*PullRequestComment resp, err := s.client.Do(ctx, req, &comments) if err != nil { @@ -108,10 +103,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, ", ")) - comment := new(PullRequestComment) resp, err := s.client.Do(ctx, req, comment) if err != nil { @@ -130,9 +121,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, ", ")) c := new(PullRequestComment) resp, err := s.client.Do(ctx, req, c) diff --git a/github/pulls_comments_test.go b/github/pulls_comments_test.go index cd6f19c12c8..1c2ba7f0608 100644 --- a/github/pulls_comments_test.go +++ b/github/pulls_comments_test.go @@ -10,7 +10,6 @@ import ( "encoding/json" "fmt" "net/http" - "strings" "testing" "time" @@ -137,10 +136,8 @@ func TestPullRequestsService_ListComments_allPulls(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} mux.HandleFunc("/repos/o/r/pulls/comments", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{ "sort": "updated", "direction": "desc", @@ -186,10 +183,8 @@ func TestPullRequestsService_ListComments_specificPull(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `[{"id":1, "pull_request_review_id":42}]`) }) @@ -218,10 +213,8 @@ func TestPullRequestsService_GetComment(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} mux.HandleFunc("/repos/o/r/pulls/comments/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `{"id":1}`) }) @@ -266,13 +259,10 @@ func TestPullRequestsService_CreateComment(t *testing.T) { input := &PullRequestComment{Body: String("b")} - wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestComment) 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) { t.Errorf("Request body = %+v, want %+v", v, input) diff --git a/github/pulls_reviews.go b/github/pulls_reviews.go index 437b0937be6..1f139e285b4 100644 --- a/github/pulls_reviews.go +++ b/github/pulls_reviews.go @@ -231,12 +231,8 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri } // Detect which style of review comment is being used. - if isCF, err := review.isComfortFadePreview(); err != nil { + if _, err := review.isComfortFadePreview(); err != nil { return nil, nil, err - } else if isCF { - // If the review comments are using the comfort fade preview fields, - // then pass the comfort fade header. - req.Header.Set("Accept", mediaTypeMultiLineCommentsPreview) } r := new(PullRequestReview) diff --git a/github/pulls_test.go b/github/pulls_test.go index b498193817d..173b80541dd 100644 --- a/github/pulls_test.go +++ b/github/pulls_test.go @@ -67,7 +67,6 @@ func TestPullRequestsService_ListPullRequestsWithCommit(t *testing.T) { mux.HandleFunc("/repos/o/r/commits/sha/pulls", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeListPullsOrBranchesForCommitPreview) testFormValues(t, r, values{ "state": "closed", "head": "h", @@ -417,7 +416,6 @@ func TestPullRequestsService_UpdateBranch(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls/1/update-branch", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeUpdatePullRequestBranchPreview) fmt.Fprint(w, ` { "message": "Updating pull request branch.", diff --git a/github/reactions.go b/github/reactions.go index 08387cb50f5..4c80f4b52fb 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -73,9 +73,6 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - var m []*Reaction resp, err := s.client.Do(ctx, req, &m) if err != nil { @@ -100,9 +97,6 @@ func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, rep return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} resp, err := s.client.Do(ctx, req, m) if err != nil { @@ -145,9 +139,6 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - var m []*Reaction resp, err := s.client.Do(ctx, req, &m) if err != nil { @@ -172,9 +163,6 @@ func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} resp, err := s.client.Do(ctx, req, m) if err != nil { @@ -217,9 +205,6 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - var m []*Reaction resp, err := s.client.Do(ctx, req, &m) if err != nil { @@ -244,9 +229,6 @@ func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} resp, err := s.client.Do(ctx, req, m) if err != nil { @@ -289,9 +271,6 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - var m []*Reaction resp, err := s.client.Do(ctx, req, &m) if err != nil { @@ -316,9 +295,6 @@ func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} resp, err := s.client.Do(ctx, req, m) if err != nil { @@ -361,8 +337,6 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team return nil, nil, err } - req.Header.Set("Accept", mediaTypeReactionsPreview) - var m []*Reaction resp, err := s.client.Do(ctx, req, &m) if err != nil { @@ -385,8 +359,6 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea return nil, nil, err } - req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} resp, err := s.client.Do(ctx, req, m) if err != nil { @@ -429,8 +401,6 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex return nil, nil, err } - req.Header.Set("Accept", mediaTypeReactionsPreview) - var m []*Reaction resp, err := s.client.Do(ctx, req, &m) if err != nil { @@ -452,8 +422,6 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte return nil, nil, err } - req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} resp, err := s.client.Do(ctx, req, m) if err != nil { @@ -487,8 +455,5 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res return nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - return s.client.Do(ctx, req, nil) } diff --git a/github/reactions_test.go b/github/reactions_test.go index 3822a515c66..89eb9e48069 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -58,7 +58,7 @@ func TestReactions_Marshal(t *testing.T) { "heart": 1, "hooray": 1, "rocket": 1, - "eyes": 1, + "eyes": 1, "url": "u" }` @@ -71,7 +71,6 @@ func TestReactionsService_ListCommentReactions(t *testing.T) { mux.HandleFunc("/repos/o/r/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) testFormValues(t, r, values{"content": "+1"}) fmt.Fprint(w, `[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`) @@ -109,7 +108,6 @@ func TestReactionsService_CreateCommentReaction(t *testing.T) { mux.HandleFunc("/repos/o/r/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) @@ -146,7 +144,6 @@ func TestReactionsService_ListIssueReactions(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/1/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusOK) w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) @@ -190,7 +187,6 @@ func TestReactionsService_CreateIssueReaction(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/1/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) @@ -227,7 +223,6 @@ func TestReactionsService_ListIssueCommentReactions(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusOK) w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) @@ -271,7 +266,6 @@ func TestReactionsService_CreateIssueCommentReaction(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) @@ -308,7 +302,6 @@ func TestReactionsService_ListPullRequestCommentReactions(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusOK) w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) @@ -352,7 +345,6 @@ func TestReactionsService_CreatePullRequestCommentReaction(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) @@ -389,7 +381,6 @@ func TestReactionsService_ListTeamDiscussionReactions(t *testing.T) { mux.HandleFunc("/teams/1/discussions/2/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusOK) w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) @@ -433,7 +424,6 @@ func TestReactionsService_CreateTeamDiscussionReaction(t *testing.T) { mux.HandleFunc("/teams/1/discussions/2/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) @@ -470,7 +460,6 @@ func TestReactionService_ListTeamDiscussionCommentReactions(t *testing.T) { mux.HandleFunc("/teams/1/discussions/2/comments/3/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusOK) w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) @@ -514,7 +503,6 @@ func TestReactionService_CreateTeamDiscussionCommentReaction(t *testing.T) { mux.HandleFunc("/teams/1/discussions/2/comments/3/reactions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) @@ -551,7 +539,6 @@ func TestReactionsService_DeleteCommitCommentReaction(t *testing.T) { mux.HandleFunc("/repos/o/r/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -578,7 +565,6 @@ func TestReactionsService_DeleteCommitCommentReactionByRepoID(t *testing.T) { mux.HandleFunc("/repositories/1/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -605,7 +591,6 @@ func TestReactionsService_DeleteIssueReaction(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -632,7 +617,6 @@ func TestReactionsService_DeleteIssueReactionByRepoID(t *testing.T) { mux.HandleFunc("/repositories/1/issues/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -659,7 +643,6 @@ func TestReactionsService_DeleteIssueCommentReaction(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -686,7 +669,6 @@ func TestReactionsService_DeleteIssueCommentReactionByRepoID(t *testing.T) { mux.HandleFunc("/repositories/1/issues/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -713,7 +695,6 @@ func TestReactionsService_DeletePullRequestCommentReaction(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -740,7 +721,6 @@ func TestReactionsService_DeletePullRequestCommentReactionByRepoID(t *testing.T) mux.HandleFunc("/repositories/1/pulls/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -767,7 +747,6 @@ func TestReactionsService_DeleteTeamDiscussionReaction(t *testing.T) { mux.HandleFunc("/orgs/o/teams/s/discussions/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -794,7 +773,6 @@ func TestReactionsService_DeleteTeamDiscussionReactionByTeamIDAndOrgID(t *testin mux.HandleFunc("/organizations/1/team/2/discussions/3/reactions/4", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -821,7 +799,6 @@ func TestReactionsService_DeleteTeamDiscussionCommentReaction(t *testing.T) { mux.HandleFunc("/orgs/o/teams/s/discussions/1/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -848,7 +825,6 @@ func TestReactionsService_DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID(t mux.HandleFunc("/organizations/1/team/2/discussions/3/comments/4/reactions/5", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) diff --git a/github/repos.go b/github/repos.go index f6236b432f7..dfa0abba018 100644 --- a/github/repos.go +++ b/github/repos.go @@ -205,10 +205,6 @@ func (s *RepositoriesService) List(ctx context.Context, user string, opts *Repos return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var repos []*Repository resp, err := s.client.Do(ctx, req, &repos) if err != nil { @@ -251,10 +247,6 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *R return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var repos []*Repository resp, err := s.client.Do(ctx, req, &repos) if err != nil { @@ -373,8 +365,6 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo return nil, nil, err } - acceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) r := new(Repository) resp, err := s.client.Do(ctx, req, r) if err != nil { @@ -406,7 +396,6 @@ func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOw return nil, nil, err } - req.Header.Set("Accept", mediaTypeRepositoryTemplatePreview) r := new(Repository) resp, err := s.client.Do(ctx, req, r) if err != nil { @@ -430,9 +419,6 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep // https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#get-a-repositorys-license acceptHeaders := []string{ mediaTypeCodesOfConductPreview, - mediaTypeTopicsPreview, - mediaTypeRepositoryTemplatePreview, - mediaTypeRepositoryVisibilityPreview, } req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -496,8 +482,6 @@ func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repo return nil, nil, err } - acceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) r := new(Repository) resp, err := s.client.Do(ctx, req, r) if err != nil { @@ -565,9 +549,6 @@ func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, return false, nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) - resp, err := s.client.Do(ctx, req, nil) vulnerabilityAlertsEnabled, err := parseBoolResponse(err) @@ -585,9 +566,6 @@ func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, own return nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) - return s.client.Do(ctx, req, nil) } @@ -602,9 +580,6 @@ func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, ow return nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) - return s.client.Do(ctx, req, nil) } @@ -619,9 +594,6 @@ func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, return nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredAutomatedSecurityFixesPreview) - return s.client.Do(ctx, req, nil) } @@ -636,9 +608,6 @@ func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, return nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredAutomatedSecurityFixesPreview) - return s.client.Do(ctx, req, nil) } @@ -1047,9 +1016,6 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - p := new(Protection) resp, err := s.client.Do(ctx, req, p) if err != nil { @@ -1106,9 +1072,6 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - p := new(Protection) resp, err := s.client.Do(ctx, req, p) if err != nil { @@ -1141,9 +1104,6 @@ func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeSignaturePreview) - p := new(SignaturesProtectedBranch) resp, err := s.client.Do(ctx, req, p) if err != nil { @@ -1164,9 +1124,6 @@ func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Con return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeSignaturePreview) - r := new(SignaturesProtectedBranch) resp, err := s.client.Do(ctx, req, r) if err != nil { @@ -1186,9 +1143,6 @@ func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Co return nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeSignaturePreview) - return s.client.Do(ctx, req, nil) } @@ -1253,9 +1207,6 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - r := new(PullRequestReviewsEnforcement) resp, err := s.client.Do(ctx, req, r) if err != nil { @@ -1276,9 +1227,6 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - r := new(PullRequestReviewsEnforcement) resp, err := s.client.Do(ctx, req, r) if err != nil { @@ -1304,9 +1252,6 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - r := new(PullRequestReviewsEnforcement) resp, err := s.client.Do(ctx, req, r) if err != nil { @@ -1396,9 +1341,6 @@ func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo str return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTopicsPreview) - topics := new(repositoryTopics) resp, err := s.client.Do(ctx, req, topics) if err != nil { @@ -1424,9 +1366,6 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTopicsPreview) - t = new(repositoryTopics) resp, err := s.client.Do(ctx, req, t) if err != nil { diff --git a/github/repos_comments.go b/github/repos_comments.go index 912eeba3fb2..5e030457508 100644 --- a/github/repos_comments.go +++ b/github/repos_comments.go @@ -49,9 +49,6 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - var comments []*RepositoryComment resp, err := s.client.Do(ctx, req, &comments) if err != nil { @@ -76,9 +73,6 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - var comments []*RepositoryComment resp, err := s.client.Do(ctx, req, &comments) if err != nil { @@ -118,9 +112,6 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) - c := new(RepositoryComment) resp, err := s.client.Do(ctx, req, c) if err != nil { diff --git a/github/repos_comments_test.go b/github/repos_comments_test.go index 3dbc10cb474..150c681eef5 100644 --- a/github/repos_comments_test.go +++ b/github/repos_comments_test.go @@ -21,7 +21,6 @@ func TestRepositoriesService_ListComments(t *testing.T) { mux.HandleFunc("/repos/o/r/comments", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{"id":1}, {"id":2}]`) }) @@ -68,7 +67,6 @@ func TestRepositoriesService_ListCommitComments(t *testing.T) { mux.HandleFunc("/repos/o/r/commits/s/comments", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{"id":1}, {"id":2}]`) }) @@ -168,7 +166,6 @@ func TestRepositoriesService_GetComment(t *testing.T) { mux.HandleFunc("/repos/o/r/comments/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) fmt.Fprint(w, `{"id":1}`) }) diff --git a/github/repos_commits.go b/github/repos_commits.go index ce3b48e3c53..7e49ca2b511 100644 --- a/github/repos_commits.go +++ b/github/repos_commits.go @@ -300,8 +300,6 @@ func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview) var branchCommits []*BranchCommit resp, err := s.client.Do(ctx, req, &branchCommits) if err != nil { diff --git a/github/repos_deployments.go b/github/repos_deployments.go index 7308bcebe5a..fe80053d4aa 100644 --- a/github/repos_deployments.go +++ b/github/repos_deployments.go @@ -9,7 +9,6 @@ import ( "context" "encoding/json" "fmt" - "strings" ) // Deployment represents a deployment in a repo @@ -116,10 +115,6 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - d := new(Deployment) resp, err := s.client.Do(ctx, req, d) if err != nil { @@ -188,10 +183,6 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var statuses []*DeploymentStatus resp, err := s.client.Do(ctx, req, &statuses) if err != nil { @@ -212,10 +203,6 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - d := new(DeploymentStatus) resp, err := s.client.Do(ctx, req, d) if err != nil { @@ -236,10 +223,6 @@ func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - d := new(DeploymentStatus) resp, err := s.client.Do(ctx, req, d) if err != nil { diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go index c3d6637e37f..01e864fc1c7 100644 --- a/github/repos_deployments_test.go +++ b/github/repos_deployments_test.go @@ -10,7 +10,6 @@ import ( "encoding/json" "fmt" "net/http" - "strings" "testing" "github.com/google/go-cmp/cmp" @@ -100,8 +99,6 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) { json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "POST") - wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -176,10 +173,8 @@ func TestRepositoriesService_ListDeploymentStatuses(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} mux.HandleFunc("/repos/o/r/deployments/1/statuses", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{"id":1}, {"id":2}]`) }) @@ -215,10 +210,8 @@ func TestRepositoriesService_GetDeploymentStatus(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} mux.HandleFunc("/repos/o/r/deployments/3/statuses/4", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `{"id":4}`) }) @@ -259,8 +252,6 @@ func TestRepositoriesService_CreateDeploymentStatus(t *testing.T) { json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "POST") - wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } diff --git a/github/repos_forks.go b/github/repos_forks.go index 74b9b445ea6..4baa44882ad 100644 --- a/github/repos_forks.go +++ b/github/repos_forks.go @@ -37,9 +37,6 @@ func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. - req.Header.Set("Accept", mediaTypeTopicsPreview) - var repos []*Repository resp, err := s.client.Do(ctx, req, &repos) if err != nil { diff --git a/github/repos_forks_test.go b/github/repos_forks_test.go index 83b7a827812..4c3d228be80 100644 --- a/github/repos_forks_test.go +++ b/github/repos_forks_test.go @@ -20,7 +20,6 @@ func TestRepositoriesService_ListForks(t *testing.T) { mux.HandleFunc("/repos/o/r/forks", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) testFormValues(t, r, values{ "sort": "newest", "page": "3", diff --git a/github/repos_pages.go b/github/repos_pages.go index a954e70584b..9d40d426275 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -64,8 +64,6 @@ func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo strin return nil, nil, err } - req.Header.Set("Accept", mediaTypeEnablePagesAPIPreview) - enable := new(Pages) resp, err := s.client.Do(ctx, req, enable) if err != nil { @@ -114,9 +112,6 @@ func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo stri return nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeEnablePagesAPIPreview) - return s.client.Do(ctx, req, nil) } diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index 85069f946c5..e08ad8dddf4 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -34,7 +34,6 @@ func TestRepositoriesService_EnablePages(t *testing.T) { json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview) want := &createPagesRequest{Source: &PagesSource{Branch: String("master"), Path: String("/")}} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) @@ -144,7 +143,6 @@ func TestRepositoriesService_DisablePages(t *testing.T) { mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview) }) ctx := context.Background() diff --git a/github/repos_prereceive_hooks.go b/github/repos_prereceive_hooks.go index 1ce6478d33b..f56a2204900 100644 --- a/github/repos_prereceive_hooks.go +++ b/github/repos_prereceive_hooks.go @@ -37,9 +37,6 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - var hooks []*PreReceiveHook resp, err := s.client.Do(ctx, req, &hooks) if err != nil { @@ -59,9 +56,6 @@ func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - h := new(PreReceiveHook) resp, err := s.client.Do(ctx, req, h) if err != nil { @@ -81,9 +75,6 @@ func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, r return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - h := new(PreReceiveHook) resp, err := s.client.Do(ctx, req, h) if err != nil { @@ -103,8 +94,5 @@ func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, r return nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) - return s.client.Do(ctx, req, nil) } diff --git a/github/repos_prereceive_hooks_test.go b/github/repos_prereceive_hooks_test.go index 303e0e1265a..5dc455ed36d 100644 --- a/github/repos_prereceive_hooks_test.go +++ b/github/repos_prereceive_hooks_test.go @@ -21,7 +21,6 @@ func TestRepositoriesService_ListPreReceiveHooks(t *testing.T) { mux.HandleFunc("/repos/o/r/pre-receive-hooks", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypePreReceiveHooksPreview) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{"id":1}, {"id":2}]`) }) @@ -69,7 +68,6 @@ func TestRepositoriesService_GetPreReceiveHook(t *testing.T) { mux.HandleFunc("/repos/o/r/pre-receive-hooks/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypePreReceiveHooksPreview) fmt.Fprint(w, `{"id":1}`) }) diff --git a/github/repos_projects.go b/github/repos_projects.go index 1938d51b9bf..498660d0210 100644 --- a/github/repos_projects.go +++ b/github/repos_projects.go @@ -34,9 +34,6 @@ func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo stri return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - var projects []*Project resp, err := s.client.Do(ctx, req, &projects) if err != nil { @@ -56,9 +53,6 @@ func (s *RepositoriesService) CreateProject(ctx context.Context, owner, repo str return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - project := &Project{} resp, err := s.client.Do(ctx, req, project) if err != nil { diff --git a/github/repos_projects_test.go b/github/repos_projects_test.go index 558cc23a00a..8a0fc8f5132 100644 --- a/github/repos_projects_test.go +++ b/github/repos_projects_test.go @@ -21,7 +21,6 @@ func TestRepositoriesService_ListProjects(t *testing.T) { mux.HandleFunc("/repos/o/r/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{"id":1}]`) }) @@ -61,7 +60,6 @@ func TestRepositoriesService_CreateProject(t *testing.T) { mux.HandleFunc("/repos/o/r/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectOptions{} json.NewDecoder(r.Body).Decode(v) diff --git a/github/repos_test.go b/github/repos_test.go index 4c799048abb..7d1f02a5bb5 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -12,7 +12,6 @@ import ( "fmt" "net/http" "net/url" - "strings" "testing" "github.com/google/go-cmp/cmp" @@ -22,10 +21,8 @@ func TestRepositoriesService_List_authenticatedUser(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `[{"id":1},{"id":2}]`) }) @@ -59,10 +56,8 @@ func TestRepositoriesService_List_specifiedUser(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{ "visibility": "public", "affiliation": "owner,collaborator", @@ -96,10 +91,8 @@ func TestRepositoriesService_List_specifiedUser_type(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{ "type": "owner", }) @@ -134,10 +127,8 @@ func TestRepositoriesService_ListByOrg(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/orgs/o/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{ "type": "forks", "page": "2", @@ -227,13 +218,11 @@ func TestRepositoriesService_Create_user(t *testing.T) { Archived: Bool(true), // not passed along. } - wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) { v := new(createRepoRequest) json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "POST") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) want := &createRepoRequest{Name: String("n")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) @@ -277,13 +266,11 @@ func TestRepositoriesService_Create_org(t *testing.T) { Archived: Bool(true), // not passed along. } - wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/orgs/o/repos", func(w http.ResponseWriter, r *http.Request) { v := new(createRepoRequest) json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "POST") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) want := &createRepoRequest{Name: String("n")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) @@ -317,7 +304,6 @@ func TestRepositoriesService_CreateFromTemplate(t *testing.T) { json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeRepositoryTemplatePreview) want := &TemplateRepoRequest{Name: String("n")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) @@ -356,10 +342,8 @@ func TestRepositoriesService_Get(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview, mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `{"id":1,"name":"n","description":"d","owner":{"login":"l"},"license":{"key":"mit"}}`) }) @@ -473,13 +457,11 @@ func TestRepositoriesService_Edit(t *testing.T) { i := true input := &Repository{HasIssues: &i} - wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) { v := new(Repository) json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "PATCH") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -561,7 +543,6 @@ func TestRepositoriesService_GetVulnerabilityAlerts(t *testing.T) { mux.HandleFunc("/repos/o/r/vulnerability-alerts", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeRequiredVulnerabilityAlertsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -597,7 +578,6 @@ func TestRepositoriesService_EnableVulnerabilityAlerts(t *testing.T) { mux.HandleFunc("/repos/o/r/vulnerability-alerts", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeRequiredVulnerabilityAlertsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -624,7 +604,6 @@ func TestRepositoriesService_DisableVulnerabilityAlerts(t *testing.T) { mux.HandleFunc("/repos/o/r/vulnerability-alerts", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeRequiredVulnerabilityAlertsPreview) w.WriteHeader(http.StatusNoContent) }) @@ -651,7 +630,6 @@ func TestRepositoriesService_EnableAutomatedSecurityFixes(t *testing.T) { mux.HandleFunc("/repos/o/r/automated-security-fixes", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeRequiredAutomatedSecurityFixesPreview) w.WriteHeader(http.StatusNoContent) }) @@ -668,7 +646,6 @@ func TestRepositoriesService_DisableAutomatedSecurityFixes(t *testing.T) { mux.HandleFunc("/repos/o/r/automated-security-fixes", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeRequiredAutomatedSecurityFixesPreview) w.WriteHeader(http.StatusNoContent) }) @@ -990,8 +967,6 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) { json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "GET") - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) fmt.Fprintf(w, `{ "required_status_checks":{ "strict":true, @@ -1091,8 +1066,6 @@ func TestRepositoriesService_GetBranchProtection_noDismissalRestrictions(t *test mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) fmt.Fprintf(w, `{ "required_status_checks":{ "strict":true, @@ -1181,8 +1154,6 @@ func TestRepositoriesService_UpdateBranchProtection(t *testing.T) { t.Errorf("Request body = %+v, want %+v", v, input) } - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) fmt.Fprintf(w, `{ "required_status_checks":{ "strict":true, @@ -1507,8 +1478,6 @@ func TestRepositoriesService_GetPullRequestReviewEnforcement(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/protection/required_pull_request_reviews", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) fmt.Fprintf(w, `{ "dismissal_restrictions":{ "users":[{"id":1,"login":"u"}], @@ -1578,8 +1547,6 @@ func TestRepositoriesService_UpdatePullRequestReviewEnforcement(t *testing.T) { if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) fmt.Fprintf(w, `{ "dismissal_restrictions":{ "users":[{"id":1,"login":"u"}], @@ -1635,8 +1602,6 @@ func TestRepositoriesService_DisableDismissalRestrictions(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/protection/required_pull_request_reviews", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) testBody(t, r, `{"dismissal_restrictions":{}}`+"\n") fmt.Fprintf(w, `{"dismiss_stale_reviews":true,"require_code_owner_reviews":true,"required_approving_review_count":1}`) }) @@ -1807,7 +1772,6 @@ func TestRepositoriesService_GetSignaturesProtectedBranch(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/protection/required_signatures", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeSignaturePreview) fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/required_signatures","enabled":false}`) }) @@ -1847,7 +1811,6 @@ func TestRepositoriesService_RequireSignaturesOnProtectedBranch(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/protection/required_signatures", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeSignaturePreview) fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/required_signatures","enabled":true}`) }) @@ -1887,7 +1850,6 @@ func TestRepositoriesService_OptionalSignaturesOnProtectedBranch(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/protection/required_signatures", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeSignaturePreview) w.WriteHeader(http.StatusNoContent) }) @@ -1959,7 +1921,6 @@ func TestRepositoriesService_ListAllTopics(t *testing.T) { mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) fmt.Fprint(w, `{"names":["go", "go-github", "github"]}`) }) @@ -1995,7 +1956,6 @@ func TestRepositoriesService_ListAllTopics_emptyTopics(t *testing.T) { mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) fmt.Fprint(w, `{"names":[]}`) }) @@ -2017,7 +1977,6 @@ func TestRepositoriesService_ReplaceAllTopics(t *testing.T) { mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) fmt.Fprint(w, `{"names":["go", "go-github", "github"]}`) }) @@ -2053,7 +2012,6 @@ func TestRepositoriesService_ReplaceAllTopics_nilSlice(t *testing.T) { mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) testBody(t, r, `{"names":[]}`+"\n") fmt.Fprint(w, `{"names":[]}`) }) @@ -2076,7 +2034,6 @@ func TestRepositoriesService_ReplaceAllTopics_emptySlice(t *testing.T) { mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) testBody(t, r, `{"names":[]}`+"\n") fmt.Fprint(w, `{"names":[]}`) }) diff --git a/github/search.go b/github/search.go index 19aa8927984..57a993324e2 100644 --- a/github/search.go +++ b/github/search.go @@ -272,22 +272,6 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter } switch { - case searchType == "commits": - // Accept header for search commits preview endpoint - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeCommitSearchPreview) - case searchType == "topics": - // Accept header for search repositories based on topics preview endpoint - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTopicsPreview) - case searchType == "repositories": - // Accept header for search repositories based on topics preview endpoint - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeTopicsPreview) - case searchType == "issues": - // Accept header for search issues based on reactions preview endpoint - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeReactionsPreview) case opts != nil && opts.TextMatch: // Accept header defaults to "application/vnd.github.v3+json" // We change it here to fetch back text-match metadata diff --git a/github/teams.go b/github/teams.go index 7a8a5d8a7b7..933fe58e54a 100644 --- a/github/teams.go +++ b/github/teams.go @@ -361,10 +361,6 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6 return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. - headers := []string{mediaTypeTopicsPreview} - req.Header.Set("Accept", strings.Join(headers, ", ")) - var repos []*Repository resp, err := s.client.Do(ctx, req, &repos) if err != nil { @@ -389,10 +385,6 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. - headers := []string{mediaTypeTopicsPreview} - req.Header.Set("Accept", strings.Join(headers, ", ")) - var repos []*Repository resp, err := s.client.Do(ctx, req, &repos) if err != nil { @@ -559,10 +551,6 @@ func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID i return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var projects []*Project resp, err := s.client.Do(ctx, req, &projects) if err != nil { @@ -583,10 +571,6 @@ func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug str return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var projects []*Project resp, err := s.client.Do(ctx, req, &projects) if err != nil { @@ -607,10 +591,6 @@ func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - projects := &Project{} resp, err := s.client.Do(ctx, req, &projects) if err != nil { @@ -631,10 +611,6 @@ func (s *TeamsService) ReviewTeamProjectsBySlug(ctx context.Context, org, slug s return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - projects := &Project{} resp, err := s.client.Do(ctx, req, &projects) if err != nil { @@ -668,10 +644,6 @@ func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, pr return nil, err } - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - return s.client.Do(ctx, req, nil) } @@ -687,10 +659,6 @@ func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug strin return nil, err } - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - return s.client.Do(ctx, req, nil) } @@ -709,10 +677,6 @@ func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, return nil, err } - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - return s.client.Do(ctx, req, nil) } @@ -731,10 +695,6 @@ func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug st return nil, err } - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders := []string{mediaTypeProjectsPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - return s.client.Do(ctx, req, nil) } diff --git a/github/teams_test.go b/github/teams_test.go index 748721c3a4d..80aeb14ca43 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -538,8 +538,6 @@ func TestTeamsService_ListTeamReposByID(t *testing.T) { mux.HandleFunc("/organizations/1/team/1/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - wantAcceptHeaders := []string{mediaTypeTopicsPreview} - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{"id":1}]`) }) @@ -577,8 +575,6 @@ func TestTeamsService_ListTeamReposBySlug(t *testing.T) { mux.HandleFunc("/orgs/o/teams/s/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - wantAcceptHeaders := []string{mediaTypeTopicsPreview} - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{"id":1}]`) }) @@ -1016,10 +1012,8 @@ func TestTeamsService_ListProjectsByID(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/organizations/1/team/1/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `[{"id":1}]`) }) @@ -1053,10 +1047,8 @@ func TestTeamsService_ListProjectsBySlug(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/orgs/o/teams/s/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `[{"id":1}]`) }) @@ -1090,10 +1082,8 @@ func TestTeamsService_ReviewProjectsByID(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/organizations/1/team/1/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `{"id":1}`) }) @@ -1127,10 +1117,8 @@ func TestTeamsService_ReviewProjectsBySlug(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/orgs/o/teams/s/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `{"id":1}`) }) @@ -1168,10 +1156,8 @@ func TestTeamsService_AddTeamProjectByID(t *testing.T) { Permission: String("admin"), } - wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/organizations/1/team/1/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) v := &TeamProjectOptions{} json.NewDecoder(r.Body).Decode(v) @@ -1207,10 +1193,8 @@ func TestTeamsService_AddTeamProjectBySlug(t *testing.T) { Permission: String("admin"), } - wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/orgs/o/teams/s/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) v := &TeamProjectOptions{} json.NewDecoder(r.Body).Decode(v) @@ -1242,10 +1226,8 @@ func TestTeamsService_RemoveTeamProjectByID(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/organizations/1/team/1/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) w.WriteHeader(http.StatusNoContent) }) @@ -1270,10 +1252,8 @@ func TestTeamsService_RemoveTeamProjectBySlug(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/orgs/o/teams/s/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) w.WriteHeader(http.StatusNoContent) }) @@ -1666,7 +1646,7 @@ func TestTeams_Marshal(t *testing.T) { "members_count": 1, "repos_count": 1 }, - "ldap_dn": "l" + "ldap_dn": "l" }` testJSONMarshal(t, u, want) diff --git a/github/users_blocking.go b/github/users_blocking.go index cdbc2c25326..8241dcfe1e9 100644 --- a/github/users_blocking.go +++ b/github/users_blocking.go @@ -25,9 +25,6 @@ func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeBlockUsersPreview) - var blockedUsers []*User resp, err := s.client.Do(ctx, req, &blockedUsers) if err != nil { @@ -48,9 +45,6 @@ func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Respo 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) isBlocked, err := parseBoolResponse(err) return isBlocked, resp, err @@ -67,9 +61,6 @@ func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, e 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) } @@ -84,8 +75,5 @@ func (s *UsersService) UnblockUser(ctx context.Context, user string) (*Response, 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) } diff --git a/github/users_blocking_test.go b/github/users_blocking_test.go index 55d8678495c..03cbbc01dd7 100644 --- a/github/users_blocking_test.go +++ b/github/users_blocking_test.go @@ -20,7 +20,6 @@ func TestUsersService_ListBlockedUsers(t *testing.T) { mux.HandleFunc("/user/blocks", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeBlockUsersPreview) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{ "login": "octocat" @@ -55,7 +54,6 @@ func TestUsersService_IsBlocked(t *testing.T) { mux.HandleFunc("/user/blocks/u", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeBlockUsersPreview) w.WriteHeader(http.StatusNoContent) }) @@ -89,7 +87,6 @@ func TestUsersService_BlockUser(t *testing.T) { mux.HandleFunc("/user/blocks/u", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeBlockUsersPreview) w.WriteHeader(http.StatusNoContent) }) @@ -116,7 +113,6 @@ func TestUsersService_UnblockUser(t *testing.T) { mux.HandleFunc("/user/blocks/u", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeBlockUsersPreview) w.WriteHeader(http.StatusNoContent) }) diff --git a/github/users_projects.go b/github/users_projects.go index dd9ceaf2f88..2be0e98c88f 100644 --- a/github/users_projects.go +++ b/github/users_projects.go @@ -25,9 +25,6 @@ func (s *UsersService) ListProjects(ctx context.Context, user string, opts *Proj return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - var projects []*Project resp, err := s.client.Do(ctx, req, &projects) if err != nil { @@ -55,9 +52,6 @@ func (s *UsersService) CreateProject(ctx context.Context, opts *CreateUserProjec return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - project := &Project{} resp, err := s.client.Do(ctx, req, project) if err != nil { diff --git a/github/users_projects_test.go b/github/users_projects_test.go index 4f4b5e26407..c259bebeed3 100644 --- a/github/users_projects_test.go +++ b/github/users_projects_test.go @@ -21,7 +21,6 @@ func TestUsersService_ListProjects(t *testing.T) { mux.HandleFunc("/users/u/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) testFormValues(t, r, values{"state": "open", "page": "2"}) fmt.Fprint(w, `[{"id":1}]`) }) @@ -61,7 +60,6 @@ func TestUsersService_CreateProject(t *testing.T) { mux.HandleFunc("/user/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &CreateUserProjectOptions{} json.NewDecoder(r.Body).Decode(v) diff --git a/update-urls/reactions_test.go b/update-urls/reactions_test.go index 7422a5951cc..1ecbc044431 100644 --- a/update-urls/reactions_test.go +++ b/update-urls/reactions_test.go @@ -140,46 +140,46 @@ var reactionsTestWebPage = ` - + - + - + - + - + - + - + - + @@ -198,7 +198,7 @@ var reactionsTestWebPage = ` GitHub Docs - +
- +When creating a reaction, the allowed values for the content parameter are as follows (with the corresponding emoji for reference):
get /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +orgteam_slugdiscussion_numbercomment_numbercontentReturns a single reaction type. Omit this parameter to list all reactions to a team discussion comment.
- +per_pageResults per page (max 100)
- +pagePage number of the results to fetch.
- +curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions
-
-
-
+
+
+
await octokit.request('GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
org: 'org',
@@ -1263,10 +1263,10 @@ var reactionsTestWebPage = `
}
})
-
-
-
-
+
+
+
+
Status: 200 OK
[
@@ -1298,22 +1298,22 @@ var reactionsTestWebPage = `
}
]
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -1336,8 +1336,8 @@ and creating reactions.
post /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +orgteam_slugdiscussion_numbercomment_numbercontentRequired. The reaction type to add to the team discussion comment.
- +curl \
-X POST \
@@ -1453,13 +1453,13 @@ and creating reactions.
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
org: 'org',
@@ -1474,10 +1474,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 201 Created
{
@@ -1507,22 +1507,22 @@ and creating reactions.
"created_at": "2016-05-20T20:09:31Z"
}
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -1545,8 +1545,8 @@ and creating reactions.
delete /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +orgteam_slugdiscussion_numbercomment_numberreaction_idcurl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}', {
org: 'org',
@@ -1681,29 +1681,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 204 No Content
-
-
+
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -1726,8 +1726,8 @@ and creating reactions.
get /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +orgteam_slugdiscussion_numbercontentReturns a single reaction type. Omit this parameter to list all reactions to a team discussion.
- +per_pageResults per page (max 100)
- +pagePage number of the results to fetch.
- +curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions
-
-
-
+
+
+
await octokit.request('GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions', {
org: 'org',
@@ -1869,10 +1869,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 200 OK
[
@@ -1904,22 +1904,22 @@ and creating reactions.
}
]
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -1942,8 +1942,8 @@ and creating reactions.
post /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +orgteam_slugdiscussion_numbercontentRequired. The reaction type to add to the team discussion.
- +curl \
-X POST \
@@ -2049,13 +2049,13 @@ and creating reactions.
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions', {
org: 'org',
@@ -2069,10 +2069,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 201 Created
{
@@ -2102,15 +2102,15 @@ and creating reactions.
"created_at": "2016-05-20T20:09:31Z"
}
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -2133,8 +2133,8 @@ and creating reactions.
delete /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +orgteam_slugdiscussion_numberreaction_idcurl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}', {
org: 'org',
@@ -2258,29 +2258,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 204 No Content
-
-
+
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -2303,8 +2303,8 @@ and creating reactions.
delete /reactions/{reaction_id}
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +reaction_idcurl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /reactions/{reaction_id}', {
reaction_id: 42,
@@ -2395,29 +2395,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 204 No Content
-
-
+
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -2440,8 +2440,8 @@ and creating reactions.
get /repos/{owner}/{repo}/comments/{comment_id}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepocomment_idcontentReturns a single reaction type. Omit this parameter to list all reactions to a commit comment.
- +per_pageResults per page (max 100)
- +pagePage number of the results to fetch.
- +curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/comments/42/reactions
-
-
-
+
+
+
await octokit.request('GET /repos/{owner}/{repo}/comments/{comment_id}/reactions', {
owner: 'octocat',
@@ -2582,10 +2582,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 200 OK
[
@@ -2617,22 +2617,22 @@ and creating reactions.
}
]
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -2655,8 +2655,8 @@ and creating reactions.
post /repos/{owner}/{repo}/comments/{comment_id}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepocomment_idcontentRequired. The reaction type to add to the commit comment.
- +curl \
-X POST \
@@ -2761,13 +2761,13 @@ and creating reactions.
https://api.github.com/repos/octocat/hello-world/comments/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /repos/{owner}/{repo}/comments/{comment_id}/reactions', {
owner: 'octocat',
@@ -2781,10 +2781,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 201 Created
{
@@ -2814,22 +2814,22 @@ and creating reactions.
"created_at": "2016-05-20T20:09:31Z"
}
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -2852,8 +2852,8 @@ and creating reactions.
delete /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepocomment_idreaction_idcurl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/comments/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}', {
owner: 'octocat',
@@ -2977,29 +2977,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 204 No Content
-
-
+
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -3022,8 +3022,8 @@ and creating reactions.
get /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepocomment_idcontentReturns a single reaction type. Omit this parameter to list all reactions to an issue comment.
- +per_pageResults per page (max 100)
- +pagePage number of the results to fetch.
- +curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions
-
-
-
+
+
+
await octokit.request('GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions', {
owner: 'octocat',
@@ -3164,10 +3164,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 200 OK
[
@@ -3199,22 +3199,22 @@ and creating reactions.
}
]
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -3237,8 +3237,8 @@ and creating reactions.
post /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepocomment_idcontentRequired. The reaction type to add to the issue comment.
- +curl \
-X POST \
@@ -3343,13 +3343,13 @@ and creating reactions.
https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions', {
owner: 'octocat',
@@ -3363,10 +3363,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 201 Created
{
@@ -3396,22 +3396,22 @@ and creating reactions.
"created_at": "2016-05-20T20:09:31Z"
}
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -3434,8 +3434,8 @@ and creating reactions.
delete /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepocomment_idreaction_idcurl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}', {
owner: 'octocat',
@@ -3559,29 +3559,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 204 No Content
-
-
+
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -3604,8 +3604,8 @@ and creating reactions.
get /repos/{owner}/{repo}/issues/{issue_number}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepoissue_numbercontentReturns a single reaction type. Omit this parameter to list all reactions to an issue.
- +per_pageResults per page (max 100)
- +pagePage number of the results to fetch.
- +curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/issues/42/reactions
-
-
-
+
+
+
await octokit.request('GET /repos/{owner}/{repo}/issues/{issue_number}/reactions', {
owner: 'octocat',
@@ -3746,10 +3746,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 200 OK
[
@@ -3781,22 +3781,22 @@ and creating reactions.
}
]
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -3819,8 +3819,8 @@ and creating reactions.
post /repos/{owner}/{repo}/issues/{issue_number}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepoissue_numbercontentRequired. The reaction type to add to the issue.
- +curl \
-X POST \
@@ -3925,13 +3925,13 @@ and creating reactions.
https://api.github.com/repos/octocat/hello-world/issues/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/reactions', {
owner: 'octocat',
@@ -3945,10 +3945,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 201 Created
{
@@ -3978,15 +3978,15 @@ and creating reactions.
"created_at": "2016-05-20T20:09:31Z"
}
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4009,8 +4009,8 @@ and creating reactions.
delete /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepoissue_numberreaction_idcurl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/issues/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}', {
owner: 'octocat',
@@ -4134,29 +4134,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 204 No Content
-
-
+
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4179,8 +4179,8 @@ and creating reactions.
get /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepocomment_idcontentReturns a single reaction type. Omit this parameter to list all reactions to a pull request review comment.
- +per_pageResults per page (max 100)
- +pagePage number of the results to fetch.
- +curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions
-
-
-
+
+
+
await octokit.request('GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions', {
owner: 'octocat',
@@ -4321,10 +4321,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 200 OK
[
@@ -4356,22 +4356,22 @@ and creating reactions.
}
]
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4394,8 +4394,8 @@ and creating reactions.
post /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepocomment_idcontentRequired. The reaction type to add to the pull request review comment.
- +curl \
-X POST \
@@ -4500,13 +4500,13 @@ and creating reactions.
https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions', {
owner: 'octocat',
@@ -4520,10 +4520,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 201 Created
{
@@ -4553,22 +4553,22 @@ and creating reactions.
"created_at": "2016-05-20T20:09:31Z"
}
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4591,8 +4591,8 @@ and creating reactions.
delete /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +ownerrepocomment_idreaction_idcurl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}', {
owner: 'octocat',
@@ -4716,29 +4716,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 204 No Content
-
-
+
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4761,8 +4761,8 @@ and creating reactions.
get /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +team_iddiscussion_numbercomment_numbercontentReturns a single reaction type. Omit this parameter to list all reactions to a team discussion comment.
- +per_pageResults per page (max 100)
- +pagePage number of the results to fetch.
- +curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/teams/42/discussions/42/comments/42/reactions
-
-
-
+
+
+
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
team_id: 42,
@@ -4904,10 +4904,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 200 OK
[
@@ -4939,22 +4939,22 @@ and creating reactions.
}
]
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4977,8 +4977,8 @@ and creating reactions.
post /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +team_iddiscussion_numbercomment_numbercontentRequired. The reaction type to add to the team discussion comment.
- +curl \
-X POST \
@@ -5084,13 +5084,13 @@ and creating reactions.
https://api.github.com/teams/42/discussions/42/comments/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
team_id: 42,
@@ -5104,10 +5104,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 201 Created
{
@@ -5137,22 +5137,22 @@ and creating reactions.
"created_at": "2016-05-20T20:09:31Z"
}
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -5175,8 +5175,8 @@ and creating reactions.
get /teams/{team_id}/discussions/{discussion_number}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +team_iddiscussion_numbercontentReturns a single reaction type. Omit this parameter to list all reactions to a team discussion.
- +per_pageResults per page (max 100)
- +pagePage number of the results to fetch.
- +curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/teams/42/discussions/42/reactions
-
-
-
+
+
+
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/reactions', {
team_id: 42,
@@ -5307,10 +5307,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 200 OK
[
@@ -5342,22 +5342,22 @@ and creating reactions.
}
]
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -5380,8 +5380,8 @@ and creating reactions.
post /teams/{team_id}/discussions/{discussion_number}/reactions
acceptThis API is under preview and subject to change.
- + - + See preview notice. - - + +team_iddiscussion_numbercontentRequired. The reaction type to add to the team discussion.
- +curl \
-X POST \
@@ -5477,13 +5477,13 @@ and creating reactions.
https://api.github.com/teams/42/discussions/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/reactions', {
team_id: 42,
@@ -5496,10 +5496,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Status: 201 Created
{
@@ -5529,15 +5529,15 @@ and creating reactions.
"created_at": "2016-05-20T20:09:31Z"
}
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -5560,8 +5560,8 @@ and creating reactions.