mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-22 21:04:41 +08:00
Upgrade go-github to v39 (#17437)
This commit is contained in:
go.modgo.sum
modules/migrations
vendor
github.com/google/go-github/v39
AUTHORSLICENSE
modules.txtgithub
actions.goactions_artifacts.goactions_runner_groups.goactions_runners.goactions_secrets.goactions_workflow_jobs.goactions_workflow_runs.goactions_workflows.goactivity.goactivity_events.goactivity_notifications.goactivity_star.goactivity_watching.goadmin.goadmin_orgs.goadmin_stats.goadmin_users.goapps.goapps_hooks.goapps_installation.goapps_manifest.goapps_marketplace.goauthorizations.gobilling.gochecks.gocode-scanning.godoc.goenterprise.goenterprise_actions_runners.goenterprise_audit_log.goevent.goevent_types.gogists.gogists_comments.gogit.gogit_blobs.gogit_commits.gogit_refs.gogit_tags.gogit_trees.gogithub-accessors.gogithub.gogitignore.gointeractions.gointeractions_orgs.gointeractions_repos.goissue_import.goissues.goissues_assignees.goissues_comments.goissues_events.goissues_labels.goissues_milestones.goissues_timeline.golicenses.gomessages.gomigrations.gomigrations_source_import.gomigrations_user.gomisc.goorgs.goorgs_actions_allowed.goorgs_actions_permissions.goorgs_audit_log.goorgs_hooks.goorgs_hooks_deliveries.goorgs_members.goorgs_outside_collaborators.goorgs_packages.goorgs_projects.goorgs_users_blocking.gopackages.goprojects.gopulls.gopulls_comments.gopulls_reviewers.gopulls_reviews.goreactions.gorepos.gorepos_autolinks.gorepos_collaborators.gorepos_comments.gorepos_commits.gorepos_community_health.gorepos_contents.gorepos_deployments.gorepos_environments.gorepos_forks.gorepos_hooks.gorepos_hooks_deliveries.gorepos_invitations.gorepos_keys.gorepos_merging.gorepos_pages.gorepos_prereceive_hooks.gorepos_projects.gorepos_releases.gorepos_stats.gorepos_statuses.gorepos_traffic.goscim.gosearch.gostrings.goteams.goteams_discussion_comments.goteams_discussions.goteams_members.gotimestamp.gousers.gousers_administration.gousers_blocking.gousers_emails.gousers_followers.gousers_gpg_keys.gousers_keys.gousers_packages.gousers_projects.gowith_appengine.gowithout_appengine.go
154
vendor/github.com/google/go-github/v39/github/issues_comments.go
generated
vendored
Normal file
154
vendor/github.com/google/go-github/v39/github/issues_comments.go
generated
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
// 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"
|
||||
"time"
|
||||
)
|
||||
|
||||
// IssueComment represents a comment left on an issue.
|
||||
type IssueComment struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Body *string `json:"body,omitempty"`
|
||||
User *User `json:"user,omitempty"`
|
||||
Reactions *Reactions `json:"reactions,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
// AuthorAssociation is the comment author's relationship to the issue's repository.
|
||||
// Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE".
|
||||
AuthorAssociation *string `json:"author_association,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
IssueURL *string `json:"issue_url,omitempty"`
|
||||
}
|
||||
|
||||
func (i IssueComment) String() string {
|
||||
return Stringify(i)
|
||||
}
|
||||
|
||||
// IssueListCommentsOptions specifies the optional parameters to the
|
||||
// IssuesService.ListComments method.
|
||||
type IssueListCommentsOptions struct {
|
||||
// Sort specifies how to sort comments. Possible values are: created, updated.
|
||||
Sort *string `url:"sort,omitempty"`
|
||||
|
||||
// Direction in which to sort comments. Possible values are: asc, desc.
|
||||
Direction *string `url:"direction,omitempty"`
|
||||
|
||||
// Since filters comments by time.
|
||||
Since *time.Time `url:"since,omitempty"`
|
||||
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// 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
|
||||
func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) {
|
||||
var u string
|
||||
if number == 0 {
|
||||
u = fmt.Sprintf("repos/%v/%v/issues/comments", owner, repo)
|
||||
} else {
|
||||
u = fmt.Sprintf("repos/%v/%v/issues/%d/comments", 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 header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
var comments []*IssueComment
|
||||
resp, err := s.client.Do(ctx, req, &comments)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return comments, resp, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
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)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||
|
||||
comment := new(IssueComment)
|
||||
resp, err := s.client.Do(ctx, req, comment)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return comment, resp, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
c := new(IssueComment)
|
||||
resp, err := s.client.Do(ctx, req, c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, nil
|
||||
}
|
||||
|
||||
// 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
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
c := new(IssueComment)
|
||||
resp, err := s.client.Do(ctx, req, c)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return c, resp, nil
|
||||
}
|
||||
|
||||
// DeleteComment deletes an issue comment.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
Reference in New Issue
Block a user