Documentation
¶
Overview ¶
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- type APIClient
- type Branch
- type Commit
- type CommitAuthor
- type CommitFile
- type Contributor
- type Issue
- type IssueComment
- type IssueRequest
- type IssueStateDetail
- type IssuesService
- func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner, repo, number string, labelNameList []string) ([]*Label, bool, error)
- func (s *IssuesService) CreateIssueComment(ctx context.Context, owner, repo, number string, comment *IssueComment) (*IssueComment, bool, error)
- func (s *IssuesService) CreateRepoIssueLabel(ctx context.Context, owner, repo string, newLabel *Label) (*Label, bool, error)
- func (s *IssuesService) DeleteRepoIssueLabel(ctx context.Context, owner, repo, name string) (bool, error)
- func (s *IssuesService) ListIssueLinkingPullRequests(ctx context.Context, owner, repo, number string) ([]*PullRequest, bool, error)
- func (s *IssuesService) ListRepoIssueLabels(ctx context.Context, owner, repo string) ([]*Label, bool, error)
- func (s *IssuesService) RemoveLabelsFromIssue(ctx context.Context, owner, repo, number, labels string) (bool, error)
- func (s *IssuesService) UpdateIssue(ctx context.Context, owner, number string, issueContent *IssueRequest) (*Issue, bool, error)
- func (s *IssuesService) UpdateRepoIssueLabel(ctx context.Context, owner, repo, originalName, newName, color string) (*Label, bool, error)
- type Label
- type MergeAbleState
- type Organization
- type Permission
- type PullRequest
- type PullRequestBranch
- type PullRequestComment
- type PullRequestLinks
- type PullRequestMergedResult
- type PullRequestOperationLog
- type PullRequestRequest
- type PullRequestsService
- func (s *PullRequestsService) AddLabelsToPullRequest(ctx context.Context, owner, repo string, number uint, labelNameList []string) ([]*Label, bool, error)
- func (s *PullRequestsService) CreatePullRequestComment(ctx context.Context, owner, repo, number string, comment *PullRequestComment) (*PullRequestComment, bool, error)
- func (s *PullRequestsService) DeletePullRequestComment(ctx context.Context, owner, repo, number, commentId string) (bool, error)
- func (s *PullRequestsService) EditPullRequestComment(ctx context.Context, owner, repo, number string, comment *PullRequestComment) (*PullRequestComment, bool, error)
- func (s *PullRequestsService) GetPullRequest(ctx context.Context, owner, repo, number string) (*PullRequest, bool, error)
- func (s *PullRequestsService) ListPullRequestCommits(ctx context.Context, owner, repo, number string) ([]*RepositoryCommit, bool, error)
- func (s *PullRequestsService) ListPullRequestFiles(ctx context.Context, owner, repo, number string) ([]*CommitFile, bool, error)
- func (s *PullRequestsService) ListPullRequestLinkingIssues(ctx context.Context, owner, repo, number string) ([]*Issue, bool, error)
- func (s *PullRequestsService) ListPullRequestOperationLog(ctx context.Context, owner, repo, number string) ([]*PullRequestOperationLog, bool, error)
- func (s *PullRequestsService) MergePullRequest(ctx context.Context, owner, repo, number string) (*PullRequestMergedResult, bool, error)
- func (s *PullRequestsService) RemoveLabelsFromPullRequest(ctx context.Context, owner string, repo, number, labels string) (bool, error)
- func (s *PullRequestsService) UpdatePullRequest(ctx context.Context, owner, repo, number string, prContent *PullRequestRequest) (*PullRequest, bool, error)
- type Repository
- type RepositoryCommit
- type RepositoryContent
- type RepositoryService
- func (s *RepositoryService) CheckUserIsRepoMember(ctx context.Context, owner, repo, username string) (bool, bool, error)
- func (s *RepositoryService) CreateRepoBranch(ctx context.Context, owner, repo, refs, name string) (*Branch, bool, error)
- func (s *RepositoryService) GetRepoAllBranch(ctx context.Context, owner, repo, sort, direction, page string) ([]*Branch, bool, error)
- func (s *RepositoryService) GetRepoAllFileList(ctx context.Context, owner, repo, ref, file string) ([]string, bool, error)
- func (s *RepositoryService) GetRepoAllMember(ctx context.Context, owner, repo, page string) ([]*User, bool, error)
- func (s *RepositoryService) GetRepoContentByPath(ctx context.Context, owner, repo, path, ref string) ([]*RepositoryContent, bool, error)
- func (s *RepositoryService) GetRepoContributors(ctx context.Context, owner, repo, category string) ([]*Contributor, bool, error)
- func (s *RepositoryService) GetRepoMemberPermission(ctx context.Context, owner, repo, username string) (*User, bool, error)
- type RequestHandler
- type RequestHandlerType
- type User
Constants ¶
const ( HeaderAuthorization = "Authorization" HeaderUserAgentName = "User-Agent" HeaderUserAgentValue = "OpenSourceCommunityRobot/1.0.0" HeaderMediaTypeName = "Accept" HeaderMediaTypeValue = "application/json" HeaderContentTypeName = "Content-Type" HeaderContentTypeJsonValue = "application/json" HeaderContentTypeFormValue = "application/x-www-form-urlencoded" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct { BaseURL *url.URL // 各个模块的服务 Issues *IssuesService PullRequests *PullRequestsService Repository *RepositoryService // contains filtered or unexported fields }
APIClient 一个客户端,管理与 GitCode OpenAPI 的通信
type Branch ¶
type Branch struct { Name *string `json:"name,omitempty"` Commit *RepositoryCommit `json:"commit,omitempty"` Protected *bool `json:"protected,omitempty"` }
Branch represents a repository branch
type Commit ¶
type Commit struct { SHA *string `json:"sha,omitempty"` Author *CommitAuthor `json:"author,omitempty"` Committer *CommitAuthor `json:"committer,omitempty"` Message *string `json:"message,omitempty"` Parents []*Commit `json:"parents,omitempty"` HTMLURL *string `json:"html_url,omitempty"` URL *string `json:"url,omitempty"` // CommentCount is the number of GitHub comments on the commit. This // is only populated for requests that fetch GitHub data like // Pulls.ListCommits, Repositories.ListCommits, etc. CommentCount *int `json:"comment_count,omitempty"` }
type CommitAuthor ¶
type CommitFile ¶
type CommitFile struct { SHA *string `json:"sha,omitempty"` Filename *string `json:"filename,omitempty"` Additions *int `json:"additions,omitempty"` Deletions *int `json:"deletions,omitempty"` Changes *int `json:"changes,omitempty"` Status *string `json:"status,omitempty"` Patch *string `json:"patch,omitempty"` BlobURL *string `json:"blob_url,omitempty"` RawURL *string `json:"raw_url,omitempty"` ContentsURL *string `json:"contents_url,omitempty"` PreviousFilename *string `json:"previous_filename,omitempty"` }
type Contributor ¶
type Contributor struct { Contributions *int `json:"contributions,omitempty"` Name *string `json:"name,omitempty"` Email *string `json:"email,omitempty"` }
Contributor represents a repository contributor
type Issue ¶
type Issue struct { ID *int64 `json:"id,omitempty"` HTMLURL *string `json:"html_url,omitempty"` Number *string `json:"number,omitempty"` State *string `json:"state,omitempty"` IssueState *string `json:"issue_state,omitempty"` IssueStateDetail *IssueStateDetail `json:"issue_state_detail,omitempty"` Priority *int `json:"priority,omitempty"` Title *string `json:"title,omitempty"` Body *string `json:"body,omitempty"` User *User `json:"user,omitempty"` Assignee *User `json:"assignee,omitempty"` Repository *Repository `json:"repository,omitempty"` Labels []*Label `json:"labels,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` ClosedAt *time.Time `json:"finished_at,omitempty"` ClosedBy *User `json:"closed_by,omitempty"` PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"` // TODO }
type IssueComment ¶
type IssueRequest ¶
type IssueRequest struct { Repository *string `json:"repo,omitempty" required:"true"` // 仓库地址 Title *string `json:"title,omitempty"` Body *string `json:"body,omitempty"` Labels *string `json:"labels,omitempty"` // 用逗号分开的标签 Assignee *string `json:"assignee,omitempty"` // Issue负责人的 username State *string `json:"state,omitempty"` Milestone *int64 `json:"milestone,omitempty"` SecurityHole *string `json:"security_hole,omitempty"` // 是否是私有issue(默认为false) IssueStage *string `json:"issue_stage,omitempty"` // 严重程序(Accepted,Coding,Completed,New,Rejected,Revising,Testing,Verified) IssueSeverity *string `json:"issue_severity,omitempty"` // 优先级 (Suggestion,Minor,Major,Fatal) }
type IssueStateDetail ¶
type IssuesService ¶
type IssuesService service
func (*IssuesService) AddLabelsToIssue ¶
func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner, repo, number string, labelNameList []string) ([]*Label, bool, error)
AddLabelsToIssue 创建Issue标签
API Docs: https://docs.gitcode.com/docs/openapi/repos/issues/#9%e5%88%9b%e5%bb%baissue%e6%a0%87%e7%ad%be
func (*IssuesService) CreateIssueComment ¶
func (s *IssuesService) CreateIssueComment(ctx context.Context, owner, repo, number string, comment *IssueComment) (*IssueComment, bool, error)
CreateIssueComment 创建Issue评论
API Docs: https://docs.gitcode.com/docs/openapi/repos/issues/#11%e5%88%9b%e5%bb%baissue%e8%af%84%e8%ae%ba
func (*IssuesService) CreateRepoIssueLabel ¶
func (s *IssuesService) CreateRepoIssueLabel(ctx context.Context, owner, repo string, newLabel *Label) (*Label, bool, error)
CreateRepoIssueLabel 创建仓库任务标签
func (*IssuesService) DeleteRepoIssueLabel ¶
func (s *IssuesService) DeleteRepoIssueLabel(ctx context.Context, owner, repo, name string) (bool, error)
DeleteRepoIssueLabel 删除一个仓库任务标签
func (*IssuesService) ListIssueLinkingPullRequests ¶
func (s *IssuesService) ListIssueLinkingPullRequests(ctx context.Context, owner, repo, number string) ([]*PullRequest, bool, error)
ListIssueLinkingPullRequests 获取 issue 关联的 pull requests
func (*IssuesService) ListRepoIssueLabels ¶
func (s *IssuesService) ListRepoIssueLabels(ctx context.Context, owner, repo string) ([]*Label, bool, error)
ListRepoIssueLabels 获取仓库所有任务标签
func (*IssuesService) RemoveLabelsFromIssue ¶
func (s *IssuesService) RemoveLabelsFromIssue(ctx context.Context, owner, repo, number, labels string) (bool, error)
RemoveLabelsFromIssue 删除Issue标签
API Docs: https://docs.gitcode.com/docs/openapi/repos/issues/#10%e5%88%a0%e9%99%a4issue%e6%a0%87%e7%ad%be
func (*IssuesService) UpdateIssue ¶
func (s *IssuesService) UpdateIssue(ctx context.Context, owner, number string, issueContent *IssueRequest) (*Issue, bool, error)
UpdateIssue 更新Issue
API Docs: https://docs.gitcode.com/docs/openapi/repos/issues/#2-%e6%9b%b4%e6%96%b0issue
func (*IssuesService) UpdateRepoIssueLabel ¶
func (s *IssuesService) UpdateRepoIssueLabel(ctx context.Context, owner, repo, originalName, newName, color string) (*Label, bool, error)
UpdateRepoIssueLabel 更新一个仓库的任务标签
type Label ¶
type Label struct { ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` Color *string `json:"color,omitempty"` RepositoryId *int64 `json:"repository_id,omitempty"` }
Label represents a GitCode label on an Issue
type MergeAbleState ¶
type MergeAbleState struct { MergeRequestID *int64 `json:"merge_request_id,omitempty"` State *string `json:"state,omitempty"` }
TODO
type Organization ¶
type Organization struct { Login *string `json:"login,omitempty"` ID *int64 `json:"id,omitempty"` AvatarURL *string `json:"avatar_url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` Name *string `json:"name,omitempty"` Company *string `json:"company,omitempty"` Description *string `json:"description,omitempty"` PublicRepos *int `json:"public_repos,omitempty"` PrivateRepos *int `json:"private_repos,omitempty"` Followers *int `json:"followers,omitempty"` FollowCount *int `json:"follow_count,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Members *string `json:"members,omitempty"` Public *bool `json:"public,omitempty"` Type *string `json:"type,omitempty"` }
Organization represents a GitHub organization account.
type Permission ¶
type Permission struct {
Admin *bool `json:"admin,omitempty"`
}
type PullRequest ¶
type PullRequest struct { ID *int64 `json:"id,omitempty"` Number *int `json:"number,omitempty"` State *string `json:"state,omitempty"` Title *string `json:"title,omitempty"` Body *string `json:"body,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` ClosedAt *time.Time `json:"closed_at,omitempty"` MergedAt *time.Time `json:"merged_at,omitempty"` Labels []*Label `json:"labels,omitempty"` User *User `json:"user,omitempty"` Draft *bool `json:"draft,omitempty"` CanMergeCheck *bool `json:"can_merge_check,omitempty"` Merged *bool `json:"merged,omitempty"` MergeAble *bool `json:"mergeable,omitempty"` MergeAbleState *MergeAbleState `json:"mergeable_state,omitempty"` MergedBy *User `json:"merged_by,omitempty"` PruneBranch *bool `json:"prune_branch,omitempty"` Head *PullRequestBranch `json:"head,omitempty"` Base *PullRequestBranch `json:"base,omitempty"` URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` IssueURL *string `json:"issue_url,omitempty"` StatusesURL *string `json:"statuses_url,omitempty"` DiffURL *string `json:"diff_url,omitempty"` PatchURL *string `json:"patch_url,omitempty"` CommitsURL *string `json:"commits_url,omitempty"` CommentsURL *string `json:"comments_url,omitempty"` ReviewCommentsURL *string `json:"review_comments_url,omitempty"` ReviewCommentURL *string `json:"review_comment_url,omitempty"` ReviewComments *int `json:"review_comments,omitempty"` Assignee *User `json:"assignee,omitempty"` Assignees []*User `json:"assignees,omitempty"` MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"` AuthorAssociation *string `json:"author_association,omitempty"` NodeID *string `json:"node_id,omitempty"` RequestedReviewers []*User `json:"requested_reviewers,omitempty"` }
PullRequest represents a GitHub pull request on a repository.
type PullRequestBranch ¶
type PullRequestBranch struct { Label *string `json:"label,omitempty"` Ref *string `json:"ref,omitempty"` SHA *string `json:"sha,omitempty"` Repo *Repository `json:"repo,omitempty"` User *User `json:"user,omitempty"` }
PullRequestBranch represents a base or head branch in a GitHub pull request.
type PullRequestComment ¶
type PullRequestLinks ¶
type PullRequestMergedResult ¶
type PullRequestOperationLog ¶
type PullRequestOperationLog struct { Project *string `json:"project,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` DiscussionID *int64 `json:"discussion_id,omitempty"` ID *int64 `json:"id,omitempty"` Content *string `json:"content,omitempty"` Action *string `json:"action,omitempty"` MergeRequestId *int64 `json:"merge_request_id,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` User *User `json:"user,omitempty"` }
PullRequestOperationLog represents a comment in a GitHub DiscussionCommentEvent.
type PullRequestRequest ¶
type PullRequestRequest struct { ID *int64 `json:"id,omitempty"` Body *string `json:"body,omitempty"` State *string `json:"state,omitempty"` Labels *string `json:"labels,omitempty"` MilestoneNumber *string `json:"milestone_number,omitempty"` Draft *string `json:"draft,omitempty"` Title *string `json:"title,omitempty"` User *User `json:"user,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Target *PullRequest `json:"target,omitempty"` }
type PullRequestsService ¶
type PullRequestsService service
func (*PullRequestsService) AddLabelsToPullRequest ¶
func (s *PullRequestsService) AddLabelsToPullRequest(ctx context.Context, owner, repo string, number uint, labelNameList []string) ([]*Label, bool, error)
AddLabelsToPullRequest 创建 Pull Request 标签
func (*PullRequestsService) CreatePullRequestComment ¶
func (s *PullRequestsService) CreatePullRequestComment(ctx context.Context, owner, repo, number string, comment *PullRequestComment) (*PullRequestComment, bool, error)
CreatePullRequestComment 提交pull request 评论
func (*PullRequestsService) DeletePullRequestComment ¶ added in v0.2.0
func (s *PullRequestsService) DeletePullRequestComment(ctx context.Context, owner, repo, number, commentId string) (bool, error)
DeletePullRequestComment 删除评论
API Docs: https://docs.gitcode.com/docs/openapi/repos/pulls/#28-%e5%88%a0%e9%99%a4%e8%af%84%e8%ae%ba
func (*PullRequestsService) EditPullRequestComment ¶
func (s *PullRequestsService) EditPullRequestComment(ctx context.Context, owner, repo, number string, comment *PullRequestComment) (*PullRequestComment, bool, error)
EditPullRequestComment 编辑评论
API Docs: https://docs.gitcode.com/docs/openapi/repos/pulls/#27-%e7%bc%96%e8%be%91%e8%af%84%e8%ae%ba
func (*PullRequestsService) GetPullRequest ¶
func (s *PullRequestsService) GetPullRequest(ctx context.Context, owner, repo, number string) (*PullRequest, bool, error)
GetPullRequest 获取单个Pull Requests
func (*PullRequestsService) ListPullRequestCommits ¶ added in v0.2.0
func (s *PullRequestsService) ListPullRequestCommits(ctx context.Context, owner, repo, number string) ([]*RepositoryCommit, bool, error)
ListPullRequestCommits 获取某Pull Request的所有Commit信息
func (*PullRequestsService) ListPullRequestFiles ¶
func (s *PullRequestsService) ListPullRequestFiles(ctx context.Context, owner, repo, number string) ([]*CommitFile, bool, error)
ListPullRequestFiles Pull Request Commit文件列表
func (*PullRequestsService) ListPullRequestLinkingIssues ¶
func (s *PullRequestsService) ListPullRequestLinkingIssues(ctx context.Context, owner, repo, number string) ([]*Issue, bool, error)
ListPullRequestLinkingIssues 获取pr关联的issue
func (*PullRequestsService) ListPullRequestOperationLog ¶
func (s *PullRequestsService) ListPullRequestOperationLog(ctx context.Context, owner, repo, number string) ([]*PullRequestOperationLog, bool, error)
ListPullRequestOperationLog 获取某个Pull Request的操作日志
func (*PullRequestsService) MergePullRequest ¶ added in v0.2.0
func (s *PullRequestsService) MergePullRequest(ctx context.Context, owner, repo, number string) (*PullRequestMergedResult, bool, error)
MergePullRequest 合并Pull Request
API Docs: https://docs.gitcode.com/docs/openapi/repos/pulls/#2-%e5%90%88%e5%b9%b6pull-request
func (*PullRequestsService) RemoveLabelsFromPullRequest ¶
func (s *PullRequestsService) RemoveLabelsFromPullRequest(ctx context.Context, owner string, repo, number, labels string) (bool, error)
RemoveLabelsFromPullRequest 删除 Pull Request 标签
func (*PullRequestsService) UpdatePullRequest ¶
func (s *PullRequestsService) UpdatePullRequest(ctx context.Context, owner, repo, number string, prContent *PullRequestRequest) (*PullRequest, bool, error)
UpdatePullRequest 更新Pull Request信息
type Repository ¶
type Repository struct { ID *int64 `json:"id,omitempty"` NodeID *string `json:"node_id,omitempty"` Owner *User `json:"owner,omitempty"` Name *string `json:"name,omitempty"` FullName *string `json:"full_name,omitempty"` Description *string `json:"description,omitempty"` Homepage *string `json:"homepage,omitempty"` DefaultBranch *string `json:"default_branch,omitempty"` MasterBranch *string `json:"master_branch,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` PushedAt *time.Time `json:"pushed_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` HTMLURL *string `json:"html_url,omitempty"` CloneURL *string `json:"clone_url,omitempty"` GitURL *string `json:"git_url,omitempty"` MirrorURL *string `json:"mirror_url,omitempty"` SSHURL *string `json:"ssh_url,omitempty"` SVNURL *string `json:"svn_url,omitempty"` Language *string `json:"language,omitempty"` Fork *bool `json:"fork,omitempty"` ForksCount *int `json:"forks_count,omitempty"` NetworkCount *int `json:"network_count,omitempty"` OpenIssuesCount *int `json:"open_issues_count,omitempty"` OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. StargazersCount *int `json:"stargazers_count,omitempty"` SubscribersCount *int `json:"subscribers_count,omitempty"` WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. Size *int `json:"size,omitempty"` AutoInit *bool `json:"auto_init,omitempty"` Parent *Repository `json:"parent,omitempty"` Source *Repository `json:"source,omitempty"` TemplateRepository *Repository `json:"template_repository,omitempty"` Organization *Organization `json:"organization,omitempty"` Permissions map[string]bool `json:"permissions,omitempty"` AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` AllowForking *bool `json:"allow_forking,omitempty"` WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" Topics []string `json:"topics,omitempty"` CustomProperties map[string]interface{} `json:"custom_properties,omitempty"` Archived *bool `json:"archived,omitempty"` Disabled *bool `json:"disabled,omitempty"` // Additional mutable fields when creating and editing a repository Private *bool `json:"private,omitempty"` HasIssues *bool `json:"has_issues,omitempty"` HasWiki *bool `json:"has_wiki,omitempty"` HasPages *bool `json:"has_pages,omitempty"` HasProjects *bool `json:"has_projects,omitempty"` HasDownloads *bool `json:"has_downloads,omitempty"` HasDiscussions *bool `json:"has_discussions,omitempty"` IsTemplate *bool `json:"is_template,omitempty"` LicenseTemplate *string `json:"license_template,omitempty"` GitignoreTemplate *string `json:"gitignore_template,omitempty"` // Creating an organization repository. Required for non-owners. TeamID *int64 `json:"team_id,omitempty"` // API URLs URL *string `json:"url,omitempty"` ArchiveURL *string `json:"archive_url,omitempty"` AssigneesURL *string `json:"assignees_url,omitempty"` BlobsURL *string `json:"blobs_url,omitempty"` BranchesURL *string `json:"branches_url,omitempty"` CollaboratorsURL *string `json:"collaborators_url,omitempty"` CommentsURL *string `json:"comments_url,omitempty"` CommitsURL *string `json:"commits_url,omitempty"` CompareURL *string `json:"compare_url,omitempty"` ContentsURL *string `json:"contents_url,omitempty"` ContributorsURL *string `json:"contributors_url,omitempty"` DeploymentsURL *string `json:"deployments_url,omitempty"` DownloadsURL *string `json:"downloads_url,omitempty"` EventsURL *string `json:"events_url,omitempty"` ForksURL *string `json:"forks_url,omitempty"` GitCommitsURL *string `json:"git_commits_url,omitempty"` GitRefsURL *string `json:"git_refs_url,omitempty"` GitTagsURL *string `json:"git_tags_url,omitempty"` HooksURL *string `json:"hooks_url,omitempty"` IssueCommentURL *string `json:"issue_comment_url,omitempty"` IssueEventsURL *string `json:"issue_events_url,omitempty"` IssuesURL *string `json:"issues_url,omitempty"` KeysURL *string `json:"keys_url,omitempty"` LabelsURL *string `json:"labels_url,omitempty"` LanguagesURL *string `json:"languages_url,omitempty"` MergesURL *string `json:"merges_url,omitempty"` MilestonesURL *string `json:"milestones_url,omitempty"` NotificationsURL *string `json:"notifications_url,omitempty"` PullsURL *string `json:"pulls_url,omitempty"` ReleasesURL *string `json:"releases_url,omitempty"` StargazersURL *string `json:"stargazers_url,omitempty"` StatusesURL *string `json:"statuses_url,omitempty"` SubscribersURL *string `json:"subscribers_url,omitempty"` SubscriptionURL *string `json:"subscription_url,omitempty"` TagsURL *string `json:"tags_url,omitempty"` TreesURL *string `json:"trees_url,omitempty"` TeamsURL *string `json:"teams_url,omitempty"` // Visibility is only used for Create and Edit endpoints. The visibility field // overrides the field parameter when both are used. // Can be one of public, private or internal. Visibility *string `json:"visibility,omitempty"` // RoleName is only returned by the API 'check team permissions for a repository'. // See: teams.go (IsTeamRepoByID) https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository RoleName *string `json:"role_name,omitempty"` }
Repository represents a GitHub repository.
type RepositoryCommit ¶
type RepositoryCommit struct { NodeID *string `json:"node_id,omitempty"` SHA *string `json:"sha,omitempty"` Commit *Commit `json:"commit,omitempty"` Author *User `json:"author,omitempty"` Committer *User `json:"committer,omitempty"` Parents []*Commit `json:"parents,omitempty"` HTMLURL *string `json:"html_url,omitempty"` URL *string `json:"url,omitempty"` CommentsURL *string `json:"comments_url,omitempty"` }
type RepositoryContent ¶
type RepositoryContent struct { Type *string `json:"type,omitempty"` // Target is only set if the type is "symlink" and the target is not a normal file. // If Target is set, Path will be the symlink path. Target *string `json:"target,omitempty"` Encoding *string `json:"encoding,omitempty"` Size *int `json:"size,omitempty"` Name *string `json:"name,omitempty"` Path *string `json:"path,omitempty"` // Content contains the actual file content, which may be encoded. // Callers should call GetContent which will decode the content if // necessary. Content *string `json:"content,omitempty"` SHA *string `json:"sha,omitempty"` URL *string `json:"url,omitempty"` GitURL *string `json:"git_url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` DownloadURL *string `json:"download_url,omitempty"` SubmoduleGitURL *string `json:"submodule_git_url,omitempty"` }
RepositoryContent represents a file or directory in a github repository.
type RepositoryService ¶
type RepositoryService service
func (*RepositoryService) CheckUserIsRepoMember ¶
func (s *RepositoryService) CheckUserIsRepoMember(ctx context.Context, owner, repo, username string) (bool, bool, error)
CheckUserIsRepoMember 判断用户是否为仓库成员
func (*RepositoryService) CreateRepoBranch ¶ added in v0.2.2
func (s *RepositoryService) CreateRepoBranch(ctx context.Context, owner, repo, refs, name string) (*Branch, bool, error)
CreateRepoBranch 创建分支
API Docs: https://docs.gitcode.com/docs/openapi/repos/branch/#2-%e5%88%9b%e5%bb%ba%e5%88%86%e6%94%af
func (*RepositoryService) GetRepoAllBranch ¶ added in v0.2.2
func (s *RepositoryService) GetRepoAllBranch(ctx context.Context, owner, repo, sort, direction, page string) ([]*Branch, bool, error)
GetRepoAllBranch 获取项目所有分支
func (*RepositoryService) GetRepoAllFileList ¶
func (s *RepositoryService) GetRepoAllFileList(ctx context.Context, owner, repo, ref, file string) ([]string, bool, error)
GetRepoAllFileList 获取文件列表
func (*RepositoryService) GetRepoAllMember ¶
func (s *RepositoryService) GetRepoAllMember(ctx context.Context, owner, repo, page string) ([]*User, bool, error)
GetRepoAllMember 获取仓库的所有成员
func (*RepositoryService) GetRepoContentByPath ¶ added in v0.2.0
func (s *RepositoryService) GetRepoContentByPath(ctx context.Context, owner, repo, path, ref string) ([]*RepositoryContent, bool, error)
GetRepoContentByPath 获取仓库具体路径下的内容
func (*RepositoryService) GetRepoContributors ¶
func (s *RepositoryService) GetRepoContributors(ctx context.Context, owner, repo, category string) ([]*Contributor, bool, error)
GetRepoContributors 获取仓库贡献者
func (*RepositoryService) GetRepoMemberPermission ¶
func (s *RepositoryService) GetRepoMemberPermission(ctx context.Context, owner, repo, username string) (*User, bool, error)
GetRepoMemberPermission 查看仓库成员的权限
type RequestHandler ¶
type RequestHandler struct {
// contains filtered or unexported fields
}
func (RequestHandler) PostOperate ¶
func (b RequestHandler) PostOperate(req *http.Request)
func (RequestHandler) PreOperate ¶
func (b RequestHandler) PreOperate(uri *url.URL, body any) error
type RequestHandlerType ¶
type RequestHandlerType string
const ( Json RequestHandlerType = "json" Form RequestHandlerType = "form" Query RequestHandlerType = "query" )
type User ¶
type User struct { Login *string `json:"login,omitempty"` ID *int64 `json:"id,omitempty"` AvatarURL *string `json:"avatar_url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` Name *string `json:"name,omitempty"` Company *string `json:"company,omitempty"` Blog *string `json:"blog,omitempty"` Email *string `json:"email,omitempty"` Bio *string `json:"bio,omitempty"` Followers *int `json:"followers,omitempty"` Following *int `json:"following,omitempty"` Type *string `json:"type,omitempty"` Permission *string `json:"permission,omitempty"` Permissions *Permission `json:"permissions,omitempty"` }
User represents a GitHub user.