openapi

package
v0.4.2-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2025 License: Apache-2.0 Imports: 14 Imported by: 2

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.

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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {

	// 各个模块的服务
	Issues       *IssuesService
	PullRequests *PullRequestsService
	Repository   *RepositoryService
	User         *UserService
	Org          *OrganizationService
	// contains filtered or unexported fields
}

APIClient 一个客户端,管理与 GitCode OpenAPI 的通信

func NewAPIClientWithAuthorization

func NewAPIClientWithAuthorization(token []byte) *APIClient

func (*APIClient) BareDo

func (c *APIClient) BareDo(ctx context.Context, req *http.Request) (*http.Response, error)

func (*APIClient) Do

func (c *APIClient) Do(ctx context.Context, req *http.Request, receiver any) (*http.Response, error)

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 BranchProtectedRuleRequest added in v0.2.2

type BranchProtectedRuleRequest struct {
	PushPermission  string `json:"pusher,omitempty"`
	MergePermission string `json:"merger,omitempty"`
	BranchName      string `json:"wildcard,omitempty"`
}

type BranchRequest added in v0.2.2

type BranchRequest struct {
	CreateFrom string `json:"refs,omitempty"`
	BranchName string `json:"branch_name,omitempty"`
}

type Commit

type Commit struct {
	SHA         *string     `json:"sha,omitempty"`
	Author      *CommitUser `json:"author,omitempty"`
	Committer   *CommitUser `json:"committer,omitempty"`
	Message     *string     `json:"message,omitempty"`
	Parents     *Commit     `json:"parents,omitempty"`
	HTMLURL     *string     `json:"html_url,omitempty"`
	URL         *string     `json:"url,omitempty"`
	CommentsURL *int        `json:"comments_url,omitempty"`
}

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            *CommitPatch `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 CommitPatch added in v0.2.0

type CommitPatch struct {
	Diff        *string `json:"diff,omitempty"`
	OldPath     *string `json:"old_path,omitempty"`
	NewPath     *string `json:"new_path,omitempty"`
	NewFile     *bool   `json:"new_file,omitempty"`
	RenamedFile *bool   `json:"renamed_file,omitempty"`
	DeletedFile *bool   `json:"deleted_file,omitempty"`
	TooLarge    *bool   `json:"too_large,omitempty"`
}

type CommitUser added in v0.2.0

type CommitUser struct {
	Login *string    `json:"login,omitempty"`
	Name  *string    `json:"name,omitempty"`
	Email *string    `json:"email,omitempty"`
	Date  *Timestamp `json:"date,omitempty"`
}

type Contributor

type Contributor struct {
	Contributions *int64  `json:"contributions,omitempty"`
	Name          *string `json:"name,omitempty"`
	Email         *string `json:"email,omitempty"`
}

Contributor represents a repository contributor

type CustomRepoRoles added in v0.2.2

type CustomRepoRoles struct {
	ID          *string    `json:"role_id,omitempty"`
	AccessLevel *int       `json:"access_level,omitempty"`
	Name        *string    `json:"role_name,omitempty"`
	Description *string    `json:"role_description,omitempty"`
	Type        *string    `json:"role_type,omitempty"`
	MemberCount *int       `json:"member_count,omitempty"`
	CreatedAt   *Timestamp `json:"created_at,omitempty"`
	UpdatedAt   *Timestamp `json:"updated_at,omitempty"`
}

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        *Timestamp        `json:"created_at,omitempty"`
	UpdatedAt        *Timestamp        `json:"updated_at,omitempty"`
	ClosedAt         *Timestamp        `json:"finished_at,omitempty"`
	ClosedBy         *User             `json:"closed_by,omitempty"`

	PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"`
	Milestone        *Milestone        `json:"milestone,omitempty"`
}

type IssueComment

type IssueComment struct {
	ID        *json.Number `json:"id,omitempty"`
	Body      *string      `json:"body,omitempty"`
	User      *User        `json:"user,omitempty"`
	CreatedAt *Timestamp   `json:"created_at,omitempty"`
	UpdatedAt *Timestamp   `json:"updated_at,omitempty"`
	Target    *Issue       `json:"target,omitempty"`
}

type IssueRequest

