Documentation ¶
Index ¶
- type Github
- func (g *Github) Branch(branch string) *Github
- func (g *Github) Owner(owner string) *Github
- func (g *Github) RegisterDirInterceptor(i GithubDirInterceptor) *Github
- func (g *Github) RegisterFileInterceptor(i GithubFileInterceptor) *Github
- func (g *Github) Repo(repo string) *Github
- func (g *Github) Root(root string) *Github
- func (g *Github) Walk() error
- type GithubContentAPI
- type GithubDirInterceptor
- type GithubDirectoryContentAPI
- type GithubFileInterceptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Github ¶
type Github struct {
// contains filtered or unexported fields
}
Github represents the Github Walker
func (*Github) Branch ¶
Branch sets github repository branch which will be traversed and returns a pointer to the same Github instance
func (*Github) Owner ¶
Owner sets github repository owner and returns a pointer to the same Github instance
func (*Github) RegisterDirInterceptor ¶
func (g *Github) RegisterDirInterceptor(i GithubDirInterceptor) *Github
RegisterFileInterceptor takes in a directory interceptor which will be invoked on each "directory" node and it returns pointer to the same github instance
Github Walker walks the nodes concurrently so if the interceptor is reading or writing to any variable from a higher namespace then those operations should be done in thread safe manner in order to avoid data races
func (*Github) RegisterFileInterceptor ¶
func (g *Github) RegisterFileInterceptor(i GithubFileInterceptor) *Github
RegisterFileInterceptor takes in a file interceptor which will be invoked on each "file" node and it returns pointer to the same github instance
Github Walker walks the nodes concurrently so if the interceptor is reading or writing to any variable from a higher namespace then those operations should be done in thread safe manner in order to avoid data races
func (*Github) Root ¶
Root sets github repository root node from where Github walker needs to start traversing and returns a pointer to the same Github instance
If the root parameter ends with a "/**" then github walker will run in "traversal" mode, ie. it will look into each sub directory of the root node
If the root node ends with an extension, then that file will be returned and github walker will not traverse deeper
type GithubContentAPI ¶
type GithubContentAPI struct { Name string `json:"name,omitempty"` Path string `json:"path,omitempty"` SHA string `json:"sha,omitempty"` Size int64 `json:"size,omitempty"` URL string `json:"url,omitempty"` HTMLURL string `json:"html_url,omitempty"` GitURL string `json:"git_url,omitempty"` DownloadURL string `json:"download_url,omitempty"` Type string `json:"type,omitempty"` // Content will be empty when the path is of a directory Content string `json:"content,omitempty"` // Encoding will be empty when the path is of a directory Encoding string `json:"encoding,omitempty"` }
GithubContentAPI represents Github API v3 response to /repos/{owner}/{repo}/contents/{path}?ref={branch}
type GithubDirInterceptor ¶
type GithubDirInterceptor func(GithubDirectoryContentAPI) error
GithubDirInterceptor represents function signature which will be used on "dir" nodes when the github walker traverses the paths
type GithubDirectoryContentAPI ¶
type GithubDirectoryContentAPI []GithubContentAPI
GithubDirectoryContentAPI represents Github API v3 response to /repos/{owner}/{repo}/contents/{path}?ref={branch} when "path" is of a directory
type GithubFileInterceptor ¶
type GithubFileInterceptor func(GithubContentAPI) error
GithubFileInterceptor represents function signature which will be used on "file" nodes when the github walker traverses the paths