From 7a7a7f0943f3fcffc4b8f30feaaed7333b035a99 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 24 May 2022 08:43:48 -0400 Subject: [PATCH] Update URLs (#2373) Fixes: #2360. --- CONTRIBUTING.md | 4 +- README.md | 6 +- github/actions.go | 2 +- github/actions_artifacts.go | 14 +- github/actions_runner_groups.go | 26 +- github/actions_runners.go | 32 +- github/actions_secrets.go | 38 +- github/actions_workflow_jobs.go | 6 +- github/actions_workflow_runs.go | 26 +- github/actions_workflows.go | 22 +- github/activity.go | 2 +- github/activity_events.go | 20 +- github/activity_notifications.go | 20 +- github/activity_star.go | 12 +- github/activity_watching.go | 12 +- github/admin.go | 6 +- github/admin_stats.go | 2 +- github/admin_users_test.go | 4 +- github/apps.go | 32 +- github/apps_hooks.go | 4 +- github/apps_hooks_deliveries.go | 6 +- github/apps_installation.go | 10 +- github/apps_manifest.go | 2 +- github/apps_marketplace.go | 14 +- github/authorizations.go | 14 +- github/billing.go | 16 +- github/checks.go | 24 +- github/code-scanning.go | 20 +- github/dependabot.go | 2 +- github/dependabot_secrets.go | 28 +- github/doc.go | 6 +- github/enterprise.go | 2 +- github/enterprise_actions_runners.go | 6 +- github/enterprise_audit_log.go | 2 +- github/event_types.go | 2 +- github/gists.go | 32 +- github/gists_comments.go | 10 +- github/git.go | 2 +- github/git_blobs.go | 6 +- github/git_commits.go | 4 +- github/git_refs.go | 10 +- github/git_tags.go | 4 +- github/git_trees.go | 4 +- github/github.go | 14 +- github/github_test.go | 14 +- github/gitignore.go | 6 +- github/interactions.go | 2 +- github/interactions_orgs.go | 6 +- github/interactions_repos.go | 6 +- github/issues.go | 26 +- github/issues_assignees.go | 8 +- github/issues_comments.go | 12 +- github/issues_events.go | 6 +- github/issues_labels.go | 22 +- github/issues_milestones.go | 10 +- github/issues_timeline.go | 2 +- github/licenses.go | 6 +- github/migrations.go | 14 +- github/migrations_source_import.go | 20 +- github/migrations_user.go | 12 +- github/misc.go | 10 +- github/orgs.go | 14 +- github/orgs_actions_allowed.go | 6 +- github/orgs_actions_permissions.go | 6 +- github/orgs_audit_log.go | 2 +- github/orgs_custom_roles.go | 2 +- github/orgs_hooks.go | 12 +- github/orgs_hooks_deliveries.go | 6 +- github/orgs_members.go | 34 +- github/orgs_outside_collaborators.go | 6 +- github/orgs_packages.go | 16 +- github/orgs_projects.go | 4 +- github/orgs_users_blocking.go | 8 +- github/projects.go | 44 +- github/pulls.go | 24 +- github/pulls_comments.go | 14 +- github/pulls_reviewers.go | 6 +- github/pulls_reviews.go | 16 +- github/reactions.go | 52 +- github/repos.go | 116 +- github/repos_actions_allowed.go | 8 +- github/repos_actions_permissions.go | 6 +- github/repos_autolinks.go | 8 +- github/repos_collaborators.go | 13 +- github/repos_comments.go | 12 +- github/repos_commits.go | 16 +- github/repos_community_health.go | 2 +- github/repos_contents.go | 14 +- github/repos_deployments.go | 14 +- github/repos_environments.go | 8 +- github/repos_forks.go | 4 +- github/repos_hooks.go | 14 +- github/repos_hooks_deliveries.go | 10 +- github/repos_invitations.go | 6 +- github/repos_keys.go | 8 +- github/repos_merging.go | 4 +- github/repos_pages.go | 16 +- github/repos_projects.go | 4 +- github/repos_releases.go | 30 +- github/repos_stats.go | 10 +- github/repos_statuses.go | 6 +- github/repos_test.go | 18 +- github/repos_traffic.go | 8 +- github/scim.go | 20 +- github/search.go | 16 +- github/secret_scanning.go | 14 +- github/teams.go | 74 +- github/teams_discussion_comments.go | 20 +- github/teams_discussions.go | 20 +- github/teams_members.go | 20 +- github/users.go | 20 +- github/users_blocking.go | 8 +- github/users_emails.go | 6 +- github/users_followers.go | 16 +- github/users_gpg_keys.go | 10 +- github/users_keys.go | 10 +- github/users_packages.go | 32 +- github/users_projects.go | 4 +- update-urls/activity-events_test.go | 6103 +-------------- update-urls/main.go | 225 +- update-urls/main_test.go | 58 +- update-urls/reactions_test.go | 6695 +---------------- update-urls/testdata/activity-events.html | 5686 ++++++++++++++ .../testdata/activity_events-original.go | 196 + update-urls/testdata/activity_events-want.go | 196 + update-urls/testdata/reactions-original.go | 490 ++ update-urls/testdata/reactions-want.go | 490 ++ update-urls/testdata/reactions.html | 5690 ++++++++++++++ 128 files changed, 13804 insertions(+), 13654 deletions(-) create mode 100644 update-urls/testdata/activity-events.html create mode 100644 update-urls/testdata/activity_events-original.go create mode 100644 update-urls/testdata/activity_events-want.go create mode 100644 update-urls/testdata/reactions-original.go create mode 100644 update-urls/testdata/reactions-want.go create mode 100644 update-urls/testdata/reactions.html diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ab4a7d7d76..ef94c683a8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,10 +87,10 @@ where to put new methods. Code is organized in files also based pretty closely on the GitHub API documentation, following the format `{service}_{api}.go`. For example, methods -defined at live in +defined at live in [repos_hooks.go][]. -[GitHub API documentation]: https://docs.github.com/en/free-pro-team@latest/rest/reference/ +[GitHub API documentation]: https://docs.github.com/en/rest [repos_hooks.go]: https://github.com/google/go-github/blob/master/github/repos_hooks.go diff --git a/README.md b/README.md index 903f33624d..c88f407ab5 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ repos, _, err := client.Repositories.ListByOrg(context.Background(), "github", o The services of a client divide the API into logical chunks and correspond to the structure of the GitHub API documentation at -https://docs.github.com/en/free-pro-team@latest/rest/reference/. +https://docs.github.com/en/rest . NOTE: Using the [context](https://godoc.org/context) package, one can easily pass cancelation signals and deadlines to various services of the client for @@ -168,7 +168,7 @@ if _, ok := err.(*github.RateLimitError); ok { ``` Learn more about GitHub rate limiting at -https://docs.github.com/en/free-pro-team@latest/rest/reference/rate-limit. +https://docs.github.com/en/rest/rate-limit . ### Accepted Status ### @@ -196,7 +196,7 @@ instead designed to work with a caching `http.Transport`. We recommend using https://github.com/gregjones/httpcache for that. Learn more about GitHub conditional requests at -https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#conditional-requests. +https://docs.github.com/en/rest/overview/resources-in-the-rest-api#conditional-requests. ### Creating and Updating Resources ### diff --git a/github/actions.go b/github/actions.go index ce15d95fae..8d552f2d0d 100644 --- a/github/actions.go +++ b/github/actions.go @@ -8,5 +8,5 @@ package github // ActionsService handles communication with the actions related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/ +// GitHub API docs: https://docs.github.com/en/rest/actions/ type ActionsService service diff --git a/github/actions_artifacts.go b/github/actions_artifacts.go index 2925921208..3b9c83c490 100644 --- a/github/actions_artifacts.go +++ b/github/actions_artifacts.go @@ -16,7 +16,7 @@ import ( // data between jobs in a workflow and provide storage for data // once a workflow is complete. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#artifacts +// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts type Artifact struct { ID *int64 `json:"id,omitempty"` NodeID *string `json:"node_id,omitempty"` @@ -30,7 +30,7 @@ type Artifact struct { // ArtifactList represents a list of GitHub artifacts. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#artifacts +// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#artifacts type ArtifactList struct { TotalCount *int64 `json:"total_count,omitempty"` Artifacts []*Artifact `json:"artifacts,omitempty"` @@ -38,7 +38,7 @@ type ArtifactList struct { // ListArtifacts lists all artifacts that belong to a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-artifacts-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#list-artifacts-for-a-repository func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, opts *ListOptions) (*ArtifactList, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts", owner, repo) u, err := addOptions(u, opts) @@ -62,7 +62,7 @@ func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, // ListWorkflowRunArtifacts lists all artifacts that belong to a workflow run. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-workflow-run-artifacts +// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#list-workflow-run-artifacts func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, repo string, runID int64, opts *ListOptions) (*ArtifactList, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/artifacts", owner, repo, runID) u, err := addOptions(u, opts) @@ -86,7 +86,7 @@ func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, re // GetArtifact gets a specific artifact for a workflow run. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-an-artifact +// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#get-an-artifact func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Artifact, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID) @@ -106,7 +106,7 @@ func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, ar // DownloadArtifact gets a redirect URL to download an archive for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#download-an-artifact +// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#download-an-artifact func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo string, artifactID int64, followRedirects bool) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v/zip", owner, repo, artifactID) @@ -126,7 +126,7 @@ func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo strin // DeleteArtifact deletes a workflow run artifact. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-an-artifact +// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#delete-an-artifact func (s *ActionsService) DeleteArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID) diff --git a/github/actions_runner_groups.go b/github/actions_runner_groups.go index da3ca0c751..6d89249150 100644 --- a/github/actions_runner_groups.go +++ b/github/actions_runner_groups.go @@ -71,7 +71,7 @@ type ListOrgRunnerGroupOptions struct { // ListOrganizationRunnerGroups lists all self-hosted runner groups configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#list-self-hosted-runner-groups-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org string, opts *ListOrgRunnerGroupOptions) (*RunnerGroups, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups", org) u, err := addOptions(u, opts) @@ -95,7 +95,7 @@ func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org s // GetOrganizationRunnerGroup gets a specific self-hosted runner group for an organization using its RunnerGroup ID. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#get-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization func (s *ActionsService) GetOrganizationRunnerGroup(ctx context.Context, org string, groupID int64) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) req, err := s.client.NewRequest("GET", u, nil) @@ -114,7 +114,7 @@ func (s *ActionsService) GetOrganizationRunnerGroup(ctx context.Context, org str // DeleteOrganizationRunnerGroup deletes a self-hosted runner group from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#delete-a-self-hosted-runner-group-from-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization func (s *ActionsService) DeleteOrganizationRunnerGroup(ctx context.Context, org string, groupID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) @@ -128,7 +128,7 @@ func (s *ActionsService) DeleteOrganizationRunnerGroup(ctx context.Context, org // CreateOrganizationRunnerGroup creates a new self-hosted runner group for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#create-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org string, createReq CreateRunnerGroupRequest) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups", org) req, err := s.client.NewRequest("POST", u, createReq) @@ -147,7 +147,7 @@ func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org // UpdateOrganizationRunnerGroup updates a self-hosted runner group for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#update-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org string, groupID int64, updateReq UpdateRunnerGroupRequest) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) req, err := s.client.NewRequest("PATCH", u, updateReq) @@ -166,7 +166,7 @@ func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org // ListRepositoryAccessRunnerGroup lists the repositories with access to a self-hosted runner group configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#list-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, opts *ListOptions) (*ListRepositories, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories", org, groupID) u, err := addOptions(u, opts) @@ -191,7 +191,7 @@ func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, or // SetRepositoryAccessRunnerGroup replaces the list of repositories that have access to a self-hosted runner group configured in an organization // with a new List of repositories. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#set-repository-access-for-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization func (s *ActionsService) SetRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, ids SetRepoAccessRunnerGroupRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories", org, groupID) @@ -206,7 +206,7 @@ func (s *ActionsService) SetRepositoryAccessRunnerGroup(ctx context.Context, org // AddRepositoryAccessRunnerGroup adds a repository to the list of selected repositories that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#add-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization func (s *ActionsService) AddRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID, repoID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories/%v", org, groupID, repoID) @@ -221,7 +221,7 @@ func (s *ActionsService) AddRepositoryAccessRunnerGroup(ctx context.Context, org // RemoveRepositoryAccessRunnerGroup removes a repository from the list of selected repositories that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization func (s *ActionsService) RemoveRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID, repoID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories/%v", org, groupID, repoID) @@ -235,7 +235,7 @@ func (s *ActionsService) RemoveRepositoryAccessRunnerGroup(ctx context.Context, // ListRunnerGroupRunners lists self-hosted runners that are in a specific organization group. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#list-self-hosted-runners-in-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, groupID int64, opts *ListOptions) (*Runners, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners", org, groupID) u, err := addOptions(u, opts) @@ -260,7 +260,7 @@ func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, // SetRunnerGroupRunners replaces the list of self-hosted runners that are part of an organization runner group // with a new list of runners. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#set-self-hosted-runners-in-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization func (s *ActionsService) SetRunnerGroupRunners(ctx context.Context, org string, groupID int64, ids SetRunnerGroupRunnersRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners", org, groupID) @@ -274,7 +274,7 @@ func (s *ActionsService) SetRunnerGroupRunners(ctx context.Context, org string, // AddRunnerGroupRunners adds a self-hosted runner to a runner group configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#add-a-self-hosted-runner-to-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization func (s *ActionsService) AddRunnerGroupRunners(ctx context.Context, org string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners/%v", org, groupID, runnerID) @@ -289,7 +289,7 @@ func (s *ActionsService) AddRunnerGroupRunners(ctx context.Context, org string, // RemoveRunnerGroupRunners removes a self-hosted runner from a group configured in an organization. // The runner is then returned to the default group. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#remove-a-self-hosted-runner-from-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization func (s *ActionsService) RemoveRunnerGroupRunners(ctx context.Context, org string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners/%v", org, groupID, runnerID) diff --git a/github/actions_runners.go b/github/actions_runners.go index f37e1aa419..40c6be3a92 100644 --- a/github/actions_runners.go +++ b/github/actions_runners.go @@ -28,7 +28,7 @@ type ActionsEnabledOnOrgRepos struct { // ListRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-runner-applications-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository func (s *ActionsService) ListRunnerApplicationDownloads(ctx context.Context, owner, repo string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/downloads", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -53,7 +53,7 @@ type RegistrationToken struct { // CreateRegistrationToken creates a token that can be used to add a self-hosted runner. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-registration-token-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository func (s *ActionsService) CreateRegistrationToken(ctx context.Context, owner, repo string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/registration-token", owner, repo) @@ -96,7 +96,7 @@ type Runners struct { // ListRunners lists all the self-hosted runners for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-self-hosted-runners-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, opts *ListOptions) (*Runners, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners", owner, repo) u, err := addOptions(u, opts) @@ -120,7 +120,7 @@ func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, op // GetRunner gets a specific self-hosted runner for a repository using its runner ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-self-hosted-runner-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository func (s *ActionsService) GetRunner(ctx context.Context, owner, repo string, runnerID int64) (*Runner, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID) req, err := s.client.NewRequest("GET", u, nil) @@ -145,7 +145,7 @@ type RemoveToken struct { // CreateRemoveToken creates a token that can be used to remove a self-hosted runner from a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-remove-token-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo string) (*RemoveToken, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/remove-token", owner, repo) @@ -165,7 +165,7 @@ func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo stri // RemoveRunner forces the removal of a self-hosted runner in a repository using the runner id. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-a-self-hosted-runner-from-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, runnerID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID) @@ -179,7 +179,7 @@ func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, r // ListOrganizationRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-runner-applications-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.Context, owner string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/downloads", owner) req, err := s.client.NewRequest("GET", u, nil) @@ -198,7 +198,7 @@ func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context. // CreateOrganizationRegistrationToken creates a token that can be used to add a self-hosted runner to an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-registration-token-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context, owner string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/registration-token", owner) @@ -218,7 +218,7 @@ func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context // ListOrganizationRunners lists all the self-hosted runners for an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-self-hosted-runners-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner string, opts *ListOptions) (*Runners, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners", owner) u, err := addOptions(u, opts) @@ -242,7 +242,7 @@ func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner stri // ListEnabledReposInOrg lists the selected repositories that are enabled for GitHub Actions in an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-selected-repositories-enabled-for-github-actions-in-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) u, err := addOptions(u, opts) @@ -266,7 +266,7 @@ func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string // SetEnabledReposInOrg replaces the list of selected repositories that are enabled for GitHub Actions in an organization.. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#set-selected-repositories-enabled-for-github-actions-in-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) @@ -287,7 +287,7 @@ func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, // AddEnabledReposInOrg adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#enable-a-selected-repository-for-github-actions-in-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) @@ -306,7 +306,7 @@ func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, // RemoveEnabledRepoInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#disable-a-selected-repository-for-github-actions-in-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization func (s *ActionsService) RemoveEnabledRepoInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) @@ -325,7 +325,7 @@ func (s *ActionsService) RemoveEnabledRepoInOrg(ctx context.Context, owner strin // GetOrganizationRunner gets a specific self-hosted runner for an organization using its runner ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-self-hosted-runner-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Runner, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID) req, err := s.client.NewRequest("GET", u, nil) @@ -344,7 +344,7 @@ func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string // CreateOrganizationRemoveToken creates a token that can be used to remove a self-hosted runner from an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-remove-token-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owner string) (*RemoveToken, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/remove-token", owner) @@ -364,7 +364,7 @@ func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owne // RemoveOrganizationRunner forces the removal of a self-hosted runner from an organization using the runner id. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-a-self-hosted-runner-from-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization func (s *ActionsService) RemoveOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID) diff --git a/github/actions_secrets.go b/github/actions_secrets.go index 29f70a1a16..dc057edba2 100644 --- a/github/actions_secrets.go +++ b/github/actions_secrets.go @@ -64,7 +64,7 @@ func (s *ActionsService) getPublicKey(ctx context.Context, url string) (*PublicK // GetRepoPublicKey gets a public key that should be used for secret encryption. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-repository-public-key +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-a-repository-public-key func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/secrets/public-key", owner, repo) return s.getPublicKey(ctx, url) @@ -72,7 +72,7 @@ func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo strin // GetOrgPublicKey gets a public key that should be used for secret encryption. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-an-organization-public-key +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-an-organization-public-key func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/public-key", org) return s.getPublicKey(ctx, url) @@ -80,7 +80,7 @@ func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*Publ // GetEnvPublicKey gets a public key that should be used for secret encryption. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#get-an-environment-public-key +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-an-environment-public-key func (s *ActionsService) GetEnvPublicKey(ctx context.Context, repoID int, env string) (*PublicKey, *Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/secrets/public-key", repoID, env) return s.getPublicKey(ctx, url) @@ -124,7 +124,7 @@ func (s *ActionsService) listSecrets(ctx context.Context, url string, opts *List // ListRepoSecrets lists all secrets available in a repository // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-repository-secrets +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#list-repository-secrets func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/secrets", owner, repo) return s.listSecrets(ctx, url, opts) @@ -133,7 +133,7 @@ func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string // ListOrgSecrets lists all secrets available in an organization // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-organization-secrets +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#list-organization-secrets func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets", org) return s.listSecrets(ctx, url, opts) @@ -141,7 +141,7 @@ func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *L // ListEnvSecrets lists all secrets available in an environment. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#list-environment-secrets +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#list-environment-secrets func (s *ActionsService) ListEnvSecrets(ctx context.Context, repoID int, env string, opts *ListOptions) (*Secrets, *Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/secrets", repoID, env) return s.listSecrets(ctx, url, opts) @@ -164,7 +164,7 @@ func (s *ActionsService) getSecret(ctx context.Context, url string) (*Secret, *R // GetRepoSecret gets a single repository secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-repository-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-a-repository-secret func (s *ActionsService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name) return s.getSecret(ctx, url) @@ -172,7 +172,7 @@ func (s *ActionsService) GetRepoSecret(ctx context.Context, owner, repo, name st // GetOrgSecret gets a single organization secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-an-organization-secret func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name) return s.getSecret(ctx, url) @@ -180,7 +180,7 @@ func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*S // GetEnvSecret gets a single environment secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#list-environment-secrets +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-an-environment-secret func (s *ActionsService) GetEnvSecret(ctx context.Context, repoID int, env, secretName string) (*Secret, *Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, secretName) return s.getSecret(ctx, url) @@ -213,7 +213,7 @@ func (s *ActionsService) putSecret(ctx context.Context, url string, eSecret *Enc // CreateOrUpdateRepoSecret creates or updates a repository secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-or-update-a-repository-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#create-or-update-a-repository-secret func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, eSecret.Name) return s.putSecret(ctx, url, eSecret) @@ -221,7 +221,7 @@ func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, re // CreateOrUpdateOrgSecret creates or updates an organization secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-or-update-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#create-or-update-an-organization-secret func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, eSecret.Name) return s.putSecret(ctx, url, eSecret) @@ -229,7 +229,7 @@ func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string // CreateOrUpdateEnvSecret creates or updates a single environment secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#create-or-update-an-environment-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#create-or-update-an-environment-secret func (s *ActionsService) CreateOrUpdateEnvSecret(ctx context.Context, repoID int, env string, eSecret *EncryptedSecret) (*Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, eSecret.Name) return s.putSecret(ctx, url, eSecret) @@ -246,7 +246,7 @@ func (s *ActionsService) deleteSecret(ctx context.Context, url string) (*Respons // DeleteRepoSecret deletes a secret in a repository using the secret name. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-a-repository-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#delete-a-repository-secret func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name) return s.deleteSecret(ctx, url) @@ -254,7 +254,7 @@ func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name // DeleteOrgSecret deletes a secret in an organization using the secret name. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#delete-an-organization-secret func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name) return s.deleteSecret(ctx, url) @@ -262,7 +262,7 @@ func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string) // DeleteEnvSecret deletes a secret in an environment using the secret name. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#delete-an-environment-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#delete-an-environment-secret func (s *ActionsService) DeleteEnvSecret(ctx context.Context, repoID int, env, secretName string) (*Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, secretName) return s.deleteSecret(ctx, url) @@ -296,7 +296,7 @@ func (s *ActionsService) listSelectedReposForSecret(ctx context.Context, url str // ListSelectedReposForOrgSecret lists all repositories that have access to a secret. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#list-selected-repositories-for-an-organization-secret func (s *ActionsService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name) return s.listSelectedReposForSecret(ctx, url, opts) @@ -317,7 +317,7 @@ func (s *ActionsService) setSelectedReposForSecret(ctx context.Context, url stri // SetSelectedReposForOrgSecret sets the repositories that have access to a secret. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#set-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#set-selected-repositories-for-an-organization-secret func (s *ActionsService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name) return s.setSelectedReposForSecret(ctx, url, ids) @@ -334,7 +334,7 @@ func (s *ActionsService) addSelectedRepoToSecret(ctx context.Context, url string // AddSelectedRepoToOrgSecret adds a repository to an organization secret. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#add-selected-repository-to-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#add-selected-repository-to-an-organization-secret func (s *ActionsService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID) return s.addSelectedRepoToSecret(ctx, url) @@ -351,7 +351,7 @@ func (s *ActionsService) removeSelectedRepoFromSecret(ctx context.Context, url s // RemoveSelectedRepoFromOrgSecret removes a repository from an organization secret. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#remove-selected-repository-from-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#remove-selected-repository-from-an-organization-secret func (s *ActionsService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID) return s.removeSelectedRepoFromSecret(ctx, url) diff --git a/github/actions_workflow_jobs.go b/github/actions_workflow_jobs.go index ad0e7b6e2a..2867e82af0 100644 --- a/github/actions_workflow_jobs.go +++ b/github/actions_workflow_jobs.go @@ -66,7 +66,7 @@ type ListWorkflowJobsOptions struct { // ListWorkflowJobs lists all jobs for a workflow run. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-jobs-for-a-workflow-run +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo string, runID int64, opts *ListWorkflowJobsOptions) (*Jobs, *Response, error) { u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/jobs", owner, repo, runID) u, err := addOptions(u, opts) @@ -90,7 +90,7 @@ func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo strin // GetWorkflowJobByID gets a specific job in a workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-job-for-a-workflow-run +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo string, jobID int64) (*WorkflowJob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v", owner, repo, jobID) @@ -110,7 +110,7 @@ func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo str // GetWorkflowJobLogs gets a redirect URL to download a plain text file of logs for a workflow job. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#download-job-logs-for-a-workflow-run +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run func (s *ActionsService) GetWorkflowJobLogs(ctx context.Context, owner, repo string, jobID int64, followRedirects bool) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/logs", owner, repo, jobID) diff --git a/github/actions_workflow_runs.go b/github/actions_workflow_runs.go index 470f0f073b..de1e6c277a 100644 --- a/github/actions_workflow_runs.go +++ b/github/actions_workflow_runs.go @@ -115,7 +115,7 @@ func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, // ListWorkflowRunsByID lists all workflow runs by workflow ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-workflow-runs +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo string, workflowID int64, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowID) return s.listWorkflowRuns(ctx, u, opts) @@ -123,7 +123,7 @@ func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo s // ListWorkflowRunsByFileName lists all workflow runs by workflow file name. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-workflow-runs +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, repo, workflowFileName string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowFileName) return s.listWorkflowRuns(ctx, u, opts) @@ -131,7 +131,7 @@ func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, // ListRepositoryWorkflowRuns lists all workflow runs for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-workflow-runs-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs-for-a-repository func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, repo string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { u := fmt.Sprintf("repos/%s/%s/actions/runs", owner, repo) u, err := addOptions(u, opts) @@ -155,7 +155,7 @@ func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, // GetWorkflowRunByID gets a specific workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-workflow-run +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#get-a-workflow-run func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v", owner, repo, runID) @@ -175,7 +175,7 @@ func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo str // GetWorkflowRunAttempt gets a specific workflow run attempt. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-workflow-run-attempt +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#get-a-workflow-run-attempt func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo string, runID int64, attemptNumber int, opts *WorkflowRunAttemptOptions) (*WorkflowRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v", owner, repo, runID, attemptNumber) u, err := addOptions(u, opts) @@ -199,7 +199,7 @@ func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo // RerunWorkflowByID re-runs a workflow by ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#re-run-a-workflow +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#re-run-a-workflow func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun", owner, repo, runID) @@ -213,7 +213,7 @@ func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo stri // RerunFailedJobsByID re-runs all of the failed jobs and their dependent jobs in a workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run func (s *ActionsService) RerunFailedJobsByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun-failed-jobs", owner, repo, runID) @@ -227,7 +227,7 @@ func (s *ActionsService) RerunFailedJobsByID(ctx context.Context, owner, repo st // RerunJobByID re-runs a job and its dependent jobs in a workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run func (s *ActionsService) RerunJobByID(ctx context.Context, owner, repo string, jobID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/rerun", owner, repo, jobID) @@ -241,7 +241,7 @@ func (s *ActionsService) RerunJobByID(ctx context.Context, owner, repo string, j // CancelWorkflowRunByID cancels a workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#cancel-a-workflow-run +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#cancel-a-workflow-run func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/cancel", owner, repo, runID) @@ -255,7 +255,7 @@ func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo // GetWorkflowRunLogs gets a redirect URL to download a plain text file of logs for a workflow run. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#download-workflow-run-logs +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#download-workflow-run-logs func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64, followRedirects bool) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID) @@ -275,7 +275,7 @@ func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo str // DeleteWorkflowRun deletes a workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#delete-a-workflow-run +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#delete-a-workflow-run func (s *ActionsService) DeleteWorkflowRun(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v", owner, repo, runID) @@ -289,7 +289,7 @@ func (s *ActionsService) DeleteWorkflowRun(ctx context.Context, owner, repo stri // DeleteWorkflowRunLogs deletes all logs for a workflow run. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-workflow-run-logs +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#delete-workflow-run-logs func (s *ActionsService) DeleteWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID) @@ -303,7 +303,7 @@ func (s *ActionsService) DeleteWorkflowRunLogs(ctx context.Context, owner, repo // GetWorkflowRunUsageByID gets a specific workflow usage run by run ID in the unit of billable milliseconds. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-workflow-run-usage +// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#get-workflow-run-usage func (s *ActionsService) GetWorkflowRunUsageByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRunUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/timing", owner, repo, runID) diff --git a/github/actions_workflows.go b/github/actions_workflows.go index e0568462e8..9973a5d3f3 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -61,7 +61,7 @@ type CreateWorkflowDispatchEventRequest struct { // ListWorkflows lists all workflows in a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-repository-workflows +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#list-repository-workflows func (s *ActionsService) ListWorkflows(ctx context.Context, owner, repo string, opts *ListOptions) (*Workflows, *Response, error) { u := fmt.Sprintf("repos/%s/%s/actions/workflows", owner, repo) u, err := addOptions(u, opts) @@ -85,7 +85,7 @@ func (s *ActionsService) ListWorkflows(ctx context.Context, owner, repo string, // GetWorkflowByID gets a specific workflow by ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-workflow +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#get-a-workflow func (s *ActionsService) GetWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Workflow, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v", owner, repo, workflowID) @@ -94,7 +94,7 @@ func (s *ActionsService) GetWorkflowByID(ctx context.Context, owner, repo string // GetWorkflowByFileName gets a specific workflow by file name. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-workflow +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#get-a-workflow func (s *ActionsService) GetWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Workflow, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v", owner, repo, workflowFileName) @@ -118,7 +118,7 @@ func (s *ActionsService) getWorkflow(ctx context.Context, url string) (*Workflow // GetWorkflowUsageByID gets a specific workflow usage by ID in the unit of billable milliseconds. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-workflow-usage +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#get-workflow-usage func (s *ActionsService) GetWorkflowUsageByID(ctx context.Context, owner, repo string, workflowID int64) (*WorkflowUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/timing", owner, repo, workflowID) @@ -127,7 +127,7 @@ func (s *ActionsService) GetWorkflowUsageByID(ctx context.Context, owner, repo s // GetWorkflowUsageByFileName gets a specific workflow usage by file name in the unit of billable milliseconds. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-workflow-usage +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#get-workflow-usage func (s *ActionsService) GetWorkflowUsageByFileName(ctx context.Context, owner, repo, workflowFileName string) (*WorkflowUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/timing", owner, repo, workflowFileName) @@ -151,7 +151,7 @@ func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*Wor // CreateWorkflowDispatchEventByID manually triggers a GitHub Actions workflow run. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-workflow-dispatch-event +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowID) @@ -160,7 +160,7 @@ func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, ow // CreateWorkflowDispatchEventByFileName manually triggers a GitHub Actions workflow run. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-workflow-dispatch-event +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowFileName) @@ -178,7 +178,7 @@ func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url st // EnableWorkflowByID enables a workflow and sets the state of the workflow to "active". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#enable-a-workflow +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#enable-a-workflow func (s *ActionsService) EnableWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/enable", owner, repo, workflowID) return s.doNewPutRequest(ctx, u) @@ -186,7 +186,7 @@ func (s *ActionsService) EnableWorkflowByID(ctx context.Context, owner, repo str // EnableWorkflowByFileName enables a workflow and sets the state of the workflow to "active". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#enable-a-workflow +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#enable-a-workflow func (s *ActionsService) EnableWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/enable", owner, repo, workflowFileName) return s.doNewPutRequest(ctx, u) @@ -194,7 +194,7 @@ func (s *ActionsService) EnableWorkflowByFileName(ctx context.Context, owner, re // DisableWorkflowByID disables a workflow and sets the state of the workflow to "disabled_manually". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#disable-a-workflow +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#disable-a-workflow func (s *ActionsService) DisableWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/disable", owner, repo, workflowID) return s.doNewPutRequest(ctx, u) @@ -202,7 +202,7 @@ func (s *ActionsService) DisableWorkflowByID(ctx context.Context, owner, repo st // DisableWorkflowByFileName disables a workflow and sets the state of the workflow to "disabled_manually". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#disable-a-workflow +// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#disable-a-workflow func (s *ActionsService) DisableWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/disable", owner, repo, workflowFileName) return s.doNewPutRequest(ctx, u) diff --git a/github/activity.go b/github/activity.go index e683afb99b..f99ecfcdff 100644 --- a/github/activity.go +++ b/github/activity.go @@ -10,7 +10,7 @@ import "context" // ActivityService handles communication with the activity related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/ +// GitHub API docs: https://docs.github.com/en/rest/activity/ type ActivityService service // FeedLink represents a link to a related resource. diff --git a/github/activity_events.go b/github/activity_events.go index 19dc15cfe6..d6f0f043b0 100644 --- a/github/activity_events.go +++ b/github/activity_events.go @@ -12,7 +12,7 @@ import ( // ListEvents drinks from the firehose of all public events across GitHub. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-public-events +// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-public-events func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) { u, err := addOptions("events", opts) if err != nil { @@ -35,7 +35,7 @@ func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([] // ListRepositoryEvents lists events for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repository-events +// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-repository-events func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { u := fmt.Sprintf("repos/%v/%v/events", owner, repo) u, err := addOptions(u, opts) @@ -59,7 +59,7 @@ func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo // ListIssueEventsForRepository lists issue events for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issue-events-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/issues/events#list-issue-events-for-a-repository func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo) u, err := addOptions(u, opts) @@ -83,7 +83,7 @@ func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owne // ListEventsForRepoNetwork lists public events for a network of repositories. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-public-events-for-a-network-of-repositories +// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-public-events-for-a-network-of-repositories func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { u := fmt.Sprintf("networks/%v/%v/events", owner, repo) u, err := addOptions(u, opts) @@ -107,7 +107,7 @@ func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, r // ListEventsForOrganization lists public events for an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-public-organization-events +// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-public-organization-events func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) { u := fmt.Sprintf("orgs/%v/events", org) u, err := addOptions(u, opts) @@ -132,8 +132,8 @@ func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org str // ListEventsPerformedByUser lists the events performed by a user. If publicOnly is // true, only public events will be returned. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-events-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-public-events-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-events-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-public-events-for-a-user func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { var u string if publicOnly { @@ -163,8 +163,8 @@ func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user st // ListEventsReceivedByUser lists the events received by a user. If publicOnly is // true, only public events will be returned. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-events-received-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-public-events-received-by-a-user +// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-events-received-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-public-events-received-by-a-user func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { var u string if publicOnly { @@ -194,7 +194,7 @@ func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user str // ListUserEventsForOrganization provides the user’s organization dashboard. You // must be authenticated as the user to view this. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-organization-events-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-organization-events-for-the-authenticated-user func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) { u := fmt.Sprintf("users/%v/events/orgs/%v", user, org) u, err := addOptions(u, opts) diff --git a/github/activity_notifications.go b/github/activity_notifications.go index 009cc5e32a..38a3184536 100644 --- a/github/activity_notifications.go +++ b/github/activity_notifications.go @@ -19,7 +19,7 @@ type Notification struct { // Reason identifies the event that triggered the notification. // - // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity#notification-reasons + // GitHub API docs: https://docs.github.com/en/rest/activity#notification-reasons Reason *string `json:"reason,omitempty"` Unread *bool `json:"unread,omitempty"` @@ -49,7 +49,7 @@ type NotificationListOptions struct { // ListNotifications lists all notifications for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-notifications-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#list-notifications-for-the-authenticated-user func (s *ActivityService) ListNotifications(ctx context.Context, opts *NotificationListOptions) ([]*Notification, *Response, error) { u := "notifications" u, err := addOptions(u, opts) @@ -74,7 +74,7 @@ func (s *ActivityService) ListNotifications(ctx context.Context, opts *Notificat // ListRepositoryNotifications lists all notifications in a given repository // for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repository-notifications-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#list-repository-notifications-for-the-authenticated-user func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner, repo string, opts *NotificationListOptions) ([]*Notification, *Response, error) { u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo) u, err := addOptions(u, opts) @@ -102,7 +102,7 @@ type markReadOptions struct { // MarkNotificationsRead marks all notifications up to lastRead as read. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity#mark-as-read +// GitHub API docs: https://docs.github.com/en/rest/activity#mark-as-read func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead time.Time) (*Response, error) { opts := &markReadOptions{ LastReadAt: lastRead, @@ -118,7 +118,7 @@ func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead ti // MarkRepositoryNotificationsRead marks all notifications up to lastRead in // the specified repository as read. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#mark-repository-notifications-as-read +// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#mark-repository-notifications-as-read func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, owner, repo string, lastRead time.Time) (*Response, error) { opts := &markReadOptions{ LastReadAt: lastRead, @@ -134,7 +134,7 @@ func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, o // GetThread gets the specified notification thread. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#get-a-thread +// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#get-a-thread func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notification, *Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) @@ -154,7 +154,7 @@ func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notificati // MarkThreadRead marks the specified thread as read. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#mark-a-thread-as-read +// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#mark-a-thread-as-read func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) @@ -169,7 +169,7 @@ func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Respo // GetThreadSubscription checks to see if the authenticated user is subscribed // to a thread. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#get-a-thread-subscription-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#get-a-thread-subscription-for-the-authenticated-user func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) @@ -190,7 +190,7 @@ func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) // SetThreadSubscription sets the subscription for the specified thread for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#set-a-thread-subscription +// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#set-a-thread-subscription func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) @@ -211,7 +211,7 @@ func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, // DeleteThreadSubscription deletes the subscription for the specified thread // for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#delete-a-thread-subscription +// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#delete-a-thread-subscription func (s *ActivityService) DeleteThreadSubscription(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/activity_star.go b/github/activity_star.go index d17ea9c3f2..65a316f532 100644 --- a/github/activity_star.go +++ b/github/activity_star.go @@ -25,7 +25,7 @@ type Stargazer struct { // ListStargazers lists people who have starred the specified repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-stargazers +// GitHub API docs: https://docs.github.com/en/rest/activity/starring#list-stargazers func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Stargazer, *Response, error) { u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo) u, err := addOptions(u, opts) @@ -67,8 +67,8 @@ type ActivityListStarredOptions struct { // ListStarred lists all the repos starred by a user. Passing the empty string // will list the starred repositories for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repositories-starred-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repositories-starred-by-a-user +// GitHub API docs: https://docs.github.com/en/rest/activity/starring#list-repositories-starred-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/starring#list-repositories-starred-by-a-user func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) { var u string if user != "" { @@ -101,7 +101,7 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac // IsStarred checks if a repository is starred by authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#check-if-a-repository-is-starred-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/starring#check-if-a-repository-is-starred-by-the-authenticated-user func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bool, *Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -116,7 +116,7 @@ func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bo // Star a repository as the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#star-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/starring#star-a-repository-for-the-authenticated-user func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) req, err := s.client.NewRequest("PUT", u, nil) @@ -129,7 +129,7 @@ func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Respon // Unstar a repository as the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#unstar-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/starring#unstar-a-repository-for-the-authenticated-user func (s *ActivityService) Unstar(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/activity_watching.go b/github/activity_watching.go index 16cceb53e5..2d6fafcc79 100644 --- a/github/activity_watching.go +++ b/github/activity_watching.go @@ -27,7 +27,7 @@ type Subscription struct { // ListWatchers lists watchers of a particular repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-watchers +// GitHub API docs: https://docs.github.com/en/rest/activity/watching#list-watchers func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo) u, err := addOptions(u, opts) @@ -52,8 +52,8 @@ func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, // ListWatched lists the repositories the specified user is watching. Passing // the empty string will fetch watched repos for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repositories-watched-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repositories-watched-by-a-user +// GitHub API docs: https://docs.github.com/en/rest/activity/watching#list-repositories-watched-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/watching#list-repositories-watched-by-a-user func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *ListOptions) ([]*Repository, *Response, error) { var u string if user != "" { @@ -84,7 +84,7 @@ func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *Li // repository for the authenticated user. If the authenticated user is not // watching the repository, a nil Subscription is returned. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#get-a-repository-subscription +// GitHub API docs: https://docs.github.com/en/rest/activity/watching#get-a-repository-subscription func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *Response, error) { u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) @@ -111,7 +111,7 @@ func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, // To ignore notifications made within a repository, set subscription.Ignored to true. // To stop watching a repository, use DeleteRepositorySubscription. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#set-a-repository-subscription +// GitHub API docs: https://docs.github.com/en/rest/activity/watching#set-a-repository-subscription func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) { u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) @@ -135,7 +135,7 @@ func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, // This is used to stop watching a repository. To control whether or not to // receive notifications from a repository, use SetRepositorySubscription. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#delete-a-repository-subscription +// GitHub API docs: https://docs.github.com/en/rest/activity/watching#delete-a-repository-subscription func (s *ActivityService) DeleteRepositorySubscription(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/admin.go b/github/admin.go index 7bf0f22b13..1b28ef64c7 100644 --- a/github/admin.go +++ b/github/admin.go @@ -14,7 +14,7 @@ import ( // GitHub API. These API routes are normally only accessible for GitHub // Enterprise installations. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise/ +// GitHub API docs: https://docs.github.com/en/rest/enterprise-admin type AdminService service // TeamLDAPMapping represents the mapping between a GitHub team and an LDAP group. @@ -82,7 +82,7 @@ func (m Enterprise) String() string { // UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise/ldap/#update-ldap-mapping-for-a-user +// GitHub API docs: https://docs.github.com/en/enterprise-server/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { u := fmt.Sprintf("admin/ldap/users/%v/mapping", user) req, err := s.client.NewRequest("PATCH", u, mapping) @@ -101,7 +101,7 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m // UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise/ldap/#update-ldap-mapping-for-a-team +// GitHub API docs: https://docs.github.com/en/rest/enterprise/ldap/#update-ldap-mapping-for-a-team func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) { u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team) req, err := s.client.NewRequest("PATCH", u, mapping) diff --git a/github/admin_stats.go b/github/admin_stats.go index 0744ffa415..ef294f4479 100644 --- a/github/admin_stats.go +++ b/github/admin_stats.go @@ -153,7 +153,7 @@ func (s RepoStats) String() string { // Please note that this is only available to site administrators, // otherwise it will error with a 404 not found (instead of 401 or 403). // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise-admin/admin_stats/ +// GitHub API docs: https://docs.github.com/en/rest/enterprise-admin/admin_stats/ func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) { u := fmt.Sprintf("enterprise/stats/all") req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/admin_users_test.go b/github/admin_users_test.go index cd008c3753..354943d50a 100644 --- a/github/admin_users_test.go +++ b/github/admin_users_test.go @@ -90,7 +90,7 @@ func TestUserImpersonation_Create(t *testing.T) { "url": "https://git.company.com/api/v3/authorizations/1234", "app": { "name": "GitHub Site Administrator", - "url": "https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise/users/", + "url": "https://docs.github.com/en/rest/enterprise/users/", "client_id": "1234" }, "token": "1234", @@ -119,7 +119,7 @@ func TestUserImpersonation_Create(t *testing.T) { URL: String("https://git.company.com/api/v3/authorizations/1234"), App: &OAuthAPP{ Name: String("GitHub Site Administrator"), - URL: String("https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise/users/"), + URL: String("https://docs.github.com/en/rest/enterprise/users/"), ClientID: String("1234"), }, Token: String("1234"), diff --git a/github/apps.go b/github/apps.go index 3823a12196..dff9b210f2 100644 --- a/github/apps.go +++ b/github/apps.go @@ -14,7 +14,7 @@ import ( // AppsService provides access to the installation related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/ +// GitHub API docs: https://docs.github.com/en/rest/apps/ type AppsService service // App represents a GitHub App. @@ -59,8 +59,8 @@ type InstallationTokenOptions struct { // InstallationPermissions lists the repository and organization permissions for an installation. // // Permission names taken from: -// https://docs.github.com/en/enterprise-server@3.0/rest/reference/apps#create-an-installation-access-token-for-an-app -// https://docs.github.com/en/rest/reference/apps#create-an-installation-access-token-for-an-app +// https://docs.github.com/en/enterprise-server@3.0/rest/apps#create-an-installation-access-token-for-an-app +// https://docs.github.com/en/rest/apps#create-an-installation-access-token-for-an-app type InstallationPermissions struct { Actions *string `json:"actions,omitempty"` Administration *string `json:"administration,omitempty"` @@ -148,8 +148,8 @@ func (i Installation) String() string { // You can find this on the settings page for your GitHub App // (e.g., https://github.com/settings/apps/:app_slug). // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-the-authenticated-app -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-an-app +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-the-authenticated-app +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-an-app func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, error) { var u string if appSlug != "" { @@ -174,7 +174,7 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, // ListInstallations lists the installations that the current GitHub App has. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-installations-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#list-installations-for-the-authenticated-app func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) { u, err := addOptions("app/installations", opts) if err != nil { @@ -197,14 +197,14 @@ func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) // GetInstallation returns the specified installation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-an-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-an-installation-for-the-authenticated-app func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("app/installations/%v", id)) } // ListUserInstallations lists installations that are accessible to the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-app-installations-accessible-to-the-user-access-token +// GitHub API docs: https://docs.github.com/en/rest/apps/installations#list-app-installations-accessible-to-the-user-access-token func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) { u, err := addOptions("user/installations", opts) if err != nil { @@ -229,7 +229,7 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio // SuspendInstallation suspends the specified installation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#suspend-an-app-installation +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#suspend-an-app-installation func (s *AppsService) SuspendInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v/suspended", id) @@ -243,7 +243,7 @@ func (s *AppsService) SuspendInstallation(ctx context.Context, id int64) (*Respo // UnsuspendInstallation unsuspends the specified installation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#unsuspend-an-app-installation +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#unsuspend-an-app-installation func (s *AppsService) UnsuspendInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v/suspended", id) @@ -257,7 +257,7 @@ func (s *AppsService) UnsuspendInstallation(ctx context.Context, id int64) (*Res // DeleteInstallation deletes the specified installation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#delete-an-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#delete-an-installation-for-the-authenticated-app func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v", id) @@ -271,7 +271,7 @@ func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Respon // CreateInstallationToken creates a new installation token. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#create-an-installation-access-token-for-an-app +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opts *InstallationTokenOptions) (*InstallationToken, *Response, error) { u := fmt.Sprintf("app/installations/%v/access_tokens", id) @@ -291,7 +291,7 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opt // CreateAttachment creates a new attachment on user comment containing a url. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#create-a-content-attachment +// TODO: Find GitHub API docs. func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID int64, title, body string) (*Attachment, *Response, error) { u := fmt.Sprintf("content_references/%v/attachments", contentReferenceID) payload := &Attachment{Title: String(title), Body: String(body)} @@ -314,14 +314,14 @@ func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID i // FindOrganizationInstallation finds the organization's installation information. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-an-organization-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-an-organization-installation-for-the-authenticated-app func (s *AppsService) FindOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("orgs/%v/installation", org)) } // FindRepositoryInstallation finds the repository's installation information. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-a-repository-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("repos/%v/%v/installation", owner, repo)) } @@ -335,7 +335,7 @@ func (s *AppsService) FindRepositoryInstallationByID(ctx context.Context, id int // FindUserInstallation finds the user's installation information. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-a-user-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-a-user-installation-for-the-authenticated-app func (s *AppsService) FindUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("users/%v/installation", user)) } diff --git a/github/apps_hooks.go b/github/apps_hooks.go index ed8396f442..e3bd2afc03 100644 --- a/github/apps_hooks.go +++ b/github/apps_hooks.go @@ -12,7 +12,7 @@ import ( // GetHookConfig returns the webhook configuration for a GitHub App. // The underlying transport must be authenticated as an app. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#get-a-webhook-configuration-for-an-app +// GitHub API docs: https://docs.github.com/en/rest/apps#get-a-webhook-configuration-for-an-app func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response, error) { req, err := s.client.NewRequest("GET", "app/hook/config", nil) if err != nil { @@ -31,7 +31,7 @@ func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response // UpdateHookConfig updates the webhook configuration for a GitHub App. // The underlying transport must be authenticated as an app. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#update-a-webhook-configuration-for-an-app +// GitHub API docs: https://docs.github.com/en/rest/apps#update-a-webhook-configuration-for-an-app func (s *AppsService) UpdateHookConfig(ctx context.Context, config *HookConfig) (*HookConfig, *Response, error) { req, err := s.client.NewRequest("PATCH", "app/hook/config", config) if err != nil { diff --git a/github/apps_hooks_deliveries.go b/github/apps_hooks_deliveries.go index 0b631b80e8..33102f36d2 100644 --- a/github/apps_hooks_deliveries.go +++ b/github/apps_hooks_deliveries.go @@ -12,7 +12,7 @@ import ( // ListHookDeliveries lists deliveries of an App webhook. // -// GitHub API docs: https://docs.github.com/en/rest/reference/apps#list-deliveries-for-an-app-webhook +// GitHub API docs: https://docs.github.com/en/rest/apps/webhooks#list-deliveries-for-an-app-webhook func (s *AppsService) ListHookDeliveries(ctx context.Context, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { u, err := addOptions("app/hook/deliveries", opts) if err != nil { @@ -35,7 +35,7 @@ func (s *AppsService) ListHookDeliveries(ctx context.Context, opts *ListCursorOp // GetHookDelivery returns the App webhook delivery with the specified ID. // -// GitHub API docs: https://docs.github.com/en/rest/reference/apps#get-a-delivery-for-an-app-webhook +// GitHub API docs: https://docs.github.com/en/rest/apps/webhooks#get-a-delivery-for-an-app-webhook func (s *AppsService) GetHookDelivery(ctx context.Context, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("app/hook/deliveries/%v", deliveryID) req, err := s.client.NewRequest("GET", u, nil) @@ -54,7 +54,7 @@ func (s *AppsService) GetHookDelivery(ctx context.Context, deliveryID int64) (*H // RedeliverHookDelivery redelivers a delivery for an App webhook. // -// GitHub API docs: https://docs.github.com/en/rest/reference/apps#redeliver-a-delivery-for-an-app-webhook +// GitHub API docs: https://docs.github.com/en/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook func (s *AppsService) RedeliverHookDelivery(ctx context.Context, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("app/hook/deliveries/%v/attempts", deliveryID) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/apps_installation.go b/github/apps_installation.go index 521860d6eb..b619080713 100644 --- a/github/apps_installation.go +++ b/github/apps_installation.go @@ -19,7 +19,7 @@ type ListRepositories struct { // ListRepos lists the repositories that are accessible to the authenticated installation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-repositories-accessible-to-the-app-installation +// GitHub API docs: https://docs.github.com/en/rest/apps/installations#list-repositories-accessible-to-the-app-installation func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRepositories, *Response, error) { u, err := addOptions("installation/repositories", opts) if err != nil { @@ -52,7 +52,7 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe // ListUserRepos lists repositories that are accessible // to the authenticated user for an installation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-repositories-accessible-to-the-user-access-token +// GitHub API docs: https://docs.github.com/en/rest/apps/installations#list-repositories-accessible-to-the-user-access-token func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOptions) (*ListRepositories, *Response, error) { u := fmt.Sprintf("user/installations/%v/repositories", id) u, err := addOptions(u, opts) @@ -84,7 +84,7 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt // AddRepository adds a single repository to an installation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#add-a-repository-to-an-app-installation +// GitHub API docs: https://docs.github.com/en/rest/apps/installations#add-a-repository-to-an-app-installation func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*Repository, *Response, error) { u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID) req, err := s.client.NewRequest("PUT", u, nil) @@ -103,7 +103,7 @@ func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) ( // RemoveRepository removes a single repository from an installation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#remove-a-repository-from-an-app-installation +// GitHub API docs: https://docs.github.com/en/rest/apps/installations#remove-a-repository-from-an-app-installation func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*Response, error) { u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -116,7 +116,7 @@ func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64 // RevokeInstallationToken revokes an installation token. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#revoke-an-installation-access-token +// GitHub API docs: https://docs.github.com/en/rest/apps/installations#revoke-an-installation-access-token func (s *AppsService) RevokeInstallationToken(ctx context.Context) (*Response, error) { u := "installation/token" req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/apps_manifest.go b/github/apps_manifest.go index 164f493999..fa4c85379c 100644 --- a/github/apps_manifest.go +++ b/github/apps_manifest.go @@ -31,7 +31,7 @@ type AppConfig struct { // CompleteAppManifest completes the App manifest handshake flow for the given // code. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#create-a-github-app-from-a-manifest +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#create-a-github-app-from-a-manifest func (s *AppsService) CompleteAppManifest(ctx context.Context, code string) (*AppConfig, *Response, error) { u := fmt.Sprintf("app-manifests/%s/conversions", code) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index 13d09f2efb..8253013684 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -13,7 +13,7 @@ import ( // MarketplaceService handles communication with the marketplace related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#marketplace +// GitHub API docs: https://docs.github.com/en/rest/apps#marketplace type MarketplaceService struct { client *Client // Stubbed controls whether endpoints that return stubbed data are used @@ -21,7 +21,7 @@ type MarketplaceService struct { // for testing your GitHub Apps. Stubbed data is hard-coded and will not // change based on actual subscriptions. // - // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#testing-with-stubbed-endpoints + // GitHub API docs: https://docs.github.com/en/rest/apps#testing-with-stubbed-endpoints Stubbed bool } @@ -77,7 +77,7 @@ type MarketplacePlanAccount struct { // ListPlans lists all plans for your Marketplace listing. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#list-plans +// GitHub API docs: https://docs.github.com/en/rest/apps#list-plans func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) ([]*MarketplacePlan, *Response, error) { uri := s.marketplaceURI("plans") u, err := addOptions(uri, opts) @@ -101,7 +101,7 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) ( // ListPlanAccountsForPlan lists all GitHub accounts (user or organization) on a specific plan. // -// GitHub API docs: https://docs.github.com/en/rest/reference/apps#list-accounts-for-a-plan +// GitHub API docs: https://docs.github.com/en/rest/apps#list-accounts-for-a-plan func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID int64, opts *ListOptions) ([]*MarketplacePlanAccount, *Response, error) { uri := s.marketplaceURI(fmt.Sprintf("plans/%v/accounts", planID)) u, err := addOptions(uri, opts) @@ -125,7 +125,7 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID // GetPlanAccountForAccount get GitHub account (user or organization) associated with an account. // -// GitHub API docs: https://docs.github.com/en/rest/reference/apps#get-a-subscription-plan-for-an-account +// GitHub API docs: https://docs.github.com/en/rest/apps#get-a-subscription-plan-for-an-account func (s *MarketplaceService) GetPlanAccountForAccount(ctx context.Context, accountID int64) (*MarketplacePlanAccount, *Response, error) { uri := s.marketplaceURI(fmt.Sprintf("accounts/%v", accountID)) @@ -145,8 +145,8 @@ func (s *MarketplaceService) GetPlanAccountForAccount(ctx context.Context, accou // ListMarketplacePurchasesForUser lists all GitHub marketplace purchases made by a user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-subscriptions-for-the-authenticated-user-stubbed -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-subscriptions-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user-stubbed +// GitHub API docs: https://docs.github.com/en/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context, opts *ListOptions) ([]*MarketplacePurchase, *Response, error) { uri := "user/marketplace_purchases" if s.Stubbed { diff --git a/github/authorizations.go b/github/authorizations.go index 76a14c3db1..ea0897e362 100644 --- a/github/authorizations.go +++ b/github/authorizations.go @@ -12,7 +12,7 @@ import ( // Scope models a GitHub authorization scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/oauth/#scopes +// GitHub API docs: https://docs.github.com/en/rest/oauth/#scopes type Scope string // This is the set of scopes for GitHub API V3 @@ -50,7 +50,7 @@ const ( // This service requires HTTP Basic Authentication; it cannot be accessed using // an OAuth token. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/oauth_authorizations/ +// GitHub API docs: https://docs.github.com/en/rest/oauth-authorizations type AuthorizationsService service // Authorization represents an individual GitHub authorization. @@ -121,7 +121,7 @@ func (a AuthorizationRequest) String() string { // fields. That is, you may provide only one of "Scopes", or "AddScopes", or // "RemoveScopes". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/oauth_authorizations/#update-an-existing-authorization +// GitHub API docs: https://docs.github.com/en/rest/oauth-authorizations#update-an-existing-authorization type AuthorizationUpdateRequest struct { Scopes []string `json:"scopes,omitempty"` AddScopes []string `json:"add_scopes,omitempty"` @@ -143,7 +143,7 @@ func (a AuthorizationUpdateRequest) String() string { // // The returned Authorization.User field will be populated. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#check-a-token +// GitHub API docs: https://docs.github.com/en/rest/apps/oauth-applications#check-a-token func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) { u := fmt.Sprintf("applications/%v/token", clientID) @@ -176,7 +176,7 @@ func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken // // The returned Authorization.User field will be populated. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#reset-a-token +// GitHub API docs: https://docs.github.com/en/rest/apps/oauth-applications#reset-a-token func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) { u := fmt.Sprintf("applications/%v/token", clientID) @@ -205,7 +205,7 @@ func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken // username is the OAuth application clientID, and the password is its // clientSecret. Invalid tokens will return a 404 Not Found. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#delete-an-app-token +// GitHub API docs: https://docs.github.com/en/rest/apps/oauth-applications#delete-an-app-token func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToken string) (*Response, error) { u := fmt.Sprintf("applications/%v/token", clientID) @@ -226,7 +226,7 @@ func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToke // grant will also delete all OAuth tokens associated with the application for // the user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#delete-an-app-authorization +// GitHub API docs: https://docs.github.com/en/rest/apps/oauth-applications#delete-an-app-authorization func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, accessToken string) (*Response, error) { u := fmt.Sprintf("applications/%v/grant", clientID) diff --git a/github/billing.go b/github/billing.go index dea4677beb..d516cd0c29 100644 --- a/github/billing.go +++ b/github/billing.go @@ -13,7 +13,7 @@ import ( // BillingService provides access to the billing related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/reference/billing +// GitHub API docs: https://docs.github.com/en/rest/billing type BillingService service // ActionBilling represents a GitHub Action billing. @@ -65,7 +65,7 @@ type AdvancedSecurityCommittersBreakdown struct { // GetActionsBillingOrg returns the summary of the free and paid GitHub Actions minutes used for an Org. // -// GitHub API docs: https://docs.github.com/en/rest/reference/billing#get-github-actions-billing-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/billing#get-github-actions-billing-for-an-organization func (s *BillingService) GetActionsBillingOrg(ctx context.Context, org string) (*ActionBilling, *Response, error) { u := fmt.Sprintf("orgs/%v/settings/billing/actions", org) req, err := s.client.NewRequest("GET", u, nil) @@ -84,7 +84,7 @@ func (s *BillingService) GetActionsBillingOrg(ctx context.Context, org string) ( // GetPackagesBillingOrg returns the free and paid storage used for GitHub Packages in gigabytes for an Org. // -// GitHub API docs: https://docs.github.com/en/rest/reference/billing#get-github-packages-billing-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/billing#get-github-packages-billing-for-an-organization func (s *BillingService) GetPackagesBillingOrg(ctx context.Context, org string) (*PackageBilling, *Response, error) { u := fmt.Sprintf("orgs/%v/settings/billing/packages", org) req, err := s.client.NewRequest("GET", u, nil) @@ -104,7 +104,7 @@ func (s *BillingService) GetPackagesBillingOrg(ctx context.Context, org string) // GetStorageBillingOrg returns the estimated paid and estimated total storage used for GitHub Actions // and GitHub Packages in gigabytes for an Org. // -// GitHub API docs: https://docs.github.com/en/rest/reference/billing#get-shared-storage-billing-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/billing#get-shared-storage-billing-for-an-organization func (s *BillingService) GetStorageBillingOrg(ctx context.Context, org string) (*StorageBilling, *Response, error) { u := fmt.Sprintf("orgs/%v/settings/billing/shared-storage", org) req, err := s.client.NewRequest("GET", u, nil) @@ -123,7 +123,7 @@ func (s *BillingService) GetStorageBillingOrg(ctx context.Context, org string) ( // GetAdvancedSecurityActiveCommittersOrg returns the GitHub Advanced Security active committers for an organization per repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/billing#get-github-advanced-security-active-committers-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/billing#get-github-advanced-security-active-committers-for-an-organization func (s *BillingService) GetAdvancedSecurityActiveCommittersOrg(ctx context.Context, org string) (*ActiveCommitters, *Response, error) { u := fmt.Sprintf("orgs/%v/settings/billing/advanced-security", org) req, err := s.client.NewRequest("GET", u, nil) @@ -142,7 +142,7 @@ func (s *BillingService) GetAdvancedSecurityActiveCommittersOrg(ctx context.Cont // GetActionsBillingUser returns the summary of the free and paid GitHub Actions minutes used for a user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/billing#get-github-actions-billing-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/billing#get-github-actions-billing-for-a-user func (s *BillingService) GetActionsBillingUser(ctx context.Context, user string) (*ActionBilling, *Response, error) { u := fmt.Sprintf("users/%v/settings/billing/actions", user) req, err := s.client.NewRequest("GET", u, nil) @@ -161,7 +161,7 @@ func (s *BillingService) GetActionsBillingUser(ctx context.Context, user string) // GetPackagesBillingUser returns the free and paid storage used for GitHub Packages in gigabytes for a user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/billing#get-github-packages-billing-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/billing#get-github-packages-billing-for-a-user func (s *BillingService) GetPackagesBillingUser(ctx context.Context, user string) (*PackageBilling, *Response, error) { u := fmt.Sprintf("users/%v/settings/billing/packages", user) req, err := s.client.NewRequest("GET", u, nil) @@ -181,7 +181,7 @@ func (s *BillingService) GetPackagesBillingUser(ctx context.Context, user string // GetStorageBillingUser returns the estimated paid and estimated total storage used for GitHub Actions // and GitHub Packages in gigabytes for a user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/billing#get-shared-storage-billing-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/billing#get-shared-storage-billing-for-a-user func (s *BillingService) GetStorageBillingUser(ctx context.Context, user string) (*StorageBilling, *Response, error) { u := fmt.Sprintf("users/%v/settings/billing/shared-storage", user) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/checks.go b/github/checks.go index b4819fc945..12d08530ca 100644 --- a/github/checks.go +++ b/github/checks.go @@ -13,7 +13,7 @@ import ( // ChecksService provides access to the Checks API in the // GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/ +// GitHub API docs: https://docs.github.com/en/rest/checks/ type ChecksService service // CheckRun represents a GitHub check run on a repository associated with a GitHub app. @@ -98,7 +98,7 @@ func (c CheckSuite) String() string { // GetCheckRun gets a check-run for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#get-a-check-run +// GitHub API docs: https://docs.github.com/en/rest/checks/runs#get-a-check-run func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) req, err := s.client.NewRequest("GET", u, nil) @@ -119,7 +119,7 @@ func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, che // GetCheckSuite gets a single check suite. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#get-a-check-suite +// GitHub API docs: https://docs.github.com/en/rest/checks/suites#get-a-check-suite func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*CheckSuite, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/%v", owner, repo, checkSuiteID) req, err := s.client.NewRequest("GET", u, nil) @@ -161,7 +161,7 @@ type CheckRunAction struct { // CreateCheckRun creates a check run for repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#create-a-check-run +// GitHub API docs: https://docs.github.com/en/rest/checks/runs#create-a-check-run func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opts CreateCheckRunOptions) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo) req, err := s.client.NewRequest("POST", u, opts) @@ -194,7 +194,7 @@ type UpdateCheckRunOptions struct { // UpdateCheckRun updates a check run for a specific commit in a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#update-a-check-run +// GitHub API docs: https://docs.github.com/en/rest/checks/runs#update-a-check-run func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opts UpdateCheckRunOptions) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) req, err := s.client.NewRequest("PATCH", u, opts) @@ -215,7 +215,7 @@ func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, // ListCheckRunAnnotations lists the annotations for a check run. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#list-check-run-annotations +// GitHub API docs: https://docs.github.com/en/rest/checks/runs#list-check-run-annotations func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo string, checkRunID int64, opts *ListOptions) ([]*CheckRunAnnotation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v/annotations", owner, repo, checkRunID) u, err := addOptions(u, opts) @@ -257,7 +257,7 @@ type ListCheckRunsResults struct { // ListCheckRunsForRef lists check runs for a specific ref. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#list-check-runs-for-a-git-reference +// GitHub API docs: https://docs.github.com/en/rest/checks/runs#list-check-runs-for-a-git-reference func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/check-runs", owner, repo, refURLEscape(ref)) u, err := addOptions(u, opts) @@ -283,7 +283,7 @@ func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, re // ListCheckRunsCheckSuite lists check runs for a check suite. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#list-check-runs-in-a-check-suite +// GitHub API docs: https://docs.github.com/en/rest/checks/runs#list-check-runs-in-a-check-suite func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/%v/check-runs", owner, repo, checkSuiteID) u, err := addOptions(u, opts) @@ -339,7 +339,7 @@ type ListCheckSuiteResults struct { // ListCheckSuitesForRef lists check suite for a specific ref. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#list-check-suites-for-a-git-reference +// GitHub API docs: https://docs.github.com/en/rest/checks/suites#list-check-suites-for-a-git-reference func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckSuiteOptions) (*ListCheckSuiteResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/check-suites", owner, repo, refURLEscape(ref)) u, err := addOptions(u, opts) @@ -387,7 +387,7 @@ type PreferenceList struct { // SetCheckSuitePreferences changes the default automatic flow when creating check suites. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#update-repository-preferences-for-check-suites +// GitHub API docs: https://docs.github.com/en/rest/checks/suites#update-repository-preferences-for-check-suites func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opts CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo) req, err := s.client.NewRequest("PATCH", u, opts) @@ -414,7 +414,7 @@ type CreateCheckSuiteOptions struct { // CreateCheckSuite manually creates a check suite for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#create-a-check-suite +// GitHub API docs: https://docs.github.com/en/rest/checks/suites#create-a-check-suite func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opts CreateCheckSuiteOptions) (*CheckSuite, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo) req, err := s.client.NewRequest("POST", u, opts) @@ -435,7 +435,7 @@ func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string // ReRequestCheckSuite triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#rerequest-a-check-suite +// GitHub API docs: https://docs.github.com/en/rest/checks/suites#rerequest-a-check-suite func (s *ChecksService) ReRequestCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/%v/rerequest", owner, repo, checkSuiteID) diff --git a/github/code-scanning.go b/github/code-scanning.go index 48d7295230..df8ed86b51 100644 --- a/github/code-scanning.go +++ b/github/code-scanning.go @@ -15,7 +15,7 @@ import ( // CodeScanningService handles communication with the code scanning related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/code-scanning/ +// GitHub API docs: https://docs.github.com/en/rest/code-scanning type CodeScanningService service // Rule represents the complete details of GitHub Code Scanning alert type. @@ -65,7 +65,7 @@ type Tool struct { // Alert represents an individual GitHub Code Scanning Alert on a single repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/code-scanning#list-code-scanning-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/code-scanning type Alert struct { Number *int `json:"number,omitempty"` Repository *Repository `json:"repository,omitempty"` @@ -137,7 +137,7 @@ type AnalysesListOptions struct { // ScanningAnalysis represents an individual GitHub Code Scanning ScanningAnalysis on a single repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/code-scanning#list-code-scanning-analyses-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/code-scanning type ScanningAnalysis struct { ID *int64 `json:"id,omitempty"` Ref *string `json:"ref,omitempty"` @@ -158,7 +158,7 @@ type ScanningAnalysis struct { // SarifAnalysis specifies the results of a code scanning job. // -// GitHub API docs: https://docs.github.com/en/rest/reference/code-scanning#upload-an-analysis-as-sarif-data +// GitHub API docs: https://docs.github.com/en/rest/code-scanning type SarifAnalysis struct { CommitSHA *string `json:"commit_sha,omitempty"` Ref *string `json:"ref,omitempty"` @@ -170,7 +170,7 @@ type SarifAnalysis struct { // SarifID identifies a sarif analysis upload. // -// GitHub API docs: https://docs.github.com/en/rest/reference/code-scanning#upload-an-analysis-as-sarif-data +// GitHub API docs: https://docs.github.com/en/rest/code-scanning type SarifID struct { ID *string `json:"id,omitempty"` URL *string `json:"url,omitempty"` @@ -209,7 +209,7 @@ func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/code-scanning/#list-code-scanning-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/code-scanning#list-code-scanning-alerts-for-a-repository func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *AlertListOptions) ([]*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts", owner, repo) u, err := addOptions(u, opts) @@ -238,7 +238,7 @@ func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo // // The security alert_id is the number at the end of the security alert's URL. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/code-scanning/#get-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/en/rest/code-scanning#get-a-code-scanning-alert func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, id int64) (*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id) @@ -262,7 +262,7 @@ func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/reference/code-scanning#upload-an-analysis-as-sarif-data +// GitHub API docs: https://docs.github.com/en/rest/code-scanning#upload-an-analysis-as-sarif-data func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo string, sarif *SarifAnalysis) (*SarifID, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs", owner, repo) @@ -286,7 +286,7 @@ func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo strin // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/reference/code-scanning#list-code-scanning-analyses-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/code-scanning#list-code-scanning-analyses-for-a-repository func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, repo string, opts *AnalysesListOptions) ([]*ScanningAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses", owner, repo) u, err := addOptions(u, opts) @@ -315,7 +315,7 @@ func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, re // // The security analysis_id is the ID of the analysis, as returned from the ListAnalysesForRepo operation. // -// GitHub API docs: https://docs.github.com/en/rest/reference/code-scanning#get-a-code-scanning-analysis-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/code-scanning#get-a-code-scanning-analysis-for-a-repository func (s *CodeScanningService) GetAnalysis(ctx context.Context, owner, repo string, id int64) (*ScanningAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses/%v", owner, repo, id) diff --git a/github/dependabot.go b/github/dependabot.go index 8ee0c0c7d8..07e68b506a 100644 --- a/github/dependabot.go +++ b/github/dependabot.go @@ -8,5 +8,5 @@ package github // DependabotService handles communication with the Dependabot related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/dependabot/ +// GitHub API docs: https://docs.github.com/en/rest/dependabot/ type DependabotService service diff --git a/github/dependabot_secrets.go b/github/dependabot_secrets.go index a6645339cc..f51f3396bd 100644 --- a/github/dependabot_secrets.go +++ b/github/dependabot_secrets.go @@ -27,7 +27,7 @@ func (s *DependabotService) getPublicKey(ctx context.Context, url string) (*Publ // GetRepoPublicKey gets a public key that should be used for Dependabot secret encryption. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#get-a-repository-public-key +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#get-a-repository-public-key func (s *DependabotService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/public-key", owner, repo) return s.getPublicKey(ctx, url) @@ -35,7 +35,7 @@ func (s *DependabotService) GetRepoPublicKey(ctx context.Context, owner, repo st // GetOrgPublicKey gets a public key that should be used for Dependabot secret encryption. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#get-an-organization-public-key +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#get-an-organization-public-key func (s *DependabotService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/public-key", org) return s.getPublicKey(ctx, url) @@ -64,7 +64,7 @@ func (s *DependabotService) listSecrets(ctx context.Context, url string, opts *L // ListRepoSecrets lists all Dependabot secrets available in a repository // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#list-repository-secrets +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#list-repository-secrets func (s *DependabotService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/secrets", owner, repo) return s.listSecrets(ctx, url, opts) @@ -73,7 +73,7 @@ func (s *DependabotService) ListRepoSecrets(ctx context.Context, owner, repo str // ListOrgSecrets lists all Dependabot secrets available in an organization // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#list-organization-secrets +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#list-organization-secrets func (s *DependabotService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets", org) return s.listSecrets(ctx, url, opts) @@ -96,7 +96,7 @@ func (s *DependabotService) getSecret(ctx context.Context, url string) (*Secret, // GetRepoSecret gets a single repository Dependabot secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#get-a-repository-secret +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#get-a-repository-secret func (s *DependabotService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, name) return s.getSecret(ctx, url) @@ -104,7 +104,7 @@ func (s *DependabotService) GetRepoSecret(ctx context.Context, owner, repo, name // GetOrgSecret gets a single organization Dependabot secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#get-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#get-an-organization-secret func (s *DependabotService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, name) return s.getSecret(ctx, url) @@ -121,7 +121,7 @@ func (s *DependabotService) putSecret(ctx context.Context, url string, eSecret * // CreateOrUpdateRepoSecret creates or updates a repository Dependabot secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#create-or-update-a-repository-secret +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#create-or-update-a-repository-secret func (s *DependabotService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, eSecret.Name) return s.putSecret(ctx, url, eSecret) @@ -129,7 +129,7 @@ func (s *DependabotService) CreateOrUpdateRepoSecret(ctx context.Context, owner, // CreateOrUpdateOrgSecret creates or updates an organization Dependabot secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#create-or-update-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#create-or-update-an-organization-secret func (s *DependabotService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, eSecret.Name) return s.putSecret(ctx, url, eSecret) @@ -146,7 +146,7 @@ func (s *DependabotService) deleteSecret(ctx context.Context, url string) (*Resp // DeleteRepoSecret deletes a Dependabot secret in a repository using the secret name. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#delete-a-repository-secret +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#delete-a-repository-secret func (s *DependabotService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, name) return s.deleteSecret(ctx, url) @@ -154,7 +154,7 @@ func (s *DependabotService) DeleteRepoSecret(ctx context.Context, owner, repo, n // DeleteOrgSecret deletes a Dependabot secret in an organization using the secret name. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#delete-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#delete-an-organization-secret func (s *DependabotService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, name) return s.deleteSecret(ctx, url) @@ -162,7 +162,7 @@ func (s *DependabotService) DeleteOrgSecret(ctx context.Context, org, name strin // ListSelectedReposForOrgSecret lists all repositories that have access to a Dependabot secret. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#list-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#list-selected-repositories-for-an-organization-secret func (s *DependabotService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories", org, name) u, err := addOptions(url, opts) @@ -186,7 +186,7 @@ func (s *DependabotService) ListSelectedReposForOrgSecret(ctx context.Context, o // SetSelectedReposForOrgSecret sets the repositories that have access to a Dependabot secret. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#set-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#set-selected-repositories-for-an-organization-secret func (s *DependabotService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories", org, name) type repoIDs struct { @@ -203,7 +203,7 @@ func (s *DependabotService) SetSelectedReposForOrgSecret(ctx context.Context, or // AddSelectedRepoToOrgSecret adds a repository to an organization Dependabot secret. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#add-selected-repository-to-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#add-selected-repository-to-an-organization-secret func (s *DependabotService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, *repo.ID) req, err := s.client.NewRequest("PUT", url, nil) @@ -216,7 +216,7 @@ func (s *DependabotService) AddSelectedRepoToOrgSecret(ctx context.Context, org, // RemoveSelectedRepoFromOrgSecret removes a repository from an organization Dependabot secret. // -// GitHub API docs: https://docs.github.com/en/rest/reference/dependabot#remove-selected-repository-from-an-organization-secret +// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#remove-selected-repository-from-an-organization-secret func (s *DependabotService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, *repo.ID) req, err := s.client.NewRequest("DELETE", url, nil) diff --git a/github/doc.go b/github/doc.go index e91d708108..49991e2f56 100644 --- a/github/doc.go +++ b/github/doc.go @@ -29,7 +29,7 @@ Some API methods have optional parameters that can be passed. For example: The services of a client divide the API into logical chunks and correspond to the structure of the GitHub API documentation at -https://docs.github.com/en/free-pro-team@latest/rest/reference/. +https://docs.github.com/en/rest . NOTE: Using the https://godoc.org/context package, one can easily pass cancelation signals and deadlines to various services of the client for @@ -137,7 +137,7 @@ For secondary rate limits, you can check if its type is *github.AbuseRateLimitEr } Learn more about GitHub rate limiting at -https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#rate-limiting. +https://docs.github.com/en/rest/rate-limit . Accepted Status @@ -163,7 +163,7 @@ instead designed to work with a caching http.Transport. We recommend using https://github.com/gregjones/httpcache for that. Learn more about GitHub conditional requests at -https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#conditional-requests. +https://docs.github.com/en/rest/overview/resources-in-the-rest-api#conditional-requests. Creating and Updating Resources diff --git a/github/enterprise.go b/github/enterprise.go index f6a5af8390..1c9b069566 100644 --- a/github/enterprise.go +++ b/github/enterprise.go @@ -8,5 +8,5 @@ package github // EnterpriseService provides access to the enterprise related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise-admin/ +// GitHub API docs: https://docs.github.com/en/rest/enterprise-admin/ type EnterpriseService service diff --git a/github/enterprise_actions_runners.go b/github/enterprise_actions_runners.go index d2758fe838..f2ba166360 100644 --- a/github/enterprise_actions_runners.go +++ b/github/enterprise_actions_runners.go @@ -12,7 +12,7 @@ import ( // CreateRegistrationToken creates a token that can be used to add a self-hosted runner. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise-admin/#create-a-registration-token-for-an-enterprise +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-registration-token-for-an-enterprise func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterprise string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/registration-token", enterprise) @@ -32,7 +32,7 @@ func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterpr // ListRunners lists all the self-hosted runners for a enterprise. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise-admin/#list-self-hosted-runners-for-an-enterprise +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-enterprise func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, opts *ListOptions) (*Runners, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners", enterprise) u, err := addOptions(u, opts) @@ -56,7 +56,7 @@ func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, // RemoveRunner forces the removal of a self-hosted runner from an enterprise using the runner id. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise-admin/#delete-a-self-hosted-runner-from-an-enterprise +// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-enterprise func (s *EnterpriseService) RemoveRunner(ctx context.Context, enterprise string, runnerID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/%v", enterprise, runnerID) diff --git a/github/enterprise_audit_log.go b/github/enterprise_audit_log.go index b889a7e570..4064867338 100644 --- a/github/enterprise_audit_log.go +++ b/github/enterprise_audit_log.go @@ -12,7 +12,7 @@ import ( // GetAuditLog gets the audit-log entries for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/enterprise-admin#get-the-audit-log-for-an-enterprise +// GitHub API docs: https://docs.github.com/en/rest/enterprise-admin/audit-log#get-the-audit-log-for-an-enterprise func (s *EnterpriseService) GetAuditLog(ctx context.Context, enterprise string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) { u := fmt.Sprintf("enterprises/%v/audit-log", enterprise) u, err := addOptions(u, opts) diff --git a/github/event_types.go b/github/event_types.go index 7ce312d210..c80a835f6b 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -853,7 +853,7 @@ type PullRequestReviewThreadEvent struct { // locked, unlocked, a pull request review is requested, or a review request is removed. // The Webhook event name is "pull_request_target". // -// GitHub API docs: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target +// GitHub API docs: https://docs.github.com/en/actions/events-that-trigger-workflows#pull_request_target type PullRequestTargetEvent struct { // Action is the action that was performed. Possible values are: // "assigned", "unassigned", "labeled", "unlabeled", "opened", "edited", "closed", "reopened", diff --git a/github/gists.go b/github/gists.go index 40a4aaf581..ecdc6f2726 100644 --- a/github/gists.go +++ b/github/gists.go @@ -14,7 +14,7 @@ import ( // GistsService handles communication with the Gist related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/ +// GitHub API docs: https://docs.github.com/en/rest/gists type GistsService service // Gist represents a GitHub's gist. @@ -96,8 +96,8 @@ type GistListOptions struct { // is authenticated, it will returns all gists for the authenticated // user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-gists-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-gists-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-gists-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-gists-for-a-user func (s *GistsService) List(ctx context.Context, user string, opts *GistListOptions) ([]*Gist, *Response, error) { var u string if user != "" { @@ -126,7 +126,7 @@ func (s *GistsService) List(ctx context.Context, user string, opts *GistListOpti // ListAll lists all public gists. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-public-gists +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-public-gists func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) { u, err := addOptions("gists/public", opts) if err != nil { @@ -149,7 +149,7 @@ func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*G // ListStarred lists starred gists of authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-starred-gists +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-starred-gists func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) { u, err := addOptions("gists/starred", opts) if err != nil { @@ -172,7 +172,7 @@ func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ( // Get a single gist. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#get-a-gist +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#get-a-gist func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -191,7 +191,7 @@ func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, er // GetRevision gets a specific revision of a gist. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#get-a-gist-revision +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#get-a-gist-revision func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v/%v", id, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -210,7 +210,7 @@ func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, // Create a gist for authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#create-a-gist +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#create-a-gist func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response, error) { u := "gists" req, err := s.client.NewRequest("POST", u, gist) @@ -229,7 +229,7 @@ func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response // Edit a gist. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#update-a-gist +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#update-a-gist func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v", id) req, err := s.client.NewRequest("PATCH", u, gist) @@ -248,7 +248,7 @@ func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, // ListCommits lists commits of a gist. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-gist-commits +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-gist-commits func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOptions) ([]*GistCommit, *Response, error) { u := fmt.Sprintf("gists/%v/commits", id) u, err := addOptions(u, opts) @@ -272,7 +272,7 @@ func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOpt // Delete a gist. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#delete-a-gist +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#delete-a-gist func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -285,7 +285,7 @@ func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error) // Star a gist on behalf of authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#star-a-gist +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#star-a-gist func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v/star", id) req, err := s.client.NewRequest("PUT", u, nil) @@ -298,7 +298,7 @@ func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) { // Unstar a gist on a behalf of authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#unstar-a-gist +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#unstar-a-gist func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v/star", id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -311,7 +311,7 @@ func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error) // IsStarred checks if a gist is starred by authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#check-if-a-gist-is-starred +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#check-if-a-gist-is-starred func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Response, error) { u := fmt.Sprintf("gists/%v/star", id) req, err := s.client.NewRequest("GET", u, nil) @@ -326,7 +326,7 @@ func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Respons // Fork a gist. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#fork-a-gist +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#fork-a-gist func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v/forks", id) req, err := s.client.NewRequest("POST", u, nil) @@ -345,7 +345,7 @@ func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, e // ListForks lists forks of a gist. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-gist-forks +// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-gist-forks func (s *GistsService) ListForks(ctx context.Context, id string, opts *ListOptions) ([]*GistFork, *Response, error) { u := fmt.Sprintf("gists/%v/forks", id) u, err := addOptions(u, opts) diff --git a/github/gists_comments.go b/github/gists_comments.go index a9452c9641..d551e9a11d 100644 --- a/github/gists_comments.go +++ b/github/gists_comments.go @@ -26,7 +26,7 @@ func (g GistComment) String() string { // ListComments lists all comments for a gist. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-gist-comments +// GitHub API docs: https://docs.github.com/en/rest/gists/comments#list-gist-comments func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *ListOptions) ([]*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments", gistID) u, err := addOptions(u, opts) @@ -50,7 +50,7 @@ func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *Li // GetComment retrieves a single comment from a gist. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#get-a-gist-comment +// GitHub API docs: https://docs.github.com/en/rest/gists/comments#get-a-gist-comment func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int64) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) req, err := s.client.NewRequest("GET", u, nil) @@ -69,7 +69,7 @@ func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID // CreateComment creates a comment for a gist. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#create-a-gist-comment +// GitHub API docs: https://docs.github.com/en/rest/gists/comments#create-a-gist-comment func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment *GistComment) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments", gistID) req, err := s.client.NewRequest("POST", u, comment) @@ -88,7 +88,7 @@ func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment // EditComment edits an existing gist comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#update-a-gist-comment +// GitHub API docs: https://docs.github.com/en/rest/gists/comments#update-a-gist-comment func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, comment *GistComment) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) req, err := s.client.NewRequest("PATCH", u, comment) @@ -107,7 +107,7 @@ func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID // DeleteComment deletes a gist comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#delete-a-gist-comment +// GitHub API docs: https://docs.github.com/en/rest/gists/comments#delete-a-gist-comment func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int64) (*Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/git.go b/github/git.go index 36b33f5e05..8960de7b14 100644 --- a/github/git.go +++ b/github/git.go @@ -8,5 +8,5 @@ package github // GitService handles communication with the git data related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/ +// GitHub API docs: https://docs.github.com/en/rest/git/ type GitService service diff --git a/github/git_blobs.go b/github/git_blobs.go index 7cbd411ca7..da0485ccbe 100644 --- a/github/git_blobs.go +++ b/github/git_blobs.go @@ -23,7 +23,7 @@ type Blob struct { // GetBlob fetches a blob from a repo given a SHA. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-blob +// GitHub API docs: https://docs.github.com/en/rest/git/blobs#get-a-blob func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -43,7 +43,7 @@ func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha // GetBlobRaw fetches a blob's contents from a repo. // Unlike GetBlob, it returns the raw bytes rather than the base64-encoded data. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-blob +// GitHub API docs: https://docs.github.com/en/rest/git/blobs#get-a-blob func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([]byte, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -64,7 +64,7 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([ // CreateBlob creates a blob object. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#create-a-blob +// GitHub API docs: https://docs.github.com/en/rest/git/blobs#create-a-blob func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo) req, err := s.client.NewRequest("POST", u, blob) diff --git a/github/git_commits.go b/github/git_commits.go index 7a728bee17..baedb3d686 100644 --- a/github/git_commits.go +++ b/github/git_commits.go @@ -70,7 +70,7 @@ func (c CommitAuthor) String() string { // GetCommit fetches the Commit object for a given SHA. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-commit +// GitHub API docs: https://docs.github.com/en/rest/git/commits#get-a-commit func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -104,7 +104,7 @@ type createCommit struct { // data if omitted. If the commit.Author is omitted, it will be filled in with // the authenticated user’s information and the current date. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#create-a-commit +// GitHub API docs: https://docs.github.com/en/rest/git/commits#create-a-commit func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit) (*Commit, *Response, error) { if commit == nil { return nil, nil, fmt.Errorf("commit must be provided") diff --git a/github/git_refs.go b/github/git_refs.go index 259f27fada..883975cc0f 100644 --- a/github/git_refs.go +++ b/github/git_refs.go @@ -49,7 +49,7 @@ type updateRefRequest struct { // GetRef fetches a single reference in a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-reference +// GitHub API docs: https://docs.github.com/en/rest/git/refs#get-a-reference func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) { ref = strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/ref/%v", owner, repo, refURLEscape(ref)) @@ -88,7 +88,7 @@ type ReferenceListOptions struct { // ListMatchingRefs lists references in a repository that match a supplied ref. // Use an empty ref to list all references. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#list-matching-references +// GitHub API docs: https://docs.github.com/en/rest/git/refs#list-matching-references func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, opts *ReferenceListOptions) ([]*Reference, *Response, error) { var ref string if opts != nil { @@ -116,7 +116,7 @@ func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, o // CreateRef creates a new ref in a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#create-a-reference +// GitHub API docs: https://docs.github.com/en/rest/git/refs#create-a-reference func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo) req, err := s.client.NewRequest("POST", u, &createRefRequest{ @@ -139,7 +139,7 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r // UpdateRef updates an existing ref in a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#update-a-reference +// GitHub API docs: https://docs.github.com/en/rest/git/refs#update-a-reference func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) { refPath := strings.TrimPrefix(*ref.Ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refPath) @@ -162,7 +162,7 @@ func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, r // DeleteRef deletes a ref from a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#delete-a-reference +// GitHub API docs: https://docs.github.com/en/rest/git/refs#delete-a-reference func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) { ref = strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(ref)) diff --git a/github/git_tags.go b/github/git_tags.go index 12cfc1b3ef..30d7b2c2d2 100644 --- a/github/git_tags.go +++ b/github/git_tags.go @@ -35,7 +35,7 @@ type createTagRequest struct { // GetTag fetches a tag from a repo given a SHA. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-tag +// GitHub API docs: https://docs.github.com/en/rest/git/tags#get-a-tag func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/tags/%v", owner, repo, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -54,7 +54,7 @@ func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha // CreateTag creates a tag object. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#create-a-tag-object +// GitHub API docs: https://docs.github.com/en/rest/git/tags#create-a-tag-object func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/tags", owner, repo) diff --git a/github/git_trees.go b/github/git_trees.go index e655e93a0b..db28976e03 100644 --- a/github/git_trees.go +++ b/github/git_trees.go @@ -93,7 +93,7 @@ func (t *TreeEntry) MarshalJSON() ([]byte, error) { // GetTree fetches the Tree object for a given sha hash from a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-tree +// GitHub API docs: https://docs.github.com/en/rest/git/trees#get-a-tree func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha) if recursive { @@ -124,7 +124,7 @@ type createTree struct { // path modifying that tree are specified, it will overwrite the contents of // that tree with the new path contents and write a new tree out. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#create-a-tree +// GitHub API docs: https://docs.github.com/en/rest/git/trees#create-a-tree func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo) diff --git a/github/github.go b/github/github.go index f51f9d88ca..08b7db8e55 100644 --- a/github/github.go +++ b/github/github.go @@ -130,10 +130,10 @@ const ( // 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 + // https://docs.github.com/en/rest/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 + // https://docs.github.com/en/rest/previews/#create-and-use-repository-templates mediaTypeRepositoryTemplatePreview = "application/vnd.github.baptiste-preview+json" // https://developer.github.com/changes/2019-10-03-multi-line-comments/ @@ -770,7 +770,7 @@ func compareHTTPResponse(r1, r2 *http.Response) bool { /* An ErrorResponse reports one or more errors caused by an API request. -GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/#client-errors +GitHub API docs: https://docs.github.com/en/rest/#client-errors */ type ErrorResponse struct { Response *http.Response // HTTP response that caused this error @@ -780,7 +780,7 @@ type ErrorResponse struct { Block *ErrorBlock `json:"block,omitempty"` // Most errors will also include a documentation_url field pointing // to some content that might help you resolve the error, see - // https://docs.github.com/en/free-pro-team@latest/rest/reference/#client-errors + // https://docs.github.com/en/rest/#client-errors DocumentationURL string `json:"documentation_url,omitempty"` } @@ -900,7 +900,7 @@ func (ae *AcceptedError) Is(target error) bool { } // AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the -// "documentation_url" field value equal to "https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#secondary-rate-limits". +// "documentation_url" field value equal to "https://docs.github.com/en/rest/overview/resources-in-the-rest-api#secondary-rate-limits". type AbuseRateLimitError struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message @@ -963,7 +963,7 @@ GitHub error responses structure are often undocumented and inconsistent. Sometimes error is just a simple string (Issue #540). In such cases, Message represents an error message as a workaround. -GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/#client-errors +GitHub API docs: https://docs.github.com/en/rest/#client-errors */ type Error struct { Resource string `json:"resource"` // resource on which the error occurred @@ -1214,7 +1214,7 @@ that need to use a higher rate limit associated with your OAuth application. This will add the client id and secret as a base64-encoded string in the format ClientID:ClientSecret and apply it as an "Authorization": "Basic" header. -See https://docs.github.com/en/free-pro-team@latest/rest/reference/#unauthenticated-rate-limited-requests for +See https://docs.github.com/en/rest/#unauthenticated-rate-limited-requests for more information. */ type UnauthenticatedRateLimitedTransport struct { diff --git a/github/github_test.go b/github/github_test.go index 9369871872..0a28ced93c 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -1046,7 +1046,7 @@ func TestDo_rateLimit_rateLimitError(t *testing.T) { w.WriteHeader(http.StatusForbidden) fmt.Fprintln(w, `{ "message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", - "documentation_url": "https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#abuse-rate-limits" + "documentation_url": "https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits" }`) }) @@ -1088,7 +1088,7 @@ func TestDo_rateLimit_noNetworkCall(t *testing.T) { w.WriteHeader(http.StatusForbidden) fmt.Fprintln(w, `{ "message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", - "documentation_url": "https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#abuse-rate-limits" + "documentation_url": "https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits" }`) }) @@ -1145,7 +1145,7 @@ func TestDo_rateLimit_ignoredFromCache(t *testing.T) { w.WriteHeader(http.StatusForbidden) fmt.Fprintln(w, `{ "message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", - "documentation_url": "https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#abuse-rate-limits" + "documentation_url": "https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits" }`) }) @@ -1184,7 +1184,7 @@ func TestDo_rateLimit_abuseRateLimitError(t *testing.T) { // there is no "Retry-After" header. fmt.Fprintln(w, `{ "message": "You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.", - "documentation_url": "https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#abuse-rate-limits" + "documentation_url": "https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits" }`) }) @@ -1219,7 +1219,7 @@ func TestDo_rateLimit_abuseRateLimitErrorEnterprise(t *testing.T) { // url changes between versions but follows roughly the same format. fmt.Fprintln(w, `{ "message": "You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.", - "documentation_url": "https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#abuse-rate-limits" + "documentation_url": "https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits" }`) }) @@ -1250,7 +1250,7 @@ func TestDo_rateLimit_abuseRateLimitError_retryAfter(t *testing.T) { w.WriteHeader(http.StatusForbidden) fmt.Fprintln(w, `{ "message": "You have triggered an abuse detection mechanism ...", - "documentation_url": "https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#abuse-rate-limits" + "documentation_url": "https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits" }`) }) @@ -1371,7 +1371,7 @@ func TestCheckResponse_AbuseRateLimit(t *testing.T) { Request: &http.Request{}, StatusCode: http.StatusForbidden, Body: ioutil.NopCloser(strings.NewReader(`{"message":"m", - "documentation_url": "docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#abuse-rate-limits"}`)), + "documentation_url": "docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits"}`)), } err := CheckResponse(res).(*AbuseRateLimitError) diff --git a/github/gitignore.go b/github/gitignore.go index 2f9d0bcfb5..a20a868b44 100644 --- a/github/gitignore.go +++ b/github/gitignore.go @@ -13,7 +13,7 @@ import ( // GitignoresService provides access to the gitignore related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gitignore/ +// GitHub API docs: https://docs.github.com/en/rest/gitignore/ type GitignoresService service // Gitignore represents a .gitignore file as returned by the GitHub API. @@ -28,7 +28,7 @@ func (g Gitignore) String() string { // List all available Gitignore templates. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gitignore/#listing-available-templates +// GitHub API docs: https://docs.github.com/en/rest/gitignore/#listing-available-templates func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, error) { req, err := s.client.NewRequest("GET", "gitignore/templates", nil) if err != nil { @@ -46,7 +46,7 @@ func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, erro // Get a Gitignore by name. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gitignore/#get-a-gitignore-template +// GitHub API docs: https://docs.github.com/en/rest/gitignore#get-a-gitignore-template func (s *GitignoresService) Get(ctx context.Context, name string) (*Gitignore, *Response, error) { u := fmt.Sprintf("gitignore/templates/%v", name) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/interactions.go b/github/interactions.go index 3b00d3c0d4..a690f61268 100644 --- a/github/interactions.go +++ b/github/interactions.go @@ -8,7 +8,7 @@ package github // InteractionsService handles communication with the repository and organization related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/ +// GitHub API docs: https://docs.github.com/en/rest/interactions/ type InteractionsService service // InteractionRestriction represents the interaction restrictions for repository and organization. diff --git a/github/interactions_orgs.go b/github/interactions_orgs.go index d22a9e748d..5c7663f583 100644 --- a/github/interactions_orgs.go +++ b/github/interactions_orgs.go @@ -12,7 +12,7 @@ import ( // GetRestrictionsForOrg fetches the interaction restrictions for an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#get-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/interactions/orgs#get-interaction-restrictions-for-an-organization func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organization string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) req, err := s.client.NewRequest("GET", u, nil) @@ -39,7 +39,7 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz // in public repositories for the given organization. // Possible values are: "existing_users", "contributors_only", "collaborators_only". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#set-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/interactions/orgs#set-interaction-restrictions-for-an-organization func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) @@ -65,7 +65,7 @@ func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, orga // RemoveRestrictionsFromOrg removes the interaction restrictions for an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#remove-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/interactions/orgs#remove-interaction-restrictions-for-an-organization func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, organization string) (*Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/interactions_repos.go b/github/interactions_repos.go index 13fffd64c0..41e6c5319d 100644 --- a/github/interactions_repos.go +++ b/github/interactions_repos.go @@ -12,7 +12,7 @@ import ( // GetRestrictionsForRepo fetches the interaction restrictions for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#get-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/interactions/repos#get-interaction-restrictions-for-a-repository func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, repo string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -39,7 +39,7 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, // for the given repository. // Possible values are: "existing_users", "contributors_only", "collaborators_only". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#set-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/interactions/repos#set-interaction-restrictions-for-a-repository func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, owner, repo, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) @@ -65,7 +65,7 @@ func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, own // RemoveRestrictionsFromRepo removes the interaction restrictions for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#remove-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/interactions/repos#remove-interaction-restrictions-for-a-repository func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/issues.go b/github/issues.go index f35f2b566a..12488f9815 100644 --- a/github/issues.go +++ b/github/issues.go @@ -14,7 +14,7 @@ import ( // IssuesService handles communication with the issue related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/ +// GitHub API docs: https://docs.github.com/en/rest/issues/ type IssuesService service // Issue represents a GitHub issue on a repository. @@ -54,7 +54,7 @@ type Issue struct { NodeID *string `json:"node_id,omitempty"` // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#text-match-metadata + // See: search.go and https://docs.github.com/en/rest/search/#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` // ActiveLockReason is populated only when LockReason is provided while locking the issue. @@ -128,8 +128,8 @@ type PullRequestLinks struct { // organization repositories; if false, list only owned and member // repositories. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-user-account-issues-assigned-to-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issues-assigned-to-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/issues/issues#list-user-account-issues-assigned-to-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/issues/issues#list-issues-assigned-to-the-authenticated-user func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptions) ([]*Issue, *Response, error) { var u string if all { @@ -143,7 +143,7 @@ func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptio // ListByOrg fetches the issues in the specified organization for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-organization-issues-assigned-to-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/issues/issues#list-organization-issues-assigned-to-the-authenticated-user func (s *IssuesService) ListByOrg(ctx context.Context, org string, opts *IssueListOptions) ([]*Issue, *Response, error) { u := fmt.Sprintf("orgs/%v/issues", org) return s.listIssues(ctx, u, opts) @@ -214,7 +214,7 @@ type IssueListByRepoOptions struct { // ListByRepo lists the issues for the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-repository-issues +// GitHub API docs: https://docs.github.com/en/rest/issues/issues#list-repository-issues func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) u, err := addOptions(u, opts) @@ -241,7 +241,7 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin // Get a single issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#get-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/issues#get-an-issue func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -263,7 +263,7 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb // Create a new issue on the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#create-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/issues#create-an-issue func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) req, err := s.client.NewRequest("POST", u, issue) @@ -280,9 +280,9 @@ func (s *IssuesService) Create(ctx context.Context, owner string, repo string, i return i, resp, nil } -// Edit an issue. +// Edit (update) an issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#update-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/issues#update-an-issue func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) req, err := s.client.NewRequest("PATCH", u, issue) @@ -303,7 +303,7 @@ func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, num // // This is a helper method to explicitly update an issue with a `null` milestone, thereby removing it. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#update-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/issues#update-an-issue func (s *IssuesService) RemoveMilestone(ctx context.Context, owner, repo string, issueNumber int) (*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, issueNumber) req, err := s.client.NewRequest("PATCH", u, &struct { @@ -333,7 +333,7 @@ type LockIssueOptions struct { // Lock an issue's conversation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#lock-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/issues#lock-an-issue func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opts *LockIssueOptions) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) req, err := s.client.NewRequest("PUT", u, opts) @@ -346,7 +346,7 @@ func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, num // Unlock an issue's conversation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#unlock-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/issues#unlock-an-issue func (s *IssuesService) Unlock(ctx context.Context, owner string, repo string, number int) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/issues_assignees.go b/github/issues_assignees.go index 34e0bb506f..b7f2e80243 100644 --- a/github/issues_assignees.go +++ b/github/issues_assignees.go @@ -13,7 +13,7 @@ import ( // ListAssignees fetches all available assignees (owners and collaborators) to // which issues may be assigned. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-assignees +// GitHub API docs: https://docs.github.com/en/rest/issues/assignees#list-assignees func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo) u, err := addOptions(u, opts) @@ -37,7 +37,7 @@ func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, o // IsAssignee checks if a user is an assignee for the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#check-if-a-user-can-be-assigned +// GitHub API docs: https://docs.github.com/en/rest/issues/assignees#check-if-a-user-can-be-assigned func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user) req, err := s.client.NewRequest("GET", u, nil) @@ -52,7 +52,7 @@ func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string // AddAssignees adds the provided GitHub users as assignees to the issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#add-assignees-to-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/assignees#add-assignees-to-an-issue func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) { users := &struct { Assignees []string `json:"assignees,omitempty"` @@ -74,7 +74,7 @@ func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, nu // RemoveAssignees removes the provided GitHub users as assignees from the issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#remove-assignees-from-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/assignees#remove-assignees-from-an-issue func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) { users := &struct { Assignees []string `json:"assignees,omitempty"` diff --git a/github/issues_comments.go b/github/issues_comments.go index 6dd6d13287..361ee49a69 100644 --- a/github/issues_comments.go +++ b/github/issues_comments.go @@ -50,8 +50,8 @@ type IssueListCommentsOptions struct { // ListComments lists all comments on the specified issue. Specifying an issue // number of 0 will return all comments on all issues for the repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issue-comments -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issue-comments-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/issues/comments#list-issue-comments +// GitHub API docs: https://docs.github.com/en/rest/issues/comments#list-issue-comments-for-a-repository func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) { var u string if number == 0 { @@ -83,7 +83,7 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str // GetComment fetches the specified issue comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#get-an-issue-comment +// GitHub API docs: https://docs.github.com/en/rest/issues/comments#get-an-issue-comment func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) @@ -106,7 +106,7 @@ func (s *IssuesService) GetComment(ctx context.Context, owner string, repo strin // CreateComment creates a new comment on the specified issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#create-an-issue-comment +// GitHub API docs: https://docs.github.com/en/rest/issues/comments#create-an-issue-comment func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number) req, err := s.client.NewRequest("POST", u, comment) @@ -125,7 +125,7 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo st // EditComment updates an issue comment. // A non-nil comment.Body must be provided. Other comment fields should be left nil. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#update-an-issue-comment +// GitHub API docs: https://docs.github.com/en/rest/issues/comments#update-an-issue-comment func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) req, err := s.client.NewRequest("PATCH", u, comment) @@ -143,7 +143,7 @@ func (s *IssuesService) EditComment(ctx context.Context, owner string, repo stri // DeleteComment deletes an issue comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#delete-an-issue-comment +// GitHub API docs: https://docs.github.com/en/rest/issues/comments#delete-an-issue-comment func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/issues_events.go b/github/issues_events.go index 384779cfed..d8ffc0b542 100644 --- a/github/issues_events.go +++ b/github/issues_events.go @@ -100,7 +100,7 @@ type DismissedReview struct { // ListIssueEvents lists events for the specified issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issue-events +// GitHub API docs: https://docs.github.com/en/rest/issues/events#list-issue-events func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/events", owner, repo, number) u, err := addOptions(u, opts) @@ -126,7 +126,7 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, // ListRepositoryEvents lists events for the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issue-events-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/issues/events#list-issue-events-for-a-repository func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo) u, err := addOptions(u, opts) @@ -150,7 +150,7 @@ func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo st // GetEvent returns the specified issue event. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#get-an-issue-event +// GitHub API docs: https://docs.github.com/en/rest/issues/events#get-an-issue-event func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int64) (*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/events/%v", owner, repo, id) diff --git a/github/issues_labels.go b/github/issues_labels.go index 40f069a9d1..d0f865c03f 100644 --- a/github/issues_labels.go +++ b/github/issues_labels.go @@ -27,7 +27,7 @@ func (l Label) String() string { // ListLabels lists all labels for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-labels-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#list-labels-for-a-repository func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) u, err := addOptions(u, opts) @@ -51,7 +51,7 @@ func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo strin // GetLabel gets a single label. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#get-a-label +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#get-a-label func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, name string) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) req, err := s.client.NewRequest("GET", u, nil) @@ -70,7 +70,7 @@ func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, // CreateLabel creates a new label on the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#create-a-label +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#create-a-label func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo string, label *Label) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) req, err := s.client.NewRequest("POST", u, label) @@ -89,7 +89,7 @@ func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo stri // EditLabel edits a label. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#update-a-label +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#update-a-label func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string, name string, label *Label) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) req, err := s.client.NewRequest("PATCH", u, label) @@ -108,7 +108,7 @@ func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string // DeleteLabel deletes a label. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#delete-a-label +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#delete-a-label func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo string, name string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) req, err := s.client.NewRequest("DELETE", u, nil) @@ -120,7 +120,7 @@ func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo stri // ListLabelsByIssue lists all labels for an issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-labels-for-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#list-labels-for-an-issue func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) u, err := addOptions(u, opts) @@ -144,7 +144,7 @@ func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, rep // AddLabelsToIssue adds labels to an issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#add-labels-to-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#add-labels-to-an-issue func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) req, err := s.client.NewRequest("POST", u, labels) @@ -163,7 +163,7 @@ func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo // RemoveLabelForIssue removes a label for an issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#remove-a-label-from-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#remove-a-label-from-an-issue func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", owner, repo, number, label) req, err := s.client.NewRequest("DELETE", u, nil) @@ -176,7 +176,7 @@ func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, r // ReplaceLabelsForIssue replaces all labels for an issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#set-labels-for-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#set-labels-for-an-issue func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) req, err := s.client.NewRequest("PUT", u, labels) @@ -195,7 +195,7 @@ func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, // RemoveLabelsForIssue removes all labels for an issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#remove-all-labels-from-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#remove-all-labels-from-an-issue func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, repo string, number int) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, nil) @@ -208,7 +208,7 @@ func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, // ListLabelsForMilestone lists labels for every issue in a milestone. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-labels-for-issues-in-a-milestone +// GitHub API docs: https://docs.github.com/en/rest/issues/labels#list-labels-for-issues-in-a-milestone func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number) u, err := addOptions(u, opts) diff --git a/github/issues_milestones.go b/github/issues_milestones.go index f9b1f19335..3c9be2407e 100644 --- a/github/issues_milestones.go +++ b/github/issues_milestones.go @@ -55,7 +55,7 @@ type MilestoneListOptions struct { // ListMilestones lists all milestones for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-milestones +// GitHub API docs: https://docs.github.com/en/rest/issues/milestones#list-milestones func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo string, opts *MilestoneListOptions) ([]*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) u, err := addOptions(u, opts) @@ -79,7 +79,7 @@ func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo s // GetMilestone gets a single milestone. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#get-a-milestone +// GitHub API docs: https://docs.github.com/en/rest/issues/milestones#get-a-milestone func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo string, number int) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -98,7 +98,7 @@ func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo str // CreateMilestone creates a new milestone on the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#create-a-milestone +// GitHub API docs: https://docs.github.com/en/rest/issues/milestones#create-a-milestone func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo string, milestone *Milestone) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) req, err := s.client.NewRequest("POST", u, milestone) @@ -117,7 +117,7 @@ func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo // EditMilestone edits a milestone. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#update-a-milestone +// GitHub API docs: https://docs.github.com/en/rest/issues/milestones#update-a-milestone func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) req, err := s.client.NewRequest("PATCH", u, milestone) @@ -136,7 +136,7 @@ func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo st // DeleteMilestone deletes a milestone. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#delete-a-milestone +// GitHub API docs: https://docs.github.com/en/rest/issues/milestones#delete-a-milestone func (s *IssuesService) DeleteMilestone(ctx context.Context, owner string, repo string, number int) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/issues_timeline.go b/github/issues_timeline.go index d0ee0a78f2..9ec498e45c 100644 --- a/github/issues_timeline.go +++ b/github/issues_timeline.go @@ -161,7 +161,7 @@ type Source struct { // ListIssueTimeline lists events for the specified issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-timeline-events-for-an-issue +// GitHub API docs: https://docs.github.com/en/rest/issues/timeline#list-timeline-events-for-an-issue func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Timeline, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/timeline", owner, repo, number) u, err := addOptions(u, opts) diff --git a/github/licenses.go b/github/licenses.go index 85e3626617..0877b6d183 100644 --- a/github/licenses.go +++ b/github/licenses.go @@ -13,7 +13,7 @@ import ( // LicensesService handles communication with the license related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/ +// GitHub API docs: https://docs.github.com/en/rest/licenses/ type LicensesService service // RepositoryLicense represents the license for a repository. @@ -60,7 +60,7 @@ func (l License) String() string { // List popular open source licenses. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#list-all-licenses +// GitHub API docs: https://docs.github.com/en/rest/licenses/#list-all-licenses func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, error) { req, err := s.client.NewRequest("GET", "licenses", nil) if err != nil { @@ -78,7 +78,7 @@ func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, erro // Get extended metadata for one license. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#get-a-license +// GitHub API docs: https://docs.github.com/en/rest/licenses#get-a-license func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License, *Response, error) { u := fmt.Sprintf("licenses/%s", licenseName) diff --git a/github/migrations.go b/github/migrations.go index 7694021f1f..67989c0789 100644 --- a/github/migrations.go +++ b/github/migrations.go @@ -16,7 +16,7 @@ import ( // MigrationService provides access to the migration related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migration/ +// GitHub API docs: https://docs.github.com/en/rest/migration/ type MigrationService service // Migration represents a GitHub migration (archival). @@ -74,7 +74,7 @@ type startMigration struct { // StartMigration starts the generation of a migration archive. // repos is a slice of repository names to migrate. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#start-an-organization-migration +// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#start-an-organization-migration func (s *MigrationService) StartMigration(ctx context.Context, org string, repos []string, opts *MigrationOptions) (*Migration, *Response, error) { u := fmt.Sprintf("orgs/%v/migrations", org) @@ -103,7 +103,7 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos // ListMigrations lists the most recent migrations. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#list-organization-migrations +// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#list-organization-migrations func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts *ListOptions) ([]*Migration, *Response, error) { u := fmt.Sprintf("orgs/%v/migrations", org) u, err := addOptions(u, opts) @@ -131,7 +131,7 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts // MigrationStatus gets the status of a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#get-an-organization-migration-status +// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#get-an-organization-migration-status func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id int64) (*Migration, *Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v", org, id) @@ -155,7 +155,7 @@ func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id i // MigrationArchiveURL fetches a migration archive URL. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#download-an-organization-migration-archive +// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#download-an-organization-migration-archive func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, id int64) (url string, err error) { u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) @@ -192,7 +192,7 @@ func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, // DeleteMigration deletes a previous migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#delete-an-organization-migration-archive +// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#delete-an-organization-migration-archive func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) @@ -212,7 +212,7 @@ func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id i // You should unlock each migrated repository and delete them when the migration // is complete and you no longer need the source data. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#unlock-an-organization-repository +// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#unlock-an-organization-repository func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64, repo string) (*Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v/repos/%v/lock", org, id, repo) diff --git a/github/migrations_source_import.go b/github/migrations_source_import.go index e34b3acdac..74a04b22a4 100644 --- a/github/migrations_source_import.go +++ b/github/migrations_source_import.go @@ -115,7 +115,7 @@ func (i Import) String() string { // SourceImportAuthor identifies an author imported from a source repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migration/source_imports/#get-commit-authors +// GitHub API docs: https://docs.github.com/en/rest/migration/source_imports/#get-commit-authors type SourceImportAuthor struct { ID *int64 `json:"id,omitempty"` RemoteID *string `json:"remote_id,omitempty"` @@ -132,7 +132,7 @@ func (a SourceImportAuthor) String() string { // LargeFile identifies a file larger than 100MB found during a repository import. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migration/source_imports/#get-large-files +// GitHub API docs: https://docs.github.com/en/rest/migration/source_imports/#get-large-files type LargeFile struct { RefName *string `json:"ref_name,omitempty"` Path *string `json:"path,omitempty"` @@ -146,7 +146,7 @@ func (f LargeFile) String() string { // StartImport initiates a repository import. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#start-an-import +// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#start-an-import func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) req, err := s.client.NewRequest("PUT", u, in) @@ -165,7 +165,7 @@ func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, // ImportProgress queries for the status and progress of an ongoing repository import. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#get-an-import-status +// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#get-an-import-status func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo string) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -184,7 +184,7 @@ func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo strin // UpdateImport initiates a repository import. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#update-an-import +// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#update-an-import func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) req, err := s.client.NewRequest("PATCH", u, in) @@ -213,7 +213,7 @@ func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, // This method and MapCommitAuthor allow you to provide correct Git author // information. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#get-commit-authors +// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#get-commit-authors func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string) ([]*SourceImportAuthor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -234,7 +234,7 @@ func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string // application can continue updating authors any time before you push new // commits to the repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#map-a-commit-author +// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#map-a-commit-author func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, author *SourceImportAuthor) (*SourceImportAuthor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/authors/%v", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, author) @@ -255,7 +255,7 @@ func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo stri // files larger than 100MB. Only the UseLFS field on the provided Import is // used. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#update-git-lfs-preference +// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#update-git-lfs-preference func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/lfs", owner, repo) req, err := s.client.NewRequest("PATCH", u, in) @@ -274,7 +274,7 @@ func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo str // LargeFiles lists files larger than 100MB found during the import. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#get-large-files +// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#get-large-files func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ([]*LargeFile, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -293,7 +293,7 @@ func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ( // CancelImport stops an import for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#cancel-an-import +// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#cancel-an-import func (s *MigrationService) CancelImport(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/migrations_user.go b/github/migrations_user.go index 5e8aaec5aa..b8a0d608d6 100644 --- a/github/migrations_user.go +++ b/github/migrations_user.go @@ -67,7 +67,7 @@ type startUserMigration struct { // StartUserMigration starts the generation of a migration archive. // repos is a slice of repository names to migrate. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#start-a-user-migration +// GitHub API docs: https://docs.github.com/en/rest/migrations/users#start-a-user-migration func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opts *UserMigrationOptions) (*UserMigration, *Response, error) { u := "user/migrations" @@ -96,7 +96,7 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin // ListUserMigrations lists the most recent migrations. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#list-user-migrations +// GitHub API docs: https://docs.github.com/en/rest/migrations/users#list-user-migrations func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigration, *Response, error) { u := "user/migrations" @@ -120,7 +120,7 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigra // UserMigrationStatus gets the status of a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#get-a-user-migration-status +// GitHub API docs: https://docs.github.com/en/rest/migrations/users#get-a-user-migration-status func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*UserMigration, *Response, error) { u := fmt.Sprintf("user/migrations/%v", id) @@ -144,7 +144,7 @@ func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (* // UserMigrationArchiveURL gets the URL for a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#download-a-user-migration-archive +// GitHub API docs: https://docs.github.com/en/rest/migrations/users#download-a-user-migration-archive func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64) (string, error) { url := fmt.Sprintf("user/migrations/%v/archive", id) @@ -178,7 +178,7 @@ func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64 // DeleteUserMigration will delete a previous migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#delete-a-user-migration-archive +// GitHub API docs: https://docs.github.com/en/rest/migrations/users#delete-a-user-migration-archive func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*Response, error) { url := fmt.Sprintf("user/migrations/%v/archive", id) @@ -198,7 +198,7 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (* // You should unlock each migrated repository and delete them when the migration // is complete and you no longer need the source data. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#unlock-a-user-repository +// GitHub API docs: https://docs.github.com/en/rest/migrations/users#unlock-a-user-repository func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo string) (*Response, error) { url := fmt.Sprintf("user/migrations/%v/repos/%v/lock", id, repo) diff --git a/github/misc.go b/github/misc.go index 7672e08acc..412d1e2b95 100644 --- a/github/misc.go +++ b/github/misc.go @@ -39,7 +39,7 @@ type markdownRequest struct { // Markdown renders an arbitrary Markdown document. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/markdown/ +// GitHub API docs: https://docs.github.com/en/rest/markdown/ func (c *Client) Markdown(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) { request := &markdownRequest{Text: String(text)} if opts != nil { @@ -67,7 +67,7 @@ func (c *Client) Markdown(ctx context.Context, text string, opts *MarkdownOption // ListEmojis returns the emojis available to use on GitHub. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/emojis/ +// GitHub API docs: https://docs.github.com/en/rest/emojis/ func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) { req, err := c.NewRequest("GET", "emojis", nil) if err != nil { @@ -97,7 +97,7 @@ func (c *CodeOfConduct) String() string { // ListCodesOfConduct returns all codes of conduct. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/codes_of_conduct/#list-all-codes-of-conduct +// GitHub API docs: https://docs.github.com/en/rest/codes_of_conduct/#list-all-codes-of-conduct func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error) { req, err := c.NewRequest("GET", "codes_of_conduct", nil) if err != nil { @@ -118,7 +118,7 @@ func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Res // GetCodeOfConduct returns an individual code of conduct. // -// https://docs.github.com/en/free-pro-team@latest/rest/reference/codes_of_conduct/#get-an-individual-code-of-conduct +// https://docs.github.com/en/rest/codes_of_conduct/#get-an-individual-code-of-conduct func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { u := fmt.Sprintf("codes_of_conduct/%s", key) req, err := c.NewRequest("GET", u, nil) @@ -182,7 +182,7 @@ type APIMeta struct { // this endpoint on your organization’s GitHub Enterprise installation, this // endpoint provides information about that installation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/meta#get-github-meta-information +// GitHub API docs: https://docs.github.com/en/rest/meta#get-github-meta-information func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { req, err := c.NewRequest("GET", "meta", nil) if err != nil { diff --git a/github/orgs.go b/github/orgs.go index 62f6ed241c..80979db350 100644 --- a/github/orgs.go +++ b/github/orgs.go @@ -14,7 +14,7 @@ import ( // OrganizationsService provides access to the organization related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/ +// GitHub API docs: https://docs.github.com/en/rest/orgs/ type OrganizationsService service // Organization represents a GitHub organization account. @@ -132,7 +132,7 @@ type OrganizationsListOptions struct { // listing the next set of organizations, use the ID of the last-returned organization // as the opts.Since parameter for the next call. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organizations +// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#list-organizations func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsListOptions) ([]*Organization, *Response, error) { u, err := addOptions("organizations", opts) if err != nil { @@ -155,8 +155,8 @@ func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsL // List the organizations for a user. Passing the empty string will list // organizations for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organizations-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organizations-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#list-organizations-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#list-organizations-for-a-user func (s *OrganizationsService) List(ctx context.Context, user string, opts *ListOptions) ([]*Organization, *Response, error) { var u string if user != "" { @@ -185,7 +185,7 @@ func (s *OrganizationsService) List(ctx context.Context, user string, opts *List // Get fetches an organization by name. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#get-an-organization +// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#get-an-organization func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organization, *Response, error) { u := fmt.Sprintf("orgs/%v", org) req, err := s.client.NewRequest("GET", u, nil) @@ -226,7 +226,7 @@ func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organiza // Edit an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#update-an-organization +// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#update-an-organization func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organization) (*Organization, *Response, error) { u := fmt.Sprintf("orgs/%v", name) req, err := s.client.NewRequest("PATCH", u, org) @@ -248,7 +248,7 @@ func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organ // ListInstallations lists installations for an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-app-installations-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#list-app-installations-for-an-organization func (s *OrganizationsService) ListInstallations(ctx context.Context, org string, opts *ListOptions) (*OrganizationInstallations, *Response, error) { u := fmt.Sprintf("orgs/%v/installations", org) diff --git a/github/orgs_actions_allowed.go b/github/orgs_actions_allowed.go index 49bcb00f94..e3b35b1df1 100644 --- a/github/orgs_actions_allowed.go +++ b/github/orgs_actions_allowed.go @@ -12,7 +12,7 @@ import ( // ActionsAllowed represents selected actions that are allowed. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#set-allowed-actions-and-workflows-for-an-organization--parameters +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions type ActionsAllowed struct { GithubOwnedAllowed *bool `json:"github_owned_allowed,omitempty"` VerifiedAllowed *bool `json:"verified_allowed,omitempty"` @@ -25,7 +25,7 @@ func (a ActionsAllowed) String() string { // GetActionsAllowed gets the actions that are allowed in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#get-allowed-actions-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) @@ -45,7 +45,7 @@ func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string // EditActionsAllowed sets the actions that are allowed in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#set-allowed-actions-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization func (s *OrganizationsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) req, err := s.client.NewRequest("PUT", u, actionsAllowed) diff --git a/github/orgs_actions_permissions.go b/github/orgs_actions_permissions.go index fc1fe31361..6d1db2ee0a 100644 --- a/github/orgs_actions_permissions.go +++ b/github/orgs_actions_permissions.go @@ -12,7 +12,7 @@ import ( // ActionsPermissions represents a policy for repositories and allowed actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#permissions +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions type ActionsPermissions struct { EnabledRepositories *string `json:"enabled_repositories,omitempty"` AllowedActions *string `json:"allowed_actions,omitempty"` @@ -25,7 +25,7 @@ func (a ActionsPermissions) String() string { // GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#get-github-actions-permissions-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-github-actions-permissions-for-an-organization func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions", org) @@ -45,7 +45,7 @@ func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org st // EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#set-github-actions-permissions-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-github-actions-permissions-for-an-organization func (s *OrganizationsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions", org) req, err := s.client.NewRequest("PUT", u, actionsPermissions) diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index ade57f5411..52bacfed9a 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -93,7 +93,7 @@ type AuditEntry struct { // GetAuditLog gets the audit-log entries for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#get-the-audit-log-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#get-the-audit-log-for-an-organization func (s *OrganizationsService) GetAuditLog(ctx context.Context, org string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) { u := fmt.Sprintf("orgs/%v/audit-log", org) u, err := addOptions(u, opts) diff --git a/github/orgs_custom_roles.go b/github/orgs_custom_roles.go index d320a90514..9904685b94 100644 --- a/github/orgs_custom_roles.go +++ b/github/orgs_custom_roles.go @@ -27,7 +27,7 @@ type CustomRepoRoles struct { // ListCustomRepoRoles lists the custom repository roles available in this organization. // In order to see custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles +// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org string) (*OrganizationCustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom_roles", org) diff --git a/github/orgs_hooks.go b/github/orgs_hooks.go index 26687e565b..c0dd51e24e 100644 --- a/github/orgs_hooks.go +++ b/github/orgs_hooks.go @@ -12,7 +12,7 @@ import ( // ListHooks lists all Hooks for the specified organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organization-webhooks +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#list-organization-webhooks func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts *ListOptions) ([]*Hook, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks", org) u, err := addOptions(u, opts) @@ -36,7 +36,7 @@ func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts * // GetHook returns a single specified Hook. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#get-an-organization-webhook +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#get-an-organization-webhook func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64) (*Hook, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) req, err := s.client.NewRequest("GET", u, nil) @@ -59,7 +59,7 @@ func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64 // Note that only a subset of the hook fields are used and hook must // not be nil. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#create-an-organization-webhook +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#create-an-organization-webhook func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook *Hook) (*Hook, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks", org) @@ -86,7 +86,7 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook // EditHook updates a specified Hook. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#update-an-organization-webhook +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#update-an-organization-webhook func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) req, err := s.client.NewRequest("PATCH", u, hook) @@ -105,7 +105,7 @@ func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int6 // PingHook triggers a 'ping' event to be sent to the Hook. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#ping-an-organization-webhook +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#ping-an-organization-webhook func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%d/pings", org, id) req, err := s.client.NewRequest("POST", u, nil) @@ -118,7 +118,7 @@ func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int6 // DeleteHook deletes a specified Hook. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#delete-an-organization-webhook +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#delete-an-organization-webhook func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/orgs_hooks_deliveries.go b/github/orgs_hooks_deliveries.go index d1fb5c832a..1bfad409ea 100644 --- a/github/orgs_hooks_deliveries.go +++ b/github/orgs_hooks_deliveries.go @@ -12,7 +12,7 @@ import ( // ListHookDeliveries lists webhook deliveries for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#list-deliveries-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#list-deliveries-for-an-organization-webhook func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries", org, id) u, err := addOptions(u, opts) @@ -36,7 +36,7 @@ func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org strin // GetHookDelivery returns a delivery for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#get-a-webhook-delivery-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#get-a-webhook-delivery-for-an-organization-webhook func (s *OrganizationsService) GetHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v", owner, hookID, deliveryID) req, err := s.client.NewRequest("GET", u, nil) @@ -55,7 +55,7 @@ func (s *OrganizationsService) GetHookDelivery(ctx context.Context, owner string // RedeliverHookDelivery redelivers a delivery for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#redeliver-a-delivery-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#redeliver-a-delivery-for-an-organization-webhook func (s *OrganizationsService) RedeliverHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v/attempts", owner, hookID, deliveryID) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/orgs_members.go b/github/orgs_members.go index dd4845441f..38f43bad5a 100644 --- a/github/orgs_members.go +++ b/github/orgs_members.go @@ -71,8 +71,8 @@ type ListMembersOptions struct { // user is an owner of the organization, this will return both concealed and // public members, otherwise it will only return public members. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organization-members -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-public-organization-members +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-organization-members +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-public-organization-members func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts *ListMembersOptions) ([]*User, *Response, error) { var u string if opts != nil && opts.PublicOnly { @@ -101,7 +101,7 @@ func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts // IsMember checks if a user is a member of an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#check-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#check-organization-membership-for-a-user func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/members/%v", org, user) req, err := s.client.NewRequest("GET", u, nil) @@ -116,7 +116,7 @@ func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) ( // IsPublicMember checks if a user is a public member of an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#check-public-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#check-public-organization-membership-for-a-user func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) req, err := s.client.NewRequest("GET", u, nil) @@ -131,7 +131,7 @@ func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user str // RemoveMember removes a user from all teams of an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#remove-an-organization-member +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#remove-an-organization-member func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/members/%v", org, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -145,7 +145,7 @@ func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user strin // PublicizeMembership publicizes a user's membership in an organization. (A // user cannot publicize the membership for another user.) // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#set-public-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#set-public-organization-membership-for-the-authenticated-user func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) req, err := s.client.NewRequest("PUT", u, nil) @@ -158,7 +158,7 @@ func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, use // ConcealMembership conceals a user's membership in an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#remove-public-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#remove-public-organization-membership-for-the-authenticated-user func (s *OrganizationsService) ConcealMembership(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -181,7 +181,7 @@ type ListOrgMembershipsOptions struct { // ListOrgMemberships lists the organization memberships for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organization-memberships-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *ListOrgMembershipsOptions) ([]*Membership, *Response, error) { u := "user/memberships/orgs" u, err := addOptions(u, opts) @@ -207,8 +207,8 @@ func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *Lis // Passing an empty string for user will get the membership for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#get-an-organization-membership-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#get-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#get-an-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#get-organization-membership-for-a-user func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org string) (*Membership, *Response, error) { var u string if user != "" { @@ -235,8 +235,8 @@ func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org s // Passing an empty string for user will edit the membership for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#update-an-organization-membership-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#set-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#update-an-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#set-organization-membership-for-a-user func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org string, membership *Membership) (*Membership, *Response, error) { var u, method string if user != "" { @@ -264,7 +264,7 @@ func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org // RemoveOrgMembership removes user from the specified organization. If the // user has been invited to the organization, this will cancel their invitation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#remove-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#remove-organization-membership-for-a-user func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, org string) (*Response, error) { u := fmt.Sprintf("orgs/%v/memberships/%v", org, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -277,7 +277,7 @@ func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, or // ListPendingOrgInvitations returns a list of pending invitations. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-pending-organization-invitations +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-pending-organization-invitations func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org string, opts *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/invitations", org) u, err := addOptions(u, opts) @@ -323,7 +323,7 @@ type CreateOrgInvitationOptions struct { // In order to create invitations in an organization, // the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#create-an-organization-invitation +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#create-an-organization-invitation func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, opts *CreateOrgInvitationOptions) (*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/invitations", org) @@ -344,7 +344,7 @@ func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org stri // ListOrgInvitationTeams lists all teams associated with an invitation. In order to see invitations in an organization, // the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organization-invitation-teams +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-organization-invitation-teams func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, invitationID string, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/invitations/%v/teams", org, invitationID) u, err := addOptions(u, opts) @@ -368,7 +368,7 @@ func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, // ListFailedOrgInvitations returns a list of failed inviatations. // -// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#list-failed-organization-invitations +// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-failed-organization-invitations func (s *OrganizationsService) ListFailedOrgInvitations(ctx context.Context, org string, opts *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/failed_invitations", org) u, err := addOptions(u, opts) diff --git a/github/orgs_outside_collaborators.go b/github/orgs_outside_collaborators.go index d9ffd25a5f..506a494603 100644 --- a/github/orgs_outside_collaborators.go +++ b/github/orgs_outside_collaborators.go @@ -27,7 +27,7 @@ type ListOutsideCollaboratorsOptions struct { // Warning: The API may change without advance notice during the preview period. // Preview features are not supported for production use. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-outside-collaborators-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/orgs/outside-collaborators#list-outside-collaborators-for-an-organization func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org string, opts *ListOutsideCollaboratorsOptions) ([]*User, *Response, error) { u := fmt.Sprintf("orgs/%v/outside_collaborators", org) u, err := addOptions(u, opts) @@ -52,7 +52,7 @@ func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org // RemoveOutsideCollaborator removes a user from the list of outside collaborators; // consequently, removing them from all the organization's repositories. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#remove-outside-collaborator-from-an-organization +// GitHub API docs: https://docs.github.com/en/rest/orgs/outside-collaborators#remove-outside-collaborator-from-an-organization func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -69,7 +69,7 @@ func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, or // Responses for converting a non-member or the last owner to an outside collaborator // are listed in GitHub API docs. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#convert-an-organization-member-to-outside-collaborator +// GitHub API docs: https://docs.github.com/en/rest/orgs/outside-collaborators#convert-an-organization-member-to-outside-collaborator func (s *OrganizationsService) ConvertMemberToOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user) req, err := s.client.NewRequest("PUT", u, nil) diff --git a/github/orgs_packages.go b/github/orgs_packages.go index 0c36f21cae..9fb11308b8 100644 --- a/github/orgs_packages.go +++ b/github/orgs_packages.go @@ -12,7 +12,7 @@ import ( // List the packages for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#list-packages-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/packages#list-packages-for-an-organization func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opts *PackageListOptions) ([]*Package, *Response, error) { u := fmt.Sprintf("orgs/%v/packages", org) u, err := addOptions(u, opts) @@ -36,7 +36,7 @@ func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opt // Get a package by name from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-for-an-organization func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, packageName string) (*Package, *Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName) req, err := s.client.NewRequest("GET", u, nil) @@ -55,7 +55,7 @@ func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, // Delete a package from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-for-an-organization func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName) req, err := s.client.NewRequest("DELETE", u, nil) @@ -68,7 +68,7 @@ func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageTy // Restore a package to an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-for-an-organization func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", org, packageType, packageName) req, err := s.client.NewRequest("POST", u, nil) @@ -81,7 +81,7 @@ func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageT // Get all versions of a package in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-all-package-versions-for-a-package-owned-by-an-organization +// GitHub API docs: https://docs.github.com/en/rest/packages#get-all-package-versions-for-a-package-owned-by-an-organization func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions", org, packageType, packageName) u, err := addOptions(u, opts) @@ -105,7 +105,7 @@ func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, p // Get a specific version of a package in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-version-for-an-organization func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID) req, err := s.client.NewRequest("GET", u, nil) @@ -124,7 +124,7 @@ func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packa // Delete a package version from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/packages#delete-package-version-for-an-organization func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -137,7 +137,7 @@ func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, pa // Restore a package version to an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/packages#restore-package-version-for-an-organization func (s *OrganizationsService) PackageRestoreVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", org, packageType, packageName, packageVersionID) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/orgs_projects.go b/github/orgs_projects.go index b0c60ecb9e..d49eae54dc 100644 --- a/github/orgs_projects.go +++ b/github/orgs_projects.go @@ -12,7 +12,7 @@ import ( // ListProjects lists the projects for an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-organization-projects +// GitHub API docs: https://docs.github.com/en/rest/projects/projects#list-organization-projects func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opts *ProjectListOptions) ([]*Project, *Response, error) { u := fmt.Sprintf("orgs/%v/projects", org) u, err := addOptions(u, opts) @@ -39,7 +39,7 @@ func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opt // CreateProject creates a GitHub Project for the specified organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#create-an-organization-project +// GitHub API docs: https://docs.github.com/en/rest/projects/projects#create-an-organization-project func (s *OrganizationsService) CreateProject(ctx context.Context, org string, opts *ProjectOptions) (*Project, *Response, error) { u := fmt.Sprintf("orgs/%v/projects", org) req, err := s.client.NewRequest("POST", u, opts) diff --git a/github/orgs_users_blocking.go b/github/orgs_users_blocking.go index 2773344c9f..9c6cf60269 100644 --- a/github/orgs_users_blocking.go +++ b/github/orgs_users_blocking.go @@ -12,7 +12,7 @@ import ( // ListBlockedUsers lists all the users blocked by an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-users-blocked-by-an-organization +// GitHub API docs: https://docs.github.com/en/rest/orgs/blocking#list-users-blocked-by-an-organization func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, opts *ListOptions) ([]*User, *Response, error) { u := fmt.Sprintf("orgs/%v/blocks", org) u, err := addOptions(u, opts) @@ -39,7 +39,7 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, // IsBlocked reports whether specified user is blocked from an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#check-if-a-user-is-blocked-by-an-organization +// GitHub API docs: https://docs.github.com/en/rest/orgs/blocking#check-if-a-user-is-blocked-by-an-organization func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) @@ -58,7 +58,7 @@ func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user s // BlockUser blocks specified user from an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#block-a-user-from-an-organization +// GitHub API docs: https://docs.github.com/en/rest/orgs/blocking#block-a-user-from-an-organization func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) @@ -75,7 +75,7 @@ func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user s // UnblockUser unblocks specified user from an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#unblock-a-user-from-an-organization +// GitHub API docs: https://docs.github.com/en/rest/orgs/blocking#unblock-a-user-from-an-organization func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) diff --git a/github/projects.go b/github/projects.go index 2886c3a3b0..df7ad6cd97 100644 --- a/github/projects.go +++ b/github/projects.go @@ -13,7 +13,7 @@ import ( // ProjectsService provides access to the projects functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/ +// GitHub API docs: https://docs.github.com/en/rest/projects type ProjectsService service // Project represents a GitHub Project. @@ -43,7 +43,7 @@ func (p Project) String() string { // GetProject gets a GitHub Project for a repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#get-a-project +// GitHub API docs: https://docs.github.com/en/rest/projects/projects#get-a-project func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, *Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -90,7 +90,7 @@ type ProjectOptions struct { // UpdateProject updates a repository project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#update-a-project +// GitHub API docs: https://docs.github.com/en/rest/projects/projects#update-a-project func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opts *ProjectOptions) (*Project, *Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("PATCH", u, opts) @@ -112,7 +112,7 @@ func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opts *Pro // DeleteProject deletes a GitHub Project from a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#delete-a-project +// GitHub API docs: https://docs.github.com/en/rest/projects/projects#delete-a-project func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -128,7 +128,7 @@ func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Respons // ProjectColumn represents a column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/projects/ +// GitHub API docs: https://docs.github.com/en/rest/repos/projects/ type ProjectColumn struct { ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -142,7 +142,7 @@ type ProjectColumn struct { // ListProjectColumns lists the columns of a GitHub Project for a repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-project-columns +// GitHub API docs: https://docs.github.com/en/rest/projects/columns#list-project-columns func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int64, opts *ListOptions) ([]*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/%v/columns", projectID) u, err := addOptions(u, opts) @@ -169,7 +169,7 @@ func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int6 // GetProjectColumn gets a column of a GitHub Project for a repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#get-a-project-column +// GitHub API docs: https://docs.github.com/en/rest/projects/columns#get-a-project-column func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/columns/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -199,7 +199,7 @@ type ProjectColumnOptions struct { // CreateProjectColumn creates a column for the specified (by number) project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#create-a-project-column +// GitHub API docs: https://docs.github.com/en/rest/projects/columns#create-a-project-column func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int64, opts *ProjectColumnOptions) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/%v/columns", projectID) req, err := s.client.NewRequest("POST", u, opts) @@ -221,7 +221,7 @@ func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int // UpdateProjectColumn updates a column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#update-an-existing-project-column +// GitHub API docs: https://docs.github.com/en/rest/projects/columns#update-an-existing-project-column func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int64, opts *ProjectColumnOptions) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/columns/%v", columnID) req, err := s.client.NewRequest("PATCH", u, opts) @@ -243,7 +243,7 @@ func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int6 // DeleteProjectColumn deletes a column from a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#delete-a-project-column +// GitHub API docs: https://docs.github.com/en/rest/projects/columns#delete-a-project-column func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int64) (*Response, error) { u := fmt.Sprintf("projects/columns/%v", columnID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -267,7 +267,7 @@ type ProjectColumnMoveOptions struct { // MoveProjectColumn moves a column within a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#move-a-project-column +// GitHub API docs: https://docs.github.com/en/rest/projects/columns#move-a-project-column func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, opts *ProjectColumnMoveOptions) (*Response, error) { u := fmt.Sprintf("projects/columns/%v/moves", columnID) req, err := s.client.NewRequest("POST", u, opts) @@ -283,7 +283,7 @@ func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, // ProjectCard represents a card in a column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/cards/#get-a-project-card +// GitHub API docs: https://docs.github.com/en/rest/projects/cards/#get-a-project-card type ProjectCard struct { URL *string `json:"url,omitempty"` ColumnURL *string `json:"column_url,omitempty"` @@ -318,7 +318,7 @@ type ProjectCardListOptions struct { // ListProjectCards lists the cards in a column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-project-cards +// GitHub API docs: https://docs.github.com/en/rest/projects/cards#list-project-cards func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opts *ProjectCardListOptions) ([]*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/%v/cards", columnID) u, err := addOptions(u, opts) @@ -345,7 +345,7 @@ func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, // GetProjectCard gets a card in a column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#get-a-project-card +// GitHub API docs: https://docs.github.com/en/rest/projects/cards#get-a-project-card func (s *ProjectsService) GetProjectCard(ctx context.Context, cardID int64) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", cardID) req, err := s.client.NewRequest("GET", u, nil) @@ -383,7 +383,7 @@ type ProjectCardOptions struct { // CreateProjectCard creates a card in the specified column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#create-a-project-card +// GitHub API docs: https://docs.github.com/en/rest/projects/cards#create-a-project-card func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, opts *ProjectCardOptions) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/%v/cards", columnID) req, err := s.client.NewRequest("POST", u, opts) @@ -405,7 +405,7 @@ func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, // UpdateProjectCard updates a card of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#update-an-existing-project-card +// GitHub API docs: https://docs.github.com/en/rest/projects/cards#update-an-existing-project-card func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, opts *ProjectCardOptions) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", cardID) req, err := s.client.NewRequest("PATCH", u, opts) @@ -427,7 +427,7 @@ func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, o // DeleteProjectCard deletes a card from a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#delete-a-project-card +// GitHub API docs: https://docs.github.com/en/rest/projects/cards#delete-a-project-card func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int64) (*Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", cardID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -455,7 +455,7 @@ type ProjectCardMoveOptions struct { // MoveProjectCard moves a card within a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#move-a-project-card +// GitHub API docs: https://docs.github.com/en/rest/projects/cards#move-a-project-card func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opts *ProjectCardMoveOptions) (*Response, error) { u := fmt.Sprintf("projects/columns/cards/%v/moves", cardID) req, err := s.client.NewRequest("POST", u, opts) @@ -485,7 +485,7 @@ type ProjectCollaboratorOptions struct { // AddProjectCollaborator adds a collaborator to an organization project and sets // their permission level. You must be an organization owner or a project admin to add a collaborator. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#add-project-collaborator +// GitHub API docs: https://docs.github.com/en/rest/projects/collaborators#add-project-collaborator func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64, username string, opts *ProjectCollaboratorOptions) (*Response, error) { u := fmt.Sprintf("projects/%v/collaborators/%v", id, username) req, err := s.client.NewRequest("PUT", u, opts) @@ -502,7 +502,7 @@ func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64, // RemoveProjectCollaborator removes a collaborator from an organization project. // You must be an organization owner or a project admin to remove a collaborator. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#remove-user-as-a-collaborator +// GitHub API docs: https://docs.github.com/en/rest/projects/collaborators#remove-user-as-a-collaborator func (s *ProjectsService) RemoveProjectCollaborator(ctx context.Context, id int64, username string) (*Response, error) { u := fmt.Sprintf("projects/%v/collaborators/%v", id, username) req, err := s.client.NewRequest("DELETE", u, nil) @@ -538,7 +538,7 @@ type ListCollaboratorOptions struct { // with access through default organization permissions, and organization owners. You must be an // organization owner or a project admin to list collaborators. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-project-collaborators +// GitHub API docs: https://docs.github.com/en/rest/projects/collaborators#list-project-collaborators func (s *ProjectsService) ListProjectCollaborators(ctx context.Context, id int64, opts *ListCollaboratorOptions) ([]*User, *Response, error) { u := fmt.Sprintf("projects/%v/collaborators", id) u, err := addOptions(u, opts) @@ -576,7 +576,7 @@ type ProjectPermissionLevel struct { // project. Possible values for the permission key: "admin", "write", "read", "none". // You must be an organization owner or a project admin to review a user's permission level. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#get-project-permission-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/projects/collaborators#get-project-permission-for-a-user func (s *ProjectsService) ReviewProjectCollaboratorPermission(ctx context.Context, id int64, username string) (*ProjectPermissionLevel, *Response, error) { u := fmt.Sprintf("projects/%v/collaborators/%v/permission", id, username) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/pulls.go b/github/pulls.go index 37fb7413a4..120a1d6f18 100644 --- a/github/pulls.go +++ b/github/pulls.go @@ -15,7 +15,7 @@ import ( // PullRequestsService handles communication with the pull request related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/ +// GitHub API docs: https://docs.github.com/en/rest/pulls/ type PullRequestsService service // PullRequestAutoMerge represents the "auto_merge" response for a PullRequest. @@ -143,7 +143,7 @@ type PullRequestListOptions struct { // List the pull requests for the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-pull-requests +// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#list-pull-requests func (s *PullRequestsService) List(ctx context.Context, owner string, repo string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) u, err := addOptions(u, opts) @@ -170,7 +170,7 @@ func (s *PullRequestsService) List(ctx context.Context, owner string, repo strin // The results may include open and closed pull requests. // By default, the PullRequestListOptions State filters for "open". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/commits/#list-pull-requests-associated-with-a-commit +// GitHub API docs: https://docs.github.com/en/rest/commits/commits#list-pull-requests-associated-with-a-commit func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/pulls", owner, repo, sha) u, err := addOptions(u, opts) @@ -196,7 +196,7 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow // Get a single pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#get-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string, number int) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -215,7 +215,7 @@ func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string // GetRaw gets a single pull request in raw (diff or patch) format. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#get-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo string, number int, opts RawOptions) (string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -254,7 +254,7 @@ type NewPullRequest struct { // Create a new pull request on the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#create-a-pull-request func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) req, err := s.client.NewRequest("POST", u, pull) @@ -293,7 +293,7 @@ type PullRequestBranchUpdateResponse struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#update-a-pull-request-branch +// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#update-a-pull-request-branch func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, opts *PullRequestBranchUpdateOptions) (*PullRequestBranchUpdateResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/update-branch", owner, repo, number) @@ -328,7 +328,7 @@ type pullRequestUpdate struct { // The following fields are editable: Title, Body, State, Base.Ref and MaintainerCanModify. // Base.Ref updates the base branch of the pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#update-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#update-a-pull-request func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) { if pull == nil { return nil, nil, fmt.Errorf("pull must be provided") @@ -365,7 +365,7 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo strin // ListCommits lists the commits in a pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-commits-on-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#list-commits-on-a-pull-request func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number) u, err := addOptions(u, opts) @@ -389,7 +389,7 @@ func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, rep // ListFiles lists the files in a pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-pull-requests-files +// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#list-pull-requests-files func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*CommitFile, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number) u, err := addOptions(u, opts) @@ -413,7 +413,7 @@ func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo // IsMerged checks if a pull request has been merged. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#check-if-a-pull-request-has-been-merged +// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#check-if-a-pull-request-has-been-merged func (s *PullRequestsService) IsMerged(ctx context.Context, owner string, repo string, number int) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -455,7 +455,7 @@ type pullRequestMergeRequest struct { // Merge a pull request. // commitMessage is an extra detail to append to automatic commit message. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#merge-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#merge-a-pull-request func (s *PullRequestsService) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) diff --git a/github/pulls_comments.go b/github/pulls_comments.go index 5078bab1d0..83e7881e51 100644 --- a/github/pulls_comments.go +++ b/github/pulls_comments.go @@ -66,8 +66,8 @@ type PullRequestListCommentsOptions struct { // pull request number of 0 will return all comments on all pull requests for // the repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-review-comments-on-a-pull-request -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-review-comments-in-a-repository +// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#list-review-comments-on-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#list-review-comments-in-a-repository func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo string, number int, opts *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) { var u string if number == 0 { @@ -100,7 +100,7 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri // GetComment fetches the specified pull request comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#get-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#get-a-review-comment-for-a-pull-request func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string, commentID int64) (*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) req, err := s.client.NewRequest("GET", u, nil) @@ -123,7 +123,7 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string // CreateComment creates a new comment on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#create-a-review-comment-for-a-pull-request func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) req, err := s.client.NewRequest("POST", u, comment) @@ -145,7 +145,7 @@ func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo str // CreateCommentInReplyTo creates a new comment as a reply to an existing pull request comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#create-a-review-comment-for-a-pull-request func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, repo string, number int, body string, commentID int64) (*PullRequestComment, *Response, error) { comment := &struct { Body string `json:"body,omitempty"` @@ -172,7 +172,7 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, // EditComment updates a pull request comment. // A non-nil comment.Body must be provided. Other comment fields should be left nil. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#update-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#update-a-review-comment-for-a-pull-request func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo string, commentID int64, comment *PullRequestComment) (*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) req, err := s.client.NewRequest("PATCH", u, comment) @@ -191,7 +191,7 @@ func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo strin // DeleteComment deletes a pull request comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#delete-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#delete-a-review-comment-for-a-pull-request func (s *PullRequestsService) DeleteComment(ctx context.Context, owner, repo string, commentID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/pulls_reviewers.go b/github/pulls_reviewers.go index f901c2e8a2..1c336540b8 100644 --- a/github/pulls_reviewers.go +++ b/github/pulls_reviewers.go @@ -25,7 +25,7 @@ type Reviewers struct { // RequestReviewers creates a review request for the provided reviewers for the specified pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#request-reviewers-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/review-requests#request-reviewers-for-a-pull-request func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) req, err := s.client.NewRequest("POST", u, &reviewers) @@ -44,7 +44,7 @@ func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo // ListReviewers lists reviewers whose reviews have been requested on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-requested-reviewers-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/review-requests#list-requested-reviewers-for-a-pull-request func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo string, number int, opts *ListOptions) (*Reviewers, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/requested_reviewers", owner, repo, number) u, err := addOptions(u, opts) @@ -68,7 +68,7 @@ func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo str // RemoveReviewers removes the review request for the provided reviewers for the specified pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#remove-requested-reviewers-from-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/review-requests#remove-requested-reviewers-from-a-pull-request func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*Response, error) { u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, &reviewers) diff --git a/github/pulls_reviews.go b/github/pulls_reviews.go index 437b0937be..14e20322ae 100644 --- a/github/pulls_reviews.go +++ b/github/pulls_reviews.go @@ -101,7 +101,7 @@ func (r PullRequestReviewDismissalRequest) String() string { // ListReviews lists all reviews on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-reviews-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#list-reviews-for-a-pull-request func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) u, err := addOptions(u, opts) @@ -125,7 +125,7 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin // GetReview fetches the specified pull request review. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#get-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#get-a-review-for-a-pull-request func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) @@ -145,7 +145,7 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, // DeletePendingReview deletes the specified pull request pending review. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#delete-a-pending-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#delete-a-pending-review-for-a-pull-request func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) @@ -165,7 +165,7 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re // ListReviewComments lists all the comments for the specified review. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-comments-for-a-pull-request-review +// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#list-comments-for-a-pull-request-review func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number int, reviewID int64, opts *ListOptions) ([]*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID) u, err := addOptions(u, opts) @@ -189,7 +189,7 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep // CreateReview creates a new review on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#create-a-review-for-a-pull-request // // In order to use multi-line comments, you must use the "comfort fade" preview. // This replaces the use of the "Position" field in comments with 4 new fields: @@ -250,7 +250,7 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri // UpdateReview updates the review summary on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#update-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#update-a-review-for-a-pull-request func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo string, number int, reviewID int64, body string) (*PullRequestReview, *Response, error) { opts := &struct { Body string `json:"body"` @@ -273,7 +273,7 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri // SubmitReview submits a specified review on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#submit-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#submit-a-review-for-a-pull-request func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID) @@ -293,7 +293,7 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri // DismissReview dismisses a specified review on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#dismiss-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#dismiss-a-review-for-a-pull-request func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID) diff --git a/github/reactions.go b/github/reactions.go index ecfcf2e945..14d193ae88 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -14,7 +14,7 @@ import ( // ReactionsService provides access to the reactions-related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/ +// GitHub API docs: https://docs.github.com/en/rest/reactions type ReactionsService service // Reaction represents a GitHub reaction. @@ -60,7 +60,7 @@ type ListCommentReactionOptions struct { // ListCommentReactions lists the reactions for a commit comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-commit-comment +// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-a-commit-comment func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opts) @@ -90,7 +90,7 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-commit-comment +// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-commit-comment func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) @@ -114,7 +114,7 @@ func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, rep // DeleteCommentReaction deletes the reaction for a commit comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-commit-comment-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-a-commit-comment-reaction func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) @@ -123,7 +123,7 @@ func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, rep // DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-commit-comment-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-a-commit-comment-reaction func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) @@ -132,7 +132,7 @@ func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID // ListIssueReactions lists the reactions for an issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-an-issue +// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-an-issue func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) u, err := addOptions(u, opts) @@ -162,7 +162,7 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-an-issue +// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-an-issue func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) @@ -186,7 +186,7 @@ func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo // DeleteIssueReaction deletes the reaction to an issue. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-an-issue-reaction func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID) @@ -195,7 +195,7 @@ func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo // DeleteIssueReactionByID deletes the reaction to an issue by repository ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-an-issue-reaction func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) @@ -204,7 +204,7 @@ func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, // ListIssueCommentReactions lists the reactions for an issue comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-an-issue-comment +// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-an-issue-comment func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opts) @@ -234,7 +234,7 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-an-issue-comment +// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-an-issue-comment func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) @@ -258,7 +258,7 @@ func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner // DeleteIssueCommentReaction deletes the reaction to an issue comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-comment-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-an-issue-comment-reaction func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID) @@ -267,7 +267,7 @@ func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner // DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-comment-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-an-issue-comment-reaction func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID) @@ -276,7 +276,7 @@ func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, r // ListPullRequestCommentReactions lists the reactions for a pull request review comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-pull-request-review-comment +// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-a-pull-request-review-comment func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opts) @@ -306,7 +306,7 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-pull-request-review-comment +// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-pull-request-review-comment func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) @@ -330,7 +330,7 @@ func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, // DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-pull-request-comment-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-a-pull-request-comment-reaction func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID) @@ -339,7 +339,7 @@ func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, // DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-pull-request-comment-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-a-pull-request-comment-reaction func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID) @@ -348,7 +348,7 @@ func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Cont // ListTeamDiscussionReactions lists the reactions for a team discussion. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-team-discussion-legacy +// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-a-team-discussion-legacy func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) u, err := addOptions(u, opts) @@ -375,7 +375,7 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team // CreateTeamDiscussionReaction creates a reaction for a team discussion. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-team-discussion-legacy +// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-team-discussion-legacy func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) @@ -398,7 +398,7 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea // DeleteTeamDiscussionReaction deletes the reaction to a team discussion. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-team-discussion-reaction func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID) @@ -407,7 +407,7 @@ func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org // DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-team-discussion func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) @@ -416,7 +416,7 @@ func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx cont // ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-team-discussion-comment-legacy +// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-a-team-discussion-comment-legacy func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) u, err := addOptions(u, opts) @@ -442,7 +442,7 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex // CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-team-discussion-comment-legacy +// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-team-discussion-comment-legacy func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) @@ -465,7 +465,7 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte // DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-comment-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-team-discussion-comment-reaction func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID) @@ -474,7 +474,7 @@ func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Conte // DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-comment-reaction +// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-team-discussion-comment func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) @@ -498,7 +498,7 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res // added the reaction type to this release. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-release +// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-release func (s *ReactionsService) CreateReleaseReaction(ctx context.Context, owner, repo string, releaseID int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/releases/%v/reactions", owner, repo, releaseID) diff --git a/github/repos.go b/github/repos.go index 49a64ee730..13e0887ea7 100644 --- a/github/repos.go +++ b/github/repos.go @@ -21,7 +21,7 @@ var ErrBranchNotProtected = errors.New("branch is not protected") // RepositoriesService handles communication with the repository related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/ +// GitHub API docs: https://docs.github.com/en/rest/repos/ type RepositoriesService service // Repository represents a GitHub repository. @@ -133,7 +133,7 @@ type Repository struct { TeamsURL *string `json:"teams_url,omitempty"` // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#text-match-metadata + // See: search.go and https://docs.github.com/en/rest/search/#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` // Visibility is only used for Create and Edit endpoints. The visibility field @@ -229,8 +229,8 @@ func (s SecretScanning) String() string { // List the repositories for a user. Passing the empty string will list // repositories for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repositories-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repositories-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repositories-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repositories-for-a-user func (s *RepositoriesService) List(ctx context.Context, user string, opts *RepositoryListOptions) ([]*Repository, *Response, error) { var u string if user != "" { @@ -281,7 +281,7 @@ type RepositoryListByOrgOptions struct { // ListByOrg lists the repositories for an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-organization-repositories +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-organization-repositories func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *RepositoryListByOrgOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("orgs/%v/repos", org) u, err := addOptions(u, opts) @@ -316,7 +316,7 @@ type RepositoryListAllOptions struct { // ListAll lists all GitHub repositories in the order that they were created. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-public-repositories +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-public-repositories func (s *RepositoriesService) ListAll(ctx context.Context, opts *RepositoryListAllOptions) ([]*Repository, *Response, error) { u, err := addOptions("repositories", opts) if err != nil { @@ -382,8 +382,8 @@ type createRepoRequest struct { // changes propagate throughout its servers. You may set up a loop with // exponential back-off to verify repository's creation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-repository-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-an-organization-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#create-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#create-an-organization-repository func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repository) (*Repository, *Response, error) { var u string if org != "" { @@ -444,7 +444,7 @@ type TemplateRepoRequest struct { // CreateFromTemplate generates a repository from a template. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-repository-using-a-template +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#create-a-repository-using-a-template func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, templateRepoReq *TemplateRepoRequest) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/generate", templateOwner, templateRepo) @@ -465,7 +465,7 @@ func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOw // Get fetches a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#update-a-repository func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -474,7 +474,7 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep } // TODO: remove custom Accept header when the license support fully launches - // https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#get-a-repositorys-license + // https://docs.github.com/en/rest/licenses/#get-a-repositorys-license acceptHeaders := []string{ mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview, @@ -493,10 +493,12 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep } // GetCodeOfConduct gets the contents of a repository's code of conduct. +// Note that https://docs.github.com/en/rest/codes-of-conduct#about-the-codes-of-conduct-api +// says to use the GET /repos/{owner}/{repo} endpoint. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/codes-of-conduct/#get-the-code-of-conduct-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#update-a-repository func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo string) (*CodeOfConduct, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/community/code_of_conduct", owner, repo) + u := fmt.Sprintf("repos/%v/%v", owner, repo) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -505,13 +507,13 @@ func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) - coc := new(CodeOfConduct) - resp, err := s.client.Do(ctx, req, coc) + r := new(Repository) + resp, err := s.client.Do(ctx, req, r) if err != nil { return nil, resp, err } - return coc, resp, nil + return r.GetCodeOfConduct(), resp, nil } // GetByID fetches a repository. @@ -535,7 +537,7 @@ func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repositor // Edit updates a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#update-a-repository func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *Repository) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) req, err := s.client.NewRequest("PATCH", u, repository) @@ -556,7 +558,7 @@ func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repo // Delete a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#delete-a-repository func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) @@ -603,7 +605,7 @@ type ListContributorsOptions struct { // GetVulnerabilityAlerts checks if vulnerability alerts are enabled for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#check-if-vulnerability-alerts-are-enabled-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#check-if-vulnerability-alerts-are-enabled-for-a-repository func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, repository string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) @@ -622,7 +624,7 @@ func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, // EnableVulnerabilityAlerts enables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#enable-vulnerability-alerts +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#enable-vulnerability-alerts func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) @@ -639,7 +641,7 @@ func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, own // DisableVulnerabilityAlerts disables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#disable-vulnerability-alerts +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#disable-vulnerability-alerts func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) @@ -656,7 +658,7 @@ func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, ow // EnableAutomatedSecurityFixes enables the automated security fixes for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#enable-automated-security-fixes +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#enable-automated-security-fixes func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) @@ -673,7 +675,7 @@ func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, // DisableAutomatedSecurityFixes disables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#disable-automated-security-fixes +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#disable-automated-security-fixes func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) @@ -690,7 +692,7 @@ func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, // ListContributors lists contributors for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-contributors +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repository-contributors func (s *RepositoriesService) ListContributors(ctx context.Context, owner string, repository string, opts *ListContributorsOptions) ([]*Contributor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository) u, err := addOptions(u, opts) @@ -721,7 +723,7 @@ func (s *RepositoriesService) ListContributors(ctx context.Context, owner string // "Python": 7769 // } // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-languages +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repository-languages func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, repo string) (map[string]int, *Response, error) { u := fmt.Sprintf("repos/%v/%v/languages", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -740,7 +742,7 @@ func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, r // ListTeams lists the teams for the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-teams +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repository-teams func (s *RepositoriesService) ListTeams(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/teams", owner, repo) u, err := addOptions(u, opts) @@ -772,7 +774,7 @@ type RepositoryTag struct { // ListTags lists tags for the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-tags +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repository-tags func (s *RepositoriesService) ListTags(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*RepositoryTag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/tags", owner, repo) u, err := addOptions(u, opts) @@ -1032,7 +1034,7 @@ type SignaturesProtectedBranch struct { // ListBranches lists branches for the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-branches +// GitHub API docs: https://docs.github.com/en/rest/branches/branches#list-branches func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, repo string, opts *BranchListOptions) ([]*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches", owner, repo) u, err := addOptions(u, opts) @@ -1056,7 +1058,7 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re // GetBranch gets the specified branch for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-branch +// GitHub API docs: https://docs.github.com/en/rest/branches/branches#get-a-branch func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string, followRedirects bool) (*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v", owner, repo, branch) @@ -1085,7 +1087,7 @@ type renameBranchRequest struct { // To rename a non-default branch: Users must have push access. GitHub Apps must have the `contents:write` repository permission. // To rename the default branch: Users must have admin or owner permissions. GitHub Apps must have the `administration:write` repository permission. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#rename-a-branch +// GitHub API docs: https://docs.github.com/en/rest/branches/branches#rename-a-branch func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, branch, newName string) (*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/rename", owner, repo, branch) r := &renameBranchRequest{NewName: newName} @@ -1105,7 +1107,7 @@ func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, bra // GetBranchProtection gets the protection of a given branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-branch-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-branch-protection func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch) req, err := s.client.NewRequest("GET", u, nil) @@ -1130,7 +1132,7 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re // GetRequiredStatusChecks gets the required status checks for a given protected branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-status-checks-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-status-checks-protection func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*RequiredStatusChecks, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch) req, err := s.client.NewRequest("GET", u, nil) @@ -1152,7 +1154,7 @@ func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner // ListRequiredStatusChecksContexts lists the required status checks contexts for a given protected branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-all-status-check-contexts +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-all-status-check-contexts func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Context, owner, repo, branch string) (contexts []string, resp *Response, err error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks/contexts", owner, repo, branch) req, err := s.client.NewRequest("GET", u, nil) @@ -1173,7 +1175,7 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte // UpdateBranchProtection updates the protection of a given branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-branch-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-branch-protection func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch) req, err := s.client.NewRequest("PUT", u, preq) @@ -1195,7 +1197,7 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, // RemoveBranchProtection removes the protection of a given branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-branch-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-branch-protection func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch) req, err := s.client.NewRequest("DELETE", u, nil) @@ -1208,7 +1210,7 @@ func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, // GetSignaturesProtectedBranch gets required signatures of protected branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-commit-signature-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-commit-signature-protection func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch) req, err := s.client.NewRequest("GET", u, nil) @@ -1231,7 +1233,7 @@ func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, // RequireSignaturesOnProtectedBranch makes signed commits required on a protected branch. // It requires admin access and branch protection to be enabled. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-commit-signature-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#create-commit-signature-protection func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch) req, err := s.client.NewRequest("POST", u, nil) @@ -1253,7 +1255,7 @@ func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Con // OptionalSignaturesOnProtectedBranch removes required signed commits on a given branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-commit-signature-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-commit-signature-protection func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch) req, err := s.client.NewRequest("DELETE", u, nil) @@ -1269,7 +1271,7 @@ func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Co // UpdateRequiredStatusChecks updates the required status checks for a given protected branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-status-check-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-status-check-protection func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch) req, err := s.client.NewRequest("PATCH", u, sreq) @@ -1288,7 +1290,7 @@ func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, ow // RemoveRequiredStatusChecks removes the required status checks for a given protected branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#remove-status-check-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#remove-status-check-protection func (s *RepositoriesService) RemoveRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch) req, err := s.client.NewRequest("DELETE", u, nil) @@ -1301,7 +1303,7 @@ func (s *RepositoriesService) RemoveRequiredStatusChecks(ctx context.Context, ow // License gets the contents of a repository's license if one is detected. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#get-the-license-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/licenses#get-the-license-for-a-repository func (s *RepositoriesService) License(ctx context.Context, owner, repo string) (*RepositoryLicense, *Response, error) { u := fmt.Sprintf("repos/%v/%v/license", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -1320,7 +1322,7 @@ func (s *RepositoriesService) License(ctx context.Context, owner, repo string) ( // GetPullRequestReviewEnforcement gets pull request review enforcement of a protected branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-pull-request-review-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-pull-request-review-protection func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) req, err := s.client.NewRequest("GET", u, nil) @@ -1343,7 +1345,7 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex // UpdatePullRequestReviewEnforcement patches pull request review enforcement of a protected branch. // It requires admin access and branch protection to be enabled. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-pull-request-review-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-pull-request-review-protection func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) req, err := s.client.NewRequest("PATCH", u, patch) @@ -1366,7 +1368,7 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con // DisableDismissalRestrictions disables dismissal restrictions of a protected branch. // It requires admin access and branch protection to be enabled. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-pull-request-review-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-pull-request-review-protection func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) @@ -1393,7 +1395,7 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, // RemovePullRequestReviewEnforcement removes pull request enforcement of a protected branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-pull-request-review-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-pull-request-review-protection func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) req, err := s.client.NewRequest("DELETE", u, nil) @@ -1406,7 +1408,7 @@ func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Con // GetAdminEnforcement gets admin enforcement information of a protected branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-admin-branch-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-admin-branch-protection func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch) req, err := s.client.NewRequest("GET", u, nil) @@ -1426,7 +1428,7 @@ func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, re // AddAdminEnforcement adds admin enforcement to a protected branch. // It requires admin access and branch protection to be enabled. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#set-admin-branch-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#set-admin-branch-protection func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch) req, err := s.client.NewRequest("POST", u, nil) @@ -1445,7 +1447,7 @@ func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, re // RemoveAdminEnforcement removes admin enforcement from a protected branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-admin-branch-protection +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-admin-branch-protection func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch) req, err := s.client.NewRequest("DELETE", u, nil) @@ -1463,7 +1465,7 @@ type repositoryTopics struct { // ListAllTopics lists topics for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-all-repository-topics +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#get-all-repository-topics func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string) ([]string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/topics", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -1483,9 +1485,9 @@ func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo str return topics.Names, resp, nil } -// ReplaceAllTopics replaces topics for a repository. +// ReplaceAllTopics replaces all repository topics. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#replace-all-repository-topics +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#replace-all-repository-topics func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo string, topics []string) ([]string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/topics", owner, repo) t := &repositoryTopics{ @@ -1514,7 +1516,7 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo // ListApps lists the GitHub apps that have push access to a given protected branch. // It requires the GitHub apps to have `write` access to the `content` permission. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-apps-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch) req, err := s.client.NewRequest("GET", u, nil) @@ -1537,7 +1539,7 @@ func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch // // Note: The list of users, apps, and teams in total is limited to 100 items. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#set-app-access-restrictions +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#set-app-access-restrictions func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, slug []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch) req, err := s.client.NewRequest("PUT", u, slug) @@ -1559,7 +1561,7 @@ func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, // // Note: The list of users, apps, and teams in total is limited to 100 items. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#add-app-access-restrictions +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#add-app-access-restrictions func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, slug []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch) req, err := s.client.NewRequest("POST", u, slug) @@ -1581,7 +1583,7 @@ func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, rep // // Note: The list of users, apps, and teams in total is limited to 100 items. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#remove-app-access-restrictions +// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#remove-app-access-restrictions func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, repo, branch string, slug []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch) req, err := s.client.NewRequest("DELETE", u, slug) @@ -1612,7 +1614,7 @@ type TransferRequest struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#transfer-a-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#transfer-a-repository func (s *RepositoriesService) Transfer(ctx context.Context, owner, repo string, transfer TransferRequest) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/transfer", owner, repo) @@ -1641,7 +1643,7 @@ type DispatchRequestOptions struct { // Dispatch triggers a repository_dispatch event in a GitHub Actions workflow. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-repository-dispatch-event +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#create-a-repository-dispatch-event func (s *RepositoriesService) Dispatch(ctx context.Context, owner, repo string, opts DispatchRequestOptions) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/dispatches", owner, repo) diff --git a/github/repos_actions_allowed.go b/github/repos_actions_allowed.go index 2770fcccf6..25a4690583 100644 --- a/github/repos_actions_allowed.go +++ b/github/repos_actions_allowed.go @@ -10,9 +10,9 @@ import ( "fmt" ) -// GetActionsAllowed gets the actions that are allowed in a repository. +// GetActionsAllowed gets the allowed actions and reusable workflows for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#get-allowed-actions-and-workflows-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, org, repo string) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -29,9 +29,9 @@ func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, org, repo s return actionsAllowed, resp, nil } -// EditActionsAllowed sets the actions that are allowed in a repository. +// EditActionsAllowed sets the allowed actions and reusable workflows for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#set-allowed-actions-and-workflows-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository func (s *RepositoriesService) EditActionsAllowed(ctx context.Context, org, repo string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo) req, err := s.client.NewRequest("PUT", u, actionsAllowed) diff --git a/github/repos_actions_permissions.go b/github/repos_actions_permissions.go index bff8c2f5ab..45f844cec0 100644 --- a/github/repos_actions_permissions.go +++ b/github/repos_actions_permissions.go @@ -12,7 +12,7 @@ import ( // ActionsPermissionsRepository represents a policy for repositories and allowed actions in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#set-github-actions-permissions-for-a-repository--parameters +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions type ActionsPermissionsRepository struct { Enabled *bool `json:"enabled,omitempty"` AllowedActions *string `json:"allowed_actions,omitempty"` @@ -25,7 +25,7 @@ func (a ActionsPermissionsRepository) String() string { // GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#get-github-actions-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-github-actions-permissions-for-a-repository func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, repo string) (*ActionsPermissionsRepository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -44,7 +44,7 @@ func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, // EditActionsPermissions sets the permissions policy for repositories and allowed actions in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/actions#set-github-actions-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-github-actions-permissions-for-a-repository func (s *RepositoriesService) EditActionsPermissions(ctx context.Context, owner, repo string, actionsPermissionsRepository ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) req, err := s.client.NewRequest("PUT", u, actionsPermissionsRepository) diff --git a/github/repos_autolinks.go b/github/repos_autolinks.go index b6404783eb..8fa916eac2 100644 --- a/github/repos_autolinks.go +++ b/github/repos_autolinks.go @@ -26,7 +26,7 @@ type Autolink struct { // ListAutolinks returns a list of autolinks configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#list-all-autolinks-of-a-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/autolinks#list-all-autolinks-of-a-repository func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) u, err := addOptions(u, opts) @@ -51,7 +51,7 @@ func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo str // AddAutolink creates an autolink reference for a repository. // Users with admin access to the repository can create an autolink. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#create-an-autolink-reference-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/autolinks#create-an-autolink-reference-for-a-repository func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo string, opts *AutolinkOptions) (*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) req, err := s.client.NewRequest("POST", u, opts) @@ -70,7 +70,7 @@ func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo strin // GetAutolink returns a single autolink reference by ID that was configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#get-an-autolink-reference-of-a-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/autolinks#get-an-autolink-reference-of-a-repository func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo string, id int64) (*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) @@ -91,7 +91,7 @@ func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo strin // DeleteAutolink deletes a single autolink reference by ID that was configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#delete-an-autolink-reference-from-a-repository +// GitHub API docs: https://docs.github.com/en/rest/repos/autolinks#delete-an-autolink-reference-from-a-repository func (s *RepositoriesService) DeleteAutolink(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/repos_collaborators.go b/github/repos_collaborators.go index dcb97b5ed2..abc4161c3b 100644 --- a/github/repos_collaborators.go +++ b/github/repos_collaborators.go @@ -27,7 +27,7 @@ type ListCollaboratorsOptions struct { } // CollaboratorInvitation represents an invitation created when adding a collaborator. -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/collaborators/#response-when-a-new-invitation-is-created +// GitHub API docs: https://docs.github.com/en/rest/repos/collaborators/#response-when-a-new-invitation-is-created type CollaboratorInvitation struct { ID *int64 `json:"id,omitempty"` Repo *Repository `json:"repository,omitempty"` @@ -41,7 +41,7 @@ type CollaboratorInvitation struct { // ListCollaborators lists the GitHub users that have access to the repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-collaborators +// GitHub API docs: https://docs.github.com/en/rest/collaborators/collaborators#list-repository-collaborators func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opts *ListCollaboratorsOptions) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators", owner, repo) u, err := addOptions(u, opts) @@ -68,7 +68,7 @@ func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo // Note: This will return false if the user is not a collaborator OR the user // is not a GitHub user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#check-if-a-user-is-a-repository-collaborator +// GitHub API docs: https://docs.github.com/en/rest/collaborators/collaborators#check-if-a-user-is-a-repository-collaborator func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) req, err := s.client.NewRequest("GET", u, nil) @@ -91,7 +91,8 @@ type RepositoryPermissionLevel struct { } // GetPermissionLevel retrieves the specific permission level a collaborator has for a given repository. -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-repository-permissions-for-a-user +// +// GitHub API docs: https://docs.github.com/en/rest/collaborators/collaborators#get-repository-permissions-for-a-user func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, repo, user string) (*RepositoryPermissionLevel, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v/permission", owner, repo, user) req, err := s.client.NewRequest("GET", u, nil) @@ -126,7 +127,7 @@ type RepositoryAddCollaboratorOptions struct { // AddCollaborator sends an invitation to the specified GitHub user // to become a collaborator to the given repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#add-a-repository-collaborator +// GitHub API docs: https://docs.github.com/en/rest/collaborators/collaborators#add-a-repository-collaborator func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, opts *RepositoryAddCollaboratorOptions) (*CollaboratorInvitation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) req, err := s.client.NewRequest("PUT", u, opts) @@ -146,7 +147,7 @@ func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, // RemoveCollaborator removes the specified GitHub user as collaborator from the given repo. // Note: Does not return error if a valid user that is not a collaborator is removed. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#remove-a-repository-collaborator +// GitHub API docs: https://docs.github.com/en/rest/collaborators/collaborators#remove-a-repository-collaborator func (s *RepositoriesService) RemoveCollaborator(ctx context.Context, owner, repo, user string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/repos_comments.go b/github/repos_comments.go index 912eeba3fb..55a88d1f5e 100644 --- a/github/repos_comments.go +++ b/github/repos_comments.go @@ -36,7 +36,7 @@ func (r RepositoryComment) String() string { // ListComments lists all the comments for the repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-commit-comments-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/commits/comments#list-commit-comments-for-a-repository func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments", owner, repo) u, err := addOptions(u, opts) @@ -63,7 +63,7 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri // ListCommitComments lists all the comments for a given commit SHA. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-commit-comments +// GitHub API docs: https://docs.github.com/en/rest/commits/comments#list-commit-comments func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha) u, err := addOptions(u, opts) @@ -91,7 +91,7 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep // CreateComment creates a comment for the given commit. // Note: GitHub allows for comments to be created for non-existing files and positions. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-commit-comment +// GitHub API docs: https://docs.github.com/en/rest/commits/comments#create-a-commit-comment func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha) req, err := s.client.NewRequest("POST", u, comment) @@ -110,7 +110,7 @@ func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sh // GetComment gets a single comment from a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-commit-comment +// GitHub API docs: https://docs.github.com/en/rest/commits/comments#get-a-commit-comment func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int64) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -132,7 +132,7 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string // UpdateComment updates the body of a single comment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-commit-comment +// GitHub API docs: https://docs.github.com/en/rest/commits/comments#update-a-commit-comment func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, comment *RepositoryComment) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, comment) @@ -151,7 +151,7 @@ func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo str // DeleteComment deletes a single comment from a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-commit-comment +// GitHub API docs: https://docs.github.com/en/rest/commits/comments#delete-a-commit-comment func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/repos_commits.go b/github/repos_commits.go index ce3b48e3c5..d1fb577c61 100644 --- a/github/repos_commits.go +++ b/github/repos_commits.go @@ -124,7 +124,7 @@ type BranchCommit struct { // ListCommits lists the commits of a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-commits +// GitHub API docs: https://docs.github.com/en/rest/commits/commits#list-commits func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo string, opts *CommitsListOptions) ([]*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits", owner, repo) u, err := addOptions(u, opts) @@ -148,8 +148,8 @@ func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo strin // GetCommit fetches the specified commit, including all details about it. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-single-commit -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-commit +// GitHub API docs: https://docs.github.com/en/rest/commits/commits#get-a-single-commit +// GitHub API docs: https://docs.github.com/en/rest/commits/commits#get-a-commit func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) (*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha) u, err := addOptions(u, opts) @@ -173,7 +173,7 @@ func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha st // GetCommitRaw fetches the specified commit in raw (diff or patch) format. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-commit +// GitHub API docs: https://docs.github.com/en/rest/commits/commits#get-a-commit func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, repo string, sha string, opts RawOptions) (string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -202,7 +202,7 @@ func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, re // GetCommitSHA1 gets the SHA-1 of a commit reference. If a last-known SHA1 is // supplied and no new commits have occurred, a 304 Unmodified response is returned. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-commit +// GitHub API docs: https://docs.github.com/en/rest/commits/commits#get-a-commit func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, refURLEscape(ref)) @@ -227,7 +227,7 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re // CompareCommits compares a range of commits with each other. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#compare-two-commits +// GitHub API docs: https://docs.github.com/en/rest/commits/commits#compare-two-commits func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string, opts *ListOptions) (*CommitsComparison, *Response, error) { escapedBase := url.QueryEscape(base) escapedHead := url.QueryEscape(head) @@ -258,7 +258,7 @@ func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo st // To compare branches across other repositories in the same network as "repo", // use the format ":branch". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#compare-two-commits +// GitHub API docs: https://docs.github.com/en/rest/commits/commits#compare-two-commits func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo, base, head string, opts RawOptions) (string, *Response, error) { escapedBase := url.QueryEscape(base) escapedHead := url.QueryEscape(head) @@ -291,7 +291,7 @@ func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo // ListBranchesHeadCommit gets all branches where the given commit SHA is the HEAD, // or latest commit for the branch. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-branches-for-head-commit +// GitHub API docs: https://docs.github.com/en/rest/commits/commits#list-branches-for-head-commit func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, repo, sha string) ([]*BranchCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/branches-where-head", owner, repo, sha) diff --git a/github/repos_community_health.go b/github/repos_community_health.go index 92e4d082ce..9de438b625 100644 --- a/github/repos_community_health.go +++ b/github/repos_community_health.go @@ -44,7 +44,7 @@ type CommunityHealthMetrics struct { // GetCommunityHealthMetrics retrieves all the community health metrics for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#get-community-profile-metrics +// GitHub API docs: https://docs.github.com/en/rest/metrics/community#get-community-profile-metrics func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, owner, repo string) (*CommunityHealthMetrics, *Response, error) { u := fmt.Sprintf("repos/%v/%v/community/profile", owner, repo) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/repos_contents.go b/github/repos_contents.go index 3175137250..d6f2dd9d74 100644 --- a/github/repos_contents.go +++ b/github/repos_contents.go @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file. // Repository contents API methods. -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/contents/ +// GitHub API docs: https://docs.github.com/en/rest/repos/contents/ package github @@ -95,7 +95,7 @@ func (r *RepositoryContent) GetContent() (string, error) { // GetReadme gets the Readme file for the repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-repository-readme +// GitHub API docs: https://docs.github.com/en/rest/repos/contents#get-a-repository-readme func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, opts *RepositoryContentGetOptions) (*RepositoryContent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/readme", owner, repo) u, err := addOptions(u, opts) @@ -192,7 +192,7 @@ func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owne // as possible, both result types will be returned but only one will contain a // value and the other will be nil. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-repository-content +// GitHub API docs: https://docs.github.com/en/rest/repos/contents#get-repository-content func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string, opts *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error) { escapedPath := (&url.URL{Path: strings.TrimSuffix(path, "/")}).String() u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, escapedPath) @@ -228,7 +228,7 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path // CreateFile creates a new file in a repository at the given path and returns // the commit and file metadata. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-or-update-file-contents +// GitHub API docs: https://docs.github.com/en/rest/repos/contents#create-or-update-file-contents func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) req, err := s.client.NewRequest("PUT", u, opts) @@ -248,7 +248,7 @@ func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path // UpdateFile updates a file in a repository at the given path and returns the // commit and file metadata. Requires the blob SHA of the file being updated. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-or-update-file-contents +// GitHub API docs: https://docs.github.com/en/rest/repos/contents#create-or-update-file-contents func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) req, err := s.client.NewRequest("PUT", u, opts) @@ -268,7 +268,7 @@ func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path // DeleteFile deletes a file from a repository and returns the commit. // Requires the blob SHA of the file to be deleted. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-file +// GitHub API docs: https://docs.github.com/en/rest/repos/contents#delete-a-file func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) req, err := s.client.NewRequest("DELETE", u, opts) @@ -300,7 +300,7 @@ const ( // repository. The archiveFormat can be specified by either the github.Tarball // or github.Zipball constant. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/contents/#get-archive-link +// GitHub API docs: https://docs.github.com/en/rest/repos/contents/#get-archive-link func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat ArchiveFormat, opts *RepositoryContentGetOptions, followRedirects bool) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%s/%s/%s", owner, repo, archiveformat) if opts != nil && opts.Ref != "" { diff --git a/github/repos_deployments.go b/github/repos_deployments.go index 7308bcebe5..36445f895e 100644 --- a/github/repos_deployments.go +++ b/github/repos_deployments.go @@ -63,7 +63,7 @@ type DeploymentsListOptions struct { // ListDeployments lists the deployments of a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-deployments +// GitHub API docs: https://docs.github.com/en/rest/deployments/deployments#list-deployments func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo string, opts *DeploymentsListOptions) ([]*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo) u, err := addOptions(u, opts) @@ -87,7 +87,7 @@ func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo s // GetDeployment returns a single deployment of a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-deployment +// GitHub API docs: https://docs.github.com/en/rest/deployments/deployments#get-a-deployment func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) @@ -107,7 +107,7 @@ func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo str // CreateDeployment creates a new deployment for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-deployment +// GitHub API docs: https://docs.github.com/en/rest/deployments/deployments#create-a-deployment func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo) @@ -131,7 +131,7 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo // DeleteDeployment deletes an existing deployment for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-deployment +// GitHub API docs: https://docs.github.com/en/rest/deployments/deployments#delete-a-deployment func (s *RepositoriesService) DeleteDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -175,7 +175,7 @@ type DeploymentStatusRequest struct { // ListDeploymentStatuses lists the statuses of a given deployment of a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-deployment-statuses +// GitHub API docs: https://docs.github.com/en/rest/deployments/statuses#list-deployment-statuses func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int64, opts *ListOptions) ([]*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment) u, err := addOptions(u, opts) @@ -203,7 +203,7 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, // GetDeploymentStatus returns a single deployment status of a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-deployment-status +// GitHub API docs: https://docs.github.com/en/rest/deployments/statuses#get-a-deployment-status func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int64) (*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses/%v", owner, repo, deploymentID, deploymentStatusID) @@ -227,7 +227,7 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re // CreateDeploymentStatus creates a new status for a deployment. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-deployment-status +// GitHub API docs: https://docs.github.com/en/rest/deployments/statuses#create-a-deployment-status func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment) diff --git a/github/repos_environments.go b/github/repos_environments.go index 5dd454289c..365f8d9202 100644 --- a/github/repos_environments.go +++ b/github/repos_environments.go @@ -104,7 +104,7 @@ func (r *RequiredReviewer) UnmarshalJSON(data []byte) error { // ListEnvironments lists all environments for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#get-all-environments +// GitHub API docs: https://docs.github.com/en/rest/deployments/environments#get-all-environments func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo string, opts *EnvironmentListOptions) (*EnvResponse, *Response, error) { u := fmt.Sprintf("repos/%s/%s/environments", owner, repo) u, err := addOptions(u, opts) @@ -127,7 +127,7 @@ func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo // GetEnvironment get a single environment for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#get-an-environment +// GitHub API docs: https://docs.github.com/en/rest/deployments/environments#get-an-environment func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, name string) (*Environment, *Response, error) { u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) @@ -170,7 +170,7 @@ type CreateUpdateEnvironment struct { // CreateUpdateEnvironment create or update a new environment for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#create-or-update-an-environment +// GitHub API docs: https://docs.github.com/en/rest/deployments/environments#create-or-update-an-environment func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner, repo, name string, environment *CreateUpdateEnvironment) (*Environment, *Response, error) { u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) @@ -189,7 +189,7 @@ func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner // DeleteEnvironment delete an environment from a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#delete-an-environment +// GitHub API docs: https://docs.github.com/en/rest/deployments/environments#delete-an-environment func (s *RepositoriesService) DeleteEnvironment(ctx context.Context, owner, repo, name string) (*Response, error) { u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) diff --git a/github/repos_forks.go b/github/repos_forks.go index 74b9b445ea..97bb328ffb 100644 --- a/github/repos_forks.go +++ b/github/repos_forks.go @@ -24,7 +24,7 @@ type RepositoryListForksOptions struct { // ListForks lists the forks of the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-forks +// GitHub API docs: https://docs.github.com/en/rest/repos/forks#list-forks func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opts *RepositoryListForksOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/forks", owner, repo) u, err := addOptions(u, opts) @@ -65,7 +65,7 @@ type RepositoryCreateForkOptions struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-fork +// GitHub API docs: https://docs.github.com/en/rest/repos/forks#create-a-fork func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opts *RepositoryCreateForkOptions) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/forks", owner, repo) u, err := addOptions(u, opts) diff --git a/github/repos_hooks.go b/github/repos_hooks.go index 61c8521993..4e738cfe8c 100644 --- a/github/repos_hooks.go +++ b/github/repos_hooks.go @@ -77,7 +77,7 @@ type createHookRequest struct { // Note that only a subset of the hook fields are used and hook must // not be nil. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-repository-webhook +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#create-a-repository-webhook func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo) @@ -104,7 +104,7 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string // ListHooks lists all Hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-webhooks +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#list-repository-webhooks func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Hook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo) u, err := addOptions(u, opts) @@ -128,7 +128,7 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, // GetHook returns a single specified Hook. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-repository-webhook +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#get-a-repository-webhook func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -146,7 +146,7 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i // EditHook updates a specified Hook. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-repository-webhook +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#update-a-repository-webhook func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, hook) @@ -164,7 +164,7 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, // DeleteHook deletes a specified Hook. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-repository-webhook +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#delete-a-repository-webhook func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -176,7 +176,7 @@ func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string // PingHook triggers a 'ping' event to be sent to the Hook. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#ping-a-repository-webhook +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#ping-a-repository-webhook func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id) req, err := s.client.NewRequest("POST", u, nil) @@ -188,7 +188,7 @@ func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, // TestHook triggers a test Hook by github. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#test-the-push-repository-webhook +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#test-the-push-repository-webhook func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/repos_hooks_deliveries.go b/github/repos_hooks_deliveries.go index 7420b59e7c..cbd2d3819a 100644 --- a/github/repos_hooks_deliveries.go +++ b/github/repos_hooks_deliveries.go @@ -14,8 +14,8 @@ import ( // HookDelivery represents the data that is received from GitHub's Webhook Delivery API // // GitHub API docs: -// - https://docs.github.com/en/rest/reference/repos#list-deliveries-for-a-repository-webhook -// - https://docs.github.com/en/rest/reference/repos#get-a-delivery-for-a-repository-webhook +// - https://docs.github.com/en/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook +// - https://docs.github.com/en/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook type HookDelivery struct { ID *int64 `json:"id,omitempty"` GUID *string `json:"guid,omitempty"` @@ -63,7 +63,7 @@ func (r HookResponse) String() string { // ListHookDeliveries lists webhook deliveries for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#list-deliveries-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, repo string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries", owner, repo, id) u, err := addOptions(u, opts) @@ -87,7 +87,7 @@ func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, rep // GetHookDelivery returns a delivery for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/repos#get-a-delivery-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries/%v", owner, repo, hookID, deliveryID) req, err := s.client.NewRequest("GET", u, nil) @@ -106,7 +106,7 @@ func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo s // RedeliverHookDelivery redelivers a delivery for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/webhooks#redeliver-a-delivery-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repo-deliveries#redeliver-a-delivery-for-a-repository-webhook func (s *RepositoriesService) RedeliverHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries/%v/attempts", owner, repo, hookID, deliveryID) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/repos_invitations.go b/github/repos_invitations.go index 79dd57889b..81956cd49c 100644 --- a/github/repos_invitations.go +++ b/github/repos_invitations.go @@ -27,7 +27,7 @@ type RepositoryInvitation struct { // ListInvitations lists all currently-open repository invitations. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-invitations +// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#list-repository-invitations func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryInvitation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/invitations", owner, repo) u, err := addOptions(u, opts) @@ -51,7 +51,7 @@ func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo s // DeleteInvitation deletes a repository invitation. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-repository-invitation +// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#delete-a-repository-invitation func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo string, invitationID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -68,7 +68,7 @@ func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo // permissions represents the permissions that the associated user will have // on the repository. Possible values are: "read", "write", "admin". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-repository-invitation +// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#update-a-repository-invitation func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo string, invitationID int64, permissions string) (*RepositoryInvitation, *Response, error) { opts := &struct { Permissions string `json:"permissions"` diff --git a/github/repos_keys.go b/github/repos_keys.go index 3e127ae435..42c5de4970 100644 --- a/github/repos_keys.go +++ b/github/repos_keys.go @@ -14,7 +14,7 @@ import ( // ListKeys lists the deploy keys for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-deploy-keys +// GitHub API docs: https://docs.github.com/en/rest/deploy-keys#list-deploy-keys func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) u, err := addOptions(u, opts) @@ -38,7 +38,7 @@ func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo s // GetKey fetches a single deploy key. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-deploy-key +// GitHub API docs: https://docs.github.com/en/rest/deploy-keys#get-a-deploy-key func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int64) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) @@ -58,7 +58,7 @@ func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo str // CreateKey adds a deploy key for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-deploy-key +// GitHub API docs: https://docs.github.com/en/rest/deploy-keys#create-a-deploy-key func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo string, key *Key) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) @@ -78,7 +78,7 @@ func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo // DeleteKey deletes a deploy key. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-deploy-key +// GitHub API docs: https://docs.github.com/en/rest/deploy-keys#delete-a-deploy-key func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) diff --git a/github/repos_merging.go b/github/repos_merging.go index a8d860742c..66e88452e8 100644 --- a/github/repos_merging.go +++ b/github/repos_merging.go @@ -34,7 +34,7 @@ type RepoMergeUpstreamResult struct { // Merge a branch in the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#merge-a-branch +// GitHub API docs: https://docs.github.com/en/rest/branches/branches#merge-a-branch func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/merges", owner, repo) req, err := s.client.NewRequest("POST", u, request) @@ -54,7 +54,7 @@ func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, req // MergeUpstream syncs a branch of a forked repository to keep it up-to-date // with the upstream repository. // -// GitHub API docs: https://docs.github.com/en/rest/reference/branches#sync-a-fork-branch-with-the-upstream-repository +// GitHub API docs: https://docs.github.com/en/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository func (s *RepositoriesService) MergeUpstream(ctx context.Context, owner, repo string, request *RepoMergeUpstreamRequest) (*RepoMergeUpstreamResult, *Response, error) { u := fmt.Sprintf("repos/%v/%v/merge-upstream", owner, repo) req, err := s.client.NewRequest("POST", u, request) diff --git a/github/repos_pages.go b/github/repos_pages.go index 60a756b647..9b864eb090 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -63,7 +63,7 @@ type createPagesRequest struct { // EnablePages enables GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-github-pages-site +// GitHub API docs: https://docs.github.com/en/rest/pages#create-a-github-pages-site func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo string, pages *Pages) (*Pages, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) @@ -106,7 +106,7 @@ type PagesUpdate struct { // UpdatePages updates GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-information-about-a-github-pages-site +// GitHub API docs: https://docs.github.com/en/rest/pages#update-information-about-a-github-pages-site func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, opts *PagesUpdate) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) @@ -125,7 +125,7 @@ func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo strin // DisablePages disables GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-github-pages-site +// GitHub API docs: https://docs.github.com/en/rest/pages#delete-a-github-pages-site func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) @@ -141,7 +141,7 @@ func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo stri // GetPagesInfo fetches information about a GitHub Pages site. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-github-pages-site +// GitHub API docs: https://docs.github.com/en/rest/pages#get-a-github-pages-site func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo string) (*Pages, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -160,7 +160,7 @@ func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo stri // ListPagesBuilds lists the builds for a GitHub Pages site. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-github-pages-builds +// GitHub API docs: https://docs.github.com/en/rest/pages#list-github-pages-builds func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo) u, err := addOptions(u, opts) @@ -184,7 +184,7 @@ func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo s // GetLatestPagesBuild fetches the latest build information for a GitHub pages site. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-latest-pages-build +// GitHub API docs: https://docs.github.com/en/rest/pages#get-latest-pages-build func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds/latest", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -203,7 +203,7 @@ func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, re // GetPageBuild fetches the specific build information for a GitHub pages site. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-github-pages-build +// GitHub API docs: https://docs.github.com/en/rest/pages#get-github-pages-build func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int64) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -222,7 +222,7 @@ func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo stri // RequestPageBuild requests a build of a GitHub Pages site without needing to push new commit. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#request-a-github-pages-build +// GitHub API docs: https://docs.github.com/en/rest/pages#request-a-github-pages-build func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/repos_projects.go b/github/repos_projects.go index 1938d51b9b..a3001dee98 100644 --- a/github/repos_projects.go +++ b/github/repos_projects.go @@ -21,7 +21,7 @@ type ProjectListOptions struct { // ListProjects lists the projects for a repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-repository-projects +// GitHub API docs: https://docs.github.com/en/rest/projects/projects#list-repository-projects func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo string, opts *ProjectListOptions) ([]*Project, *Response, error) { u := fmt.Sprintf("repos/%v/%v/projects", owner, repo) u, err := addOptions(u, opts) @@ -48,7 +48,7 @@ func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo stri // CreateProject creates a GitHub Project for the specified repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#create-a-repository-project +// GitHub API docs: https://docs.github.com/en/rest/projects/projects#create-a-repository-project func (s *RepositoriesService) CreateProject(ctx context.Context, owner, repo string, opts *ProjectOptions) (*Project, *Response, error) { u := fmt.Sprintf("repos/%v/%v/projects", owner, repo) req, err := s.client.NewRequest("POST", u, opts) diff --git a/github/repos_releases.go b/github/repos_releases.go index 1cd2fae669..f1ab65c185 100644 --- a/github/repos_releases.go +++ b/github/repos_releases.go @@ -83,7 +83,7 @@ func (r ReleaseAsset) String() string { // ListReleases lists the releases for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-releases +// GitHub API docs: https://docs.github.com/en/rest/releases/releases#list-releases func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) u, err := addOptions(u, opts) @@ -106,7 +106,7 @@ func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo stri // GetRelease fetches a single release. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-release +// GitHub API docs: https://docs.github.com/en/rest/releases/releases#get-a-release func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) return s.getSingleRelease(ctx, u) @@ -114,7 +114,7 @@ func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string // GetLatestRelease fetches the latest published release for the repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-latest-release +// GitHub API docs: https://docs.github.com/en/rest/releases/releases#get-the-latest-release func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/latest", owner, repo) return s.getSingleRelease(ctx, u) @@ -122,15 +122,15 @@ func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo // GetReleaseByTag fetches a release with the specified tag. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-release-by-tag-name +// GitHub API docs: https://docs.github.com/en/rest/releases/releases#get-a-release-by-tag-name func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/tags/%s", owner, repo, tag) return s.getSingleRelease(ctx, u) } // GenerateReleaseNotes generates the release notes for the given tag. -// TODO: api docs -// GitHub API docs: +// +// GitHub API docs: https://docs.github.com/en/rest/releases/releases#generate-release-notes-content-for-a-release func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, opts *GenerateNotesOptions) (*RepositoryReleaseNotes, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/generate-notes", owner, repo) req, err := s.client.NewRequest("POST", u, opts) @@ -183,7 +183,7 @@ type repositoryReleaseRequest struct { // Note that only a subset of the release fields are used. // See RepositoryRelease for more information. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-release +// GitHub API docs: https://docs.github.com/en/rest/releases/releases#create-a-release func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) @@ -216,7 +216,7 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str // Note that only a subset of the release fields are used. // See RepositoryRelease for more information. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-release +// GitHub API docs: https://docs.github.com/en/rest/releases/releases#update-a-release func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) @@ -246,7 +246,7 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin // DeleteRelease delete a single release from a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-release +// GitHub API docs: https://docs.github.com/en/rest/releases/releases#delete-a-release func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) @@ -259,7 +259,7 @@ func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo str // ListReleaseAssets lists the release's assets. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-release-assets +// GitHub API docs: https://docs.github.com/en/rest/releases/assets#list-release-assets func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) u, err := addOptions(u, opts) @@ -282,7 +282,7 @@ func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo // GetReleaseAsset fetches a single release asset. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-release-asset +// GitHub API docs: https://docs.github.com/en/rest/releases/assets#get-a-release-asset func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) @@ -311,7 +311,7 @@ func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo s // exist, but it's possible to pass any http.Client. If nil is passed the // redirectURL will be returned instead. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-release-asset +// GitHub API docs: https://docs.github.com/en/rest/releases/assets#get-a-release-asset func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64, followRedirectsClient *http.Client) (rc io.ReadCloser, redirectURL string, err error) { u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) @@ -373,7 +373,7 @@ func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, f // EditReleaseAsset edits a repository release asset. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-release-asset +// GitHub API docs: https://docs.github.com/en/rest/releases/assets#update-a-release-asset func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) @@ -392,7 +392,7 @@ func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo // DeleteReleaseAsset delete a single release asset from a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-release-asset +// GitHub API docs: https://docs.github.com/en/rest/releases/assets#delete-a-release-asset func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) @@ -406,7 +406,7 @@ func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, rep // UploadReleaseAsset creates an asset by uploading a file into a release repository. // To upload assets that cannot be represented by an os.File, call NewUploadRequest directly. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#upload-a-release-asset +// GitHub API docs: https://docs.github.com/en/rest/releases/assets#upload-a-release-asset func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opts *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) u, err := addOptions(u, opts) diff --git a/github/repos_stats.go b/github/repos_stats.go index 756dbc21b6..3df0a8f6de 100644 --- a/github/repos_stats.go +++ b/github/repos_stats.go @@ -45,7 +45,7 @@ func (w WeeklyStats) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-all-contributor-commit-activity +// GitHub API docs: https://docs.github.com/en/rest/metrics/statistics#get-all-contributor-commit-activity func (s *RepositoriesService) ListContributorsStats(ctx context.Context, owner, repo string) ([]*ContributorStats, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -84,7 +84,7 @@ func (w WeeklyCommitActivity) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-last-year-of-commit-activity +// GitHub API docs: https://docs.github.com/en/rest/metrics/statistics#get-the-last-year-of-commit-activity func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, repo string) ([]*WeeklyCommitActivity, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -111,7 +111,7 @@ func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, rep // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-weekly-commit-activity +// GitHub API docs: https://docs.github.com/en/rest/metrics/statistics#get-the-weekly-commit-activity func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo string) ([]*WeeklyStats, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -167,7 +167,7 @@ func (r RepositoryParticipation) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-weekly-commit-count +// GitHub API docs: https://docs.github.com/en/rest/metrics/statistics#get-the-weekly-commit-count func (s *RepositoriesService) ListParticipation(ctx context.Context, owner, repo string) (*RepositoryParticipation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/participation", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -200,7 +200,7 @@ type PunchCard struct { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-hourly-commit-count-for-each-day +// GitHub API docs: https://docs.github.com/en/rest/metrics/statistics#get-the-hourly-commit-count-for-each-day func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo string) ([]*PunchCard, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/repos_statuses.go b/github/repos_statuses.go index 347d856ae2..42238f3c9d 100644 --- a/github/repos_statuses.go +++ b/github/repos_statuses.go @@ -46,7 +46,7 @@ func (r RepoStatus) String() string { // ListStatuses lists the statuses of a repository at the specified // reference. ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-commit-statuses-for-a-reference +// GitHub API docs: https://docs.github.com/en/rest/commits/statuses#list-commit-statuses-for-a-reference func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref string, opts *ListOptions) ([]*RepoStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, refURLEscape(ref)) u, err := addOptions(u, opts) @@ -71,7 +71,7 @@ func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref // CreateStatus creates a new status for a repository at the specified // reference. Ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-commit-status +// GitHub API docs: https://docs.github.com/en/rest/commits/statuses#create-a-commit-status func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, refURLEscape(ref)) req, err := s.client.NewRequest("POST", u, status) @@ -110,7 +110,7 @@ func (s CombinedStatus) String() string { // GetCombinedStatus returns the combined status of a repository at the specified // reference. ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-combined-status-for-a-specific-reference +// GitHub API docs: https://docs.github.com/en/rest/commits/statuses#get-the-combined-status-for-a-specific-reference func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo, ref string, opts *ListOptions) (*CombinedStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/status", owner, repo, refURLEscape(ref)) u, err := addOptions(u, opts) diff --git a/github/repos_test.go b/github/repos_test.go index cbf56a2f7c..0bf228ebaf 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -393,14 +393,16 @@ func TestRepositoriesService_GetCodeOfConduct(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repos/o/r/community/code_of_conduct", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") testHeader(t, r, "Accept", mediaTypeCodesOfConductPreview) fmt.Fprint(w, `{ - "key": "key", - "name": "name", - "url": "url", - "body": "body"}`, + "code_of_conduct": { + "key": "key", + "name": "name", + "url": "url", + "body": "body" + }}`, ) }) @@ -1241,7 +1243,7 @@ func TestRepositoriesService_GetBranchProtection_branchNotProtected(t *testing.T w.WriteHeader(http.StatusBadRequest) fmt.Fprintf(w, `{ "message": %q, - "documentation_url": "https://docs.github.com/rest/reference/repos#get-branch-protection" + "documentation_url": "https://docs.github.com/rest/repos#get-branch-protection" }`, githubBranchNotProtected) }) @@ -1659,7 +1661,7 @@ func TestRepositoriesService_GetRequiredStatusChecks_branchNotProtected(t *testi w.WriteHeader(http.StatusBadRequest) fmt.Fprintf(w, `{ "message": %q, - "documentation_url": "https://docs.github.com/rest/reference/repos#get-branch-protection" + "documentation_url": "https://docs.github.com/rest/repos#get-branch-protection" }`, githubBranchNotProtected) }) @@ -1893,7 +1895,7 @@ func TestRepositoriesService_ListRequiredStatusChecksContexts_branchNotProtected w.WriteHeader(http.StatusBadRequest) fmt.Fprintf(w, `{ "message": %q, - "documentation_url": "https://docs.github.com/rest/reference/repos#get-branch-protection" + "documentation_url": "https://docs.github.com/rest/repos#get-branch-protection" }`, githubBranchNotProtected) }) diff --git a/github/repos_traffic.go b/github/repos_traffic.go index e372fb5a7f..bf093c03ea 100644 --- a/github/repos_traffic.go +++ b/github/repos_traffic.go @@ -54,7 +54,7 @@ type TrafficBreakdownOptions struct { // ListTrafficReferrers list the top 10 referrers over the last 14 days. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-top-referral-sources +// GitHub API docs: https://docs.github.com/en/rest/metrics/traffic#get-top-referral-sources func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, repo string) ([]*TrafficReferrer, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/popular/referrers", owner, repo) @@ -74,7 +74,7 @@ func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, r // ListTrafficPaths list the top 10 popular content over the last 14 days. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-top-referral-paths +// GitHub API docs: https://docs.github.com/en/rest/metrics/traffic#get-top-referral-paths func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo string) ([]*TrafficPath, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/popular/paths", owner, repo) @@ -94,7 +94,7 @@ func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo // ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-page-views +// GitHub API docs: https://docs.github.com/en/rest/metrics/traffic#get-page-views func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficViews, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/views", owner, repo) u, err := addOptions(u, opts) @@ -118,7 +118,7 @@ func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo // ListTrafficClones get total number of clones for the last 14 days and breaks it down either per day or week for the last 14 days. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-repository-clones +// GitHub API docs: https://docs.github.com/en/rest/metrics/traffic#get-repository-clones func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficClones, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/clones", owner, repo) u, err := addOptions(u, opts) diff --git a/github/scim.go b/github/scim.go index 7a12d85b88..c4abb9ab3e 100644 --- a/github/scim.go +++ b/github/scim.go @@ -14,12 +14,12 @@ import ( // SCIMService provides access to SCIM related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/reference/scim +// GitHub API docs: https://docs.github.com/en/rest/scim type SCIMService service // SCIMUserAttributes represents supported SCIM User attributes. // -// GitHub API docs: https://docs.github.com/en/rest/reference/scim#supported-scim-user-attributes +// GitHub API docs: https://docs.github.com/en/rest/scim#supported-scim-user-attributes type SCIMUserAttributes struct { UserName string `json:"userName"` // Configured by the admin. Could be an email, login, or username. (Required.) Name SCIMUserName `json:"name"` // (Required.) @@ -47,7 +47,7 @@ type SCIMUserEmail struct { // ListSCIMProvisionedIdentitiesOptions represents options for ListSCIMProvisionedIdentities. // -// Github API docs: https://docs.github.com/en/rest/reference/scim#list-scim-provisioned-identities--parameters +// Github API docs: https://docs.github.com/en/rest/scim#list-scim-provisioned-identities--parameters type ListSCIMProvisionedIdentitiesOptions struct { StartIndex *int `json:"startIndex,omitempty"` // Used for pagination: the index of the first result to return. (Optional.) Count *int `json:"count,omitempty"` // Used for pagination: the number of results to return. (Optional.) @@ -61,7 +61,7 @@ type ListSCIMProvisionedIdentitiesOptions struct { // ListSCIMProvisionedIdentities lists SCIM provisioned identities. // -// GitHub API docs: https://docs.github.com/en/rest/reference/scim#list-scim-provisioned-identities +// GitHub API docs: https://docs.github.com/en/rest/scim#list-scim-provisioned-identities func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org string, opts *ListSCIMProvisionedIdentitiesOptions) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users", org) u, err := addOptions(u, opts) @@ -77,7 +77,7 @@ func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org str // ProvisionAndInviteSCIMUser provisions organization membership for a user, and sends an activation email to the email address. // -// GitHub API docs: https://docs.github.com/en/rest/reference/scim#provision-and-invite-a-scim-user +// GitHub API docs: https://docs.github.com/en/rest/scim#provision-and-invite-a-scim-user func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string, opts *SCIMUserAttributes) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users", org) u, err := addOptions(u, opts) @@ -93,7 +93,7 @@ func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string // GetSCIMProvisioningInfoForUser returns SCIM provisioning information for a user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/scim#get-scim-provisioning-information-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/scim#supported-scim-user-attributes func (s *SCIMService) GetSCIMProvisioningInfoForUser(ctx context.Context, org, scimUserID string) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) req, err := s.client.NewRequest("GET", u, nil) @@ -105,7 +105,7 @@ func (s *SCIMService) GetSCIMProvisioningInfoForUser(ctx context.Context, org, s // UpdateProvisionedOrgMembership updates a provisioned organization membership. // -// GitHub API docs: https://docs.github.com/en/rest/reference/scim#update-a-provisioned-organization-membership +// GitHub API docs: https://docs.github.com/en/rest/scim#update-a-provisioned-organization-membership func (s *SCIMService) UpdateProvisionedOrgMembership(ctx context.Context, org, scimUserID string, opts *SCIMUserAttributes) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) u, err := addOptions(u, opts) @@ -121,7 +121,7 @@ func (s *SCIMService) UpdateProvisionedOrgMembership(ctx context.Context, org, s // UpdateAttributeForSCIMUserOptions represents options for UpdateAttributeForSCIMUser. // -// GitHub API docs: https://docs.github.com/en/rest/reference/scim#update-an-attribute-for-a-scim-user--parameters +// GitHub API docs: https://docs.github.com/en/rest/scim#update-an-attribute-for-a-scim-user--parameters type UpdateAttributeForSCIMUserOptions struct { Schemas []string `json:"schemas,omitempty"` // (Optional.) Operations UpdateAttributeForSCIMUserOperations `json:"operations"` // Set of operations to be performed. (Required.) @@ -136,7 +136,7 @@ type UpdateAttributeForSCIMUserOperations struct { // UpdateAttributeForSCIMUser updates an attribute for an SCIM user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/scim#update-an-attribute-for-a-scim-user +// GitHub API docs: https://docs.github.com/en/rest/scim#update-an-attribute-for-a-scim-user func (s *SCIMService) UpdateAttributeForSCIMUser(ctx context.Context, org, scimUserID string, opts *UpdateAttributeForSCIMUserOptions) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) u, err := addOptions(u, opts) @@ -152,7 +152,7 @@ func (s *SCIMService) UpdateAttributeForSCIMUser(ctx context.Context, org, scimU // DeleteSCIMUserFromOrg deletes SCIM user from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/reference/scim#delete-a-scim-user-from-an-organization +// GitHub API docs: https://docs.github.com/en/rest/scim#delete-a-scim-user-from-an-organization func (s *SCIMService) DeleteSCIMUserFromOrg(ctx context.Context, org, scimUserID string) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/search.go b/github/search.go index a3da304c51..344f1bb985 100644 --- a/github/search.go +++ b/github/search.go @@ -29,7 +29,7 @@ import ( // For example, querying with "language:c++" and "leveldb", then query should be // "language:c++ leveldb" but not "language:c+++leveldb". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/ +// GitHub API docs: https://docs.github.com/en/rest/search/ type SearchService service // SearchOptions specifies optional parameters to the SearchService methods. @@ -69,7 +69,7 @@ type RepositoriesSearchResult struct { // Repositories searches repositories via various criteria. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-repositories +// GitHub API docs: https://docs.github.com/en/rest/search#search-repositories func (s *SearchService) Repositories(ctx context.Context, query string, opts *SearchOptions) (*RepositoriesSearchResult, *Response, error) { result := new(RepositoriesSearchResult) resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opts, result) @@ -104,7 +104,7 @@ type TopicResult struct { // Please see https://help.github.com/en/articles/searching-topics for more // information about search qualifiers. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-topics +// GitHub API docs: https://docs.github.com/en/rest/search#search-topics func (s *SearchService) Topics(ctx context.Context, query string, opts *SearchOptions) (*TopicsSearchResult, *Response, error) { result := new(TopicsSearchResult) resp, err := s.search(ctx, "topics", &searchParameters{Query: query}, opts, result) @@ -139,7 +139,7 @@ type CommitResult struct { // Commits searches commits via various criteria. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-commits +// GitHub API docs: https://docs.github.com/en/rest/search#search-commits func (s *SearchService) Commits(ctx context.Context, query string, opts *SearchOptions) (*CommitsSearchResult, *Response, error) { result := new(CommitsSearchResult) resp, err := s.search(ctx, "commits", &searchParameters{Query: query}, opts, result) @@ -159,7 +159,7 @@ type IssuesSearchResult struct { // Issues searches issues via various criteria. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-issues-and-pull-requests +// GitHub API docs: https://docs.github.com/en/rest/search#search-issues-and-pull-requests func (s *SearchService) Issues(ctx context.Context, query string, opts *SearchOptions) (*IssuesSearchResult, *Response, error) { result := new(IssuesSearchResult) resp, err := s.search(ctx, "issues", &searchParameters{Query: query}, opts, result) @@ -179,7 +179,7 @@ type UsersSearchResult struct { // Users searches users via various criteria. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-users +// GitHub API docs: https://docs.github.com/en/rest/search#search-users func (s *SearchService) Users(ctx context.Context, query string, opts *SearchOptions) (*UsersSearchResult, *Response, error) { result := new(UsersSearchResult) resp, err := s.search(ctx, "users", &searchParameters{Query: query}, opts, result) @@ -232,7 +232,7 @@ func (c CodeResult) String() string { // Code searches code via various criteria. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-code +// GitHub API docs: https://docs.github.com/en/rest/search#search-code func (s *SearchService) Code(ctx context.Context, query string, opts *SearchOptions) (*CodeSearchResult, *Response, error) { result := new(CodeSearchResult) resp, err := s.search(ctx, "code", &searchParameters{Query: query}, opts, result) @@ -267,7 +267,7 @@ func (l LabelResult) String() string { // Labels searches labels in the repository with ID repoID via various criteria. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-labels +// GitHub API docs: https://docs.github.com/en/rest/search#search-labels func (s *SearchService) Labels(ctx context.Context, repoID int64, query string, opts *SearchOptions) (*LabelsSearchResult, *Response, error) { result := new(LabelsSearchResult) resp, err := s.search(ctx, "labels", &searchParameters{RepositoryID: &repoID, Query: query}, opts, result) diff --git a/github/secret_scanning.go b/github/secret_scanning.go index f5061f3b92..ec64950a67 100644 --- a/github/secret_scanning.go +++ b/github/secret_scanning.go @@ -12,8 +12,6 @@ import ( // SecretScanningService handles communication with the secret scanning related // methods of the GitHub API. -// -// GitHub API docs: https://docs.github.com/en/rest/reference/secret-scanning type SecretScanningService service // SecretScanningAlert represents a GitHub secret scanning alert. @@ -84,7 +82,7 @@ type SecretScanningAlertUpdateOptions struct { // To use this endpoint, you must be a member of the enterprise, and you must use an access token with the repo scope or // security_events scope. Alerts are only returned for organizations in the enterprise for which you are an organization owner or a security manager. // -// GitHub API docs: https://docs.github.com/en/rest/reference/secret-scanning#list-secret-scanning-alerts-for-an-enterprise +// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-secret-scanning-alerts-for-an-enterprise func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, enterprise string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("enterprises/%v/secret-scanning/alerts", enterprise) u, err := addOptions(u, opts) @@ -111,7 +109,7 @@ func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, ent // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/en/rest/reference/secret-scanning#list-secret-scanning-alerts-for-an-organization +// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("orgs/%v/secret-scanning/alerts", org) u, err := addOptions(u, opts) @@ -138,7 +136,7 @@ func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/en/rest/reference/secret-scanning#list-secret-scanning-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-secret-scanning-alerts-for-a-repository func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts", owner, repo) u, err := addOptions(u, opts) @@ -165,7 +163,7 @@ func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, re // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/en/rest/reference/secret-scanning#get-a-secret-scanning-alert +// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#get-a-secret-scanning-alert func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string, number int64) (*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) @@ -188,7 +186,7 @@ func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/en/rest/reference/secret-scanning#update-a-secret-scanning-alert +// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#update-a-secret-scanning-alert func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo string, number int64, opts *SecretScanningAlertUpdateOptions) (*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) @@ -211,7 +209,7 @@ func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo str // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/en/rest/reference/secret-scanning#list-locations-for-a-secret-scanning-alert +// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-locations-for-a-secret-scanning-alert func (s *SecretScanningService) ListLocationsForAlert(ctx context.Context, owner, repo string, number int64, opts *ListOptions) ([]*SecretScanningAlertLocation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v/locations", owner, repo, number) u, err := addOptions(u, opts) diff --git a/github/teams.go b/github/teams.go index 5b1096ea29..77b38dd6dd 100644 --- a/github/teams.go +++ b/github/teams.go @@ -16,7 +16,7 @@ import ( // TeamsService provides access to the team-related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/ +// GitHub API docs: https://docs.github.com/en/rest/teams/ type TeamsService service // Team represents a team within a GitHub organization. Teams are used to @@ -82,7 +82,7 @@ func (i Invitation) String() string { // ListTeams lists all of the teams for an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-teams +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-teams func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams", org) u, err := addOptions(u, opts) @@ -106,7 +106,7 @@ func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOpti // GetTeamByID fetches a team, given a specified organization ID, by ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-team-by-name +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#get-a-team-by-name func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) req, err := s.client.NewRequest("GET", u, nil) @@ -125,7 +125,7 @@ func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*T // GetTeamBySlug fetches a team, given a specified organization name, by slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-team-by-name +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#get-a-team-by-name func (s *TeamsService) GetTeamBySlug(ctx context.Context, org, slug string) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) req, err := s.client.NewRequest("GET", u, nil) @@ -175,7 +175,7 @@ func (s NewTeam) String() string { // CreateTeam creates a new team within an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#create-a-team func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams", org) req, err := s.client.NewRequest("POST", u, team) @@ -221,7 +221,7 @@ func copyNewTeamWithoutParent(team *NewTeam) *newTeamNoParent { // EditTeamByID edits a team, given an organization ID, selected by ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#update-a-team func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, team NewTeam, removeParent bool) (*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) @@ -248,7 +248,7 @@ func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, te // EditTeamBySlug edits a team, given an organization name, by slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#update-a-team func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, team NewTeam, removeParent bool) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) @@ -275,7 +275,7 @@ func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, tea // DeleteTeamByID deletes a team referenced by ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#delete-a-team func (s *TeamsService) DeleteTeamByID(ctx context.Context, orgID, teamID int64) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -288,7 +288,7 @@ func (s *TeamsService) DeleteTeamByID(ctx context.Context, orgID, teamID int64) // DeleteTeamBySlug deletes a team reference by slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#delete-a-team func (s *TeamsService) DeleteTeamBySlug(ctx context.Context, org, slug string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) req, err := s.client.NewRequest("DELETE", u, nil) @@ -301,7 +301,7 @@ func (s *TeamsService) DeleteTeamBySlug(ctx context.Context, org, slug string) ( // ListChildTeamsByParentID lists child teams for a parent team given parent ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-child-teams +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-child-teams func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/teams", orgID, teamID) u, err := addOptions(u, opts) @@ -325,7 +325,7 @@ func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, team // ListChildTeamsByParentSlug lists child teams for a parent team given parent slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-child-teams +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-child-teams func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/teams", org, slug) u, err := addOptions(u, opts) @@ -349,7 +349,7 @@ func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug // ListTeamReposByID lists the repositories given a team ID that the specified team has access to. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-team-repositories +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-team-repositories func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos", orgID, teamID) u, err := addOptions(u, opts) @@ -377,7 +377,7 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6 // ListTeamReposBySlug lists the repositories given a team slug that the specified team has access to. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-team-repositories +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-team-repositories func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos", org, slug) u, err := addOptions(u, opts) @@ -407,7 +407,7 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string // repository is managed by team, a Repository is returned which includes the // permissions team has for that repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#check-team-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-repository func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -431,7 +431,7 @@ func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64, // repository is managed by team, a Repository is returned which includes the // permissions team has for that repo. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#check-team-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-repository func (s *TeamsService) IsTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -470,7 +470,7 @@ type TeamAddTeamRepoOptions struct { // The specified repository must be owned by the organization to which the team // belongs, or a direct fork of a repository owned by the organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#add-or-update-team-repository-permissions +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#add-or-update-team-repository-permissions func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) req, err := s.client.NewRequest("PUT", u, opts) @@ -485,7 +485,7 @@ func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, // The specified repository must be owned by the organization to which the team // belongs, or a direct fork of a repository owned by the organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#add-or-update-team-repository-permissions +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#add-or-update-team-repository-permissions func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) req, err := s.client.NewRequest("PUT", u, opts) @@ -500,7 +500,7 @@ func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, // team given the team ID. Note that this does not delete the repository, it // just removes it from the team. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#remove-a-repository-from-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#remove-a-repository-from-a-team func (s *TeamsService) RemoveTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) @@ -515,7 +515,7 @@ func (s *TeamsService) RemoveTeamRepoByID(ctx context.Context, orgID, teamID int // team given the team slug. Note that this does not delete the repository, it // just removes it from the team. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#remove-a-repository-from-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#remove-a-repository-from-a-team func (s *TeamsService) RemoveTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) @@ -527,7 +527,7 @@ func (s *TeamsService) RemoveTeamRepoBySlug(ctx context.Context, org, slug, owne } // ListUserTeams lists a user's teams -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-teams-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-teams-for-the-authenticated-user func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([]*Team, *Response, error) { u := "user/teams" u, err := addOptions(u, opts) @@ -551,7 +551,7 @@ func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([] // ListTeamProjectsByID lists the organization projects for a team given the team ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-team-projects +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-team-projects func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID int64) ([]*Project, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects", orgID, teamID) @@ -575,7 +575,7 @@ func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID i // ListTeamProjectsBySlug lists the organization projects for a team given the team slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-team-projects +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-team-projects func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug string) ([]*Project, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects", org, slug) @@ -600,7 +600,7 @@ func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug str // ReviewTeamProjectsByID checks whether a team, given its ID, has read, write, or admin // permissions for an organization project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#check-team-permissions-for-a-project +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-project func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID, projectID int64) (*Project, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) req, err := s.client.NewRequest("GET", u, nil) @@ -624,7 +624,7 @@ func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID // ReviewTeamProjectsBySlug checks whether a team, given its slug, has read, write, or admin // permissions for an organization project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#check-team-permissions-for-a-project +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-project func (s *TeamsService) ReviewTeamProjectsBySlug(ctx context.Context, org, slug string, projectID int64) (*Project, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) req, err := s.client.NewRequest("GET", u, nil) @@ -661,7 +661,7 @@ type TeamProjectOptions struct { // To add a project to a team or update the team's permission on a project, the // authenticated user must have admin permissions for the project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#add-or-update-team-project-permissions +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#add-or-update-team-project-permissions func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64, opts *TeamProjectOptions) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) req, err := s.client.NewRequest("PUT", u, opts) @@ -680,7 +680,7 @@ func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, pr // To add a project to a team or update the team's permission on a project, the // authenticated user must have admin permissions for the project. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#add-or-update-team-project-permissions +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#add-or-update-team-project-permissions func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64, opts *TeamProjectOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) req, err := s.client.NewRequest("PUT", u, opts) @@ -702,7 +702,7 @@ func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug strin // or project. // Note: This endpoint removes the project from the team, but does not delete it. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#remove-a-project-from-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#remove-a-project-from-a-team func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -724,7 +724,7 @@ func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, // or project. // Note: This endpoint removes the project from the team, but does not delete it. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#remove-a-project-from-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/teams#remove-a-project-from-a-team func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -753,7 +753,7 @@ type IDPGroup struct { // ListIDPGroupsInOrganization lists IDP groups available in an organization. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-idp-groups-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/teams/team-sync#list-idp-groups-for-an-organization func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org string, opts *ListCursorOptions) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/team-sync/groups", org) u, err := addOptions(u, opts) @@ -778,7 +778,7 @@ func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org stri // ListIDPGroupsForTeamByID lists IDP groups connected to a team on GitHub // given organization and team IDs. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-idp-groups-for-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/team-sync#list-idp-groups-for-a-team func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, teamID int64) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID) @@ -799,7 +799,7 @@ func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, team // ListIDPGroupsForTeamBySlug lists IDP groups connected to a team on GitHub // given organization name and team slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-idp-groups-for-a-team +// GitHub API docs: https://docs.github.com/en/rest/teams/team-sync#list-idp-groups-for-a-team func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug string) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug) @@ -820,7 +820,7 @@ func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug // CreateOrUpdateIDPGroupConnectionsByID creates, updates, or removes a connection // between a team and an IDP group given organization and team IDs. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-or-update-idp-group-connections +// GitHub API docs: https://docs.github.com/en/rest/teams/team-sync#create-or-update-idp-group-connections func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context, orgID, teamID int64, opts IDPGroupList) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID) @@ -841,7 +841,7 @@ func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context // CreateOrUpdateIDPGroupConnectionsBySlug creates, updates, or removes a connection // between a team and an IDP group given organization name and team slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-or-update-idp-group-connections +// GitHub API docs: https://docs.github.com/en/rest/teams/team-sync#create-or-update-idp-group-connections func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsBySlug(ctx context.Context, org, slug string, opts IDPGroupList) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug) @@ -889,7 +889,7 @@ type ExternalGroupList struct { // GetExternalGroup fetches an external group. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/reference/teams#get-an-external-group +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#get-an-external-group func (s *TeamsService) GetExternalGroup(ctx context.Context, org string, groupID int64) (*ExternalGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/external-group/%v", org, groupID) req, err := s.client.NewRequest("GET", u, nil) @@ -916,7 +916,7 @@ type ListExternalGroupsOptions struct { // ListExternalGroups lists external groups connected to a team on GitHub. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/reference/teams#list-external-groups-in-an-organization +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#list-external-groups-in-an-organization func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts *ListExternalGroupsOptions) (*ExternalGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/external-groups", org) u, err := addOptions(u, opts) @@ -940,7 +940,7 @@ func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts // UpdateConnectedExternalGroup updates the connection between an external group and a team. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/reference/teams#update-the-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#update-the-connection-between-an-external-group-and-a-team func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, slug string, eg *ExternalGroup) (*ExternalGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) @@ -960,7 +960,7 @@ func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, sl // RemoveConnectedExternalGroup removes the connection between an external group and a team. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/reference/teams#remove-the-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#remove-the-connection-between-an-external-group-and-a-team func (s *TeamsService) RemoveConnectedExternalGroup(ctx context.Context, org, slug string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) diff --git a/github/teams_discussion_comments.go b/github/teams_discussion_comments.go index b6c7e17845..f3a1cc4dc0 100644 --- a/github/teams_discussion_comments.go +++ b/github/teams_discussion_comments.go @@ -43,7 +43,7 @@ type DiscussionCommentListOptions struct { // ListCommentsByID lists all comments on a team discussion by team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-discussion-comments +// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#list-discussion-comments func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discussionNumber) u, err := addOptions(u, options) @@ -68,7 +68,7 @@ func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64 // ListCommentsBySlug lists all comments on a team discussion by team slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-discussion-comments +// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#list-discussion-comments func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discussionNumber) u, err := addOptions(u, options) @@ -93,7 +93,7 @@ func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, // GetCommentByID gets a specific comment on a team discussion by team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-discussion-comment +// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#get-a-discussion-comment func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) req, err := s.client.NewRequest("GET", u, nil) @@ -113,7 +113,7 @@ func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64, // GetCommentBySlug gets a specific comment on a team discussion by team slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-discussion-comment +// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#get-a-discussion-comment func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) @@ -134,7 +134,7 @@ func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, d // CreateCommentByID creates a new comment on a team discussion by team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-a-discussion-comment +// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#create-a-discussion-comment func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int64, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discsusionNumber) req, err := s.client.NewRequest("POST", u, comment) @@ -154,7 +154,7 @@ func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int6 // CreateCommentBySlug creates a new comment on a team discussion by team slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-a-discussion-comment +// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#create-a-discussion-comment func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discsusionNumber) req, err := s.client.NewRequest("POST", u, comment) @@ -175,7 +175,7 @@ func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string // Authenticated user must grant write:discussion scope. // User is allowed to edit body of a comment only. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-discussion-comment +// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#update-a-discussion-comment func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) req, err := s.client.NewRequest("PATCH", u, comment) @@ -196,7 +196,7 @@ func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, // Authenticated user must grant write:discussion scope. // User is allowed to edit body of a comment only. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-discussion-comment +// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#update-a-discussion-comment func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) req, err := s.client.NewRequest("PATCH", u, comment) @@ -216,7 +216,7 @@ func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, // DeleteCommentByID deletes a comment on a team discussion by team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-discussion-comment +// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#delete-a-discussion-comment func (s *TeamsService) DeleteCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) req, err := s.client.NewRequest("DELETE", u, nil) @@ -230,7 +230,7 @@ func (s *TeamsService) DeleteCommentByID(ctx context.Context, orgID, teamID int6 // DeleteCommentBySlug deletes a comment on a team discussion by team slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-discussion-comment +// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#delete-a-discussion-comment func (s *TeamsService) DeleteCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/teams_discussions.go b/github/teams_discussions.go index 5678548e9b..69a3ebd51f 100644 --- a/github/teams_discussions.go +++ b/github/teams_discussions.go @@ -49,7 +49,7 @@ type DiscussionListOptions struct { // ListDiscussionsByID lists all discussions on team's page given Organization and Team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-discussions +// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#list-discussions func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID int64, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID) u, err := addOptions(u, opts) @@ -74,7 +74,7 @@ func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID in // ListDiscussionsBySlug lists all discussions on team's page given Organization name and Team's slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-discussions +// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#list-discussions func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug string, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug) u, err := addOptions(u, opts) @@ -99,7 +99,7 @@ func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug stri // GetDiscussionByID gets a specific discussion on a team's page given Organization and Team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-discussion +// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#get-a-discussion func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) req, err := s.client.NewRequest("GET", u, nil) @@ -119,7 +119,7 @@ func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int6 // GetDiscussionBySlug gets a specific discussion on a team's page given Organization name and Team's slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-discussion +// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#get-a-discussion func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) req, err := s.client.NewRequest("GET", u, nil) @@ -139,7 +139,7 @@ func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string // CreateDiscussionByID creates a new discussion post on a team's page given Organization and Team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-a-discussion +// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#create-a-discussion func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID int64, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID) req, err := s.client.NewRequest("POST", u, discussion) @@ -159,7 +159,7 @@ func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID i // CreateDiscussionBySlug creates a new discussion post on a team's page given Organization name and Team's slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-a-discussion +// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#create-a-discussion func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug string, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug) req, err := s.client.NewRequest("POST", u, discussion) @@ -180,7 +180,7 @@ func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug str // Authenticated user must grant write:discussion scope. // User is allowed to change Title and Body of a discussion only. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-discussion +// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#update-a-discussion func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) req, err := s.client.NewRequest("PATCH", u, discussion) @@ -201,7 +201,7 @@ func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int // Authenticated user must grant write:discussion scope. // User is allowed to change Title and Body of a discussion only. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-discussion +// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#update-a-discussion func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) req, err := s.client.NewRequest("PATCH", u, discussion) @@ -221,7 +221,7 @@ func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug strin // DeleteDiscussionByID deletes a discussion from team's page given Organization and Team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-discussion +// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#delete-a-discussion func (s *TeamsService) DeleteDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) req, err := s.client.NewRequest("DELETE", u, nil) @@ -235,7 +235,7 @@ func (s *TeamsService) DeleteDiscussionByID(ctx context.Context, orgID, teamID i // DeleteDiscussionBySlug deletes a discussion from team's page given Organization name and Team's slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-discussion +// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#delete-a-discussion func (s *TeamsService) DeleteDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/teams_members.go b/github/teams_members.go index e6ad448b0e..58cb79744e 100644 --- a/github/teams_members.go +++ b/github/teams_members.go @@ -23,7 +23,7 @@ type TeamListTeamMembersOptions struct { // ListTeamMembersByID lists all of the users who are members of a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-team-members +// GitHub API docs: https://docs.github.com/en/rest/teams/members#list-team-members func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID int64, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/members", orgID, teamID) u, err := addOptions(u, opts) @@ -48,7 +48,7 @@ func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID in // ListTeamMembersBySlug lists all of the users who are members of a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-team-members +// GitHub API docs: https://docs.github.com/en/rest/teams/members#list-team-members func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug string, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/members", org, slug) u, err := addOptions(u, opts) @@ -73,7 +73,7 @@ func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug stri // GetTeamMembershipByID returns the membership status for a user in a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/teams/members#list-team-members func (s *TeamsService) GetTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string) (*Membership, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) req, err := s.client.NewRequest("GET", u, nil) @@ -93,7 +93,7 @@ func (s *TeamsService) GetTeamMembershipByID(ctx context.Context, orgID, teamID // GetTeamMembershipBySlug returns the membership status for a user in a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/teams/members#get-team-membership-for-a-user func (s *TeamsService) GetTeamMembershipBySlug(ctx context.Context, org, slug, user string) (*Membership, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) req, err := s.client.NewRequest("GET", u, nil) @@ -127,7 +127,7 @@ type TeamAddTeamMembershipOptions struct { // AddTeamMembershipByID adds or invites a user to a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#add-or-update-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/teams/members#add-or-update-team-membership-for-a-user func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string, opts *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) req, err := s.client.NewRequest("PUT", u, opts) @@ -147,7 +147,7 @@ func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID // AddTeamMembershipBySlug adds or invites a user to a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#add-or-update-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/teams/members#add-or-update-team-membership-for-a-user func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, user string, opts *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) req, err := s.client.NewRequest("PUT", u, opts) @@ -167,7 +167,7 @@ func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, u // RemoveTeamMembershipByID removes a user from a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#remove-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/teams/members#remove-team-membership-for-a-user func (s *TeamsService) RemoveTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -181,7 +181,7 @@ func (s *TeamsService) RemoveTeamMembershipByID(ctx context.Context, orgID, team // RemoveTeamMembershipBySlug removes a user from a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#remove-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/teams/members#remove-team-membership-for-a-user func (s *TeamsService) RemoveTeamMembershipBySlug(ctx context.Context, org, slug, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -195,7 +195,7 @@ func (s *TeamsService) RemoveTeamMembershipBySlug(ctx context.Context, org, slug // ListPendingTeamInvitationsByID gets pending invitation list of a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-pending-team-invitations +// GitHub API docs: https://docs.github.com/en/rest/teams/members#list-pending-team-invitations func (s *TeamsService) ListPendingTeamInvitationsByID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/invitations", orgID, teamID) u, err := addOptions(u, opts) @@ -220,7 +220,7 @@ func (s *TeamsService) ListPendingTeamInvitationsByID(ctx context.Context, orgID // ListPendingTeamInvitationsBySlug get pending invitation list of a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-pending-team-invitations +// GitHub API docs: https://docs.github.com/en/rest/teams/members#list-pending-team-invitations func (s *TeamsService) ListPendingTeamInvitationsBySlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/invitations", org, slug) u, err := addOptions(u, opts) diff --git a/github/users.go b/github/users.go index f45b1f6711..e694e05416 100644 --- a/github/users.go +++ b/github/users.go @@ -13,7 +13,7 @@ import ( // UsersService handles communication with the user related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/ +// GitHub API docs: https://docs.github.com/en/rest/users/ type UsersService service // User represents a GitHub user. @@ -63,7 +63,7 @@ type User struct { SubscriptionsURL *string `json:"subscriptions_url,omitempty"` // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#text-match-metadata + // See: search.go and https://docs.github.com/en/rest/search/#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` // Permissions identifies the permissions that a user has on a given @@ -78,8 +78,8 @@ func (u User) String() string { // Get fetches a user. Passing the empty string will fetch the authenticated // user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#get-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#get-a-user +// GitHub API docs: https://docs.github.com/en/rest/users/users#get-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/users#get-a-user func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, error) { var u string if user != "" { @@ -122,7 +122,7 @@ func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, // Edit the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#update-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/users#update-the-authenticated-user func (s *UsersService) Edit(ctx context.Context, user *User) (*User, *Response, error) { u := "user" req, err := s.client.NewRequest("PATCH", u, user) @@ -164,7 +164,7 @@ type UserContext struct { // GetHovercard fetches contextual information about user. It requires authentication // via Basic Auth or via OAuth with the repo scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#get-contextual-information-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/users/users#get-contextual-information-for-a-user func (s *UsersService) GetHovercard(ctx context.Context, user string, opts *HovercardOptions) (*Hovercard, *Response, error) { u := fmt.Sprintf("users/%v/hovercard", user) u, err := addOptions(u, opts) @@ -202,7 +202,7 @@ type UserListOptions struct { // // To paginate through all users, populate 'Since' with the ID of the last user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-users +// GitHub API docs: https://docs.github.com/en/rest/users/users#list-users func (s *UsersService) ListAll(ctx context.Context, opts *UserListOptions) ([]*User, *Response, error) { u, err := addOptions("users", opts) if err != nil { @@ -226,7 +226,7 @@ func (s *UsersService) ListAll(ctx context.Context, opts *UserListOptions) ([]*U // ListInvitations lists all currently-open repository invitations for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-invitations-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#list-repository-invitations-for-the-authenticated-user func (s *UsersService) ListInvitations(ctx context.Context, opts *ListOptions) ([]*RepositoryInvitation, *Response, error) { u, err := addOptions("user/repository_invitations", opts) if err != nil { @@ -250,7 +250,7 @@ func (s *UsersService) ListInvitations(ctx context.Context, opts *ListOptions) ( // AcceptInvitation accepts the currently-open repository invitation for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#accept-a-repository-invitation +// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#accept-a-repository-invitation func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64) (*Response, error) { u := fmt.Sprintf("user/repository_invitations/%v", invitationID) req, err := s.client.NewRequest("PATCH", u, nil) @@ -264,7 +264,7 @@ func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64) // DeclineInvitation declines the currently-open repository invitation for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#decline-a-repository-invitation +// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#decline-a-repository-invitation func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int64) (*Response, error) { u := fmt.Sprintf("user/repository_invitations/%v", invitationID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/users_blocking.go b/github/users_blocking.go index cdbc2c2532..3d38d94789 100644 --- a/github/users_blocking.go +++ b/github/users_blocking.go @@ -12,7 +12,7 @@ import ( // ListBlockedUsers lists all the blocked users by the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-users-blocked-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/blocking#list-users-blocked-by-the-authenticated-user func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) ([]*User, *Response, error) { u := "user/blocks" u, err := addOptions(u, opts) @@ -39,7 +39,7 @@ func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) // IsBlocked reports whether specified user is blocked by the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#check-if-a-user-is-blocked-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/blocking#check-if-a-user-is-blocked-by-the-authenticated-user func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Response, error) { u := fmt.Sprintf("user/blocks/%v", user) @@ -58,7 +58,7 @@ func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Respo // BlockUser blocks specified user for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#block-a-user +// GitHub API docs: https://docs.github.com/en/rest/users/blocking#block-a-user func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/blocks/%v", user) @@ -75,7 +75,7 @@ func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, e // UnblockUser unblocks specified user for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#unblock-a-user +// GitHub API docs: https://docs.github.com/en/rest/users/blocking#unblock-a-user func (s *UsersService) UnblockUser(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/blocks/%v", user) diff --git a/github/users_emails.go b/github/users_emails.go index 94e7fb81a6..be7e0f819e 100644 --- a/github/users_emails.go +++ b/github/users_emails.go @@ -17,7 +17,7 @@ type UserEmail struct { // ListEmails lists all email addresses for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-email-addresses-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/emails#list-email-addresses-for-the-authenticated-user func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*UserEmail, *Response, error) { u := "user/emails" u, err := addOptions(u, opts) @@ -41,7 +41,7 @@ func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*Us // AddEmails adds email addresses of the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#add-an-email-address-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/emails#add-an-email-address-for-the-authenticated-user func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserEmail, *Response, error) { u := "user/emails" req, err := s.client.NewRequest("POST", u, emails) @@ -60,7 +60,7 @@ func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserE // DeleteEmails deletes email addresses from authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#delete-an-email-address-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/emails#delete-an-email-address-for-the-authenticated-user func (s *UsersService) DeleteEmails(ctx context.Context, emails []string) (*Response, error) { u := "user/emails" req, err := s.client.NewRequest("DELETE", u, emails) diff --git a/github/users_followers.go b/github/users_followers.go index f26392b6e2..1266e0e9ee 100644 --- a/github/users_followers.go +++ b/github/users_followers.go @@ -13,8 +13,8 @@ import ( // ListFollowers lists the followers for a user. Passing the empty string will // fetch followers for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-followers-of-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-followers-of-a-user +// GitHub API docs: https://docs.github.com/en/rest/users/followers#list-followers-of-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/followers#list-followers-of-a-user func (s *UsersService) ListFollowers(ctx context.Context, user string, opts *ListOptions) ([]*User, *Response, error) { var u string if user != "" { @@ -44,8 +44,8 @@ func (s *UsersService) ListFollowers(ctx context.Context, user string, opts *Lis // ListFollowing lists the people that a user is following. Passing the empty // string will list people the authenticated user is following. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-the-people-the-authenticated-user-follows -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-the-people-a-user-follows +// GitHub API docs: https://docs.github.com/en/rest/users/followers#list-the-people-the-authenticated-user-follows +// GitHub API docs: https://docs.github.com/en/rest/users/followers#list-the-people-a-user-follows func (s *UsersService) ListFollowing(ctx context.Context, user string, opts *ListOptions) ([]*User, *Response, error) { var u string if user != "" { @@ -75,8 +75,8 @@ func (s *UsersService) ListFollowing(ctx context.Context, user string, opts *Lis // IsFollowing checks if "user" is following "target". Passing the empty // string for "user" will check if the authenticated user is following "target". // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#check-if-a-person-is-followed-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#check-if-a-user-follows-another-user +// GitHub API docs: https://docs.github.com/en/rest/users/followers#check-if-a-person-is-followed-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/followers#check-if-a-user-follows-another-user func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bool, *Response, error) { var u string if user != "" { @@ -97,7 +97,7 @@ func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bo // Follow will cause the authenticated user to follow the specified user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#follow-a-user +// GitHub API docs: https://docs.github.com/en/rest/users/followers#follow-a-user func (s *UsersService) Follow(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/following/%v", user) req, err := s.client.NewRequest("PUT", u, nil) @@ -110,7 +110,7 @@ func (s *UsersService) Follow(ctx context.Context, user string) (*Response, erro // Unfollow will cause the authenticated user to unfollow the specified user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#unfollow-a-user +// GitHub API docs: https://docs.github.com/en/rest/users/followers#unfollow-a-user func (s *UsersService) Unfollow(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/following/%v", user) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/users_gpg_keys.go b/github/users_gpg_keys.go index 387cc9b038..e9ce62221c 100644 --- a/github/users_gpg_keys.go +++ b/github/users_gpg_keys.go @@ -45,8 +45,8 @@ type GPGEmail struct { // string will fetch keys for the authenticated user. It requires authentication // via Basic Auth or via OAuth with at least read:gpg_key scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-gpg-keys-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-gpg-keys-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/gpg-keys#list-gpg-keys-for-a-user func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opts *ListOptions) ([]*GPGKey, *Response, error) { var u string if user != "" { @@ -76,7 +76,7 @@ func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opts *ListO // GetGPGKey gets extended details for a single GPG key. It requires authentication // via Basic Auth or via OAuth with at least read:gpg_key scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#get-a-gpg-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/gpg-keys#get-a-gpg-key-for-the-authenticated-user func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -96,7 +96,7 @@ func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Respo // CreateGPGKey creates a GPG key. It requires authenticatation via Basic Auth // or OAuth with at least write:gpg_key scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#create-a-gpg-key +// GitHub API docs: https://docs.github.com/en/rest/users/gpg-keys#create-a-gpg-key func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string) (*GPGKey, *Response, error) { gpgKey := &struct { ArmoredPublicKey string `json:"armored_public_key"` @@ -118,7 +118,7 @@ func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string // DeleteGPGKey deletes a GPG key. It requires authentication via Basic Auth or // via OAuth with at least admin:gpg_key scope. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#delete-a-gpg-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/gpg-keys#delete-a-gpg-key-for-the-authenticated-user func (s *UsersService) DeleteGPGKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/users_keys.go b/github/users_keys.go index b5d4f79dfb..59d26cdefa 100644 --- a/github/users_keys.go +++ b/github/users_keys.go @@ -28,8 +28,8 @@ func (k Key) String() string { // ListKeys lists the verified public keys for a user. Passing the empty // string will fetch keys for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-public-ssh-keys-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#list-public-keys-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/users/keys#list-public-ssh-keys-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/keys#list-public-keys-for-a-user func (s *UsersService) ListKeys(ctx context.Context, user string, opts *ListOptions) ([]*Key, *Response, error) { var u string if user != "" { @@ -58,7 +58,7 @@ func (s *UsersService) ListKeys(ctx context.Context, user string, opts *ListOpti // GetKey fetches a single public key. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#get-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/keys#get-a-public-ssh-key-for-the-authenticated-user func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, error) { u := fmt.Sprintf("user/keys/%v", id) @@ -78,7 +78,7 @@ func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, e // CreateKey adds a public key for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#create-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/keys#create-a-public-ssh-key-for-the-authenticated-user func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response, error) { u := "user/keys" @@ -98,7 +98,7 @@ func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response // DeleteKey deletes a public key. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/users/#delete-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/users/keys#delete-a-public-ssh-key-for-the-authenticated-user func (s *UsersService) DeleteKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/keys/%v", id) diff --git a/github/users_packages.go b/github/users_packages.go index cd20f8c189..da04919ecc 100644 --- a/github/users_packages.go +++ b/github/users_packages.go @@ -13,8 +13,8 @@ import ( // List the packages for a user. Passing the empty string for "user" will // list packages for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#list-packages-for-the-authenticated-users-namespace -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#list-packages-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/packages#list-packages-for-the-authenticated-users-namespace +// GitHub API docs: https://docs.github.com/en/rest/packages#list-packages-for-a-user func (s *UsersService) ListPackages(ctx context.Context, user string, opts *PackageListOptions) ([]*Package, *Response, error) { var u string if user != "" { @@ -44,8 +44,8 @@ func (s *UsersService) ListPackages(ctx context.Context, user string, opts *Pack // Get a package by name for a user. Passing the empty string for "user" will // get the package for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-for-a-user func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packageName string) (*Package, *Response, error) { var u string if user != "" { @@ -71,8 +71,8 @@ func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packag // Delete a package from a user. Passing the empty string for "user" will // delete the package for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-a-package-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-a-package-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-for-a-user func (s *UsersService) DeletePackage(ctx context.Context, user, packageType, packageName string) (*Response, error) { var u string if user != "" { @@ -92,8 +92,8 @@ func (s *UsersService) DeletePackage(ctx context.Context, user, packageType, pac // Restore a package to a user. Passing the empty string for "user" will // restore the package for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-a-package-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-a-package-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-for-a-user func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, packageName string) (*Response, error) { var u string if user != "" { @@ -113,8 +113,8 @@ func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, pa // Get all versions of a package for a user. Passing the empty string for "user" will // get versions for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-all-package-versions-for-a-package-owned-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/reference/users#delete-an-email-address-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/packages#get-all-package-versions-for-a-package-owned-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/packages#get-all-package-versions-for-a-package-owned-by-a-user func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { var u string if user != "" { @@ -144,8 +144,8 @@ func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageT // Get a specific version of a package for a user. Passing the empty string for "user" will // get the version for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-version-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-version-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-version-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-version-for-a-user func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { var u string if user != "" { @@ -171,8 +171,8 @@ func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, // Delete a package version for a user. Passing the empty string for "user" will // delete the version for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-a-package-version-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-package-version-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-version-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/packages#delete-package-version-for-a-user func (s *UsersService) PackageDeleteVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*Response, error) { var u string if user != "" { @@ -192,8 +192,8 @@ func (s *UsersService) PackageDeleteVersion(ctx context.Context, user, packageTy // Restore a package version to a user. Passing the empty string for "user" will // restore the version for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-a-package-version-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-package-version-for-a-user +// GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-version-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/packages#restore-package-version-for-a-user func (s *UsersService) PackageRestoreVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*Response, error) { var u string if user != "" { diff --git a/github/users_projects.go b/github/users_projects.go index dd9ceaf2f8..0cbd61f923 100644 --- a/github/users_projects.go +++ b/github/users_projects.go @@ -12,7 +12,7 @@ import ( // ListProjects lists the projects for the specified user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-user-projects +// GitHub API docs: https://docs.github.com/en/rest/projects/projects#list-user-projects func (s *UsersService) ListProjects(ctx context.Context, user string, opts *ProjectListOptions) ([]*Project, *Response, error) { u := fmt.Sprintf("users/%v/projects", user) u, err := addOptions(u, opts) @@ -47,7 +47,7 @@ type CreateUserProjectOptions struct { // CreateProject creates a GitHub Project for the current user. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#create-a-user-project +// GitHub API docs: https://docs.github.com/en/rest/projects/projects#create-a-user-project func (s *UsersService) CreateProject(ctx context.Context, opts *CreateUserProjectOptions) (*Project, *Response, error) { u := "user/projects" req, err := s.client.NewRequest("POST", u, opts) diff --git a/update-urls/activity-events_test.go b/update-urls/activity-events_test.go index 2e06c55181..9c5b3415df 100644 --- a/update-urls/activity-events_test.go +++ b/update-urls/activity-events_test.go @@ -6,17 +6,19 @@ package main import ( + _ "embed" + "strings" "testing" ) func newActivitiesEventsPipeline() *pipelineSetup { return &pipelineSetup{ - baseURL: "https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/", + baseURL: "https://docs.github.com/en/rest/activity/events/", endpointsFromWebsite: activityEventsWant, filename: "activity_events.go", serviceName: "ActivityService", - originalGoSource: activityEventsGoFileOriginal, - wantGoSource: activityEventsGoFileWant, + originalGoSource: strings.ReplaceAll(activityEventsGoFileOriginal, "\r", ""), + wantGoSource: strings.ReplaceAll(activityEventsGoFileWant, "\r", ""), wantNumEndpoints: 7, } } @@ -46,8 +48,11 @@ func TestPipeline_ActivityEvents_FirstStripAllURLsAndDestroyReceivers(t *testing } func TestParseWebPageEndpoints_ActivityEvents(t *testing.T) { - got, want := parseWebPageEndpoints(activityEventsTestWebPage), activityEventsWant - testWebPageHelper(t, got, want) + got, err := parseWebPageEndpoints(activityEventsTestWebPage) + if err != nil { + t.Fatal(err) + } + testWebPageHelper(t, got, activityEventsWant) } var activityEventsWant = endpointsByFragmentID{ @@ -178,6087 +183,11 @@ var activityEventsWant = endpointsByFragmentID{ }, } -var activityEventsTestWebPage = ` - - - Activity - GitHub Docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - - -
-
- -
- - - Article version: GitHub.com - - - - -
- - -
-
- - -
-
- -
- -
-
-

Activity

-
- -
-
- - - - - - - - -
-
-
- -

In this article

- - -
- -
-

- Did this doc help you? -

-

- - - - -

- - - - - -

- - -

- - -
- -
-
-
-
- -

Events

-

The Events API is a read-only API to the GitHub events. These events power the various activity streams on the site.

-

The Events API can return different types of events triggered by activity on GitHub. For more information about the specific events that you can receive from the Events API, see "GitHub Event types." An events API for repository issues is also available. For more information, see the "Issue Events API."

-

Events are optimized for polling with the "ETag" header. If no new events have been triggered, you will see a "304 Not Modified" response, and your current rate limit will be untouched. There is also an "X-Poll-Interval" header that specifies how often (in seconds) you are allowed to poll. In times of high server load, the time may increase. Please obey the header.

-
$ curl -I https://api.github.com/users/tater/events
-> HTTP/1.1 200 OK
-> X-Poll-Interval: 60
-> ETag: "a18c3bded88eb5dbb5c849a489412bf3"
-
-# The quotes around the ETag value are important
-$ curl -I https://api.github.com/users/tater/events \
-$    -H 'If-None-Match: "a18c3bded88eb5dbb5c849a489412bf3"'
-> HTTP/1.1 304 Not Modified
-> X-Poll-Interval: 60
-

Events support pagination, however the per_page option is unsupported. The fixed page size is 30 items. Fetching up to ten pages is supported, for a total of 300 events. For information, see "Traversing with pagination."

-

Only events created within the past 90 days will be included in timelines. Events older than 90 days will not be included (even if the total number of events in the timeline is less than 300).

-
-
-

- List public events -

-

We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago.

-
-
get /events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /events')
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
- -
get /networks/{owner}/{repo}/events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/networks/octocat/hello-world/events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /networks/{owner}/{repo}/events', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
- -
get /orgs/{org}/events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
orgstringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/orgs/ORG/events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /orgs/{org}/events', {
-  org: 'org'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
- -
get /repos/{owner}/{repo}/events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/events', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
-
-

- List events for the authenticated user -

-

If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events.

-
-
get /users/{username}/events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/events', {
-  username: 'username'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
-
-

- List organization events for the authenticated user -

-

This is the user's organization dashboard. You must be authenticated as the user to view this.

-
-
get /users/{username}/events/orgs/{org}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
orgstringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/events/orgs/ORG
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/events/orgs/{org}', {
-  username: 'username',
-  org: 'org'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - - -
-
-
-
- -
get /users/{username}/events/public
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/events/public
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/events/public', {
-  username: 'username'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
-
-

- List events received by the authenticated user -

-

These are events that you've received by watching repos and following users. If you are authenticated as the given user, you will see private events. Otherwise, you'll only see public events.

-
-
get /users/{username}/received_events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/received_events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/received_events', {
-  username: 'username'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
- -
get /users/{username}/received_events/public
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/received_events/public
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/received_events/public', {
-  username: 'username'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-

Feeds

-
-
-

- Get feeds -

-

GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticated user:

-
    -
  • Timeline: The GitHub global public timeline
  • -
  • User: The public timeline for any user, using URI template
  • -
  • Current user public: The public timeline for the authenticated user
  • -
  • Current user: The private timeline for the authenticated user
  • -
  • Current user actor: The private timeline for activity created by the authenticated user
  • -
  • Current user organizations: The private timeline for the organizations the authenticated user is a member of.
  • -
  • Security advisories: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub.
  • -
-

Note: Private feeds are only returned when authenticating via Basic Auth since current feed URIs use the older, non revocable auth tokens.

-
-
get /feeds
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/feeds
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /feeds')
-
- - - - -

Default response

-
Status: 200 OK
-
{
-  "timeline_url": "https://github.com/timeline",
-  "user_url": "https://github.com/{user}",
-  "current_user_public_url": "https://github.com/octocat",
-  "current_user_url": "https://github.com/octocat.private?token=abc123",
-  "current_user_actor_url": "https://github.com/octocat.private.actor?token=abc123",
-  "current_user_organization_url": "",
-  "current_user_organization_urls": [
-    "https://github.com/organizations/github/octocat.private.atom?token=abc123"
-  ],
-  "security_advisories_url": "https://github.com/security-advisories",
-  "_links": {
-    "timeline": {
-      "href": "https://github.com/timeline",
-      "type": "application/atom+xml"
-    },
-    "user": {
-      "href": "https://github.com/{user}",
-      "type": "application/atom+xml"
-    },
-    "current_user_public": {
-      "href": "https://github.com/octocat",
-      "type": "application/atom+xml"
-    },
-    "current_user": {
-      "href": "https://github.com/octocat.private?token=abc123",
-      "type": "application/atom+xml"
-    },
-    "current_user_actor": {
-      "href": "https://github.com/octocat.private.actor?token=abc123",
-      "type": "application/atom+xml"
-    },
-    "current_user_organization": {
-      "href": "",
-      "type": ""
-    },
-    "current_user_organizations": [
-      {
-        "href": "https://github.com/organizations/github/octocat.private.atom?token=abc123",
-        "type": "application/atom+xml"
-      }
-    ],
-    "security_advisories": {
-      "href": "https://github.com/security-advisories",
-      "type": "application/atom+xml"
-    }
-  }
-}
-
- - -

Notes

- - - -
-
-
-

Example of getting an Atom feed

-

To get a feed in Atom format, you must specify the application/atom+xml type in the Accept header. For example, to get the Atom feed for GitHub security advisories:

-
curl -H "Accept: application/atom+xml" https://github.com/security-advisories
-
-

Response

-
Status: 200 OK
-
<?xml version="1.0" encoding="UTF-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
-  <id>tag:github.com,2008:/security-advisories</id>
-  <link rel="self" type="application/atom+xml" href="https://github.com/security-advisories.atom"/>
-  <title>GitHub Security Advisory Feed</title>
-  <author>
-    <name>GitHub</name>
-  </author>
-  <updated>2019-01-14T19:34:52Z</updated>
-     <entry>
-      <id>tag:github.com,2008:GHSA-abcd-12ab-23cd</id>
-      <published>2018-07-26T15:14:52Z</published>
-      <updated>2019-01-14T19:34:52Z</updated>
-      <title type="html">[GHSA-abcd-12ab-23cd] Moderate severity vulnerability that affects Octoapp</title>
-        <category term="NPM"/>
-      <content type="html">
-        &lt;p&gt;Octoapp node module before 4.17.5 suffers from a Modification of Assumed-Immutable Data (MAID) vulnerability via defaultsDeep, merge, and mergeWith functions, which allows a malicious user to modify the prototype of &quot;Object&quot; via &lt;strong&gt;proto&lt;/strong&gt;, causing the addition or modification of an existing property that will exist on all objects.&lt;/p&gt;
-          &lt;p&gt;&lt;strong&gt;Affected Packages&lt;/strong&gt;&lt;/p&gt;
-
-  &lt;dl&gt;
-      &lt;dt&gt;Octoapp&lt;/dt&gt;
-      &lt;dd&gt;Ecosystem: npm&lt;/dd&gt;
-      &lt;dd&gt;Severity: moderate&lt;/dd&gt;
-      &lt;dd&gt;Versions: &amp;lt; 4.17.5&lt;/dd&gt;
-        &lt;dd&gt;Fixed in: 4.17.5&lt;/dd&gt;
-  &lt;/dl&gt;
-
-          &lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;
-
-  &lt;ul&gt;
-      &lt;li&gt;https://nvd.nist.gov/vuln/detail/CVE-2018-123&lt;/li&gt;
-  &lt;/ul&gt;
-
-      </content>
-    </entry>
-</feed>
-
-

Notifications

-

Users receive notifications for conversations in repositories they watch including:

-
    -
  • Issues and their comments
  • -
  • Pull Requests and their comments
  • -
  • Comments on any commits
  • -
-

Notifications are also sent for conversations in unwatched repositories when the user is involved including:

-
    -
  • @mentions
  • -
  • Issue assignments
  • -
  • Commits the user authors or commits
  • -
  • Any discussion in which the user actively participates
  • -
-

All Notification API calls require the notifications or repo API scopes. Doing this will give read-only access to some issue and commit content. You will still need the repo scope to access issues and commits from their respective endpoints.

-

Notifications come back as "threads". A thread contains information about the current discussion of an issue, pull request, or commit.

-

Notifications are optimized for polling with the Last-Modified header. If there are no new notifications, you will see a 304 Not Modified response, leaving your current rate limit untouched. There is an X-Poll-Interval header that specifies how often (in seconds) you are allowed to poll. In times of high server load, the time may increase. Please obey the header.

-
# Add authentication to your requests
-$ curl -I https://api.github.com/notifications
-HTTP/1.1 200 OK
-Last-Modified: Thu, 25 Oct 2012 15:16:27 GMT
-X-Poll-Interval: 60
-
-# Pass the Last-Modified header exactly
-$ curl -I https://api.github.com/notifications
-$    -H "If-Modified-Since: Thu, 25 Oct 2012 15:16:27 GMT"
-> HTTP/1.1 304 Not Modified
-> X-Poll-Interval: 60
-

Notification reasons

-

When retrieving responses from the Notifications API, each payload has a key titled reason. These correspond to events that trigger a notification.

-

Here's a list of potential reasons for receiving a notification:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Reason NameDescription
assignYou were assigned to the issue.
authorYou created the thread.
commentYou commented on the thread.
invitationYou accepted an invitation to contribute to the repository.
manualYou subscribed to the thread (via an issue or pull request).
mentionYou were specifically @mentioned in the content.
review_requestedYou, or a team you're a member of, were requested to review a pull request.
security_alertGitHub discovered a security vulnerability in your repository.
state_changeYou changed the thread state (for example, closing an issue or merging a pull request).
subscribedYou're watching the repository.
team_mentionYou were on a team that was mentioned.
-

Note that the reason is modified on a per-thread basis, and can change, if the reason on a later notification is different.

-

For example, if you are the author of an issue, subsequent notifications on that issue will have a reason of author. If you're then @mentioned on the same issue, the notifications you fetch thereafter will have a reason of mention. The reason remains as mention, regardless of whether you're ever mentioned again.

-
-
-

- List notifications for the authenticated user -

-

List all notifications for the current user, sorted by most recently updated.

-
-
get /notifications
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
allbooleanquery -

If true, show notifications marked as read.

- -
participatingbooleanquery -

If true, only shows notifications in which the user is directly participating or mentioned.

- -
sincestringquery -

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

- -
beforestringquery -

Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /notifications')
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": "1",
-    "repository": {
-      "id": 1296269,
-      "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-      "name": "Hello-World",
-      "full_name": "octocat/Hello-World",
-      "owner": {
-        "login": "octocat",
-        "id": 1,
-        "node_id": "MDQ6VXNlcjE=",
-        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-        "gravatar_id": "",
-        "url": "https://api.github.com/users/octocat",
-        "html_url": "https://github.com/octocat",
-        "followers_url": "https://api.github.com/users/octocat/followers",
-        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-        "organizations_url": "https://api.github.com/users/octocat/orgs",
-        "repos_url": "https://api.github.com/users/octocat/repos",
-        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-        "received_events_url": "https://api.github.com/users/octocat/received_events",
-        "type": "User",
-        "site_admin": false
-      },
-      "private": false,
-      "html_url": "https://github.com/octocat/Hello-World",
-      "description": "This your first repo!",
-      "fork": false,
-      "url": "https://api.github.com/repos/octocat/Hello-World",
-      "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-      "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-      "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-      "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-      "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-      "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-      "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-      "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-      "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-      "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-      "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-      "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-      "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-      "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-      "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-      "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-      "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-      "git_url": "git:github.com/octocat/Hello-World.git",
-      "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-      "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-      "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-      "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-      "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-      "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-      "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-      "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-      "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-      "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-      "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-      "ssh_url": "git@github.com:octocat/Hello-World.git",
-      "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-      "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-      "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-      "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-      "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-      "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-      "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}"
-    },
-    "subject": {
-      "title": "Greetings",
-      "url": "https://api.github.com/repos/octokit/octokit.rb/issues/123",
-      "latest_comment_url": "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123",
-      "type": "Issue"
-    },
-    "reason": "subscribed",
-    "unread": true,
-    "updated_at": "2014-11-07T22:01:45Z",
-    "last_read_at": "2014-11-07T22:01:45Z",
-    "url": "https://api.github.com/notifications/threads/1"
-  }
-]
-
- - - -
-
-
-
-
-

- Mark notifications as read -

-

Marks all notifications as "read" removes it from the default view on GitHub. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List notifications for the authenticated user endpoint and pass the query parameter all=false.

-
-
put /notifications
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
last_read_atstringbody -

Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: The current timestamp.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PUT \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications \
-  -d '{"last_read_at":"last_read_at"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PUT /notifications', {
-  last_read_at: 'last_read_at'
-})
-
- - - - -

Response

-
Status: 205 Reset Content
-
- - - -
-
-
-
-
-

- Get a thread -

- -
-
get /notifications/threads/{thread_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
thread_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications/threads/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /notifications/threads/{thread_id}', {
-  thread_id: 42
-})
-
- - - - -

Default response

-
Status: 200 OK
-
{
-  "id": "1",
-  "repository": {
-    "id": 1296269,
-    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-    "name": "Hello-World",
-    "full_name": "octocat/Hello-World",
-    "owner": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "private": false,
-    "html_url": "https://github.com/octocat/Hello-World",
-    "description": "This your first repo!",
-    "fork": false,
-    "url": "https://api.github.com/repos/octocat/Hello-World",
-    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-    "git_url": "git:github.com/octocat/Hello-World.git",
-    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-    "ssh_url": "git@github.com:octocat/Hello-World.git",
-    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}"
-  },
-  "subject": {
-    "title": "Greetings",
-    "url": "https://api.github.com/repos/octokit/octokit.rb/issues/123",
-    "latest_comment_url": "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123",
-    "type": "Issue"
-  },
-  "reason": "subscribed",
-  "unread": true,
-  "updated_at": "2014-11-07T22:01:45Z",
-  "last_read_at": "2014-11-07T22:01:45Z",
-  "url": "https://api.github.com/notifications/threads/1"
-}
-
- - - -
-
-
-
- -
patch /notifications/threads/{thread_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
thread_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PATCH \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications/threads/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PATCH /notifications/threads/{thread_id}', {
-  thread_id: 42
-})
-
- - - - -

Response

-
Status: 205 Reset Content
-
- - - -
-
-
-
-
-

- Get a thread subscription for the authenticated user -

-

This checks to see if the current user is subscribed to a thread. You can also get a repository subscription.

-

Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were @mentioned, or manually subscribe to a thread.

-
-
get /notifications/threads/{thread_id}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
thread_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications/threads/42/subscription
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /notifications/threads/{thread_id}/subscription', {
-  thread_id: 42
-})
-
- - - - -

Default response

-
Status: 200 OK
-
{
-  "subscribed": true,
-  "ignored": false,
-  "reason": null,
-  "created_at": "2012-10-06T21:34:12Z",
-  "url": "https://api.github.com/notifications/threads/1/subscription",
-  "thread_url": "https://api.github.com/notifications/threads/1"
-}
-
- - - -
-
-
-
-
-

- Set a thread subscription -

-

If you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an @mention.

-

You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored.

-

Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the Delete a thread subscription endpoint.

-
-
put /notifications/threads/{thread_id}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
thread_idintegerpath - - -
ignoredbooleanbody -

Unsubscribes and subscribes you to a conversation. Set ignored to true to block all notifications from this thread.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PUT \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications/threads/42/subscription \
-  -d '{"ignored":true}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PUT /notifications/threads/{thread_id}/subscription', {
-  thread_id: 42,
-  ignored: true
-})
-
- - - - -

Default response

-
Status: 200 OK
-
{
-  "subscribed": true,
-  "ignored": false,
-  "reason": null,
-  "created_at": "2012-10-06T21:34:12Z",
-  "url": "https://api.github.com/notifications/threads/1/subscription",
-  "thread_url": "https://api.github.com/notifications/threads/1"
-}
-
- - - -
-
-
-
-
-

- Delete a thread subscription -

-

Mutes all future notifications for a conversation until you comment on the thread or get an @mention. If you are watching the repository of the thread, you will still receive notifications. To ignore future notifications for a repository you are watching, use the Set a thread subscription endpoint and set ignore to true.

-
-
delete /notifications/threads/{thread_id}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
thread_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications/threads/42/subscription
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /notifications/threads/{thread_id}/subscription', {
-  thread_id: 42
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - - -
-
-
-
-
-

- List repository notifications for the authenticated user -

-

List all notifications for the current user.

-
-
get /repos/{owner}/{repo}/notifications
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
allbooleanquery -

If true, show notifications marked as read.

- -
participatingbooleanquery -

If true, only shows notifications in which the user is directly participating or mentioned.

- -
sincestringquery -

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

- -
beforestringquery -

Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/notifications
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/notifications', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": "1",
-    "repository": {
-      "id": 1296269,
-      "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-      "name": "Hello-World",
-      "full_name": "octocat/Hello-World",
-      "owner": {
-        "login": "octocat",
-        "id": 1,
-        "node_id": "MDQ6VXNlcjE=",
-        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-        "gravatar_id": "",
-        "url": "https://api.github.com/users/octocat",
-        "html_url": "https://github.com/octocat",
-        "followers_url": "https://api.github.com/users/octocat/followers",
-        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-        "organizations_url": "https://api.github.com/users/octocat/orgs",
-        "repos_url": "https://api.github.com/users/octocat/repos",
-        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-        "received_events_url": "https://api.github.com/users/octocat/received_events",
-        "type": "User",
-        "site_admin": false
-      },
-      "private": false,
-      "html_url": "https://github.com/octocat/Hello-World",
-      "description": "This your first repo!",
-      "fork": false,
-      "url": "https://api.github.com/repos/octocat/Hello-World",
-      "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-      "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-      "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-      "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-      "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-      "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-      "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-      "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-      "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-      "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-      "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-      "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-      "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-      "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-      "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-      "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-      "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-      "git_url": "git:github.com/octocat/Hello-World.git",
-      "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-      "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-      "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-      "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-      "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-      "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-      "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-      "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-      "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-      "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-      "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-      "ssh_url": "git@github.com:octocat/Hello-World.git",
-      "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-      "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-      "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-      "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-      "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-      "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-      "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}"
-    },
-    "subject": {
-      "title": "Greetings",
-      "url": "https://api.github.com/repos/octokit/octokit.rb/issues/123",
-      "latest_comment_url": "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123",
-      "type": "Issue"
-    },
-    "reason": "subscribed",
-    "unread": true,
-    "updated_at": "2014-11-07T22:01:45Z",
-    "last_read_at": "2014-11-07T22:01:45Z",
-    "url": "https://api.github.com/notifications/threads/1"
-  }
-]
-
- - - -
-
-
-
-
-

- Mark repository notifications as read -

-

Marks all notifications in a repository as "read" removes them from the default view on GitHub. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List repository notifications for the authenticated user endpoint and pass the query parameter all=false.

-
-
put /repos/{owner}/{repo}/notifications
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
last_read_atstringbody -

Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: The current timestamp.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PUT \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/notifications \
-  -d '{"last_read_at":"last_read_at"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PUT /repos/{owner}/{repo}/notifications', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  last_read_at: 'last_read_at'
-})
-
- - - - -

Response

-
Status: 205 Reset Content
-
- - - -
-
-
-

Starring

-

Repository starring is a feature that lets users bookmark repositories. Stars are shown next to repositories to show an approximate level of interest. Stars have no effect on notifications or the activity feed.

-

Starring vs. Watching

-

In August 2012, we changed the way watching -works on GitHub. Many API -client applications may be using the original "watcher" endpoints for accessing -this data. You can now start using the "star" endpoints instead (described -below). For more information, see the Watcher API Change post and the "Repository Watching API."

-

Custom media types for starring

-

There is one supported custom media type for the Starring REST API. When you use this custom media type, you will receive a response with the starred_at timestamp property that indicates the time the star was created. The response also has a second property that includes the resource that is returned when the custom media type is not included. The property that contains the resource will be either user or repo.

-
application/vnd.github.v3.star+json
-
-

For more information about media types, see "Custom media types."

-
-
-

- List stargazers -

-

Lists the people that have starred the repository.

-

You can also find out when stars were created by passing the following custom media type via the Accept header:

-
-
get /repos/{owner}/{repo}/stargazers
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/stargazers
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/stargazers', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  }
-]
-
- - -

Notes

- - - -
-
-
-
-
-

- List repositories starred by the authenticated user -

-

Lists repositories the authenticated user has starred.

-

You can also find out when stars were created by passing the following custom media type via the Accept header:

-
-
get /user/starred
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
sortstringquery -

One of created (when the repository was starred) or updated (when it was last pushed to).

- -
directionstringquery -

One of asc (ascending) or desc (descending).

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/user/starred
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /user/starred')
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1296269,
-    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-    "name": "Hello-World",
-    "full_name": "octocat/Hello-World",
-    "owner": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "private": false,
-    "html_url": "https://github.com/octocat/Hello-World",
-    "description": "This your first repo!",
-    "fork": false,
-    "url": "https://api.github.com/repos/octocat/Hello-World",
-    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-    "git_url": "git:github.com/octocat/Hello-World.git",
-    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-    "ssh_url": "git@github.com:octocat/Hello-World.git",
-    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
-    "clone_url": "https://github.com/octocat/Hello-World.git",
-    "mirror_url": "git:git.example.com/octocat/Hello-World",
-    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
-    "svn_url": "https://svn.github.com/octocat/Hello-World",
-    "homepage": "https://github.com",
-    "language": null,
-    "forks_count": 9,
-    "stargazers_count": 80,
-    "watchers_count": 80,
-    "size": 108,
-    "default_branch": "master",
-    "open_issues_count": 0,
-    "is_template": true,
-    "topics": [
-      "octocat",
-      "atom",
-      "electron",
-      "api"
-    ],
-    "has_issues": true,
-    "has_projects": true,
-    "has_wiki": true,
-    "has_pages": false,
-    "has_downloads": true,
-    "archived": false,
-    "disabled": false,
-    "visibility": "public",
-    "pushed_at": "2011-01-26T19:06:43Z",
-    "created_at": "2011-01-26T19:01:12Z",
-    "updated_at": "2011-01-26T19:14:43Z",
-    "permissions": {
-      "admin": false,
-      "push": false,
-      "pull": true
-    },
-    "allow_rebase_merge": true,
-    "template_repository": null,
-    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
-    "allow_squash_merge": true,
-    "delete_branch_on_merge": true,
-    "allow_merge_commit": true,
-    "subscribers_count": 42,
-    "network_count": 0
-  }
-]
-
- - - -
-
-
-
- -
get /user/starred/{owner}/{repo}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/user/starred/octocat/hello-world
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /user/starred/{owner}/{repo}', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Response if this repository is starred by you

-
Status: 204 No Content
-
- -

Response if this repository is not starred by you

-
Status: 404 Not Found
-
- - - -
-
-
-
-
-

- Star a repository for the authenticated user -

-

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."

-
-
put /user/starred/{owner}/{repo}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PUT \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/user/starred/octocat/hello-world
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PUT /user/starred/{owner}/{repo}', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - - -
-
-
-
- -
delete /user/starred/{owner}/{repo}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/user/starred/octocat/hello-world
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /user/starred/{owner}/{repo}', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - - -
-
-
-
-
-

- List repositories starred by a user -

-

Lists repositories a user has starred.

-

You can also find out when stars were created by passing the following custom media type via the Accept header:

-
-
get /users/{username}/starred
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
sortstringquery -

One of created (when the repository was starred) or updated (when it was last pushed to).

- -
directionstringquery -

One of asc (ascending) or desc (descending).

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/starred
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/starred', {
-  username: 'username'
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1296269,
-    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-    "name": "Hello-World",
-    "full_name": "octocat/Hello-World",
-    "owner": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "private": false,
-    "html_url": "https://github.com/octocat/Hello-World",
-    "description": "This your first repo!",
-    "fork": false,
-    "url": "https://api.github.com/repos/octocat/Hello-World",
-    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-    "git_url": "git:github.com/octocat/Hello-World.git",
-    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-    "ssh_url": "git@github.com:octocat/Hello-World.git",
-    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
-    "clone_url": "https://github.com/octocat/Hello-World.git",
-    "mirror_url": "git:git.example.com/octocat/Hello-World",
-    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
-    "svn_url": "https://svn.github.com/octocat/Hello-World",
-    "homepage": "https://github.com",
-    "language": null,
-    "forks_count": 9,
-    "stargazers_count": 80,
-    "watchers_count": 80,
-    "size": 108,
-    "default_branch": "master",
-    "open_issues_count": 0,
-    "is_template": true,
-    "topics": [
-      "octocat",
-      "atom",
-      "electron",
-      "api"
-    ],
-    "has_issues": true,
-    "has_projects": true,
-    "has_wiki": true,
-    "has_pages": false,
-    "has_downloads": true,
-    "archived": false,
-    "disabled": false,
-    "visibility": "public",
-    "pushed_at": "2011-01-26T19:06:43Z",
-    "created_at": "2011-01-26T19:01:12Z",
-    "updated_at": "2011-01-26T19:14:43Z",
-    "permissions": {
-      "admin": false,
-      "push": false,
-      "pull": true
-    },
-    "allow_rebase_merge": true,
-    "template_repository": null,
-    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
-    "allow_squash_merge": true,
-    "delete_branch_on_merge": true,
-    "allow_merge_commit": true,
-    "subscribers_count": 42,
-    "network_count": 0
-  }
-]
-
- - -

Notes

- - - -
-
-
-

Watching

-

Watching a repository registers the user to receive notifications on new discussions, as well as events in the user's activity feed. For simple repository bookmarks, see "Repository starring."

-
-
-

- List watchers -

-

Lists the people watching the specified repository.

-
-
get /repos/{owner}/{repo}/subscribers
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/subscribers
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/subscribers', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  }
-]
-
- - -

Notes

- - - -
-
-
-
- -
get /repos/{owner}/{repo}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/subscription
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/subscription', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Response if you subscribe to the repository

-
Status: 200 OK
-
{
-  "subscribed": true,
-  "ignored": false,
-  "reason": null,
-  "created_at": "2012-10-06T21:34:12Z",
-  "url": "https://api.github.com/repos/octocat/example/subscription",
-  "repository_url": "https://api.github.com/repos/octocat/example"
-}
-
- -

Response if you don t subscribe to the repository

-
Status: 404 Not Found
-
- - - -
-
-
-
-
-

- Set a repository subscription -

-

If you would like to watch a repository, set subscribed to true. If you would like to ignore notifications made within a repository, set ignored to true. If you would like to stop watching a repository, delete the repository's subscription completely.

-
-
put /repos/{owner}/{repo}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
subscribedbooleanbody -

Determines if notifications should be received from this repository.

- -
ignoredbooleanbody -

Determines if all notifications should be blocked from this repository.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PUT \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/subscription \
-  -d '{"subscribed":true}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PUT /repos/{owner}/{repo}/subscription', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  subscribed: true
-})
-
- - - - -

Default response

-
Status: 200 OK
-
{
-  "subscribed": true,
-  "ignored": false,
-  "reason": null,
-  "created_at": "2012-10-06T21:34:12Z",
-  "url": "https://api.github.com/repos/octocat/example/subscription",
-  "repository_url": "https://api.github.com/repos/octocat/example"
-}
-
- - - -
-
-
-
-
-

- Delete a repository subscription -

-

This endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, set the repository's subscription manually.

-
-
delete /repos/{owner}/{repo}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/subscription
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /repos/{owner}/{repo}/subscription', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - - -
-
-
-
-
-

- List repositories watched by the authenticated user -

-

Lists repositories the authenticated user is watching.

-
-
get /user/subscriptions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/user/subscriptions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /user/subscriptions')
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1296269,
-    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-    "name": "Hello-World",
-    "full_name": "octocat/Hello-World",
-    "owner": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "private": false,
-    "html_url": "https://github.com/octocat/Hello-World",
-    "description": "This your first repo!",
-    "fork": false,
-    "url": "https://api.github.com/repos/octocat/Hello-World",
-    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-    "git_url": "git:github.com/octocat/Hello-World.git",
-    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-    "ssh_url": "git@github.com:octocat/Hello-World.git",
-    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
-    "clone_url": "https://github.com/octocat/Hello-World.git",
-    "mirror_url": "git:git.example.com/octocat/Hello-World",
-    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
-    "svn_url": "https://svn.github.com/octocat/Hello-World",
-    "homepage": "https://github.com",
-    "language": null,
-    "forks_count": 9,
-    "stargazers_count": 80,
-    "watchers_count": 80,
-    "size": 108,
-    "default_branch": "master",
-    "open_issues_count": 0,
-    "is_template": true,
-    "topics": [
-      "octocat",
-      "atom",
-      "electron",
-      "api"
-    ],
-    "has_issues": true,
-    "has_projects": true,
-    "has_wiki": true,
-    "has_pages": false,
-    "has_downloads": true,
-    "archived": false,
-    "disabled": false,
-    "visibility": "public",
-    "pushed_at": "2011-01-26T19:06:43Z",
-    "created_at": "2011-01-26T19:01:12Z",
-    "updated_at": "2011-01-26T19:14:43Z",
-    "permissions": {
-      "admin": false,
-      "push": false,
-      "pull": true
-    },
-    "template_repository": null,
-    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
-    "delete_branch_on_merge": true,
-    "subscribers_count": 42,
-    "network_count": 0,
-    "license": {
-      "key": "mit",
-      "name": "MIT License",
-      "spdx_id": "MIT",
-      "url": "https://api.github.com/licenses/mit",
-      "node_id": "MDc6TGljZW5zZW1pdA=="
-    }
-  }
-]
-
- - - -
-
-
-
-
-

- List repositories watched by a user -

-

Lists repositories a user is watching.

-
-
get /users/{username}/subscriptions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/subscriptions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/subscriptions', {
-  username: 'username'
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1296269,
-    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-    "name": "Hello-World",
-    "full_name": "octocat/Hello-World",
-    "owner": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "private": false,
-    "html_url": "https://github.com/octocat/Hello-World",
-    "description": "This your first repo!",
-    "fork": false,
-    "url": "https://api.github.com/repos/octocat/Hello-World",
-    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-    "git_url": "git:github.com/octocat/Hello-World.git",
-    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-    "ssh_url": "git@github.com:octocat/Hello-World.git",
-    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
-    "clone_url": "https://github.com/octocat/Hello-World.git",
-    "mirror_url": "git:git.example.com/octocat/Hello-World",
-    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
-    "svn_url": "https://svn.github.com/octocat/Hello-World",
-    "homepage": "https://github.com",
-    "language": null,
-    "forks_count": 9,
-    "stargazers_count": 80,
-    "watchers_count": 80,
-    "size": 108,
-    "default_branch": "master",
-    "open_issues_count": 0,
-    "is_template": true,
-    "topics": [
-      "octocat",
-      "atom",
-      "electron",
-      "api"
-    ],
-    "has_issues": true,
-    "has_projects": true,
-    "has_wiki": true,
-    "has_pages": false,
-    "has_downloads": true,
-    "archived": false,
-    "disabled": false,
-    "visibility": "public",
-    "pushed_at": "2011-01-26T19:06:43Z",
-    "created_at": "2011-01-26T19:01:12Z",
-    "updated_at": "2011-01-26T19:14:43Z",
-    "permissions": {
-      "admin": false,
-      "push": false,
-      "pull": true
-    },
-    "template_repository": null,
-    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
-    "delete_branch_on_merge": true,
-    "subscribers_count": 42,
-    "network_count": 0,
-    "license": {
-      "key": "mit",
-      "name": "MIT License",
-      "spdx_id": "MIT",
-      "url": "https://api.github.com/licenses/mit",
-      "node_id": "MDc6TGljZW5zZW1pdA=="
-    }
-  }
-]
-
- - -

Notes

- - - -
-
-
-
-
-
-
- -
-

- Did this doc help you? -

-

- - - - -

- - - - - -

- - -

- - -
- -
-
- - - -
-
-
-
-

Ask a human

-

Can't find what you're looking for?

- Contact us -
-
- -
-
-
-
- - - - - -
- - -` - -var activityEventsGoFileOriginal = `// Copyright 2013 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// ListEvents drinks from the firehose of all public events across GitHub. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-events -func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) { - u, err := addOptions("events", opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListRepositoryEvents lists events for a repository. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-repository-events -func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/events", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// Note that ActivityService.ListIssueEventsForRepository was moved to: -// IssuesService.ListRepositoryEvents. - -// ListEventsForRepoNetwork lists public events for a network of repositories. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-events-for-a-network-of-repositories -func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("networks/%v/%v/events", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsForOrganization lists public events for an organization. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-events-for-an-organization -func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("orgs/%v/events", org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is -// true, only public events will be returned. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-events-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-events-for-a-user -func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { - var u string - if publicOnly { - u = fmt.Sprintf("users/%v/events/public", user) - } else { - u = fmt.Sprintf("users/%v/events", user) - } - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsReceivedByUser lists the events received by a user. If publicOnly is -// true, only public events will be returned. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-events-received-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-events-received-by-a-user -func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { - var u string - if publicOnly { - u = fmt.Sprintf("users/%v/received_events/public", user) - } else { - u = fmt.Sprintf("users/%v/received_events", user) - } - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListUserEventsForOrganization provides the user’s organization dashboard. You -// must be authenticated as the user to view this. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-events-for-an-organization -func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("users/%v/events/orgs/%v", user, org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} -` - -var activityEventsGoFileWant = `// Copyright 2013 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github +//go:embed testdata/activity-events.html +var activityEventsTestWebPage string -import ( - "context" - "fmt" -) +//go:embed testdata/activity_events-original.go +var activityEventsGoFileOriginal string -// ListEvents drinks from the firehose of all public events across GitHub. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-events -func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) { - u, err := addOptions("events", opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListRepositoryEvents lists events for a repository. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-repository-events -func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/events", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// Note that ActivityService.ListIssueEventsForRepository was moved to: -// IssuesService.ListRepositoryEvents. - -// ListEventsForRepoNetwork lists public events for a network of repositories. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-events-for-a-network-of-repositories -func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("networks/%v/%v/events", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsForOrganization lists public events for an organization. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-organization-events -func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("orgs/%v/events", org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is -// true, only public events will be returned. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-events-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-events-for-a-user -func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { - var u string - if publicOnly { - u = fmt.Sprintf("users/%v/events/public", user) - } else { - u = fmt.Sprintf("users/%v/events", user) - } - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsReceivedByUser lists the events received by a user. If publicOnly is -// true, only public events will be returned. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-events-received-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-events-received-by-a-user -func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { - var u string - if publicOnly { - u = fmt.Sprintf("users/%v/received_events/public", user) - } else { - u = fmt.Sprintf("users/%v/received_events", user) - } - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListUserEventsForOrganization provides the user’s organization dashboard. You -// must be authenticated as the user to view this. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-organization-events-for-the-authenticated-user -func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("users/%v/events/orgs/%v", user, org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} -` +//go:embed testdata/activity_events-want.go +var activityEventsGoFileWant string diff --git a/update-urls/main.go b/update-urls/main.go index 0e3f1eb079..41533ca469 100644 --- a/update-urls/main.go +++ b/update-urls/main.go @@ -33,12 +33,14 @@ import ( "regexp" "sort" "strings" + "time" + + "github.com/google/go-cmp/cmp" ) const ( codeLegacySplitString = `` codeSplitString = `await octokit.request('` - fragmentIDString = `

]*id="`) + stripHTMLRE = regexp.MustCompile(`<\/?[^>]+\/?>`) + condenseWhitespaceRE = regexp.MustCompile(`\s+`) + // skipMethods holds methods which are skipped because they do not have GitHub v3 // API URLs or are otherwise problematic in parsing, discovering, and/or fixing. skipMethods = map[string]bool{ @@ -65,6 +73,7 @@ var ( "AdminService.RenameOrgByName": true, "AdminService.UpdateTeamLDAPMapping": true, "AdminService.UpdateUserLDAPMapping": true, + "AppsService.CreateAttachment": true, "AppsService.FindRepositoryInstallationByID": true, "AuthorizationsService.CreateImpersonation": true, "AuthorizationsService.DeleteImpersonation": true, @@ -72,7 +81,10 @@ var ( "IssueImportService.CheckStatusSince": true, "IssueImportService.Create": true, "MarketplaceService.marketplaceURI": true, + "MigrationService.UserMigrationArchiveURL": true, "OrganizationsService.GetByID": true, + "RepositoriesService.CompareCommits": true, + "RepositoriesService.CompareCommitsRaw": true, "RepositoriesService.DeletePreReceiveHook": true, "RepositoriesService.DownloadContents": true, "RepositoriesService.DownloadContentsWithMeta": true, @@ -148,7 +160,7 @@ func main() { // Step 3 - resolve all missing httpMethods from helperMethods. // Additionally, use existing URLs as hints to pre-cache all apiDocs. - docCache := &documentCache{} + docCache := &documentCache{positioner: iter} usedHelpers, endpointsByFilename := resolveHelpersAndCacheDocs(endpoints, docCache) // Step 4 - validate and rewrite all URLs, skipping used helper methods. @@ -496,6 +508,7 @@ func findAllServiceEndpoints(iter astFileIterator, services servicesMap) (endpoi } func resolveHelpersAndCacheDocs(endpoints endpointsMap, docCache documentCacheWriter) (usedHelpers usedHelpersMap, endpointsByFilename endpointsByFilenameMap) { + logf("Step 3 - resolving helpers and cache docs ...") usedHelpers = usedHelpersMap{} endpointsByFilename = endpointsByFilenameMap{} for k, v := range endpoints { @@ -505,10 +518,10 @@ func resolveHelpersAndCacheDocs(endpoints endpointsMap, docCache documentCacheWr endpointsByFilename[v.filename] = append(endpointsByFilename[v.filename], v) for _, cmt := range v.enterpriseRefLines { - docCache.CacheDocFromInternet(cmt.Text, v.filename) + docCache.CacheDocFromInternet(cmt.Text, v.filename, docCache.Position(cmt.Pos())) } for _, cmt := range v.stdRefLines { - docCache.CacheDocFromInternet(cmt.Text, v.filename) + docCache.CacheDocFromInternet(cmt.Text, v.filename, docCache.Position(cmt.Pos())) } if v.httpMethod == "" && v.helperMethod != "" { @@ -533,13 +546,19 @@ type documentCacheReader interface { } type documentCacheWriter interface { - CacheDocFromInternet(urlWithFragmentID, filename string) + CacheDocFromInternet(urlWithFragmentID, filename string, pos token.Position) + Position(token.Pos) token.Position +} + +type positioner interface { + Position(token.Pos) token.Position } // documentCache implements documentCacheReader and documentCachWriter. type documentCache struct { apiDocs map[string]map[string][]*Endpoint // cached by URL, then mapped by web fragment identifier. urlByMethodAndPath map[string]string + positioner positioner } func (dc *documentCache) URLByMethodAndPath(methodAndPath string) (string, bool) { @@ -547,32 +566,42 @@ func (dc *documentCache) URLByMethodAndPath(methodAndPath string) (string, bool) return url, ok } -func (dc *documentCache) CacheDocFromInternet(urlWithID, filename string) { +func (dc *documentCache) CacheDocFromInternet(urlWithID, filename string, pos token.Position) { if dc.apiDocs == nil { dc.apiDocs = map[string]map[string][]*Endpoint{} // cached by URL, then mapped by web fragment identifier. dc.urlByMethodAndPath = map[string]string{} } - url := getURL(urlWithID) - if _, ok := dc.apiDocs[url]; ok { + baseURL, fullURL := getURL(urlWithID) + if _, ok := dc.apiDocs[baseURL]; ok { return // already cached } - logf("GET %q ...", url) - resp, err := http.Get(url) - check("Unable to get URL: %v: %v", url, err) - if resp.StatusCode != http.StatusOK { - log.Fatalf("filename: %v - url %v - StatusCode=%v", filename, url, resp.StatusCode) + logf("GET %q ...", fullURL) + time.Sleep(httpGetDelay) + resp, err := http.Get(fullURL) + check("Unable to get URL: %v: %v", fullURL, err) + switch resp.StatusCode { + case http.StatusTooManyRequests, http.StatusServiceUnavailable: + logf("Sleeping 60 seconds and trying again...") + time.Sleep(60 * time.Second) + resp, err = http.Get(fullURL) + check("Unable to get URL: %v: %v", fullURL, err) + case http.StatusOK: + default: + log.Fatalf("url %v - StatusCode=%v\ngithub/%v:%v:%v %v", fullURL, resp.StatusCode, filename, pos.Line, pos.Column, urlWithID) } finalURL := resp.Request.URL.String() - url = getURL(finalURL) - logf("The final URL is: %v; url=%v\n", finalURL, url) + baseURL, fullURL = getURL(finalURL) + url := baseURL + logf("urlWithID: %v ; finalURL: %v ; baseURL: %v, fullURL: %v", urlWithID, finalURL, baseURL, fullURL) b, err := ioutil.ReadAll(resp.Body) check("Unable to read body of URL: %v, %v", url, err) check("Unable to close body of URL: %v, %v", url, resp.Body.Close()) - dc.apiDocs[url] = parseWebPageEndpoints(string(b)) + dc.apiDocs[url], err = parseWebPageEndpoints(string(b)) + check("Unable to parse web page endpoints: url: %v, filename: %v, err: %v", url, filename, err) logf("Found %v web page fragment identifiers.", len(dc.apiDocs[url])) if len(dc.apiDocs[url]) == 0 { logf("webage text: %s", b) @@ -585,13 +614,17 @@ func (dc *documentCache) CacheDocFromInternet(urlWithID, filename string) { logf("For fragID=%q, endpoint=%q, found %v paths.", fragID, endpoint, len(endpoint.urlFormats)) for _, path := range endpoint.urlFormats { methodAndPath := fmt.Sprintf("%v %v", endpoint.httpMethod, path) - dc.urlByMethodAndPath[methodAndPath] = fmt.Sprintf("%v#%v", url, fragID) + dc.urlByMethodAndPath[methodAndPath] = fmt.Sprintf("%v#%v", strings.TrimRight(url, "/"), fragID) logf("urlByMethodAndPath[%q] = %q", methodAndPath, dc.urlByMethodAndPath[methodAndPath]) } } } } +func (dc *documentCache) Position(pos token.Pos) token.Position { + return dc.positioner.Position(pos) +} + // FileEdit represents an edit that needs to be performed on a file. type FileEdit struct { pos token.Position @@ -599,21 +632,26 @@ type FileEdit struct { toText string } -func getURL(s string) string { +func getURL(s string) (baseURL, fullURL string) { i := strings.Index(s, "http") if i < 0 { - return "" + return "", "" } j := strings.Index(s, "#") if j < i { - s = s[i:] + if !strings.HasSuffix(s, "/") { // Prevent unnecessary redirects if possible. + s += "/" + } + baseURL = s[i:] + fullURL = s[i:] } else { - s = s[i:j] - } - if !strings.HasSuffix(s, "/") { // Prevent unnecessary redirects if possible. - s += "/" + fullURL = s[i:] + baseURL = s[i:j] + if !strings.HasSuffix(baseURL, "/") { // Prevent unnecessary redirects if possible. + baseURL += "/" + } } - return s + return baseURL, fullURL } // Service represents a go-github service. @@ -637,10 +675,19 @@ type Endpoint struct { // String helps with debugging by providing an easy-to-read summary of the endpoint. func (e *Endpoint) String() string { + if e == nil { + return "Endpoint{nil}" + } var b strings.Builder - b.WriteString(fmt.Sprintf(" filename: %v\n", e.filename)) - b.WriteString(fmt.Sprintf(" serviceName: %v\n", e.serviceName)) - b.WriteString(fmt.Sprintf(" endpointName: %v\n", e.endpointName)) + if e.filename != "" { + b.WriteString(fmt.Sprintf(" filename: %v\n", e.filename)) + } + if e.serviceName != "" { + b.WriteString(fmt.Sprintf(" serviceName: %v\n", e.serviceName)) + } + if e.endpointName != "" { + b.WriteString(fmt.Sprintf(" endpointName: %v\n", e.endpointName)) + } b.WriteString(fmt.Sprintf(" httpMethod: %v\n", e.httpMethod)) if e.helperMethod != "" { b.WriteString(fmt.Sprintf(" helperMethod: %v\n", e.helperMethod)) @@ -751,7 +798,7 @@ func processAST(filename string, f *ast.File, services servicesMap, endpoints en endpoints[fullName] = ep logf("endpoints[%q] = %#v", fullName, endpoints[fullName]) if ep.httpMethod == "" && (ep.helperMethod == "" || len(ep.urlFormats) == 0) { - return fmt.Errorf("could not find body info: %#v", *ep) + return fmt.Errorf("filename=%q, endpoint=%q: could not find body info: %#v", filename, fullName, *ep) } case *ast.GenDecl: default: @@ -825,9 +872,9 @@ func (b *bodyData) parseBody(body *ast.BlockStmt) error { case *ast.ReturnStmt: // Return Results logf("*ast.ReturnStmt: %#v", *stmt) if len(stmt.Results) > 0 { - ce, ok := stmt.Results[0].(*ast.CallExpr) - if ok { - recv, funcName, args := processCallExpr(ce) + switch rslt0 := stmt.Results[0].(type) { + case *ast.CallExpr: + recv, funcName, args := processCallExpr(rslt0) logf("return CallExpr: recv=%q, funcName=%q, args=%#v", recv, funcName, args) // If the httpMethod has not been found at this point, but // this method is calling a helper function, then see if @@ -840,18 +887,32 @@ func (b *bodyData) parseBody(body *ast.BlockStmt) error { if len(b.assignments) == 0 && len(b.urlFormats) == 0 { b.urlFormats = append(b.urlFormats, strings.Trim(args[1], `"`)) b.helperMethod = funcName - logf("found urlFormat: %v and helper method: %v", b.urlFormats[0], b.helperMethod) + switch b.helperMethod { + case "deleteReaction": + b.httpMethod = "DELETE" + default: + logf("WARNING: helper method %q not found", b.helperMethod) + } + logf("found urlFormat: %v and helper method: %v, httpMethod: %v", b.urlFormats[0], b.helperMethod, b.httpMethod) } else { for _, lr := range b.assignments { if lr.lhs == args[1] { // Multiple matches are possible. Loop over all assignments. b.urlVarName = args[1] b.urlFormats = append(b.urlFormats, lr.rhs) b.helperMethod = funcName - logf("found urlFormat: %v and helper method: %v", lr.rhs, b.helperMethod) + switch b.helperMethod { + case "deleteReaction": + b.httpMethod = "DELETE" + default: + logf("WARNING: helper method %q not found", b.helperMethod) + } + logf("found urlFormat: %v and helper method: %v, httpMethod: %v", lr.rhs, b.helperMethod, b.httpMethod) } } } } + default: + logf("WARNING: stmt.Results[0] unhandled type = %T = %#v", stmt.Results[0], stmt.Results[0]) } } case *ast.SwitchStmt: @@ -866,18 +927,18 @@ func (b *bodyData) parseBody(body *ast.BlockStmt) error { } func (b *bodyData) parseIf(stmt *ast.IfStmt) error { - logf("*ast.IfStmt: %#v", *stmt) + logf("parseIf: *ast.IfStmt: %#v", *stmt) if err := b.parseBody(stmt.Body); err != nil { return err } - logf("if body: b=%#v", *b) + logf("parseIf: if body: b=%#v", *b) if stmt.Else != nil { switch els := stmt.Else.(type) { case *ast.BlockStmt: if err := b.parseBody(els); err != nil { return err } - logf("if else: b=%#v", *b) + logf("parseIf: if else: b=%#v", *b) case *ast.IfStmt: if err := b.parseIf(els); err != nil { return err @@ -940,6 +1001,11 @@ func processAssignStmt(receiverName string, stmt *ast.AssignStmt) (httpMethod, u case "NewUploadRequest": httpMethod = "POST" urlVarName = args[0] + case "roundTripWithOptionalFollowRedirect": + httpMethod = "GET" + urlVarName = args[1] + default: + logf("WARNING: processAssignStmt: unhandled CallExpr: recv=%q, funcName=%q, args=%#v", recv, funcName, args) } if recv == receiverName && len(args) > 1 && args[0] == "ctx" { // This might be a helper method. fullName := fmt.Sprintf("%v.%v", recv, funcName) @@ -1116,9 +1182,19 @@ func check(fmtStr string, args ...interface{}) { } } +func endpointsEqual(a, b *Endpoint) bool { + if a == nil || b == nil { + return false + } + if a.httpMethod != b.httpMethod { + return false + } + return cmp.Equal(a.urlFormats, b.urlFormats) +} + // parseWebPageEndpoints returns endpoint information, mapped by // web page fragment identifier. -func parseWebPageEndpoints(buf string) map[string][]*Endpoint { +func parseWebPageEndpoints(buf string) (map[string][]*Endpoint, error) { result := map[string][]*Endpoint{} // The GitHub v3 API web pages do not appear to be auto-generated @@ -1134,28 +1210,61 @@ func parseWebPageEndpoints(buf string) map[string][]*Endpoint { parts := splitHTML(buf) var lastFragmentID string - for _, part := range parts { + + addDedup := func(endpoint *Endpoint) { + for _, v := range result[lastFragmentID] { + if endpointsEqual(v, endpoint) { + return + } + } + result[lastFragmentID] = append(result[lastFragmentID], endpoint) + } + + for i, part := range parts { + noHTML := stripHTML(part) + + m := fragmentIDStringRE.FindAllStringSubmatch(part, -1) + if len(m) > 0 { + fragmentIDString := m[len(m)-1][0] + if i := strings.LastIndex(part, fragmentIDString); i >= 0 { + b := part[i+len(fragmentIDString):] + i = strings.Index(b, `"`) + if i >= 0 { + lastFragmentID = b[:i] + if j := strings.Index(lastFragmentID, "--"); j > 0 { + lastFragmentID = lastFragmentID[:j] // chop off trailing "--code-samples" for example. + } + logf("Found lastFragmentID: %v", lastFragmentID) + } + } + } + for _, method := range httpMethods { if strings.HasPrefix(part, method) { - endpoint := parseEndpoint(part, method) if lastFragmentID == "" { - log.Fatalf("parseWebPageEndpoints: empty lastFragmentID") + logf("WARNING: ignoring empty lastFragmentID: part #%v: noHTML=\n%v", i+1, noHTML) + continue } - result[lastFragmentID] = append(result[lastFragmentID], endpoint) + endpoint := parseEndpoint(part, method) + addDedup(endpoint) + continue } - } - if i := strings.LastIndex(part, fragmentIDString); i >= 0 { - b := part[i+len(fragmentIDString):] - i = strings.Index(b, `"`) - if i >= 0 { - lastFragmentID = b[:i] - logf("Found lastFragmentID: %v", lastFragmentID) + if endpoint := parseNewfangledEndpoint(noHTML, method); endpoint != nil && lastFragmentID != "" { + logf("part #%v: adding newfangled endpoint: %#v", i+1, endpoint) + addDedup(endpoint) } } } - return result + return result, nil +} + +func stripHTML(s string) string { + s = strings.ReplaceAll(s, "", "") + s = strings.ReplaceAll(s, "", "") + s = stripHTMLRE.ReplaceAllString(s, " ") + return condenseWhitespaceRE.ReplaceAllString(s, " ") } func splitHTML(buf string) []string { @@ -1167,12 +1276,15 @@ func splitHTML(buf string) []string { case i < 0 && j < 0: result = append(result, buf) buf = "" + logf("splitHTML region #%v (%v bytes): case 1: i=%v, j=%v", len(result), len(result[len(result)-1]), i, j) case j < 0, i >= 0 && j >= 0 && i < j: result = append(result, buf[:i]) buf = buf[i+len(codeLegacySplitString):] + logf("splitHTML region #%v (%v bytes): case 2: i=%v, j=%v", len(result), len(result[len(result)-1]), i, j) case i < 0, i >= 0 && j >= 0 && j < i: result = append(result, buf[:j]) buf = buf[j+len(codeSplitString):] + logf("splitHTML region #%v (%v bytes): case 3: i=%v, j=%v", len(result), len(result[len(result)-1]), i, j) default: log.Fatalf("splitHTML: i=%v, j=%v", i, j) } @@ -1180,6 +1292,19 @@ func splitHTML(buf string) []string { return result } +func parseNewfangledEndpoint(s, method string) *Endpoint { + parts := strings.Split(s, " ") + if len(parts) < 2 { + return nil + } + for i, part := range parts[:len(parts)-1] { + if strings.EqualFold(part, method) && strings.HasPrefix(parts[i+1], "/") { + return parseEndpoint(method+" "+parts[i+1], method) + } + } + return nil +} + func parseEndpoint(s, method string) *Endpoint { eol := strings.Index(s, "\n") if eol < 0 { diff --git a/update-urls/main_test.go b/update-urls/main_test.go index 49f165fd9d..d4696e1e96 100644 --- a/update-urls/main_test.go +++ b/update-urls/main_test.go @@ -251,7 +251,8 @@ func (f *fakeDocCache) URLByMethodAndPath(methodAndPath string) (string, bool) { return "", false } -func (f *fakeDocCache) CacheDocFromInternet(url, filename string) {} // no-op +func (f *fakeDocCache) CacheDocFromInternet(url, filename string, pos token.Position) {} // no-op +func (f *fakeDocCache) Position(pos token.Pos) token.Position { return token.Position{} } // no-op // fakeFileRewriter implements FileRewriter. type fakeFileRewriter struct { @@ -509,45 +510,49 @@ func TestPerformBufferEdits(t *testing.T) { func TestGitURL(t *testing.T) { tests := []struct { - name string - s string - want string + name string + s string + wantBase string + wantFull string }{ {name: "empty string"}, {name: "non-http", s: "howdy"}, { - name: "normal URL, no slash", - s: "https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events", - want: "https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/", + name: "normal URL, no slash", + s: "https://docs.github.com/en/rest/activity/events", + wantBase: "https://docs.github.com/en/rest/activity/events/", + wantFull: "https://docs.github.com/en/rest/activity/events/", }, { - name: "normal URL, with slash", - s: "https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/", - want: "https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/", + name: "normal URL, with slash", + s: "https://docs.github.com/en/rest/activity/events/", + wantBase: "https://docs.github.com/en/rest/activity/events/", + wantFull: "https://docs.github.com/en/rest/activity/events/", }, { - name: "normal URL, with fragment identifier", - s: "https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/#list-public-events", - want: "https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/", + name: "normal URL, with fragment identifier", + s: "https://docs.github.com/en/rest/activity/events/#list-public-events", + wantBase: "https://docs.github.com/en/rest/activity/events/", + wantFull: "https://docs.github.com/en/rest/activity/events/#list-public-events", }, } for i, tt := range tests { t.Run(fmt.Sprintf("test #%v: %v", i, tt.name), func(t *testing.T) { - got := getURL(tt.s) - if got != tt.want { - t.Errorf("getURL = %v ; want %v", got, tt.want) + gotBase, gotFull := getURL(tt.s) + + if gotBase != tt.wantBase { + t.Errorf("getURL base = %v ; want %v", gotBase, tt.wantBase) + } + + if gotFull != tt.wantFull { + t.Errorf("getURL full = %v ; want %v", gotFull, tt.wantFull) } }) } } -var endpointEqual = cmp.Comparer(func(a, b *Endpoint) bool { - if a.httpMethod != b.httpMethod { - return false - } - return cmp.Equal(a.urlFormats, b.urlFormats) -}) +var endpointsEqualCmp = cmp.Comparer(endpointsEqual) func testWebPageHelper(t *testing.T, got, want map[string][]*Endpoint) { t.Helper() @@ -557,16 +562,19 @@ func testWebPageHelper(t *testing.T, got, want map[string][]*Endpoint) { if len(got[k]) != len(w) { t.Errorf("len(got[%q]) = %v, len(want[%q]) = %v", k, len(got[k]), k, len(w)) } + for i := 0; i < len(got[k]); i++ { var wantEndpoint *Endpoint if ok && i < len(w) { wantEndpoint = w[i] } - if !cmp.Equal(got[k][i], wantEndpoint, endpointEqual) { - t.Errorf("got[%q][%v] =\n%#v\nwant[%q][%v]:\n%#v", k, i, got[k][i], k, i, wantEndpoint) + + if diff := cmp.Diff(wantEndpoint, got[k][i], endpointsEqualCmp); diff != "" { + t.Errorf("endpoint %q i=%v mismatch (-want +got):\n%v", k, i, diff) } } } + for k := range want { if _, ok := got[k]; !ok { t.Errorf("got[%q] = nil\nwant[%q]:\n%#v", k, k, want[k]) @@ -601,7 +609,7 @@ func TestParseEndpoint(t *testing.T) { t.Run(fmt.Sprintf("test #%v: %v", i, tt.name), func(t *testing.T) { got := parseEndpoint(tt.s, tt.method) - if !cmp.Equal(got, tt.want, endpointEqual) { + if !cmp.Equal(got, tt.want, endpointsEqualCmp) { t.Errorf("parseEndpoint = %#v, want %#v", got, tt.want) } }) diff --git a/update-urls/reactions_test.go b/update-urls/reactions_test.go index 7422a5951c..a3071966b9 100644 --- a/update-urls/reactions_test.go +++ b/update-urls/reactions_test.go @@ -6,17 +6,19 @@ package main import ( + _ "embed" + "strings" "testing" ) func newReactionsPipeline() *pipelineSetup { return &pipelineSetup{ - baseURL: "https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/", + baseURL: "https://docs.github.com/en/rest/reactions/", endpointsFromWebsite: reactionsWant, filename: "reactions.go", serviceName: "ReactionsService", - originalGoSource: reactionsGoFileOriginal, - wantGoSource: reactionsGoFileWant, + originalGoSource: strings.ReplaceAll(reactionsGoFileOriginal, "\r", ""), + wantGoSource: strings.ReplaceAll(reactionsGoFileWant, "\r", ""), wantNumEndpoints: 25, } } @@ -46,8 +48,11 @@ func TestPipeline_Reactions_FirstStripAllURLsAndDestroyReceivers(t *testing.T) { } func TestParseWebPageEndpoints_Reactions(t *testing.T) { - got, want := parseWebPageEndpoints(reactionsTestWebPage), reactionsWant - testWebPageHelper(t, got, want) + got, err := parseWebPageEndpoints(reactionsTestWebPage) + if err != nil { + t.Fatal(err) + } + testWebPageHelper(t, got, reactionsWant) } var reactionsWant = endpointsByFragmentID{ @@ -128,6679 +133,11 @@ var reactionsWant = endpointsByFragmentID{ "list-reactions-for-a-team-discussion-legacy": []*Endpoint{{urlFormats: []string{"teams/%v/discussions/%v/reactions"}, httpMethod: "GET"}}, } -var reactionsTestWebPage = ` - - - Reactions - GitHub Docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - - -
-
- -
- - - Article version: GitHub.com - - - - -
- - -
-
- - -
-
- -
- -
-
-

Reactions

-
- -
-
- - - - - - - - -
-
-
- -

In this article

- - -
- -
-

- Did this doc help you? -

-

- - - - -

- - - - - -

- - -

- - -
- -
-
-
-
- -

Reaction types

-

When creating a reaction, the allowed values for the content parameter are as follows (with the corresponding emoji for reference):

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
contentemoji
+1👍
-1👎
laugh😄
confused😕
heart❤️
hooray🎉
rocket🚀
eyes👀
-
-
-

- List reactions for a team discussion comment -

-

List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.

-

Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.

-
-
get /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
comment_numberintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  comment_number: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a team discussion comment -

-

Create a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion comment.

-

Note: You can also specify a team by org_id and team_id using the route POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.

-
-
post /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
comment_numberintegerpath - - -
contentstringbody -

Required. The reaction type to add to the team discussion comment.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  comment_number: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete team discussion comment reaction -

-

Note: You can also specify a team or organization with team_id and org_id using the route DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id.

-

Delete a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope.

-
-
delete /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
comment_numberintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -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
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  comment_number: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for a team discussion -

-

List the reactions to a team discussion. OAuth access tokens require the read:discussion scope.

-

Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions.

-
-
get /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a team discussion -

-

Create a reaction to a team discussion. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion.

-

Note: You can also specify a team by org_id and team_id using the route POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions.

-
-
post /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
contentstringbody -

Required. The reaction type to add to the team discussion.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete team discussion reaction -

-

Note: You can also specify a team or organization with team_id and org_id using the route DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions/:reaction_id.

-

Delete a reaction to a team discussion. OAuth access tokens require the write:discussion scope.

-
-
delete /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete a reaction (Legacy) -

-

Deprecation Notice: This endpoint route is deprecated and will be removed from the Reactions API. We recommend migrating your existing code to use the new delete reactions endpoints. For more information, see this blog post.

-

OAuth access tokens require the write:discussion scope, when deleting a team discussion or team discussion comment.

-
-
delete /reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /reactions/{reaction_id}', {
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for a commit comment -

-

List the reactions to a commit comment.

-
-
get /repos/{owner}/{repo}/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a commit comment.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/comments/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a commit comment -

-

Create a reaction to a commit comment. A response with a Status: 200 OK means that you already added the reaction type to this commit comment.

-
-
post /repos/{owner}/{repo}/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringbody -

Required. The reaction type to add to the commit comment.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/comments/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /repos/{owner}/{repo}/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete a commit comment reaction -

-

Note: You can also specify a repository by repository_id using the route DELETE /repositories/:repository_id/comments/:comment_id/reactions/:reaction_id.

-

Delete a reaction to a commit comment.

-
-
delete /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/comments/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for an issue comment -

-

List the reactions to an issue comment.

-
-
get /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to an issue comment.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for an issue comment -

-

Create a reaction to an issue comment. A response with a Status: 200 OK means that you already added the reaction type to this issue comment.

-
-
post /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringbody -

Required. The reaction type to add to the issue comment.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete an issue comment reaction -

-

Note: You can also specify a repository by repository_id using the route DELETE delete /repositories/:repository_id/issues/comments/:comment_id/reactions/:reaction_id.

-

Delete a reaction to an issue comment.

-
-
delete /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for an issue -

-

List the reactions to an issue.

-
-
get /repos/{owner}/{repo}/issues/{issue_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
issue_numberintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to an issue.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/issues/{issue_number}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  issue_number: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for an issue -

-

Create a reaction to an issue. A response with a Status: 200 OK means that you already added the reaction type to this issue.

-
-
post /repos/{owner}/{repo}/issues/{issue_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
issue_numberintegerpath - - -
contentstringbody -

Required. The reaction type to add to the issue.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  issue_number: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete an issue reaction -

-

Note: You can also specify a repository by repository_id using the route DELETE /repositories/:repository_id/issues/:issue_number/reactions/:reaction_id.

-

Delete a reaction to an issue.

-
-
delete /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
issue_numberintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  issue_number: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
- -
get /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a pull request review comment.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a pull request review comment -

-

Create a reaction to a pull request review comment. A response with a Status: 200 OK means that you already added the reaction type to this pull request review comment.

-
-
post /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringbody -

Required. The reaction type to add to the pull request review comment.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete a pull request comment reaction -

-

Note: You can also specify a repository by repository_id using the route DELETE /repositories/:repository_id/pulls/comments/:comment_id/reactions/:reaction_id.

-

Delete a reaction to a pull request review comment.

-
-
delete /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for a team discussion comment (Legacy) -

-

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List reactions for a team discussion comment endpoint.

-

List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.

-
-
get /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
team_idintegerpath - - -
discussion_numberintegerpath - - -
comment_numberintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/teams/42/discussions/42/comments/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
-  team_id: 42,
-  discussion_number: 42,
-  comment_number: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a team discussion comment (Legacy) -

-

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create reaction for a team discussion comment endpoint.

-

Create a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion comment.

-
-
post /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
team_idintegerpath - - -
discussion_numberintegerpath - - -
comment_numberintegerpath - - -
contentstringbody -

Required. The reaction type to add to the team discussion comment.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/teams/42/discussions/42/comments/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
-  team_id: 42,
-  discussion_number: 42,
-  comment_number: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for a team discussion (Legacy) -

-

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List reactions for a team discussion endpoint.

-

List the reactions to a team discussion. OAuth access tokens require the read:discussion scope.

-
-
get /teams/{team_id}/discussions/{discussion_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
team_idintegerpath - - -
discussion_numberintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/teams/42/discussions/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/reactions', {
-  team_id: 42,
-  discussion_number: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a team discussion (Legacy) -

-

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create reaction for a team discussion endpoint.

-

Create a reaction to a team discussion. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion.

-
-
post /teams/{team_id}/discussions/{discussion_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
team_idintegerpath - - -
discussion_numberintegerpath - - -
contentstringbody -

Required. The reaction type to add to the team discussion.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/teams/42/discussions/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/reactions', {
-  team_id: 42,
-  discussion_number: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - - -

- - Preview notice - -

- -
-

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 -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-
-
- -
-

- Did this doc help you? -

-

- - - - -

- - - - - -

- - -

- - -
- -
-
- - - -
-
-
-
-

Ask a human

-

Can't find what you're looking for?

- Contact us -
-
- -
-
-
-
- - - - - -
- - -` - -var reactionsGoFileOriginal = `// Copyright 2016 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" - "net/http" -) - -// ReactionsService provides access to the reactions-related functions in the -// GitHub API. -type ReactionsService service - -// Reaction represents a GitHub reaction. -type Reaction struct { - // ID is the Reaction ID. - ID *int64 ` + "`" + `json:"id,omitempty"` + "`" + ` - User *User ` + "`" + `json:"user,omitempty"` + "`" + ` - NodeID *string ` + "`" + `json:"node_id,omitempty"` + "`" + ` - // Content is the type of reaction. - // Possible values are: - // "+1", "-1", "laugh", "confused", "heart", "hooray". - Content *string ` + "`" + `json:"content,omitempty"` + "`" + ` -} - -// Reactions represents a summary of GitHub reactions. -type Reactions struct { - TotalCount *int ` + "`" + `json:"total_count,omitempty"` + "`" + ` - PlusOne *int ` + "`" + `json:"+1,omitempty"` + "`" + ` - MinusOne *int ` + "`" + `json:"-1,omitempty"` + "`" + ` - Laugh *int ` + "`" + `json:"laugh,omitempty"` + "`" + ` - Confused *int ` + "`" + `json:"confused,omitempty"` + "`" + ` - Heart *int ` + "`" + `json:"heart,omitempty"` + "`" + ` - Hooray *int ` + "`" + `json:"hooray,omitempty"` + "`" + ` - URL *string ` + "`" + `json:"url,omitempty"` + "`" + ` -} - -func (r Reaction) String() string { - return Stringify(r) -} - -// ListCommentReactionOptions specifies the optional parameters to the -// ReactionsService.ListCommentReactions method. -type ListCommentReactionOptions struct { - // Content restricts the returned comment reactions to only those with the given type. - // Omit this parameter to list all reactions to a commit comment. - // Possible values are: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". - Content string ` + "`" + `url:"content,omitempty"` + "`" + ` - - ListOptions -} - -// ListCommentReactions lists the reactions for a commit comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-commit-comment -func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateCommentReaction creates a reaction for a commit comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-commit-comment -func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteCommentReaction deletes the reaction for a commit comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-commit-comment-reaction -func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, u) -} - -// DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-commit-comment-reaction -func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, u) -} - -// ListIssueReactions lists the reactions for an issue. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-an-issue -func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateIssueReaction creates a reaction for an issue. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-an-issue -func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteIssueReaction deletes the reaction to an issue. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteIssueReactionByID deletes the reaction to an issue by repository ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListIssueCommentReactions lists the reactions for an issue comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-an-issue-comment -func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateIssueCommentReaction creates a reaction for an issue comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-an-issue-comment -func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteIssueCommentReaction deletes the reaction to an issue comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-comment-reaction -func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-comment-reaction -func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListPullRequestCommentReactions lists the reactions for a pull request review comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-an-issue-comment -func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// CreatePullRequestCommentReaction creates a reaction for a pull request review comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-an-issue-comment -func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) +//go:embed testdata/reactions.html +var reactionsTestWebPage string - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } +//go:embed testdata/reactions-original.go +var reactionsGoFileOriginal string - return m, resp, nil -} - -// DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-pull-request-comment-reaction -func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-pull-request-comment-reaction -func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListTeamDiscussionReactions lists the reactions for a team discussion. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-team-discussion -func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateTeamDiscussionReaction creates a reaction for a team discussion. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-team-discussion -func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteTeamDiscussionReaction deletes the reaction to a team discussion. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-team-discussion-comment -func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, nil, err - } - return m, resp, nil -} - -// CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-team-discussion-comment -func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest(http.MethodDelete, url, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - return s.client.Do(ctx, req, nil) -} -` - -var reactionsGoFileWant = `// Copyright 2016 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" - "net/http" -) - -// ReactionsService provides access to the reactions-related functions in the -// GitHub API. -type ReactionsService service - -// Reaction represents a GitHub reaction. -type Reaction struct { - // ID is the Reaction ID. - ID *int64 ` + "`" + `json:"id,omitempty"` + "`" + ` - User *User ` + "`" + `json:"user,omitempty"` + "`" + ` - NodeID *string ` + "`" + `json:"node_id,omitempty"` + "`" + ` - // Content is the type of reaction. - // Possible values are: - // "+1", "-1", "laugh", "confused", "heart", "hooray". - Content *string ` + "`" + `json:"content,omitempty"` + "`" + ` -} - -// Reactions represents a summary of GitHub reactions. -type Reactions struct { - TotalCount *int ` + "`" + `json:"total_count,omitempty"` + "`" + ` - PlusOne *int ` + "`" + `json:"+1,omitempty"` + "`" + ` - MinusOne *int ` + "`" + `json:"-1,omitempty"` + "`" + ` - Laugh *int ` + "`" + `json:"laugh,omitempty"` + "`" + ` - Confused *int ` + "`" + `json:"confused,omitempty"` + "`" + ` - Heart *int ` + "`" + `json:"heart,omitempty"` + "`" + ` - Hooray *int ` + "`" + `json:"hooray,omitempty"` + "`" + ` - URL *string ` + "`" + `json:"url,omitempty"` + "`" + ` -} - -func (r Reaction) String() string { - return Stringify(r) -} - -// ListCommentReactionOptions specifies the optional parameters to the -// ReactionsService.ListCommentReactions method. -type ListCommentReactionOptions struct { - // Content restricts the returned comment reactions to only those with the given type. - // Omit this parameter to list all reactions to a commit comment. - // Possible values are: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". - Content string ` + "`" + `url:"content,omitempty"` + "`" + ` - - ListOptions -} - -// ListCommentReactions lists the reactions for a commit comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-commit-comment -func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateCommentReaction creates a reaction for a commit comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-commit-comment -func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteCommentReaction deletes the reaction for a commit comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-commit-comment-reaction -func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, u) -} - -// DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-commit-comment-reaction -func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, u) -} - -// ListIssueReactions lists the reactions for an issue. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-an-issue -func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateIssueReaction creates a reaction for an issue. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-an-issue -func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteIssueReaction deletes the reaction to an issue. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteIssueReactionByID deletes the reaction to an issue by repository ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListIssueCommentReactions lists the reactions for an issue comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-an-issue-comment -func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateIssueCommentReaction creates a reaction for an issue comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-an-issue-comment -func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteIssueCommentReaction deletes the reaction to an issue comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-comment-reaction -func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-comment-reaction -func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListPullRequestCommentReactions lists the reactions for a pull request review comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-pull-request-review-comment -func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// CreatePullRequestCommentReaction creates a reaction for a pull request review comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-pull-request-review-comment -func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - 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 { - return nil, resp, err - } - - return m, resp, nil -} - -// DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-pull-request-comment-reaction -func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-pull-request-comment-reaction -func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListTeamDiscussionReactions lists the reactions for a team discussion. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-team-discussion-legacy -func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateTeamDiscussionReaction creates a reaction for a team discussion. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-team-discussion-legacy -func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteTeamDiscussionReaction deletes the reaction to a team discussion. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-team-discussion-comment-legacy -func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, nil, err - } - return m, resp, nil -} - -// CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-team-discussion-comment-legacy -func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. -// -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest(http.MethodDelete, url, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - return s.client.Do(ctx, req, nil) -} -` +//go:embed testdata/reactions-want.go +var reactionsGoFileWant string diff --git a/update-urls/testdata/activity-events.html b/update-urls/testdata/activity-events.html new file mode 100644 index 0000000000..90eac2f59f --- /dev/null +++ b/update-urls/testdata/activity-events.html @@ -0,0 +1,5686 @@ + + + Activity - GitHub Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + + +
+
+ +
+ + + Article version: GitHub.com + + + + +
+ + +
+
+ + +
+
+ +
+ +
+
+

Activity

+
+ +
+
+ + + + + + + + +
+
+
+ +

In this article

+ + +
+ +
+

+ Did this doc help you? +

+

+ + + + +

+ + + + + +

+ + +

+ + +
+ +
+
+
+
+ +

Events

+

The Events API is a read-only API to the GitHub events. These events power the various activity streams on the site.

+

The Events API can return different types of events triggered by activity on GitHub. For more information about the specific events that you can receive from the Events API, see "GitHub Event types." An events API for repository issues is also available. For more information, see the "Issue Events API."

+

Events are optimized for polling with the "ETag" header. If no new events have been triggered, you will see a "304 Not Modified" response, and your current rate limit will be untouched. There is also an "X-Poll-Interval" header that specifies how often (in seconds) you are allowed to poll. In times of high server load, the time may increase. Please obey the header.

+
$ curl -I https://api.github.com/users/tater/events
+> HTTP/1.1 200 OK
+> X-Poll-Interval: 60
+> ETag: "a18c3bded88eb5dbb5c849a489412bf3"
+
+# The quotes around the ETag value are important
+$ curl -I https://api.github.com/users/tater/events \
+$    -H 'If-None-Match: "a18c3bded88eb5dbb5c849a489412bf3"'
+> HTTP/1.1 304 Not Modified
+> X-Poll-Interval: 60
+

Events support pagination, however the per_page option is unsupported. The fixed page size is 30 items. Fetching up to ten pages is supported, for a total of 300 events. For information, see "Traversing with pagination."

+

Only events created within the past 90 days will be included in timelines. Events older than 90 days will not be included (even if the total number of events in the timeline is less than 300).

+
+
+

+ List public events +

+

We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago.

+
+
get /events
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/events
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /events')
+
+ + + + +

Response

+
Status: 200 OK
+
+ + +

Notes

+ + + +
+
+
+
+ +
get /networks/{owner}/{repo}/events
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/networks/octocat/hello-world/events
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /networks/{owner}/{repo}/events', {
+  owner: 'octocat',
+  repo: 'hello-world'
+})
+
+ + + + +

Response

+
Status: 200 OK
+
+ + +

Notes

+ + + +
+
+
+
+ +
get /orgs/{org}/events
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
orgstringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/orgs/ORG/events
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /orgs/{org}/events', {
+  org: 'org'
+})
+
+ + + + +

Response

+
Status: 200 OK
+
+ + +

Notes

+ + + +
+
+
+
+ +
get /repos/{owner}/{repo}/events
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/repos/octocat/hello-world/events
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /repos/{owner}/{repo}/events', {
+  owner: 'octocat',
+  repo: 'hello-world'
+})
+
+ + + + +

Response

+
Status: 200 OK
+
+ + +

Notes

+ + + +
+
+
+
+
+

+ List events for the authenticated user +

+

If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events.

+
+
get /users/{username}/events
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
usernamestringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/users/USERNAME/events
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /users/{username}/events', {
+  username: 'username'
+})
+
+ + + + +

Response

+
Status: 200 OK
+
+ + +

Notes

+ + + +
+
+
+
+
+

+ List organization events for the authenticated user +

+

This is the user's organization dashboard. You must be authenticated as the user to view this.

+
+
get /users/{username}/events/orgs/{org}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
usernamestringpath + + +
orgstringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/users/USERNAME/events/orgs/ORG
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /users/{username}/events/orgs/{org}', {
+  username: 'username',
+  org: 'org'
+})
+
+ + + + +

Response

+
Status: 200 OK
+
+ + + +
+
+
+
+ +
get /users/{username}/events/public
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
usernamestringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/users/USERNAME/events/public
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /users/{username}/events/public', {
+  username: 'username'
+})
+
+ + + + +

Response

+
Status: 200 OK
+
+ + +

Notes

+ + + +
+
+
+
+
+

+ List events received by the authenticated user +

+

These are events that you've received by watching repos and following users. If you are authenticated as the given user, you will see private events. Otherwise, you'll only see public events.

+
+
get /users/{username}/received_events
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
usernamestringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/users/USERNAME/received_events
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /users/{username}/received_events', {
+  username: 'username'
+})
+
+ + + + +

Response

+
Status: 200 OK
+
+ + +

Notes

+ + + +
+
+
+
+ +
get /users/{username}/received_events/public
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
usernamestringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/users/USERNAME/received_events/public
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /users/{username}/received_events/public', {
+  username: 'username'
+})
+
+ + + + +

Response

+
Status: 200 OK
+
+ + +

Notes

+ + + +
+
+
+

Feeds

+
+
+

+ Get feeds +

+

GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticated user:

+
    +
  • Timeline: The GitHub global public timeline
  • +
  • User: The public timeline for any user, using URI template
  • +
  • Current user public: The public timeline for the authenticated user
  • +
  • Current user: The private timeline for the authenticated user
  • +
  • Current user actor: The private timeline for activity created by the authenticated user
  • +
  • Current user organizations: The private timeline for the organizations the authenticated user is a member of.
  • +
  • Security advisories: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub.
  • +
+

Note: Private feeds are only returned when authenticating via Basic Auth since current feed URIs use the older, non revocable auth tokens.

+
+
get /feeds
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/feeds
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /feeds')
+
+ + + + +

Default response

+
Status: 200 OK
+
{
+  "timeline_url": "https://github.com/timeline",
+  "user_url": "https://github.com/{user}",
+  "current_user_public_url": "https://github.com/octocat",
+  "current_user_url": "https://github.com/octocat.private?token=abc123",
+  "current_user_actor_url": "https://github.com/octocat.private.actor?token=abc123",
+  "current_user_organization_url": "",
+  "current_user_organization_urls": [
+    "https://github.com/organizations/github/octocat.private.atom?token=abc123"
+  ],
+  "security_advisories_url": "https://github.com/security-advisories",
+  "_links": {
+    "timeline": {
+      "href": "https://github.com/timeline",
+      "type": "application/atom+xml"
+    },
+    "user": {
+      "href": "https://github.com/{user}",
+      "type": "application/atom+xml"
+    },
+    "current_user_public": {
+      "href": "https://github.com/octocat",
+      "type": "application/atom+xml"
+    },
+    "current_user": {
+      "href": "https://github.com/octocat.private?token=abc123",
+      "type": "application/atom+xml"
+    },
+    "current_user_actor": {
+      "href": "https://github.com/octocat.private.actor?token=abc123",
+      "type": "application/atom+xml"
+    },
+    "current_user_organization": {
+      "href": "",
+      "type": ""
+    },
+    "current_user_organizations": [
+      {
+        "href": "https://github.com/organizations/github/octocat.private.atom?token=abc123",
+        "type": "application/atom+xml"
+      }
+    ],
+    "security_advisories": {
+      "href": "https://github.com/security-advisories",
+      "type": "application/atom+xml"
+    }
+  }
+}
+
+ + +

Notes

+ + + +
+
+
+

Example of getting an Atom feed

+

To get a feed in Atom format, you must specify the application/atom+xml type in the Accept header. For example, to get the Atom feed for GitHub security advisories:

+
curl -H "Accept: application/atom+xml" https://github.com/security-advisories
+
+

Response

+
Status: 200 OK
+
<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
+  <id>tag:github.com,2008:/security-advisories</id>
+  <link rel="self" type="application/atom+xml" href="https://github.com/security-advisories.atom"/>
+  <title>GitHub Security Advisory Feed</title>
+  <author>
+    <name>GitHub</name>
+  </author>
+  <updated>2019-01-14T19:34:52Z</updated>
+     <entry>
+      <id>tag:github.com,2008:GHSA-abcd-12ab-23cd</id>
+      <published>2018-07-26T15:14:52Z</published>
+      <updated>2019-01-14T19:34:52Z</updated>
+      <title type="html">[GHSA-abcd-12ab-23cd] Moderate severity vulnerability that affects Octoapp</title>
+        <category term="NPM"/>
+      <content type="html">
+        &lt;p&gt;Octoapp node module before 4.17.5 suffers from a Modification of Assumed-Immutable Data (MAID) vulnerability via defaultsDeep, merge, and mergeWith functions, which allows a malicious user to modify the prototype of &quot;Object&quot; via &lt;strong&gt;proto&lt;/strong&gt;, causing the addition or modification of an existing property that will exist on all objects.&lt;/p&gt;
+          &lt;p&gt;&lt;strong&gt;Affected Packages&lt;/strong&gt;&lt;/p&gt;
+
+  &lt;dl&gt;
+      &lt;dt&gt;Octoapp&lt;/dt&gt;
+      &lt;dd&gt;Ecosystem: npm&lt;/dd&gt;
+      &lt;dd&gt;Severity: moderate&lt;/dd&gt;
+      &lt;dd&gt;Versions: &amp;lt; 4.17.5&lt;/dd&gt;
+        &lt;dd&gt;Fixed in: 4.17.5&lt;/dd&gt;
+  &lt;/dl&gt;
+
+          &lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;
+
+  &lt;ul&gt;
+      &lt;li&gt;https://nvd.nist.gov/vuln/detail/CVE-2018-123&lt;/li&gt;
+  &lt;/ul&gt;
+
+      </content>
+    </entry>
+</feed>
+
+

Notifications

+

Users receive notifications for conversations in repositories they watch including:

+
    +
  • Issues and their comments
  • +
  • Pull Requests and their comments
  • +
  • Comments on any commits
  • +
+

Notifications are also sent for conversations in unwatched repositories when the user is involved including:

+
    +
  • @mentions
  • +
  • Issue assignments
  • +
  • Commits the user authors or commits
  • +
  • Any discussion in which the user actively participates
  • +
+

All Notification API calls require the notifications or repo API scopes. Doing this will give read-only access to some issue and commit content. You will still need the repo scope to access issues and commits from their respective endpoints.

+

Notifications come back as "threads". A thread contains information about the current discussion of an issue, pull request, or commit.

+

Notifications are optimized for polling with the Last-Modified header. If there are no new notifications, you will see a 304 Not Modified response, leaving your current rate limit untouched. There is an X-Poll-Interval header that specifies how often (in seconds) you are allowed to poll. In times of high server load, the time may increase. Please obey the header.

+
# Add authentication to your requests
+$ curl -I https://api.github.com/notifications
+HTTP/1.1 200 OK
+Last-Modified: Thu, 25 Oct 2012 15:16:27 GMT
+X-Poll-Interval: 60
+
+# Pass the Last-Modified header exactly
+$ curl -I https://api.github.com/notifications
+$    -H "If-Modified-Since: Thu, 25 Oct 2012 15:16:27 GMT"
+> HTTP/1.1 304 Not Modified
+> X-Poll-Interval: 60
+

Notification reasons

+

When retrieving responses from the Notifications API, each payload has a key titled reason. These correspond to events that trigger a notification.

+

Here's a list of potential reasons for receiving a notification:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Reason NameDescription
assignYou were assigned to the issue.
authorYou created the thread.
commentYou commented on the thread.
invitationYou accepted an invitation to contribute to the repository.
manualYou subscribed to the thread (via an issue or pull request).
mentionYou were specifically @mentioned in the content.
review_requestedYou, or a team you're a member of, were requested to review a pull request.
security_alertGitHub discovered a security vulnerability in your repository.
state_changeYou changed the thread state (for example, closing an issue or merging a pull request).
subscribedYou're watching the repository.
team_mentionYou were on a team that was mentioned.
+

Note that the reason is modified on a per-thread basis, and can change, if the reason on a later notification is different.

+

For example, if you are the author of an issue, subsequent notifications on that issue will have a reason of author. If you're then @mentioned on the same issue, the notifications you fetch thereafter will have a reason of mention. The reason remains as mention, regardless of whether you're ever mentioned again.

+
+
+

+ List notifications for the authenticated user +

+

List all notifications for the current user, sorted by most recently updated.

+
+
get /notifications
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
allbooleanquery +

If true, show notifications marked as read.

+ +
participatingbooleanquery +

If true, only shows notifications in which the user is directly participating or mentioned.

+ +
sincestringquery +

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

+ +
beforestringquery +

Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/notifications
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /notifications')
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": "1",
+    "repository": {
+      "id": 1296269,
+      "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
+      "name": "Hello-World",
+      "full_name": "octocat/Hello-World",
+      "owner": {
+        "login": "octocat",
+        "id": 1,
+        "node_id": "MDQ6VXNlcjE=",
+        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+        "gravatar_id": "",
+        "url": "https://api.github.com/users/octocat",
+        "html_url": "https://github.com/octocat",
+        "followers_url": "https://api.github.com/users/octocat/followers",
+        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+        "organizations_url": "https://api.github.com/users/octocat/orgs",
+        "repos_url": "https://api.github.com/users/octocat/repos",
+        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+        "received_events_url": "https://api.github.com/users/octocat/received_events",
+        "type": "User",
+        "site_admin": false
+      },
+      "private": false,
+      "html_url": "https://github.com/octocat/Hello-World",
+      "description": "This your first repo!",
+      "fork": false,
+      "url": "https://api.github.com/repos/octocat/Hello-World",
+      "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
+      "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
+      "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
+      "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
+      "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
+      "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
+      "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
+      "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
+      "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
+      "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
+      "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
+      "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
+      "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
+      "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
+      "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
+      "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
+      "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
+      "git_url": "git:github.com/octocat/Hello-World.git",
+      "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
+      "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
+      "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
+      "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
+      "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
+      "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
+      "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
+      "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
+      "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
+      "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
+      "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
+      "ssh_url": "git@github.com:octocat/Hello-World.git",
+      "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
+      "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
+      "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
+      "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
+      "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
+      "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
+      "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}"
+    },
+    "subject": {
+      "title": "Greetings",
+      "url": "https://api.github.com/repos/octokit/octokit.rb/issues/123",
+      "latest_comment_url": "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123",
+      "type": "Issue"
+    },
+    "reason": "subscribed",
+    "unread": true,
+    "updated_at": "2014-11-07T22:01:45Z",
+    "last_read_at": "2014-11-07T22:01:45Z",
+    "url": "https://api.github.com/notifications/threads/1"
+  }
+]
+
+ + + +
+
+
+
+
+

+ Mark notifications as read +

+

Marks all notifications as "read" removes it from the default view on GitHub. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List notifications for the authenticated user endpoint and pass the query parameter all=false.

+
+
put /notifications
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
last_read_atstringbody +

Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: The current timestamp.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X PUT \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/notifications \
+  -d '{"last_read_at":"last_read_at"}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('PUT /notifications', {
+  last_read_at: 'last_read_at'
+})
+
+ + + + +

Response

+
Status: 205 Reset Content
+
+ + + +
+
+
+
+
+

+ Get a thread +

+ +
+
get /notifications/threads/{thread_id}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
thread_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/notifications/threads/42
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /notifications/threads/{thread_id}', {
+  thread_id: 42
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
{
+  "id": "1",
+  "repository": {
+    "id": 1296269,
+    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
+    "name": "Hello-World",
+    "full_name": "octocat/Hello-World",
+    "owner": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "private": false,
+    "html_url": "https://github.com/octocat/Hello-World",
+    "description": "This your first repo!",
+    "fork": false,
+    "url": "https://api.github.com/repos/octocat/Hello-World",
+    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
+    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
+    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
+    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
+    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
+    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
+    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
+    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
+    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
+    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
+    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
+    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
+    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
+    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
+    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
+    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
+    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
+    "git_url": "git:github.com/octocat/Hello-World.git",
+    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
+    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
+    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
+    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
+    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
+    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
+    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
+    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
+    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
+    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
+    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
+    "ssh_url": "git@github.com:octocat/Hello-World.git",
+    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
+    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
+    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
+    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
+    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
+    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
+    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}"
+  },
+  "subject": {
+    "title": "Greetings",
+    "url": "https://api.github.com/repos/octokit/octokit.rb/issues/123",
+    "latest_comment_url": "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123",
+    "type": "Issue"
+  },
+  "reason": "subscribed",
+  "unread": true,
+  "updated_at": "2014-11-07T22:01:45Z",
+  "last_read_at": "2014-11-07T22:01:45Z",
+  "url": "https://api.github.com/notifications/threads/1"
+}
+
+ + + +
+
+
+
+ +
patch /notifications/threads/{thread_id}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
thread_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X PATCH \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/notifications/threads/42
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('PATCH /notifications/threads/{thread_id}', {
+  thread_id: 42
+})
+
+ + + + +

Response

+
Status: 205 Reset Content
+
+ + + +
+
+
+
+
+

+ Get a thread subscription for the authenticated user +

+

This checks to see if the current user is subscribed to a thread. You can also get a repository subscription.

+

Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were @mentioned, or manually subscribe to a thread.

+
+
get /notifications/threads/{thread_id}/subscription
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
thread_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/notifications/threads/42/subscription
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /notifications/threads/{thread_id}/subscription', {
+  thread_id: 42
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
{
+  "subscribed": true,
+  "ignored": false,
+  "reason": null,
+  "created_at": "2012-10-06T21:34:12Z",
+  "url": "https://api.github.com/notifications/threads/1/subscription",
+  "thread_url": "https://api.github.com/notifications/threads/1"
+}
+
+ + + +
+
+
+
+
+

+ Set a thread subscription +

+

If you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an @mention.

+

You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored.

+

Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the Delete a thread subscription endpoint.

+
+
put /notifications/threads/{thread_id}/subscription
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
thread_idintegerpath + + +
ignoredbooleanbody +

Unsubscribes and subscribes you to a conversation. Set ignored to true to block all notifications from this thread.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X PUT \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/notifications/threads/42/subscription \
+  -d '{"ignored":true}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('PUT /notifications/threads/{thread_id}/subscription', {
+  thread_id: 42,
+  ignored: true
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
{
+  "subscribed": true,
+  "ignored": false,
+  "reason": null,
+  "created_at": "2012-10-06T21:34:12Z",
+  "url": "https://api.github.com/notifications/threads/1/subscription",
+  "thread_url": "https://api.github.com/notifications/threads/1"
+}
+
+ + + +
+
+
+
+
+

+ Delete a thread subscription +

+

Mutes all future notifications for a conversation until you comment on the thread or get an @mention. If you are watching the repository of the thread, you will still receive notifications. To ignore future notifications for a repository you are watching, use the Set a thread subscription endpoint and set ignore to true.

+
+
delete /notifications/threads/{thread_id}/subscription
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
thread_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X DELETE \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/notifications/threads/42/subscription
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('DELETE /notifications/threads/{thread_id}/subscription', {
+  thread_id: 42
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + + +
+
+
+
+
+

+ List repository notifications for the authenticated user +

+

List all notifications for the current user.

+
+
get /repos/{owner}/{repo}/notifications
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
allbooleanquery +

If true, show notifications marked as read.

+ +
participatingbooleanquery +

If true, only shows notifications in which the user is directly participating or mentioned.

+ +
sincestringquery +

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

+ +
beforestringquery +

Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/repos/octocat/hello-world/notifications
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /repos/{owner}/{repo}/notifications', {
+  owner: 'octocat',
+  repo: 'hello-world'
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": "1",
+    "repository": {
+      "id": 1296269,
+      "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
+      "name": "Hello-World",
+      "full_name": "octocat/Hello-World",
+      "owner": {
+        "login": "octocat",
+        "id": 1,
+        "node_id": "MDQ6VXNlcjE=",
+        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+        "gravatar_id": "",
+        "url": "https://api.github.com/users/octocat",
+        "html_url": "https://github.com/octocat",
+        "followers_url": "https://api.github.com/users/octocat/followers",
+        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+        "organizations_url": "https://api.github.com/users/octocat/orgs",
+        "repos_url": "https://api.github.com/users/octocat/repos",
+        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+        "received_events_url": "https://api.github.com/users/octocat/received_events",
+        "type": "User",
+        "site_admin": false
+      },
+      "private": false,
+      "html_url": "https://github.com/octocat/Hello-World",
+      "description": "This your first repo!",
+      "fork": false,
+      "url": "https://api.github.com/repos/octocat/Hello-World",
+      "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
+      "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
+      "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
+      "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
+      "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
+      "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
+      "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
+      "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
+      "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
+      "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
+      "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
+      "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
+      "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
+      "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
+      "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
+      "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
+      "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
+      "git_url": "git:github.com/octocat/Hello-World.git",
+      "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
+      "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
+      "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
+      "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
+      "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
+      "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
+      "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
+      "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
+      "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
+      "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
+      "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
+      "ssh_url": "git@github.com:octocat/Hello-World.git",
+      "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
+      "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
+      "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
+      "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
+      "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
+      "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
+      "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}"
+    },
+    "subject": {
+      "title": "Greetings",
+      "url": "https://api.github.com/repos/octokit/octokit.rb/issues/123",
+      "latest_comment_url": "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123",
+      "type": "Issue"
+    },
+    "reason": "subscribed",
+    "unread": true,
+    "updated_at": "2014-11-07T22:01:45Z",
+    "last_read_at": "2014-11-07T22:01:45Z",
+    "url": "https://api.github.com/notifications/threads/1"
+  }
+]
+
+ + + +
+
+
+
+
+

+ Mark repository notifications as read +

+

Marks all notifications in a repository as "read" removes them from the default view on GitHub. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List repository notifications for the authenticated user endpoint and pass the query parameter all=false.

+
+
put /repos/{owner}/{repo}/notifications
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
last_read_atstringbody +

Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: The current timestamp.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X PUT \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/repos/octocat/hello-world/notifications \
+  -d '{"last_read_at":"last_read_at"}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('PUT /repos/{owner}/{repo}/notifications', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  last_read_at: 'last_read_at'
+})
+
+ + + + +

Response

+
Status: 205 Reset Content
+
+ + + +
+
+
+

Starring

+

Repository starring is a feature that lets users bookmark repositories. Stars are shown next to repositories to show an approximate level of interest. Stars have no effect on notifications or the activity feed.

+

Starring vs. Watching

+

In August 2012, we changed the way watching +works on GitHub. Many API +client applications may be using the original "watcher" endpoints for accessing +this data. You can now start using the "star" endpoints instead (described +below). For more information, see the Watcher API Change post and the "Repository Watching API."

+

Custom media types for starring

+

There is one supported custom media type for the Starring REST API. When you use this custom media type, you will receive a response with the starred_at timestamp property that indicates the time the star was created. The response also has a second property that includes the resource that is returned when the custom media type is not included. The property that contains the resource will be either user or repo.

+
application/vnd.github.v3.star+json
+
+

For more information about media types, see "Custom media types."

+
+
+

+ List stargazers +

+

Lists the people that have starred the repository.

+

You can also find out when stars were created by passing the following custom media type via the Accept header:

+
+
get /repos/{owner}/{repo}/stargazers
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/repos/octocat/hello-world/stargazers
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /repos/{owner}/{repo}/stargazers', {
+  owner: 'octocat',
+  repo: 'hello-world'
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "login": "octocat",
+    "id": 1,
+    "node_id": "MDQ6VXNlcjE=",
+    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/octocat",
+    "html_url": "https://github.com/octocat",
+    "followers_url": "https://api.github.com/users/octocat/followers",
+    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+    "organizations_url": "https://api.github.com/users/octocat/orgs",
+    "repos_url": "https://api.github.com/users/octocat/repos",
+    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/octocat/received_events",
+    "type": "User",
+    "site_admin": false
+  }
+]
+
+ + +

Notes

+ + + +
+
+
+
+
+

+ List repositories starred by the authenticated user +

+

Lists repositories the authenticated user has starred.

+

You can also find out when stars were created by passing the following custom media type via the Accept header:

+
+
get /user/starred
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
sortstringquery +

One of created (when the repository was starred) or updated (when it was last pushed to).

+ +
directionstringquery +

One of asc (ascending) or desc (descending).

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/user/starred
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /user/starred')
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1296269,
+    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
+    "name": "Hello-World",
+    "full_name": "octocat/Hello-World",
+    "owner": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "private": false,
+    "html_url": "https://github.com/octocat/Hello-World",
+    "description": "This your first repo!",
+    "fork": false,
+    "url": "https://api.github.com/repos/octocat/Hello-World",
+    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
+    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
+    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
+    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
+    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
+    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
+    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
+    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
+    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
+    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
+    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
+    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
+    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
+    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
+    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
+    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
+    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
+    "git_url": "git:github.com/octocat/Hello-World.git",
+    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
+    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
+    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
+    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
+    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
+    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
+    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
+    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
+    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
+    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
+    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
+    "ssh_url": "git@github.com:octocat/Hello-World.git",
+    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
+    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
+    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
+    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
+    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
+    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
+    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
+    "clone_url": "https://github.com/octocat/Hello-World.git",
+    "mirror_url": "git:git.example.com/octocat/Hello-World",
+    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
+    "svn_url": "https://svn.github.com/octocat/Hello-World",
+    "homepage": "https://github.com",
+    "language": null,
+    "forks_count": 9,
+    "stargazers_count": 80,
+    "watchers_count": 80,
+    "size": 108,
+    "default_branch": "master",
+    "open_issues_count": 0,
+    "is_template": true,
+    "topics": [
+      "octocat",
+      "atom",
+      "electron",
+      "api"
+    ],
+    "has_issues": true,
+    "has_projects": true,
+    "has_wiki": true,
+    "has_pages": false,
+    "has_downloads": true,
+    "archived": false,
+    "disabled": false,
+    "visibility": "public",
+    "pushed_at": "2011-01-26T19:06:43Z",
+    "created_at": "2011-01-26T19:01:12Z",
+    "updated_at": "2011-01-26T19:14:43Z",
+    "permissions": {
+      "admin": false,
+      "push": false,
+      "pull": true
+    },
+    "allow_rebase_merge": true,
+    "template_repository": null,
+    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
+    "allow_squash_merge": true,
+    "delete_branch_on_merge": true,
+    "allow_merge_commit": true,
+    "subscribers_count": 42,
+    "network_count": 0
+  }
+]
+
+ + + +
+
+
+
+ +
get /user/starred/{owner}/{repo}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/user/starred/octocat/hello-world
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /user/starred/{owner}/{repo}', {
+  owner: 'octocat',
+  repo: 'hello-world'
+})
+
+ + + + +

Response if this repository is starred by you

+
Status: 204 No Content
+
+ +

Response if this repository is not starred by you

+
Status: 404 Not Found
+
+ + + +
+
+
+
+
+

+ Star a repository for the authenticated user +

+

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."

+
+
put /user/starred/{owner}/{repo}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X PUT \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/user/starred/octocat/hello-world
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('PUT /user/starred/{owner}/{repo}', {
+  owner: 'octocat',
+  repo: 'hello-world'
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + + +
+
+
+
+ +
delete /user/starred/{owner}/{repo}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X DELETE \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/user/starred/octocat/hello-world
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('DELETE /user/starred/{owner}/{repo}', {
+  owner: 'octocat',
+  repo: 'hello-world'
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + + +
+
+
+
+
+

+ List repositories starred by a user +

+

Lists repositories a user has starred.

+

You can also find out when stars were created by passing the following custom media type via the Accept header:

+
+
get /users/{username}/starred
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
usernamestringpath + + +
sortstringquery +

One of created (when the repository was starred) or updated (when it was last pushed to).

+ +
directionstringquery +

One of asc (ascending) or desc (descending).

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/users/USERNAME/starred
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /users/{username}/starred', {
+  username: 'username'
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1296269,
+    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
+    "name": "Hello-World",
+    "full_name": "octocat/Hello-World",
+    "owner": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "private": false,
+    "html_url": "https://github.com/octocat/Hello-World",
+    "description": "This your first repo!",
+    "fork": false,
+    "url": "https://api.github.com/repos/octocat/Hello-World",
+    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
+    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
+    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
+    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
+    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
+    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
+    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
+    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
+    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
+    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
+    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
+    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
+    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
+    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
+    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
+    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
+    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
+    "git_url": "git:github.com/octocat/Hello-World.git",
+    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
+    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
+    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
+    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
+    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
+    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
+    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
+    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
+    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
+    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
+    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
+    "ssh_url": "git@github.com:octocat/Hello-World.git",
+    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
+    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
+    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
+    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
+    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
+    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
+    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
+    "clone_url": "https://github.com/octocat/Hello-World.git",
+    "mirror_url": "git:git.example.com/octocat/Hello-World",
+    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
+    "svn_url": "https://svn.github.com/octocat/Hello-World",
+    "homepage": "https://github.com",
+    "language": null,
+    "forks_count": 9,
+    "stargazers_count": 80,
+    "watchers_count": 80,
+    "size": 108,
+    "default_branch": "master",
+    "open_issues_count": 0,
+    "is_template": true,
+    "topics": [
+      "octocat",
+      "atom",
+      "electron",
+      "api"
+    ],
+    "has_issues": true,
+    "has_projects": true,
+    "has_wiki": true,
+    "has_pages": false,
+    "has_downloads": true,
+    "archived": false,
+    "disabled": false,
+    "visibility": "public",
+    "pushed_at": "2011-01-26T19:06:43Z",
+    "created_at": "2011-01-26T19:01:12Z",
+    "updated_at": "2011-01-26T19:14:43Z",
+    "permissions": {
+      "admin": false,
+      "push": false,
+      "pull": true
+    },
+    "allow_rebase_merge": true,
+    "template_repository": null,
+    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
+    "allow_squash_merge": true,
+    "delete_branch_on_merge": true,
+    "allow_merge_commit": true,
+    "subscribers_count": 42,
+    "network_count": 0
+  }
+]
+
+ + +

Notes

+ + + +
+
+
+

Watching

+

Watching a repository registers the user to receive notifications on new discussions, as well as events in the user's activity feed. For simple repository bookmarks, see "Repository starring."

+
+
+

+ List watchers +

+

Lists the people watching the specified repository.

+
+
get /repos/{owner}/{repo}/subscribers
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/repos/octocat/hello-world/subscribers
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /repos/{owner}/{repo}/subscribers', {
+  owner: 'octocat',
+  repo: 'hello-world'
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "login": "octocat",
+    "id": 1,
+    "node_id": "MDQ6VXNlcjE=",
+    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/octocat",
+    "html_url": "https://github.com/octocat",
+    "followers_url": "https://api.github.com/users/octocat/followers",
+    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+    "organizations_url": "https://api.github.com/users/octocat/orgs",
+    "repos_url": "https://api.github.com/users/octocat/repos",
+    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/octocat/received_events",
+    "type": "User",
+    "site_admin": false
+  }
+]
+
+ + +

Notes

+ + + +
+
+
+
+ +
get /repos/{owner}/{repo}/subscription
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/repos/octocat/hello-world/subscription
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /repos/{owner}/{repo}/subscription', {
+  owner: 'octocat',
+  repo: 'hello-world'
+})
+
+ + + + +

Response if you subscribe to the repository

+
Status: 200 OK
+
{
+  "subscribed": true,
+  "ignored": false,
+  "reason": null,
+  "created_at": "2012-10-06T21:34:12Z",
+  "url": "https://api.github.com/repos/octocat/example/subscription",
+  "repository_url": "https://api.github.com/repos/octocat/example"
+}
+
+ +

Response if you don t subscribe to the repository

+
Status: 404 Not Found
+
+ + + +
+
+
+
+
+

+ Set a repository subscription +

+

If you would like to watch a repository, set subscribed to true. If you would like to ignore notifications made within a repository, set ignored to true. If you would like to stop watching a repository, delete the repository's subscription completely.

+
+
put /repos/{owner}/{repo}/subscription
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
subscribedbooleanbody +

Determines if notifications should be received from this repository.

+ +
ignoredbooleanbody +

Determines if all notifications should be blocked from this repository.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X PUT \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/repos/octocat/hello-world/subscription \
+  -d '{"subscribed":true}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('PUT /repos/{owner}/{repo}/subscription', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  subscribed: true
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
{
+  "subscribed": true,
+  "ignored": false,
+  "reason": null,
+  "created_at": "2012-10-06T21:34:12Z",
+  "url": "https://api.github.com/repos/octocat/example/subscription",
+  "repository_url": "https://api.github.com/repos/octocat/example"
+}
+
+ + + +
+
+
+
+
+

+ Delete a repository subscription +

+

This endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, set the repository's subscription manually.

+
+
delete /repos/{owner}/{repo}/subscription
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
ownerstringpath + + +
repostringpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X DELETE \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/repos/octocat/hello-world/subscription
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('DELETE /repos/{owner}/{repo}/subscription', {
+  owner: 'octocat',
+  repo: 'hello-world'
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + + +
+
+
+
+
+

+ List repositories watched by the authenticated user +

+

Lists repositories the authenticated user is watching.

+
+
get /user/subscriptions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/user/subscriptions
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /user/subscriptions')
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1296269,
+    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
+    "name": "Hello-World",
+    "full_name": "octocat/Hello-World",
+    "owner": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "private": false,
+    "html_url": "https://github.com/octocat/Hello-World",
+    "description": "This your first repo!",
+    "fork": false,
+    "url": "https://api.github.com/repos/octocat/Hello-World",
+    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
+    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
+    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
+    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
+    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
+    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
+    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
+    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
+    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
+    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
+    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
+    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
+    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
+    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
+    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
+    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
+    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
+    "git_url": "git:github.com/octocat/Hello-World.git",
+    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
+    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
+    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
+    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
+    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
+    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
+    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
+    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
+    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
+    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
+    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
+    "ssh_url": "git@github.com:octocat/Hello-World.git",
+    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
+    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
+    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
+    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
+    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
+    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
+    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
+    "clone_url": "https://github.com/octocat/Hello-World.git",
+    "mirror_url": "git:git.example.com/octocat/Hello-World",
+    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
+    "svn_url": "https://svn.github.com/octocat/Hello-World",
+    "homepage": "https://github.com",
+    "language": null,
+    "forks_count": 9,
+    "stargazers_count": 80,
+    "watchers_count": 80,
+    "size": 108,
+    "default_branch": "master",
+    "open_issues_count": 0,
+    "is_template": true,
+    "topics": [
+      "octocat",
+      "atom",
+      "electron",
+      "api"
+    ],
+    "has_issues": true,
+    "has_projects": true,
+    "has_wiki": true,
+    "has_pages": false,
+    "has_downloads": true,
+    "archived": false,
+    "disabled": false,
+    "visibility": "public",
+    "pushed_at": "2011-01-26T19:06:43Z",
+    "created_at": "2011-01-26T19:01:12Z",
+    "updated_at": "2011-01-26T19:14:43Z",
+    "permissions": {
+      "admin": false,
+      "push": false,
+      "pull": true
+    },
+    "template_repository": null,
+    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
+    "delete_branch_on_merge": true,
+    "subscribers_count": 42,
+    "network_count": 0,
+    "license": {
+      "key": "mit",
+      "name": "MIT License",
+      "spdx_id": "MIT",
+      "url": "https://api.github.com/licenses/mit",
+      "node_id": "MDc6TGljZW5zZW1pdA=="
+    }
+  }
+]
+
+ + + +
+
+
+
+
+

+ List repositories watched by a user +

+

Lists repositories a user is watching.

+
+
get /users/{username}/subscriptions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

Setting to application/vnd.github.v3+json is recommended

+ +
usernamestringpath + + +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.v3+json" \
+  https://api.github.com/users/USERNAME/subscriptions
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /users/{username}/subscriptions', {
+  username: 'username'
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1296269,
+    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
+    "name": "Hello-World",
+    "full_name": "octocat/Hello-World",
+    "owner": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "private": false,
+    "html_url": "https://github.com/octocat/Hello-World",
+    "description": "This your first repo!",
+    "fork": false,
+    "url": "https://api.github.com/repos/octocat/Hello-World",
+    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
+    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
+    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
+    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
+    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
+    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
+    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
+    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
+    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
+    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
+    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
+    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
+    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
+    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
+    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
+    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
+    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
+    "git_url": "git:github.com/octocat/Hello-World.git",
+    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
+    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
+    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
+    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
+    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
+    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
+    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
+    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
+    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
+    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
+    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
+    "ssh_url": "git@github.com:octocat/Hello-World.git",
+    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
+    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
+    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
+    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
+    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
+    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
+    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
+    "clone_url": "https://github.com/octocat/Hello-World.git",
+    "mirror_url": "git:git.example.com/octocat/Hello-World",
+    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
+    "svn_url": "https://svn.github.com/octocat/Hello-World",
+    "homepage": "https://github.com",
+    "language": null,
+    "forks_count": 9,
+    "stargazers_count": 80,
+    "watchers_count": 80,
+    "size": 108,
+    "default_branch": "master",
+    "open_issues_count": 0,
+    "is_template": true,
+    "topics": [
+      "octocat",
+      "atom",
+      "electron",
+      "api"
+    ],
+    "has_issues": true,
+    "has_projects": true,
+    "has_wiki": true,
+    "has_pages": false,
+    "has_downloads": true,
+    "archived": false,
+    "disabled": false,
+    "visibility": "public",
+    "pushed_at": "2011-01-26T19:06:43Z",
+    "created_at": "2011-01-26T19:01:12Z",
+    "updated_at": "2011-01-26T19:14:43Z",
+    "permissions": {
+      "admin": false,
+      "push": false,
+      "pull": true
+    },
+    "template_repository": null,
+    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
+    "delete_branch_on_merge": true,
+    "subscribers_count": 42,
+    "network_count": 0,
+    "license": {
+      "key": "mit",
+      "name": "MIT License",
+      "spdx_id": "MIT",
+      "url": "https://api.github.com/licenses/mit",
+      "node_id": "MDc6TGljZW5zZW1pdA=="
+    }
+  }
+]
+
+ + +

Notes

+ + + +
+
+
+
+
+
+
+ +
+

+ Did this doc help you? +

+

+ + + + +

+ + + + + +

+ + +

+ + +
+ +
+
+ + + +
+
+
+
+

Ask a human

+

Can't find what you're looking for?

+ Contact us +
+
+ +
+
+
+
+ + + + + +
+ + diff --git a/update-urls/testdata/activity_events-original.go b/update-urls/testdata/activity_events-original.go new file mode 100644 index 0000000000..eec0f956de --- /dev/null +++ b/update-urls/testdata/activity_events-original.go @@ -0,0 +1,196 @@ +// Copyright 2013 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ListEvents drinks from the firehose of all public events across GitHub. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events +func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) { + u, err := addOptions("events", opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// ListRepositoryEvents lists events for a repository. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-repository-events +func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/events", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// Note that ActivityService.ListIssueEventsForRepository was moved to: +// IssuesService.ListRepositoryEvents. + +// ListEventsForRepoNetwork lists public events for a network of repositories. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-for-a-network-of-repositories +func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { + u := fmt.Sprintf("networks/%v/%v/events", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// ListEventsForOrganization lists public events for an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-for-an-organization +func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) { + u := fmt.Sprintf("orgs/%v/events", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is +// true, only public events will be returned. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-events-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-for-a-user +func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { + var u string + if publicOnly { + u = fmt.Sprintf("users/%v/events/public", user) + } else { + u = fmt.Sprintf("users/%v/events", user) + } + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// ListEventsReceivedByUser lists the events received by a user. If publicOnly is +// true, only public events will be returned. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-events-received-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-received-by-a-user +func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { + var u string + if publicOnly { + u = fmt.Sprintf("users/%v/received_events/public", user) + } else { + u = fmt.Sprintf("users/%v/received_events", user) + } + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// ListUserEventsForOrganization provides the user’s organization dashboard. You +// must be authenticated as the user to view this. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-events-for-an-organization +func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) { + u := fmt.Sprintf("users/%v/events/orgs/%v", user, org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} diff --git a/update-urls/testdata/activity_events-want.go b/update-urls/testdata/activity_events-want.go new file mode 100644 index 0000000000..760793e698 --- /dev/null +++ b/update-urls/testdata/activity_events-want.go @@ -0,0 +1,196 @@ +// Copyright 2013 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ListEvents drinks from the firehose of all public events across GitHub. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events +func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) { + u, err := addOptions("events", opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// ListRepositoryEvents lists events for a repository. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-repository-events +func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/events", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// Note that ActivityService.ListIssueEventsForRepository was moved to: +// IssuesService.ListRepositoryEvents. + +// ListEventsForRepoNetwork lists public events for a network of repositories. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-for-a-network-of-repositories +func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { + u := fmt.Sprintf("networks/%v/%v/events", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// ListEventsForOrganization lists public events for an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-organization-events +func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) { + u := fmt.Sprintf("orgs/%v/events", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is +// true, only public events will be returned. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-events-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-for-a-user +func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { + var u string + if publicOnly { + u = fmt.Sprintf("users/%v/events/public", user) + } else { + u = fmt.Sprintf("users/%v/events", user) + } + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// ListEventsReceivedByUser lists the events received by a user. If publicOnly is +// true, only public events will be returned. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-events-received-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-received-by-a-user +func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { + var u string + if publicOnly { + u = fmt.Sprintf("users/%v/received_events/public", user) + } else { + u = fmt.Sprintf("users/%v/received_events", user) + } + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} + +// ListUserEventsForOrganization provides the user’s organization dashboard. You +// must be authenticated as the user to view this. +// +// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-organization-events-for-the-authenticated-user +func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) { + u := fmt.Sprintf("users/%v/events/orgs/%v", user, org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var events []*Event + resp, err := s.client.Do(ctx, req, &events) + if err != nil { + return nil, resp, err + } + + return events, resp, nil +} diff --git a/update-urls/testdata/reactions-original.go b/update-urls/testdata/reactions-original.go new file mode 100644 index 0000000000..d3e57bdb81 --- /dev/null +++ b/update-urls/testdata/reactions-original.go @@ -0,0 +1,490 @@ +// Copyright 2016 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" +) + +// ReactionsService provides access to the reactions-related functions in the +// GitHub API. +type ReactionsService service + +// Reaction represents a GitHub reaction. +type Reaction struct { + // ID is the Reaction ID. + ID *int64 `json:"id,omitempty"` + User *User `json:"user,omitempty"` + NodeID *string `json:"node_id,omitempty"` + // Content is the type of reaction. + // Possible values are: + // "+1", "-1", "laugh", "confused", "heart", "hooray". + Content *string `json:"content,omitempty"` +} + +// Reactions represents a summary of GitHub reactions. +type Reactions struct { + TotalCount *int `json:"total_count,omitempty"` + PlusOne *int `json:"+1,omitempty"` + MinusOne *int `json:"-1,omitempty"` + Laugh *int `json:"laugh,omitempty"` + Confused *int `json:"confused,omitempty"` + Heart *int `json:"heart,omitempty"` + Hooray *int `json:"hooray,omitempty"` + URL *string `json:"url,omitempty"` +} + +func (r Reaction) String() string { + return Stringify(r) +} + +// ListCommentReactionOptions specifies the optional parameters to the +// ReactionsService.ListCommentReactions method. +type ListCommentReactionOptions struct { + // Content restricts the returned comment reactions to only those with the given type. + // Omit this parameter to list all reactions to a commit comment. + // Possible values are: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". + Content string `url:"content,omitempty"` + + ListOptions +} + +// ListCommentReactions lists the reactions for a commit comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-commit-comment +func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// CreateCommentReaction creates a reaction for a commit comment. +// Note that if you have already created a reaction of type content, the +// previously created reaction will be returned with Status: 200 OK. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-commit-comment +func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// DeleteCommentReaction deletes the reaction for a commit comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-commit-comment-reaction +func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) + + return s.deleteReaction(ctx, u) +} + +// DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-commit-comment-reaction +func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { + u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) + + return s.deleteReaction(ctx, u) +} + +// ListIssueReactions lists the reactions for an issue. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-an-issue +func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// CreateIssueReaction creates a reaction for an issue. +// Note that if you have already created a reaction of type content, the +// previously created reaction will be returned with Status: 200 OK. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-an-issue +func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// DeleteIssueReaction deletes the reaction to an issue. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-reaction +func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteIssueReactionByID deletes the reaction to an issue by repository ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-reaction +func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// ListIssueCommentReactions lists the reactions for an issue comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-an-issue-comment +func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// CreateIssueCommentReaction creates a reaction for an issue comment. +// Note that if you have already created a reaction of type content, the +// previously created reaction will be returned with Status: 200 OK. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-an-issue-comment +func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// DeleteIssueCommentReaction deletes the reaction to an issue comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-comment-reaction +func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-comment-reaction +func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + +// ListPullRequestCommentReactions lists the reactions for a pull request review comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-an-issue-comment +func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// CreatePullRequestCommentReaction creates a reaction for a pull request review comment. +// Note that if you have already created a reaction of type content, the +// previously created reaction will be returned with Status: 200 OK. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-an-issue-comment +func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-pull-request-comment-reaction +func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-pull-request-comment-reaction +func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + +// ListTeamDiscussionReactions lists the reactions for a team discussion. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-team-discussion +func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var m []*Reaction + resp, err := s.client.Do(ctx, req, &m) + if err != nil { + return nil, resp, err + } + + return m, resp, nil +} + +// CreateTeamDiscussionReaction creates a reaction for a team discussion. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-team-discussion +func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + m := &Reaction{} + resp, err := s.client.Do(ctx, req, m) + if err != nil { + return nil, resp, err + } + + return m, resp, nil +} + +// DeleteTeamDiscussionReaction deletes the reaction to a team discussion. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-reaction +func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-reaction +func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-team-discussion-comment +func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var m []*Reaction + resp, err := s.client.Do(ctx, req, &m) + if err != nil { + return nil, nil, err + } + return m, resp, nil +} + +// CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-team-discussion-comment +func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + m := &Reaction{} + resp, err := s.client.Do(ctx, req, m) + if err != nil { + return nil, resp, err + } + + return m, resp, nil +} + +// DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-comment-reaction +func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-comment-reaction +func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Response, error) { + req, err := s.client.NewRequest(http.MethodDelete, url, nil) + if err != nil { + 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/update-urls/testdata/reactions-want.go b/update-urls/testdata/reactions-want.go new file mode 100644 index 0000000000..4e70c45870 --- /dev/null +++ b/update-urls/testdata/reactions-want.go @@ -0,0 +1,490 @@ +// Copyright 2016 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" +) + +// ReactionsService provides access to the reactions-related functions in the +// GitHub API. +type ReactionsService service + +// Reaction represents a GitHub reaction. +type Reaction struct { + // ID is the Reaction ID. + ID *int64 `json:"id,omitempty"` + User *User `json:"user,omitempty"` + NodeID *string `json:"node_id,omitempty"` + // Content is the type of reaction. + // Possible values are: + // "+1", "-1", "laugh", "confused", "heart", "hooray". + Content *string `json:"content,omitempty"` +} + +// Reactions represents a summary of GitHub reactions. +type Reactions struct { + TotalCount *int `json:"total_count,omitempty"` + PlusOne *int `json:"+1,omitempty"` + MinusOne *int `json:"-1,omitempty"` + Laugh *int `json:"laugh,omitempty"` + Confused *int `json:"confused,omitempty"` + Heart *int `json:"heart,omitempty"` + Hooray *int `json:"hooray,omitempty"` + URL *string `json:"url,omitempty"` +} + +func (r Reaction) String() string { + return Stringify(r) +} + +// ListCommentReactionOptions specifies the optional parameters to the +// ReactionsService.ListCommentReactions method. +type ListCommentReactionOptions struct { + // Content restricts the returned comment reactions to only those with the given type. + // Omit this parameter to list all reactions to a commit comment. + // Possible values are: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". + Content string `url:"content,omitempty"` + + ListOptions +} + +// ListCommentReactions lists the reactions for a commit comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-commit-comment +func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// CreateCommentReaction creates a reaction for a commit comment. +// Note that if you have already created a reaction of type content, the +// previously created reaction will be returned with Status: 200 OK. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-commit-comment +func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// DeleteCommentReaction deletes the reaction for a commit comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-commit-comment-reaction +func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) + + return s.deleteReaction(ctx, u) +} + +// DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-commit-comment-reaction +func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { + u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) + + return s.deleteReaction(ctx, u) +} + +// ListIssueReactions lists the reactions for an issue. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-an-issue +func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// CreateIssueReaction creates a reaction for an issue. +// Note that if you have already created a reaction of type content, the +// previously created reaction will be returned with Status: 200 OK. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-an-issue +func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// DeleteIssueReaction deletes the reaction to an issue. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-reaction +func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteIssueReactionByID deletes the reaction to an issue by repository ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-reaction +func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// ListIssueCommentReactions lists the reactions for an issue comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-an-issue-comment +func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// CreateIssueCommentReaction creates a reaction for an issue comment. +// Note that if you have already created a reaction of type content, the +// previously created reaction will be returned with Status: 200 OK. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-an-issue-comment +func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// DeleteIssueCommentReaction deletes the reaction to an issue comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-comment-reaction +func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-comment-reaction +func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + +// ListPullRequestCommentReactions lists the reactions for a pull request review comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-pull-request-review-comment +func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// CreatePullRequestCommentReaction creates a reaction for a pull request review comment. +// Note that if you have already created a reaction of type content, the +// previously created reaction will be returned with Status: 200 OK. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-pull-request-review-comment +func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + 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 { + return nil, resp, err + } + + return m, resp, nil +} + +// DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-pull-request-comment-reaction +func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-pull-request-comment-reaction +func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + +// ListTeamDiscussionReactions lists the reactions for a team discussion. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-team-discussion-legacy +func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var m []*Reaction + resp, err := s.client.Do(ctx, req, &m) + if err != nil { + return nil, resp, err + } + + return m, resp, nil +} + +// CreateTeamDiscussionReaction creates a reaction for a team discussion. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-team-discussion-legacy +func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + m := &Reaction{} + resp, err := s.client.Do(ctx, req, m) + if err != nil { + return nil, resp, err + } + + return m, resp, nil +} + +// DeleteTeamDiscussionReaction deletes the reaction to a team discussion. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-reaction +func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-reaction +func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-team-discussion-comment-legacy +func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var m []*Reaction + resp, err := s.client.Do(ctx, req, &m) + if err != nil { + return nil, nil, err + } + return m, resp, nil +} + +// CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. +// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-team-discussion-comment-legacy +func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { + u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) + + body := &Reaction{Content: String(content)} + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + m := &Reaction{} + resp, err := s.client.Do(ctx, req, m) + if err != nil { + return nil, resp, err + } + + return m, resp, nil +} + +// DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-comment-reaction +func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. +// +// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-comment-reaction +func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { + url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Response, error) { + req, err := s.client.NewRequest(http.MethodDelete, url, nil) + if err != nil { + 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/update-urls/testdata/reactions.html b/update-urls/testdata/reactions.html new file mode 100644 index 0000000000..2669f856c0 --- /dev/null +++ b/update-urls/testdata/reactions.html @@ -0,0 +1,5690 @@ + + + Reactions - GitHub Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + + +
+
+ +
+ + + Article version: GitHub.com + + + + +
+ + +
+
+ + +
+
+ +
+ +
+
+

Reactions

+
+ +
+
+ + + + + + + + +
+
+
+ +

In this article

+ + +
+ +
+

+ Did this doc help you? +

+

+ + + + +

+ + + + + +

+ + +

+ + +
+ +
+
+
+
+ +

Reaction types

+

When creating a reaction, the allowed values for the content parameter are as follows (with the corresponding emoji for reference):

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
contentemoji
+1👍
-1👎
laugh😄
confused😕
heart❤️
hooray🎉
rocket🚀
eyes👀
+
+
+

+ List reactions for a team discussion comment +

+

List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.

+

Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.

+
+
get /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
orgstringpath + + +
team_slugstringpath + + +
discussion_numberintegerpath + + +
comment_numberintegerpath + + +
contentstringquery +

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment.

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
+  org: 'org',
+  team_slug: 'team_slug',
+  discussion_number: 42,
+  comment_number: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1,
+    "node_id": "MDg6UmVhY3Rpb24x",
+    "user": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "content": "heart",
+    "created_at": "2016-05-20T20:09:31Z"
+  }
+]
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Create reaction for a team discussion comment +

+

Create a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion comment.

+

Note: You can also specify a team by org_id and team_id using the route POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.

+
+
post /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
orgstringpath + + +
team_slugstringpath + + +
discussion_numberintegerpath + + +
comment_numberintegerpath + + +
contentstringbody +

Required. The reaction type to add to the team discussion comment.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X POST \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions \
+  -d '{"content":"content"}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
+  org: 'org',
+  team_slug: 'team_slug',
+  discussion_number: 42,
+  comment_number: 42,
+  content: 'content',
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 201 Created
+
{
+  "id": 1,
+  "node_id": "MDg6UmVhY3Rpb24x",
+  "user": {
+    "login": "octocat",
+    "id": 1,
+    "node_id": "MDQ6VXNlcjE=",
+    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/octocat",
+    "html_url": "https://github.com/octocat",
+    "followers_url": "https://api.github.com/users/octocat/followers",
+    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+    "organizations_url": "https://api.github.com/users/octocat/orgs",
+    "repos_url": "https://api.github.com/users/octocat/repos",
+    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/octocat/received_events",
+    "type": "User",
+    "site_admin": false
+  },
+  "content": "heart",
+  "created_at": "2016-05-20T20:09:31Z"
+}
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Delete team discussion comment reaction +

+

Note: You can also specify a team or organization with team_id and org_id using the route DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id.

+

Delete a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope.

+
+
delete /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
orgstringpath + + +
team_slugstringpath + + +
discussion_numberintegerpath + + +
comment_numberintegerpath + + +
reaction_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -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
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}', {
+  org: 'org',
+  team_slug: 'team_slug',
+  discussion_number: 42,
+  comment_number: 42,
+  reaction_id: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ List reactions for a team discussion +

+

List the reactions to a team discussion. OAuth access tokens require the read:discussion scope.

+

Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions.

+
+
get /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
orgstringpath + + +
team_slugstringpath + + +
discussion_numberintegerpath + + +
contentstringquery +

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion.

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions', {
+  org: 'org',
+  team_slug: 'team_slug',
+  discussion_number: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1,
+    "node_id": "MDg6UmVhY3Rpb24x",
+    "user": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "content": "heart",
+    "created_at": "2016-05-20T20:09:31Z"
+  }
+]
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Create reaction for a team discussion +

+

Create a reaction to a team discussion. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion.

+

Note: You can also specify a team by org_id and team_id using the route POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions.

+
+
post /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
orgstringpath + + +
team_slugstringpath + + +
discussion_numberintegerpath + + +
contentstringbody +

Required. The reaction type to add to the team discussion.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X POST \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions \
+  -d '{"content":"content"}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions', {
+  org: 'org',
+  team_slug: 'team_slug',
+  discussion_number: 42,
+  content: 'content',
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 201 Created
+
{
+  "id": 1,
+  "node_id": "MDg6UmVhY3Rpb24x",
+  "user": {
+    "login": "octocat",
+    "id": 1,
+    "node_id": "MDQ6VXNlcjE=",
+    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/octocat",
+    "html_url": "https://github.com/octocat",
+    "followers_url": "https://api.github.com/users/octocat/followers",
+    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+    "organizations_url": "https://api.github.com/users/octocat/orgs",
+    "repos_url": "https://api.github.com/users/octocat/repos",
+    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/octocat/received_events",
+    "type": "User",
+    "site_admin": false
+  },
+  "content": "heart",
+  "created_at": "2016-05-20T20:09:31Z"
+}
+
+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Delete team discussion reaction +

+

Note: You can also specify a team or organization with team_id and org_id using the route DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions/:reaction_id.

+

Delete a reaction to a team discussion. OAuth access tokens require the write:discussion scope.

+
+
delete /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
orgstringpath + + +
team_slugstringpath + + +
discussion_numberintegerpath + + +
reaction_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X DELETE \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions/42
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}', {
+  org: 'org',
+  team_slug: 'team_slug',
+  discussion_number: 42,
+  reaction_id: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Delete a reaction (Legacy) +

+

Deprecation Notice: This endpoint route is deprecated and will be removed from the Reactions API. We recommend migrating your existing code to use the new delete reactions endpoints. For more information, see this blog post.

+

OAuth access tokens require the write:discussion scope, when deleting a team discussion or team discussion comment.

+
+
delete /reactions/{reaction_id}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
reaction_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X DELETE \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/reactions/42
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('DELETE /reactions/{reaction_id}', {
+  reaction_id: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ List reactions for a commit comment +

+

List the reactions to a commit comment.

+
+
get /repos/{owner}/{repo}/comments/{comment_id}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
comment_idintegerpath + + +
contentstringquery +

Returns a single reaction type. Omit this parameter to list all reactions to a commit comment.

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/comments/42/reactions
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /repos/{owner}/{repo}/comments/{comment_id}/reactions', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  comment_id: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1,
+    "node_id": "MDg6UmVhY3Rpb24x",
+    "user": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "content": "heart",
+    "created_at": "2016-05-20T20:09:31Z"
+  }
+]
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Create reaction for a commit comment +

+

Create a reaction to a commit comment. A response with a Status: 200 OK means that you already added the reaction type to this commit comment.

+
+
post /repos/{owner}/{repo}/comments/{comment_id}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
comment_idintegerpath + + +
contentstringbody +

Required. The reaction type to add to the commit comment.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X POST \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/comments/42/reactions \
+  -d '{"content":"content"}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('POST /repos/{owner}/{repo}/comments/{comment_id}/reactions', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  comment_id: 42,
+  content: 'content',
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 201 Created
+
{
+  "id": 1,
+  "node_id": "MDg6UmVhY3Rpb24x",
+  "user": {
+    "login": "octocat",
+    "id": 1,
+    "node_id": "MDQ6VXNlcjE=",
+    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/octocat",
+    "html_url": "https://github.com/octocat",
+    "followers_url": "https://api.github.com/users/octocat/followers",
+    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+    "organizations_url": "https://api.github.com/users/octocat/orgs",
+    "repos_url": "https://api.github.com/users/octocat/repos",
+    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/octocat/received_events",
+    "type": "User",
+    "site_admin": false
+  },
+  "content": "heart",
+  "created_at": "2016-05-20T20:09:31Z"
+}
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Delete a commit comment reaction +

+

Note: You can also specify a repository by repository_id using the route DELETE /repositories/:repository_id/comments/:comment_id/reactions/:reaction_id.

+

Delete a reaction to a commit comment.

+
+
delete /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
comment_idintegerpath + + +
reaction_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X DELETE \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/comments/42/reactions/42
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  comment_id: 42,
+  reaction_id: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ List reactions for an issue comment +

+

List the reactions to an issue comment.

+
+
get /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
comment_idintegerpath + + +
contentstringquery +

Returns a single reaction type. Omit this parameter to list all reactions to an issue comment.

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  comment_id: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1,
+    "node_id": "MDg6UmVhY3Rpb24x",
+    "user": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "content": "heart",
+    "created_at": "2016-05-20T20:09:31Z"
+  }
+]
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Create reaction for an issue comment +

+

Create a reaction to an issue comment. A response with a Status: 200 OK means that you already added the reaction type to this issue comment.

+
+
post /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
comment_idintegerpath + + +
contentstringbody +

Required. The reaction type to add to the issue comment.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X POST \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions \
+  -d '{"content":"content"}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  comment_id: 42,
+  content: 'content',
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 201 Created
+
{
+  "id": 1,
+  "node_id": "MDg6UmVhY3Rpb24x",
+  "user": {
+    "login": "octocat",
+    "id": 1,
+    "node_id": "MDQ6VXNlcjE=",
+    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/octocat",
+    "html_url": "https://github.com/octocat",
+    "followers_url": "https://api.github.com/users/octocat/followers",
+    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+    "organizations_url": "https://api.github.com/users/octocat/orgs",
+    "repos_url": "https://api.github.com/users/octocat/repos",
+    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/octocat/received_events",
+    "type": "User",
+    "site_admin": false
+  },
+  "content": "heart",
+  "created_at": "2016-05-20T20:09:31Z"
+}
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Delete an issue comment reaction +

+

Note: You can also specify a repository by repository_id using the route DELETE delete /repositories/:repository_id/issues/comments/:comment_id/reactions/:reaction_id.

+

Delete a reaction to an issue comment.

+
+
delete /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
comment_idintegerpath + + +
reaction_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X DELETE \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions/42
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  comment_id: 42,
+  reaction_id: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ List reactions for an issue +

+

List the reactions to an issue.

+
+
get /repos/{owner}/{repo}/issues/{issue_number}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
issue_numberintegerpath + + +
contentstringquery +

Returns a single reaction type. Omit this parameter to list all reactions to an issue.

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/issues/42/reactions
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /repos/{owner}/{repo}/issues/{issue_number}/reactions', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  issue_number: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1,
+    "node_id": "MDg6UmVhY3Rpb24x",
+    "user": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "content": "heart",
+    "created_at": "2016-05-20T20:09:31Z"
+  }
+]
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Create reaction for an issue +

+

Create a reaction to an issue. A response with a Status: 200 OK means that you already added the reaction type to this issue.

+
+
post /repos/{owner}/{repo}/issues/{issue_number}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
issue_numberintegerpath + + +
contentstringbody +

Required. The reaction type to add to the issue.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X POST \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/issues/42/reactions \
+  -d '{"content":"content"}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/reactions', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  issue_number: 42,
+  content: 'content',
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 201 Created
+
{
+  "id": 1,
+  "node_id": "MDg6UmVhY3Rpb24x",
+  "user": {
+    "login": "octocat",
+    "id": 1,
+    "node_id": "MDQ6VXNlcjE=",
+    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/octocat",
+    "html_url": "https://github.com/octocat",
+    "followers_url": "https://api.github.com/users/octocat/followers",
+    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+    "organizations_url": "https://api.github.com/users/octocat/orgs",
+    "repos_url": "https://api.github.com/users/octocat/repos",
+    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/octocat/received_events",
+    "type": "User",
+    "site_admin": false
+  },
+  "content": "heart",
+  "created_at": "2016-05-20T20:09:31Z"
+}
+
+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Delete an issue reaction +

+

Note: You can also specify a repository by repository_id using the route DELETE /repositories/:repository_id/issues/:issue_number/reactions/:reaction_id.

+

Delete a reaction to an issue.

+
+
delete /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
issue_numberintegerpath + + +
reaction_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X DELETE \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/issues/42/reactions/42
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  issue_number: 42,
+  reaction_id: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+ +
get /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
comment_idintegerpath + + +
contentstringquery +

Returns a single reaction type. Omit this parameter to list all reactions to a pull request review comment.

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  comment_id: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1,
+    "node_id": "MDg6UmVhY3Rpb24x",
+    "user": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "content": "heart",
+    "created_at": "2016-05-20T20:09:31Z"
+  }
+]
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Create reaction for a pull request review comment +

+

Create a reaction to a pull request review comment. A response with a Status: 200 OK means that you already added the reaction type to this pull request review comment.

+
+
post /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
comment_idintegerpath + + +
contentstringbody +

Required. The reaction type to add to the pull request review comment.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X POST \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions \
+  -d '{"content":"content"}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  comment_id: 42,
+  content: 'content',
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 201 Created
+
{
+  "id": 1,
+  "node_id": "MDg6UmVhY3Rpb24x",
+  "user": {
+    "login": "octocat",
+    "id": 1,
+    "node_id": "MDQ6VXNlcjE=",
+    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/octocat",
+    "html_url": "https://github.com/octocat",
+    "followers_url": "https://api.github.com/users/octocat/followers",
+    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+    "organizations_url": "https://api.github.com/users/octocat/orgs",
+    "repos_url": "https://api.github.com/users/octocat/repos",
+    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/octocat/received_events",
+    "type": "User",
+    "site_admin": false
+  },
+  "content": "heart",
+  "created_at": "2016-05-20T20:09:31Z"
+}
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Delete a pull request comment reaction +

+

Note: You can also specify a repository by repository_id using the route DELETE /repositories/:repository_id/pulls/comments/:comment_id/reactions/:reaction_id.

+

Delete a reaction to a pull request review comment.

+
+
delete /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
ownerstringpath + + +
repostringpath + + +
comment_idintegerpath + + +
reaction_idintegerpath + + +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X DELETE \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions/42
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}', {
+  owner: 'octocat',
+  repo: 'hello-world',
+  comment_id: 42,
+  reaction_id: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default Response

+
Status: 204 No Content
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ List reactions for a team discussion comment (Legacy) +

+

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List reactions for a team discussion comment endpoint.

+

List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.

+
+
get /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
team_idintegerpath + + +
discussion_numberintegerpath + + +
comment_numberintegerpath + + +
contentstringquery +

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment.

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/teams/42/discussions/42/comments/42/reactions
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
+  team_id: 42,
+  discussion_number: 42,
+  comment_number: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1,
+    "node_id": "MDg6UmVhY3Rpb24x",
+    "user": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "content": "heart",
+    "created_at": "2016-05-20T20:09:31Z"
+  }
+]
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Create reaction for a team discussion comment (Legacy) +

+

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create reaction for a team discussion comment endpoint.

+

Create a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion comment.

+
+
post /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
team_idintegerpath + + +
discussion_numberintegerpath + + +
comment_numberintegerpath + + +
contentstringbody +

Required. The reaction type to add to the team discussion comment.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X POST \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/teams/42/discussions/42/comments/42/reactions \
+  -d '{"content":"content"}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
+  team_id: 42,
+  discussion_number: 42,
+  comment_number: 42,
+  content: 'content',
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 201 Created
+
{
+  "id": 1,
+  "node_id": "MDg6UmVhY3Rpb24x",
+  "user": {
+    "login": "octocat",
+    "id": 1,
+    "node_id": "MDQ6VXNlcjE=",
+    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/octocat",
+    "html_url": "https://github.com/octocat",
+    "followers_url": "https://api.github.com/users/octocat/followers",
+    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+    "organizations_url": "https://api.github.com/users/octocat/orgs",
+    "repos_url": "https://api.github.com/users/octocat/repos",
+    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/octocat/received_events",
+    "type": "User",
+    "site_admin": false
+  },
+  "content": "heart",
+  "created_at": "2016-05-20T20:09:31Z"
+}
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ List reactions for a team discussion (Legacy) +

+

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List reactions for a team discussion endpoint.

+

List the reactions to a team discussion. OAuth access tokens require the read:discussion scope.

+
+
get /teams/{team_id}/discussions/{discussion_number}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
team_idintegerpath + + +
discussion_numberintegerpath + + +
contentstringquery +

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion.

+ +
per_pageintegerquery +

Results per page (max 100)

+ +
pageintegerquery +

Page number of the results to fetch.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/teams/42/discussions/42/reactions
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/reactions', {
+  team_id: 42,
+  discussion_number: 42,
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 200 OK
+
[
+  {
+    "id": 1,
+    "node_id": "MDg6UmVhY3Rpb24x",
+    "user": {
+      "login": "octocat",
+      "id": 1,
+      "node_id": "MDQ6VXNlcjE=",
+      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/octocat",
+      "html_url": "https://github.com/octocat",
+      "followers_url": "https://api.github.com/users/octocat/followers",
+      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+      "organizations_url": "https://api.github.com/users/octocat/orgs",
+      "repos_url": "https://api.github.com/users/octocat/repos",
+      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/octocat/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "content": "heart",
+    "created_at": "2016-05-20T20:09:31Z"
+  }
+]
+
+ + +

Notes

+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+

+ Create reaction for a team discussion (Legacy) +

+

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create reaction for a team discussion endpoint.

+

Create a reaction to a team discussion. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion.

+
+
post /teams/{team_id}/discussions/{discussion_number}/reactions
+
+ +

+ Parameters +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeInDescription
acceptstringheader +

This API is under preview and subject to change.

+ + + + See preview notice. + + +
team_idintegerpath + + +
discussion_numberintegerpath + + +
contentstringbody +

Required. The reaction type to add to the team discussion.

+ +
+ + +

+ Code samples +

+ + +
+ + Shell + +
+
curl \
+  -X POST \
+  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
+  https://api.github.com/teams/42/discussions/42/reactions \
+  -d '{"content":"content"}'
+
+ + + +
+ + JavaScript (@octokit/core.js) + +
+
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/reactions', {
+  team_id: 42,
+  discussion_number: 42,
+  content: 'content',
+  mediaType: {
+    previews: [
+      'squirrel-girl'
+    ]
+  }
+})
+
+ + + + +

Default response

+
Status: 201 Created
+
{
+  "id": 1,
+  "node_id": "MDg6UmVhY3Rpb24x",
+  "user": {
+    "login": "octocat",
+    "id": 1,
+    "node_id": "MDQ6VXNlcjE=",
+    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/octocat",
+    "html_url": "https://github.com/octocat",
+    "followers_url": "https://api.github.com/users/octocat/followers",
+    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
+    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
+    "organizations_url": "https://api.github.com/users/octocat/orgs",
+    "repos_url": "https://api.github.com/users/octocat/repos",
+    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/octocat/received_events",
+    "type": "User",
+    "site_admin": false
+  },
+  "content": "heart",
+  "created_at": "2016-05-20T20:09:31Z"
+}
+
+ + + +

+ + Preview notice + +

+ +
+

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 +post for full details.

+

To access the API you must provide a custom media type in the Accept header:

+
application/vnd.github.squirrel-girl-preview
+
+

The reactions key will have the following payload where url can be used to construct the API location for listing +and creating reactions.

+
{
+  "total_count": 5,
+  "+1": 3,
+  "-1": 1,
+  "laugh": 0,
+  "confused": 0,
+  "heart": 1,
+  "hooray": 0,
+  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
+}
+
+ ☝️ This header is required. +
+ + +
+
+
+
+
+
+
+ +
+

+ Did this doc help you? +

+

+ + + + +

+ + + + + +

+ + +

+ + +
+ +
+
+ + + +
+
+
+
+

Ask a human

+

Can't find what you're looking for?

+ Contact us +
+
+ +
+
+
+
+ + + + + +
+ +