type IssueRequest struct {
	Repository    string `json:"repo,omitempty"` // 仓库地址
	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 IssueStateDetail struct {
	Title  *string `json:"title,omitempty"`
	Serial *int    `json:"serial,omitempty"`
}

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/apis/post-api-v-5-repos-owner-repo-issues-number-labels

func (*IssuesService) CreateIssue added in v0.2.2

func (s *IssuesService) CreateIssue(ctx context.Context, owner string, issueContent *IssueRequest) (*Issue, bool, error)

CreateIssue 创建Issue

api Docs: https://docs.gitcode.com/docs/apis/post-api-v-5-repos-owner-issues

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/apis/post-api-v-5-repos-owner-repo-issues-number-comments

func (*IssuesService) CreateRepoIssueLabel

func (s *IssuesService) CreateRepoIssueLabel(ctx context.Context, owner, repo string, newLabel *Label) (*Label, bool, error)

CreateRepoIssueLabel 创建仓库任务标签

api Docs: https://docs.gitcode.com/docs/apis/post-api-v-5-repos-owner-repo-labels

func (*IssuesService) DeleteRepoIssueLabel

func (s *IssuesService) DeleteRepoIssueLabel(ctx context.Context, owner, repo, name string) (bool, error)

DeleteRepoIssueLabel 删除一个仓库任务标签

api Docs: https://docs.gitcode.com/docs/apis/delete-api-v-5-repos-owner-repo-labels-name

func (*IssuesService) GetIssue added in v0.2.2

func (s *IssuesService) GetIssue(ctx context.Context, owner, repo, number string) (*Issue, bool, error)

GetIssue 获取仓库的某个Issue

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-issues-number

func (*IssuesService) GetIssueLabels added in v0.2.0

func (s *IssuesService) GetIssueLabels(ctx context.Context, owner, issueID, page string) ([]*Label, bool, error)

GetIssueLabels 获取企业某个Issue所有标签

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-enterprises-enterprise-issues-issue-id-labels

func (*IssuesService) ListIssueLinkingPullRequests

func (s *IssuesService) ListIssueLinkingPullRequests(ctx context.Context, owner, repo, number string) ([]*PullRequest, bool, error)

ListIssueLinkingPullRequests 获取 issue 关联的 pull requests

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-issues-number-pull-requests

func (*IssuesService) ListRepoIssueLabels

func (s *IssuesService) ListRepoIssueLabels(ctx context.Context, owner, repo string) ([]*Label, bool, error)

ListRepoIssueLabels 获取仓库所有任务标签

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-labels

func (*IssuesService) RemoveLabelsFromIssue

func (s *IssuesService) RemoveLabelsFromIssue(ctx context.Context, owner, repo, number, label string) (bool, error)

RemoveLabelsFromIssue 删除Issue标签

api Docs: https://docs.gitcode.com/docs/apis/delete-api-v-5-repos-owner-repo-issues-number-labels-name

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/apis/patch-api-v-5-repos-owner-issues-number

func (*IssuesService) UpdateRepoIssueLabel

func (s *IssuesService) UpdateRepoIssueLabel(ctx context.Context, owner, repo, originalName, newName, color string) (*Label, bool, error)

UpdateRepoIssueLabel 更新一个仓库的任务标签

api Docs: https://docs.gitcode.com/docs/apis/patch-api-v-5-repos-owner-repo-labels-original-name

type Label

type Label struct {
	Name  string `json:"name,omitempty"`
	Color string `json:"color,omitempty"`
	Title string `json:"title,omitempty"`
}

Label represents a GitCode label on an Issue

func (*Label) Form

func (l *Label) Form() *url.Values

type MergeAbleState

type MergeAbleState struct {
	MergeRequestID *int64 `json:"merge_request_id,omitempty"`
	State          *bool  `json:"state,omitempty"`
}

type Milestone added in v0.2.2

type Milestone struct {
	URL         *string    `json:"url,omitempty"`
	Number      *int       `json:"number,omitempty"`
	State       *string    `json:"state,omitempty"`
	Title       *string    `json:"title,omitempty"`
	Description *string    `json:"description,omitempty"`
	CreatedAt   *Timestamp `json:"created_at,omitempty"`
	UpdatedAt   *Timestamp `json:"updated_at,omitempty"`
	ClosedAt    *Timestamp `json:"closed_at,omitempty"`
	DueOn       *Timestamp `json:"due_on,omitempty"`
}

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    *Timestamp `json:"created_at,omitempty"`
	UpdatedAt    *Timestamp `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 OrganizationService added in v0.2.2

type OrganizationService service

func (*OrganizationService) AddOrgMember added in v0.2.2

func (s *OrganizationService) AddOrgMember(ctx context.Context, owner, username, permission, roleId string) (bool, error)

AddOrgMember 邀请组织成员

api Docs: https://docs.gitcode.com/docs/apis/post-api-v-5-orgs-org-memberships-username

func (*OrganizationService) ListOrgMember added in v0.2.2

func (s *OrganizationService) ListOrgMember(ctx context.Context, owner, role, page string) ([]*User, bool, error)

ListOrgMember 列出一个组织的所有成员

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-orgs-org-members

func (*OrganizationService) RemoveOrgMember added in v0.2.2

func (s *OrganizationService) RemoveOrgMember(ctx context.Context, owner, username string) (bool, error)

RemoveOrgMember 移除授权用户所管理组织中的成员

api Docs: https://docs.gitcode.com/docs/apis/delete-api-v-5-orgs-org-memberships-username

type Permission

type Permission struct {
	Admin *bool `json:"admin,omitempty"`
}

type PullRequest

type PullRequest struct {
	ID             *int64          `json:"id,omitempty"`
	Number         *int64          `json:"number,omitempty"`
	State          *string         `json:"state,omitempty"`
	Title          *string         `json:"title,omitempty"`
	Body           *string         `json:"body,omitempty"`
	CreatedAt      *Timestamp      `json:"created_at,omitempty"`
	UpdatedAt      *Timestamp      `json:"updated_at,omitempty"`
	ClosedAt       *Timestamp      `json:"closed_at,omitempty"`
	MergedAt       *Timestamp      `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"`
	Milestone           *Milestone `json:"milestone,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 PullRequestComment struct {
	ID        *json.Number `json:"id,omitempty"`
	Body      *string      `json:"body,omitempty"`
	User      *User        `json:"user,omitempty"`
	CreatedAt *Timestamp   `json:"created_at,omitempty"`
	UpdatedAt *Timestamp   `json:"updated_at,omitempty"`
}

type PullRequestCommentRequest

type PullRequestCommentRequest struct {
	Body     string `json:"body,omitempty"`
	Path     string `json:"path,omitempty"`
	Position string `json:"position,omitempty"`
}
type PullRequestLinks struct {
	URL      *string    `json:"url,omitempty"`
	HTMLURL  *string    `json:"html_url,omitempty"`
	DiffURL  *string    `json:"diff_url,omitempty"`
	PatchURL *string    `json:"patch_url,omitempty"`
	MergedAt *Timestamp `json:"merged_at,omitempty"`
}

type PullRequestMergedResult

type PullRequestMergedResult struct {
	SHA     *string `json:"sha,omitempty"`
	Merged  *bool   `json:"merged,omitempty"`
	Message *string `json:"message,omitempty"`
}

type PullRequestOperationLog

type PullRequestOperationLog struct {
	Project        *string    `json:"project,omitempty"`
	CreatedAt      *Timestamp `json:"created_at,omitempty"`
	DiscussionID   *string    `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      *Timestamp `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"`
	Title           string      `json:"title,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"`
	User            User        `json:"user,omitempty"`
	Target          PullRequest `json:"target,omitempty"`
}

