Documentation
¶
Index ¶
- Constants
- func APILastCommits(owner, repo string) string
- func APILastCommitsOfBranch(owner, repo, branch string) string
- func APILastCommitsOfPath(owner, repo, branch, path string) string
- func APIMetadata(owner, repo string) string
- func APIRaw(owner, repo, branch, path string) string
- func APIRepoTree(owner, repo, branch string) string
- type Author
- type Commit
- type CommitsMetadata
- type Committer
- type Files
- type GitHubAPI
- func (gh *GitHubAPI) GetDefaultBranchName(owner, repo string, headers *Headers) (string, error)
- func (gh *GitHubAPI) GetFileLatestCommit(owner, repo, branch, fullPath string, headers *Headers) ([]Commit, error)
- func (gh *GitHubAPI) GetLatestCommit(owner, repo, branch string, headers *Headers) (*Commit, error)
- func (gh *GitHubAPI) GetRepoTree(owner, repo, branch string, headers *Headers) (*Tree, error)
- type Headers
- type IGitHubAPI
- type InnerTree
- type MockGitHubAPI
- type ObjectType
- type Tree
Constants ¶
View Source
const ( DEFAULT_HOST string = "github.com" RAW_HOST string = "raw.githubusercontent.com" SUBDOMAIN_HOST string = "www.github.com" )
Variables ¶
This section is empty.
Functions ¶
func APILastCommits ¶
APILastCommits github last commit api
func APILastCommitsOfBranch ¶
APILastCommitsOfBranch github last commit of specific branch api
func APILastCommitsOfPath ¶
APILastCommitsOfPath github last commit of specific branch api
func APIMetadata ¶
APIDefaultBranch github repo metadata api
Types ¶
type Author ¶
type Author struct {
Login string `json:"login"`
ID int `json:"id"`
NodeID string `json:"node_id"`
AvatarURL string `json:"avatar_url"`
GravatarID string `json:"gravatar_id"`
URL string `json:"url"`
HtmlURL string `json:"html_url"`
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"`
SiteAdmin bool `json:"site_admin"`
}
type Commit ¶
type Commit struct {
SHA string `json:"sha"`
NodeID string `json:"node_id"`
Commit CommitsMetadata `json:"commit"`
URL string `json:"url"`
HtmlURL string `json:"html_url"`
CommentsURL string `json:"comments_url"`
Author Author `json:"author"`
Committer Committer `json:"committer"`
Parents []struct {
SHA string `json:"sha"`
URL string `json:"url"`
HtmlURL string `json:"html_url"`
} `json:"parents"`
Stats struct {
Total int `json:"total"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
} `json:"stats"`
Files []Files `json:"files"`
}
LatestCommit returned structure
type CommitsMetadata ¶
type CommitsMetadata struct {
Author struct {
Name string `json:"name"`
Email string `json:"email"`
Date time.Time `json:"date"`
} `json:"author"`
Committer struct {
Name string `json:"name"`
Email string `json:"email"`
Date time.Time `json:"date"`
} `json:"committer"`
Message string `json:"message"`
Tree struct {
SHA string `json:"sha"`
URL string `json:"url"`
} `json:"tree"`
URL string `json:"url"`
CommentCount int `json:"comment_count"`
Verification struct {
Verified bool `json:"verified"`
Reason string `json:"reason"`
Signature interface{} `json:"signature"`
Payload interface{} `json:"payload"`
} `json:"verification"`
}
type Committer ¶
type Committer struct {
Login string `json:"login"`
ID int `json:"id"`
NodeID string `json:"node_id"`
AvatarURL string `json:"avatar_url"`
GravatarID string `json:"gravatar_id"`
URL string `json:"url"`
HtmlURL string `json:"html_url"`
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"`
SiteAdmin bool `json:"site_admin"`
}
type Files ¶
type 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"`
ContentsURL string `json:"contents_url"`
Patch string `json:"patch"`
}
type GitHubAPI ¶
type GitHubAPI struct {
// contains filtered or unexported fields
}
func NewGitHubAPI ¶
func NewGitHubAPI() *GitHubAPI
func (*GitHubAPI) GetDefaultBranchName ¶
func (*GitHubAPI) GetFileLatestCommit ¶
func (gh *GitHubAPI) GetFileLatestCommit(owner, repo, branch, fullPath string, headers *Headers) ([]Commit, error)
Get latest commit data of path/file
func (*GitHubAPI) GetLatestCommit ¶
type IGitHubAPI ¶
type InnerTree ¶
type InnerTree struct {
Path string `json:"path"`
Mode string `json:"mode"`
SHA string `json:"sha"`
URL string `json:"url"`
Type ObjectType `json:"type"`
}
type MockGitHubAPI ¶
type MockGitHubAPI struct {
}
func NewMockGitHubAPI ¶
func NewMockGitHubAPI() *MockGitHubAPI
func (MockGitHubAPI) GetDefaultBranchName ¶
func (gh MockGitHubAPI) GetDefaultBranchName(owner, repo string, headers *Headers) (string, error)
func (MockGitHubAPI) GetLatestCommit ¶
func (gh MockGitHubAPI) GetLatestCommit(owner, repo, branch string, headers *Headers) (*Commit, error)
func (*MockGitHubAPI) GetRepoTree ¶
func (gh *MockGitHubAPI) GetRepoTree(owner, repo, branch string, headers *Headers) (*Tree, error)
type ObjectType ¶
type ObjectType string
const ( ObjectTypeDir ObjectType = "tree" ObjectTypeFile ObjectType = "blob" )
type Tree ¶
type Tree struct {
InnerTrees []InnerTree `json:"tree"`
SHA string `json:"sha"`
URL string `json:"url"`
Truncated bool `json:"truncated"`
}
func (*Tree) ListAllDirs ¶
ListAllDirs list all directories in repo tree
func (*Tree) ListAllFiles ¶
ListAllFiles list all files in repo tree
Click to show internal directories.
Click to hide internal directories.