Documentation
¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- func Stringify(message interface{}) string
- type Branch
- type BranchRef
- type BranchesService
- type Client
- type Commit
- type CommitRef
- type CommitsService
- type Compare
- type CreateFileOptions
- type DeleteFileOptions
- type Diff
- type Enterprise
- type ErrorResponse
- type File
- type FileOperationResponse
- type GetFileOptions
- type GiteeUser
- type ListCommitsOptions
- type ListOptions
- type ListPullRequestDiffsOptions
- type ListRepositoriesOptions
- type Namespace
- type Permission
- type PullRequestsService
- type RepoTypeValue
- type RepositoriesService
- type Repository
- type RepositoryFilesService
- func (s *RepositoryFilesService) CreateFile(owner, repo, path string, opts *CreateFileOptions) (*FileOperationResponse, *Response, error)
- func (s *RepositoryFilesService) DeleteFile(owner, repo, path string, opts *DeleteFileOptions) (*FileOperationResponse, *Response, error)
- func (s *RepositoryFilesService) GetFile(owner, repo, path string, opts *GetFileOptions) (*File, *Response, error)
- func (s *RepositoryFilesService) UpdateFile(owner, repo, path string, opts *UpdateFileOptions) (*FileOperationResponse, *Response, error)
- type Response
- type SortDirectionValue
- type SortValue
- type Tag
- type TagsService
- type UpdateFileOptions
- type User
- type UsersService
- type VisibilityValue
Constants ¶
View Source
const ( TotalCount = "total_count" TotalPage = "total_page" )
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
Types ¶
type Branch ¶
type Branch struct {
Name string `json:"name"`
Commit *struct {
SHA string `json:"sha"`
URL string `json:"url"`
Commit *struct {
Author *struct {
Name string `json:"name"`
Date *time.Time `json:"date"`
Email string `json:"email"`
} `json:"author"`
URL string `json:"url"`
Message string `json:"message"`
Tree *struct {
SHA string `json:"sha"`
URL string `json:"url"`
} `json:"tree"`
Committer *struct {
Name string `json:"name"`
Date *time.Time `json:"date"`
Email string `json:"email"`
} `json:"committer"`
} `json:"commit"`
Author *struct {
AvatarURL string `json:"avatar_url"`
URL string `json:"url"`
ID int64 `json:"id"`
Login string `json:"login"`
} `json:"author"`
Parents []*struct {
SHA string `json:"sha"`
URL string `json:"url"`
} `json:"parents"`
Committer *struct {
AvatarURL string `json:"avatar_url"`
URL string `json:"url"`
ID int64 `json:"id"`
Login string `json:"login"`
} `json:"committer"`
} `json:"commit"`
Protected bool `json:"protected"`
ProtectionURL string `json:"protection_url"`
}
type BranchRef ¶
type BranchesService ¶
type BranchesService struct {
// contains filtered or unexported fields
}
func (*BranchesService) CreateBranch ¶
func (s *BranchesService) CreateBranch(owner, repo, refs, branch_name string) (*Branch, *Response, error)
func (*BranchesService) GetBranch ¶
func (s *BranchesService) GetBranch(owner, repo, branch string) (*Branch, *Response, error)
func (*BranchesService) ListBranches ¶
func (s *BranchesService) ListBranches(owner, repo string) ([]*BranchRef, *Response, error)
type Client ¶
type Client struct {
// User agent used when communicating with the TGit API.
UserAgent string
// Services used for talking to different parts of the TGit API.
Branches *BranchesService
Commits *CommitsService
Repositories *RepositoriesService
RepositoryFiles *RepositoryFilesService
Tags *TagsService
PullRequests *PullRequestsService
Users *UsersService
// contains filtered or unexported fields
}
func NewBasicAuthClient ¶
func NewBasicAuthClient(hc *retryablehttp.Client, username, password string) (*Client, error)
func NewOAuthClient ¶
func NewOAuthClient(hc *retryablehttp.Client, token string) (*Client, error)
func (*Client) Do ¶
func (c *Client) Do(req *retryablehttp.Request, v interface{}) (*Response, error)
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, path string, opt interface{}) (*retryablehttp.Request, error)
type Commit ¶
type Commit struct {
URL string `json:"url"`
SHA string `json:"sha"`
HTMLURL string `json:"html_url"`
CommentsURL string `json:"comment_url"`
Commit *struct {
Author *struct {
Name string `json:"name"`
Date *time.Time `json:"date"`
Email string `json:"email"`
} `json:"author"`
Committer *struct {
Name string `json:"name"`
Date *time.Time `json:"date"`
Email string `json:"email"`
} `json:"committer"`
Message string `json:"message"`
Tree *struct {
SHA string `json:"sha"`
URL string `json:"url"`
} `json:"tree"`
} `json:"commit"`
Author *struct {
ID int64 `json:"id"`
Login string `json:"login"`
Name string `json:"name"`
AvatarURL string `json:"avatar_url"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
Remark string `json:"remark"`
FollowersURL string `json:"followers_url"`
FollowingURL string `json:"following_url"`
GistsURL string `json:"gists_url"`
StarredURL string `json:"starred_url"`
SubscriptionsURL string `json:"subscriptions_url"`
OrganizationsURL string `json:"organizations_url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
ReceivedEventsURL string `json:"received_events_url"`
Type string `json:"type"`
} `json:"author"`
Committer *struct {
ID int64 `json:"id"`
Login string `json:"login"`
Name string `json:"name"`
AvatarURL string `json:"avatar_url"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
Remark string `json:"remark"`
FollowersURL string `json:"followers_url"`
FollowingURL string `json:"following_url"`
GistsURL string `json:"gists_url"`
StarredURL string `json:"starred_url"`
SubscriptionsURL string `json:"subscriptions_url"`
OrganizationsURL string `json:"organizations_url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
ReceivedEventsURL string `json:"received_events_url"`
Type string `json:"type"`
} `json:"committer"`
Parents []*struct {
SHA string `json:"sha"`
URL string `json:"url"`
} `json:"parents"`
Stats *struct {
ID string `json:"id"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
Total int `json:"total"`
} `json:"stats"`
Files []*struct {
SHA string `json:"sha"`
Filename string `json:"filename"`
Status string `json:"status"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
Changes int `json:"changes"`
BlobURL string `json:"blob_url"`
RawURL string `json:"raw_url"`
ContentURL string `json:"content_url"`
Patch string `json:"patch"`
} `json:"files"`
}
type CommitsService ¶
type CommitsService struct {
// contains filtered or unexported fields
}
func (*CommitsService) GetCommit ¶
func (s *CommitsService) GetCommit(owner, repo, sha string) (*Commit, *Response, error)
GetCommit 404 {message: Commit not found}
func (*CommitsService) ListCommits ¶
func (s *CommitsService) ListCommits(owner, repo string, opts *ListCommitsOptions) ([]*Commit, *Response, error)
type Compare ¶
type Compare struct {
BaseCommit *Commit `json:"base_commit,omitempty"`
MergeBaseCommit *Commit `json:"merge_base_commit,omitempty"`
Commits []*Commit `json:"commits,omitempty"`
Files []*struct {
SHA string `json:"sha,omitempty"`
FileName string `json:"filename,omitempty"`
Status string `json:"status,omitempty"`
Additions int `json:"additions,omitempty"`
Deletions int `json:"deletions,omitempty"`
Changes int `json:"changes,omitempty"`
BlobURL string `json:"blob_url,omitempty"`
RawURL string `json:"raw_url,omitempty"`
ContentURL string `json:"content_url,omitempty"`
Patch string `json:"patch,omitempty"`
} `json:"files,omitempty"`
}
type CreateFileOptions ¶
type CreateFileOptions struct {
Content string `json:"content"`
Message string `json:"message"`
Branch string `json:"branch"`
CommitterName string `json:"committer[name]"`
CommitterEmail string `json:"commtter[email]"`
AuthorName string `json:"author[name]"`
AuthorEmail string `json:"author[email]"`
}
type DeleteFileOptions ¶
type Diff ¶
type Diff struct {
Sha string `json:"sha"`
Filename string `json:"filename"`
Status string `json:"status"`
Additions string `json:"additions"`
Deletions string `json:"deletions"`
BlobURL string `json:"blob_url"`
RawURL string `json:"raw_url"`
Patch struct {
Diff string `json:"diff"`
NewPath string `json:"new_path"`
OldPath string `json:"old_path"`
AMode string `json:"a_mode"`
BMode string `json:"b_mode"`
NewFile bool `json:"new_file"`
RenamedFile bool `json:"renamed_file"`
DeletedFile bool `json:"deleted_file"`
TooLarge bool `json:"too_large"`
} `json:"patch"`
}
type Enterprise ¶
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type File ¶
type File struct {
Type string `json:"type"`
Encoding string `json:"encoding"`
Size int `json:"size"`
Name string `json:"name"`
Path string `json:"path"`
Content string `json:"content"`
SHA string `json:"sha"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
DownloadURL string `json:"download_url"`
}
type FileOperationResponse ¶
type FileOperationResponse struct {
Content *struct {
Name string `json:"name"`
Path string `json:"path"`
Size int `json:"size"`
SHA string `json:"sha"`
Type string `json:"file"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
DownloadURL string `json:"download_url"`
} `json:"content"`
Commit *struct {
SHA string `json:"sha"`
Author *struct {
Name string `json:"name"`
Date *time.Time `json:"date"`
Email string `json:"email"`
} `json:"author"`
Committer *struct {
Name string `json:"name"`
Date *time.Time `json:"date"`
Email string `json:"email"`
} `json:"committer"`
Message string `json:"message"`
Tree *struct {
SHA string `json:"sha"`
URL string `json:"url"`
} `json:"tree"`
Parents []*struct {
SHA string `json:"sha"`
URL string `json:"url"`
} `json:"parents"`
} `json:"commit"`
}
type GetFileOptions ¶
type GetFileOptions struct {
Ref *string `url:"ref,omitempty"`
}
type GiteeUser ¶
type GiteeUser struct {
ID *int64 `json:"id"`
Login *string `json:"login"`
Name *string `json:"name"`
AvatarURL *string `json:"avatar_url"`
URL *string `json:"url"`
HTMLURL *string `json:"html_url"`
Remark *string `json:"remark"`
FollowersURL *string `json:"followers_url"`
FollowingURL *string `json:"following_url"`
GistsURL *string `json:"gists_url"`
StarredURL *string `json:"starred_url"`
SubscriptionsURL *string `json:"subscriptions_url"`
OrganizationsURL *string `json:"organizations_url"`
ReposURL *string `json:"repos_url"`
EventsURL *string `json:"events_url"`
ReceivedEventsURL *string `json:"received_events_url"`
Type *string `json:"type"`
}
type ListCommitsOptions ¶
type ListCommitsOptions struct {
ListOptions
SHA string `json:"sha,omitempty"`
Path string `json:"path,omitempty"`
Author string `json:"author,omitempty"`
}
type ListOptions ¶
type ListRepositoriesOptions ¶
type ListRepositoriesOptions struct {
ListOptions
Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
Affiliation *string `url:"affiliation,omitempty" json:"affiliation,omitempty"`
Type *RepoTypeValue `url:"type,omitempty" json:"type,omitempty"`
Sort *SortValue `url:"sort,omitempty" json:"sort,omitempty"`
Direction *SortDirectionValue `url:"direction,omitempty" json:"direction,omitempty"`
Q *string `url:"q,omitempty" json:"q,omitempty"`
}
type Permission ¶
type PullRequestsService ¶
type PullRequestsService struct {
// contains filtered or unexported fields
}
func (*PullRequestsService) CreatePullRequest ¶
func (s *PullRequestsService) CreatePullRequest() (*Response, error)
TODO: CreatePullRequest CreatePullRequest https://gitee.com/api/v5/swagger#/postV5ReposOwnerRepoPulls
func (*PullRequestsService) ListPullRequestDiffs ¶
func (s *PullRequestsService) ListPullRequestDiffs(opts *ListPullRequestDiffsOptions) ([]*Diff, *Response, error)
ListPullRequestDiffs https://gitee.com/api/v5/swagger#/getV5ReposOwnerRepoPullsNumberFiles
type RepoTypeValue ¶
type RepoTypeValue string
const ( OwnerType RepoTypeValue = "owner" PersonalType RepoTypeValue = "personal" MemberType RepoTypeValue = "member" PublicType RepoTypeValue = "public" PrivateType RepoTypeValue = "private" )
type RepositoriesService ¶
type RepositoriesService struct {
// contains filtered or unexported fields
}
func (*RepositoriesService) Compare ¶
func (s *RepositoriesService) Compare(owner, repo, base, head string) (*Compare, *Response, error)
func (*RepositoriesService) List ¶
func (s *RepositoriesService) List(opts *ListRepositoriesOptions) ([]*Repository, *Response, error)
type Repository ¶
type Repository struct {
ID *int64 `json:"id"`
FullName *string `json:"full_name"`
HumanName *string `json:"human_name"`
URL *string `json:"url"`
Namespace *Namespace `json:"namespace"`
Path *string `json:"path"`
Name *string `json:"name"`
Owner *GiteeUser `json:"owner"`
Assigner *GiteeUser `json:"assigner"`
Description *string `json:"description"`
Private *bool `json:"private"`
Public *bool `json:"public"`
Internal *bool `json:"internal"`
Fork *bool `json:"fork"`
HTMLURL *string `json:"html_url"`
SSHURL *string `json:"ssh_url"`
ForksURL *string `json:"forks_url"`
KeysURL *string `json:"keys_url"`
CollaboratorsURL *string `json:"collaborators_url"`
HooksURL *string `json:"hooks_url"`
BranchesURL *string `json:"branches_url"`
TagsURL *string `json:"tags_url"`
BlobsURL *string `json:"blobs_url"`
StargazersURL *string `json:"stargazers_url"`
ContributorsURL *string `json:"contributors_url"`
CommitsURL *string `json:"commits_url"`
CommentsURL *string `json:"comments_url"`
IssueCommentURL *string `json:"issue_comment_url"`
IssuesURL *string `json:"issues_url"`
PullsURL *string `json:"pulls_url"`
MilestonesURL *string `json:"milestones_url"`
NotificationsURL *string `json:"notifications_url"`
LabelsURL *string `json:"labels_url"`
ReleasesURL *string `json:"releases_url"`
Recommend *bool `json:"recommend"`
Gvp *bool `json:"gvp"`
Homepage *string `json:"homepage"`
Language *string `json:"language"`
ForksCount *int `json:"forks_count"`
StargazersCount *int `json:"stargazers_count"`
WatchersCount *int `json:"watchers_count"`
DefaultBranch *string `json:"default_branch"`
OpenIssuesCount *int `json:"open_issues_count"`
HasIssues *bool `json:"has_issues"`
HasWiki *bool `json:"has_wiki"`
IssueComment *bool `json:"issue_comment"`
CanComment *bool `json:"can_comment"`
PullRequestsEnabled *bool `json:"pull_requests_enabled"`
HasPage *bool `json:"has_page"`
License *string `json:"license"`
Outsourced *bool `json:"outsourced"`
ProjectCreator *string `json:"project_creator"`
Members []*string `json:"members"`
PushedAt *time.Time `json:"pushed_at"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
Paas *string `json:"paas"`
Stared *bool `json:"stared"`
Watched *bool `json:"watched"`
Permission *Permission `json:"permission"`
Relation *string `json:"relation"`
AssigneesNumber *int `json:"assignees_number"`
TestersNumber *int `json:"testers_number"`
Assignee []*GiteeUser `json:"assignee"`
Testers []*GiteeUser `json:"testers"`
Status *string `json:"status"`
EmptyRepo *bool `json:"empty_repo"`
Enterprise *Enterprise `json:"enterprise"`
}
type RepositoryFilesService ¶
type RepositoryFilesService struct {
// contains filtered or unexported fields
}
func (*RepositoryFilesService) CreateFile ¶
func (s *RepositoryFilesService) CreateFile(owner, repo, path string, opts *CreateFileOptions) (*FileOperationResponse, *Response, error)
CreateFile return 400 {message: A file with this name already exists}
func (*RepositoryFilesService) DeleteFile ¶
func (s *RepositoryFilesService) DeleteFile(owner, repo, path string, opts *DeleteFileOptions) (*FileOperationResponse, *Response, error)
DeleteFile if path does not exist, 404 {message: File}
func (*RepositoryFilesService) GetFile ¶
func (s *RepositoryFilesService) GetFile(owner, repo, path string, opts *GetFileOptions) (*File, *Response, error)
func (*RepositoryFilesService) UpdateFile ¶
func (s *RepositoryFilesService) UpdateFile(owner, repo, path string, opts *UpdateFileOptions) (*FileOperationResponse, *Response, error)
UpdateFile if path does not exist, 404 {message: File}
type SortDirectionValue ¶
type SortDirectionValue string
const ( AscDirection SortDirectionValue = "asc" DescDirection SortDirectionValue = "desc" )
type Tag ¶
type TagsService ¶
type TagsService struct {
// contains filtered or unexported fields
}
type UpdateFileOptions ¶
type UpdateFileOptions struct {
Content string `json:"content"`
SHA string `json:"sha"`
Message string `json:"message"`
Branch string `json:"branch"`
CommitterName string `json:"committer[name]"`
CommitterEmail string `json:"commtter[email]"`
AuthorName string `json:"author[name]"`
AuthorEmail string `json:"author[email]"`
}
type User ¶
type User struct {
GiteeUser
Weibo *string `json:"weibo"`
Bio *string `json:"bio"`
Blog *string `json:"blog"`
Company *string `json:"company"`
Linkedin *string `json:"linkedin"`
Email *string `json:"email"`
Follers *int `json:"followers"`
Following *int `json:"following"`
MemberRole *string `json:"member_role"`
PublicGists *int `json:"public_gists"`
PublicRepos *int `json:"public_repos"`
Stared *int `json:"stared"`
Watched *int `json:"watched"`
CreatedAt *string `json:"created_at"`
UpdatedAt *string `json:"updated_at"`
}
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
type VisibilityValue ¶
type VisibilityValue string
const ( PrivateVisibility VisibilityValue = "private" PublicVisibility VisibilityValue = "public" AllVisibility VisibilityValue = "all" )
Click to show internal directories.
Click to hide internal directories.