type PullRequestRequestMerge added in v0.2.0

type PullRequestRequestMerge struct {
	Method string `json:"merge_method,omitempty"`
}

type PullRequestsService

type PullRequestsService service

func (*PullRequestsService) AddLabelsToPullRequest

func (s *PullRequestsService) AddLabelsToPullRequest(ctx context.Context, owner, repo, number string, labelNameList []string) ([]*Label, bool, error)

AddLabelsToPullRequest 创建 Pull Request 标签

api Docs: https://docs.gitcode.com/docs/apis/post-api-v-5-repos-owner-repo-pulls-number-labels

func (*PullRequestsService) CreatePullRequestComment

func (s *PullRequestsService) CreatePullRequestComment(ctx context.Context, owner, repo, number string, comment *PullRequestCommentRequest) (*SimpleComment, bool, error)

CreatePullRequestComment 提交 pull request 评论

api Docs: https://docs.gitcode.com/docs/apis/post-api-v-5-repos-owner-repo-pulls-number-comments

func (*PullRequestsService) DeletePullRequestComment added in v0.2.0

func (s *PullRequestsService) DeletePullRequestComment(ctx context.Context, owner, repo, commentID string) (bool, error)

DeletePullRequestComment 删除评论

api Docs: https://docs.gitcode.com/docs/apis/delete-api-v-5-repos-owner-repo-pulls-comments-id

func (*PullRequestsService) GetLabelsOfPullRequest added in v0.2.0

func (s *PullRequestsService) GetLabelsOfPullRequest(ctx context.Context, owner, repo, number string) ([]*Label, bool, error)

GetLabelsOfPullRequest 获取某个 Pull Request 的所有标签

api Docs: https://docs.gitcode.com/docs/apis/delete-api-v-5-repos-owner-repo-pulls-number-labels-name

func (*PullRequestsService) GetPullRequest

func (s *PullRequestsService) GetPullRequest(ctx context.Context, owner, repo, number string) (*PullRequest, bool, error)

GetPullRequest 获取单个Pull Requests

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-pulls-number

func (*PullRequestsService) GetPullRequestChangeFiles added in v0.2.0

func (s *PullRequestsService) GetPullRequestChangeFiles(ctx context.Context, owner, repo, number string) ([]*CommitFile, bool, error)

GetPullRequestChangeFiles Pull Request Commit文件列表

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-pulls-number-files

func (*PullRequestsService) ListPullRequestComments added in v0.2.0

func (s *PullRequestsService) ListPullRequestComments(ctx context.Context, owner, repo, number, page, commentType string) ([]*PullRequestComment, bool, error)

ListPullRequestComments 获取某个Pull Request的所有评论

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-pulls-number-comments

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信息

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-pulls-number-commits

func (*PullRequestsService) ListPullRequestLinkingIssues

func (s *PullRequestsService) ListPullRequestLinkingIssues(ctx context.Context, owner, repo, number, page string) ([]*Issue, bool, error)

ListPullRequestLinkingIssues 获取pr关联的issue

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-pulls-number-issues

func (*PullRequestsService) ListPullRequestOperationLogs added in v0.2.0

func (s *PullRequestsService) ListPullRequestOperationLogs(ctx context.Context, owner, repo, number, sort, page string) ([]*PullRequestOperationLog, bool, error)

ListPullRequestOperationLogs 获取某个Pull Request的操作日志

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-pulls-number-operate-logs

func (*PullRequestsService) MergePullRequest added in v0.2.0

func (s *PullRequestsService) MergePullRequest(ctx context.Context, owner, repo, number, mergeMethod string) (*PullRequestMergedResult, bool, error)

MergePullRequest 合并Pull Request

api Docs: https://docs.gitcode.com/docs/apis/put-api-v-5-repos-owner-repo-pulls-number-merge

func (*PullRequestsService) RemoveLabelsFromPullRequest

func (s *PullRequestsService) RemoveLabelsFromPullRequest(ctx context.Context, owner, repo, number string, labels []string) (bool, error)

RemoveLabelsFromPullRequest 删除 Pull Request 标签

api Docs: https://docs.gitcode.com/docs/openapi/repos/pulls/#13-%e5%88%a0%e9%99%a4-pull-request-%e6%a0%87%e7%ad%be

func (*PullRequestsService) UpdatePullRequest

func (s *PullRequestsService) UpdatePullRequest(ctx context.Context, owner, repo, number string, prContent *PullRequestRequest) (*PullRequest, bool, error)

UpdatePullRequest 更新Pull Request信息

api Docs: https://docs.gitcode.com/docs/apis/patch-api-v-5-repos-owner-repo-pulls-number

func (*PullRequestsService) UpdatePullRequestComment added in v0.2.0

func (s *PullRequestsService) UpdatePullRequestComment(ctx context.Context, owner, repo, commentID, body string) (bool, error)

UpdatePullRequestComment 编辑评论

api Docs: https://docs.gitcode.com/docs/apis/patch-api-v-5-repos-owner-repo-pulls-comments-id

type Repository

type Repository struct {
	ID                 *int64        `json:"id,omitempty"`
	Name               *string       `json:"name,omitempty"`
	Path               *string       `json:"path,omitempty"`
	FullName           *string       `json:"full_name,omitempty"`
	Description        *string       `json:"description,omitempty"`
	Homepage           *string       `json:"homepage,omitempty"`
	DefaultBranch      *string       `json:"default_branch,omitempty"`
	CreatedAt          *Timestamp    `json:"created_at,omitempty"`
	PushedAt           *Timestamp    `json:"pushed_at,omitempty"`
	UpdatedAt          *Timestamp    `json:"updated_at,omitempty"`
	HTMLURL            *string       `json:"html_url,omitempty"`
	MirrorURL          *string       `json:"mirror_url,omitempty"`
	Language           *string       `json:"language,omitempty"`
	Status             *string       `json:"status,omitempty"`
	Internal           *bool         `json:"internal,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"`
	StargazersCount    *int          `json:"stargazers_count,omitempty"`
	SubscribersCount   *int          `json:"subscribers_count,omitempty"`
	WatchersCount      *int          `json:"watchers_count,omitempty"`
	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:"namespace,omitempty"`
	Topics             []string      `json:"topics,omitempty"`
	Archived           *bool         `json:"archived,omitempty"`

	// Additional mutable fields when creating and editing a repository
	Public            *bool   `json:"public,omitempty"`
	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"`
}

Repository represents a GitHub repository.

type RepositoryCommit

type RepositoryCommit struct {
	ID          *string     `json:"id,omitempty"`
	Title       *string     `json:"title,omitempty"`
	Message     *string     `json:"message,omitempty"`
	SHA         *string     `json:"sha,omitempty"`
	Commit      *Commit     `json:"commit,omitempty"`
	Author      *CommitUser `json:"author,omitempty"`
	Committer   *CommitUser `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     *int64  `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 RepositoryMemberPermission added in v0.2.2

type RepositoryMemberPermission struct {
	Permission *string `json:"permission,omitempty"`
}

type RepositoryPermissionMode added in v0.2.2

type RepositoryPermissionMode struct {
	Model int `json:"memberMgntMode,omitempty"`
}

type RepositoryPermissionModeRequest added in v0.2.2

type RepositoryPermissionModeRequest struct {
	Model int `json:"mode,omitempty"`
}

type RepositoryRepoPullRequestSettingRequest added in v0.2.2

type RepositoryRepoPullRequestSettingRequest struct {
	DisableMergeBySelf    bool `json:"disable_merge_by_self,omitempty"`
	AddNotesAfterMerged   bool `json:"add_notes_after_merged,omitempty"`
	CanReopen             bool `json:"can_reopen,omitempty"`
	AllowLiteMergeRequest bool `json:"is_allow_lite_merge_request,omitempty"`
}

type RepositoryRepoSettingRequest added in v0.2.2

type RepositoryRepoSettingRequest struct {
	GeneratePreMergeRef            bool `json:"generate_pre_merge_ref,omitempty"`
	ForbiddenCommitterCreateBranch bool `json:"forbidden_committer_create_branch,omitempty"`
	ForbiddenDeveloperCreateBranch bool `json:"forbidden_developer_create_branch,omitempty"`
	ForbiddenDeveloperCreateTag    bool `json:"forbidden_developer_create_tag,omitempty"`
}

type RepositoryRequest added in v0.2.2

type RepositoryRequest struct {
	Name              *string `json:"name,omitempty"`
	Description       *string `json:"description,omitempty"`
	Homepage          *string `json:"homepage,omitempty"`
	HasIssues         *bool   `json:"has_issues,omitempty"`
	HasWiki           *bool   `json:"has_wiki,omitempty"`
	AutoInit          *bool   `json:"auto_init,omitempty"`
	Private           *bool   `json:"private,omitempty"`
	Public            *int    `json:"public,omitempty"`
	DefaultBranch     *string `json:"default_branch,omitempty"`
	LicenseTemplate   *string `json:"license_template,omitempty"`
	GitignoreTemplate *string `json:"gitignore_template,omitempty"`
	Path              *string `json:"path,omitempty"`
	ImportUrl         *string `json:"import_url,omitempty"`
}

type RepositoryService

type RepositoryService service

func (*RepositoryService) AddRepoMember added in v0.2.2

func (s *RepositoryService) AddRepoMember(ctx context.Context, owner, repo, username, permission string) (bool, error)

AddRepoMember 添加项目成员或更新项目成员权限

api Docs: https://docs.gitcode.com/docs/apis/put-api-v-5-repos-owner-repo-collaborators-username

func (*RepositoryService) CheckUserIsRepoMember

func (s *RepositoryService) CheckUserIsRepoMember(ctx context.Context, owner, repo, username string) (bool, bool, error)

CheckUserIsRepoMember 判断用户是否为仓库成员

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-collaborators-username

func (*RepositoryService) CreateOrgRepo added in v0.2.2

func (s *RepositoryService) CreateOrgRepo(ctx context.Context, owner string, repoContent *RepositoryRequest) (*Repository, bool, error)

CreateOrgRepo 创建组织仓库

api Docs: https://docs.gitcode.com/docs/apis/post-api-v-5-orgs-org-repos

func (*RepositoryService) CreateRepoBranch added in v0.2.2

func (s *RepositoryService) CreateRepoBranch(ctx context.Context, owner, repo, branch, createFrom string) (bool, error)

CreateRepoBranch 创建分支

api Docs: https://docs.gitcode.com/docs/apis/post-api-v-5-repos-owner-repo-branches

func (*RepositoryService) CreateRepoBranchProtectedRule added in v0.2.2

func (s *RepositoryService) CreateRepoBranchProtectedRule(ctx context.Context, owner, repo, branch, permission string) (bool, error)

CreateRepoBranchProtectedRule 新建保护分支规则

api Docs: https://docs.gitcode.com/docs/apis/put-api-v-5-repos-owner-repo-branches-setting-new

func (*RepositoryService) DeleteOrgRepo added in v0.2.2

func (s *RepositoryService) DeleteOrgRepo(ctx context.Context, owner, repo string) (bool, error)

DeleteOrgRepo 删除一个仓库

api Docs: https://docs.gitcode.com/docs/apis/delete-api-v-5-repos-owner-repo

func (*RepositoryService) GetRepoAllBranch added in v0.2.2

func (s *RepositoryService) GetRepoAllBranch(ctx context.Context, owner, repo, page string) ([]*Branch, bool, error)

GetRepoAllBranch 获取项目所有分支

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-branches

func (*RepositoryService) GetRepoAllMember

func (s *RepositoryService) GetRepoAllMember(ctx context.Context, owner, repo, page string) ([]*User, bool, error)

GetRepoAllMember 获取仓库的所有成员

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-collaborators

func (*RepositoryService) GetRepoBranch added in v0.2.2

func (s *RepositoryService) GetRepoBranch(ctx context.Context, owner, repo, branch string) (*Branch, bool, error)

GetRepoBranch 获取单个分支

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-branches-branch

func (*RepositoryService) GetRepoContentByPath added in v0.2.0

func (s *RepositoryService) GetRepoContentByPath(ctx context.Context, owner, repo, path, ref string) (*RepositoryContent, bool, error)

GetRepoContentByPath 获取仓库具体路径下的内容

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-contents-path

func (*RepositoryService) GetRepoContributors

func (s *RepositoryService) GetRepoContributors(ctx context.Context, owner, repo, category string) ([]*Contributor, bool, error)

GetRepoContributors 获取仓库贡献者

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-contributors

func (*RepositoryService) GetRepoCustomRoles added in v0.2.2

func (s *RepositoryService) GetRepoCustomRoles(ctx context.Context, owner, repo string) ([]*CustomRepoRoles, bool, error)

GetRepoCustomRoles 获取项目自定义角色

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-customized-roles

func (*RepositoryService) GetRepoFileList added in v0.2.2

func (s *RepositoryService) GetRepoFileList(ctx context.Context, owner, repo, refName, fileName string) ([]string, bool, error)

GetRepoFileList 获取文件列表

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-file-list

func (*RepositoryService) GetRepoMemberPermission

func (s *RepositoryService) GetRepoMemberPermission(ctx context.Context, owner, repo, login string) (*User, [2]bool, error)

GetRepoMemberPermission 查看仓库成员的权限

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-collaborators-username-permission

func (*RepositoryService) GetRepoPermissionMode added in v0.2.2

func (s *RepositoryService) GetRepoPermissionMode(ctx context.Context, owner, repo string) (*RepositoryPermissionMode, bool, error)

GetRepoPermissionMode 获取项目的权限模式

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-transition

func (*RepositoryService) GetRepoTrees added in v0.2.2

func (s *RepositoryService) GetRepoTrees(ctx context.Context, owner, repo, sha, page, recursive string) (*RepositoryTree, bool, error)

GetRepoTrees 获取仓库目录Tree

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-repos-owner-repo-git-trees-sha

func (*RepositoryService) ListOrgRepo added in v0.2.2

func (s *RepositoryService) ListOrgRepo(ctx context.Context, owner, repoType, page string) ([]*Repository, bool, error)

ListOrgRepo 获取组织项目列表

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-orgs-org-repos

func (*RepositoryService) RemoveRepoBranchProtectedRule added in v0.2.2

func (s *RepositoryService) RemoveRepoBranchProtectedRule(ctx context.Context, owner, repo, branch string) (bool, error)

RemoveRepoBranchProtectedRule 删除保护分支规则

api Docs: https://docs.gitcode.com/docs/apis/delete-api-v-5-repos-owner-repo-branches-wildcard-setting

func (*RepositoryService) RemoveRepoMember added in v0.2.2

func (s *RepositoryService) RemoveRepoMember(ctx context.Context, owner, repo, username string) (bool, error)

RemoveRepoMember 移除项目成员

api Docs: https://docs.gitcode.com/docs/apis/delete-api-v-5-repos-owner-repo-collaborators-username

func (*RepositoryService) UpdateRepoBranchProtectedRule added in v0.2.2

func (s *RepositoryService) UpdateRepoBranchProtectedRule(ctx context.Context, owner, repo, branch, permission string) (bool, error)

UpdateRepoBranchProtectedRule 更新保护分支规则

api Docs: https://docs.gitcode.com/docs/apis/put-api-v-5-repos-owner-repo-branches-wildcard-setting

func (*RepositoryService) UpdateRepoPermissionMode added in v0.2.2

func (s *RepositoryService) UpdateRepoPermissionMode(ctx context.Context, owner, repo, mode string) (bool, error)

UpdateRepoPermissionMode 更新仓库的权限模式

api Docs: https://docs.gitcode.com/docs/apis/put-api-v-5-repos-owner-repo-transition

func (*RepositoryService) UpdateRepoPullRequestSetting added in v0.2.2

func (s *RepositoryService) UpdateRepoPullRequestSetting(ctx context.Context, owner, repo string) (bool, error)

UpdateRepoPullRequestSetting 更新 Pull Request设置

api Docs: https://docs.gitcode.com/docs/apis/put-api-v-5-repos-owner-repo-pull-request-settings

func (*RepositoryService) UpdateRepoSetting added in v0.2.2

func (s *RepositoryService) UpdateRepoSetting(ctx context.Context, owner, repo string) (bool, error)

UpdateRepoSetting 更新仓库设置

api Docs: https://docs.gitcode.com/docs/apis/put-api-v-5-repos-owner-repo-repo-settings

type RepositoryTree added in v0.2.2

type RepositoryTree struct {
	Sha  *string              `json:"sha,omitempty"`
	Tree []*RepositoryContent `json:"tree,omitempty"`
}

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 SimpleComment added in v0.2.0

type SimpleComment struct {
	Body string `json:"body,omitempty"`
}

type Timestamp added in v0.2.0

type Timestamp time.Time

func (*Timestamp) MarshalJSON added in v0.2.0

func (t *Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) ToString added in v0.2.0

func (t *Timestamp) ToString() *string

func (*Timestamp) ToTime added in v0.2.2

func (t *Timestamp) ToTime() time.Time

func (*Timestamp) UnmarshalJSON added in v0.2.0

func (t *Timestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.

type User

type User struct {
	Login       *string     `json:"login,omitempty"`
	AvatarURL   *string     `json:"avatar_url,omitempty"`
	HTMLURL     *string     `json:"web_url,omitempty"`
	UserName    *string     `json:"username,omitempty"`
	Name        *string     `json:"name,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"`
	RoleId      *string     `json:"role_id,omitempty"`
	Permissions *Permission `json:"permissions,omitempty"`
}

User represents a GitHub user.

type UserService

type UserService service

func (*UserService) GetUserInfo

func (s *UserService) GetUserInfo(ctx context.Context) (*User, bool, error)

GetUserInfo 获取授权用户的资料

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-user

func (*UserService) GetUserInfoByUsername added in v0.2.2

func (s *UserService) GetUserInfoByUsername(ctx context.Context, username string) (*User, bool, error)

GetUserInfoByUsername 获取一个用户

api Docs: https://docs.gitcode.com/docs/apis/get-api-v-5-users-username

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL