{"modulePath":"github.com/armory/dinghy","version":"v1.0.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\n## Types\n\n```go\ntype Commit struct {\n\tID       string   `json:\"id\"`\n\tAdded    []string `json:\"added\"`\n\tModified []string `json:\"modified\"`\n}\n```\nCommit is a commit received from Github webhook\n\n```go\ntype FileService struct {\n\tGitHub GitHubClient\n\tLogger logrus.FieldLogger\n\t// contains filtered or unexported fields\n}\n```\nFileService is for working with repositories\n\n```go\nfunc (f *FileService) DecodeURL(url string) (org, repo, path, branch string)\n```\nDecodeURL takes a url and returns the org, repo, path and branch\n\n```go\nfunc (f *FileService) Download(org, repo, path, branch string) (string, error)\n```\nDownload a file from github note that \"path\" is the full path relative to the repo root eg: src/foo/bar/filename\n\n```go\nfunc (f *FileService) EncodeURL(org, repo, path, branch string) string\n```\nEncodeURL returns the git url for a given org, repo, path and branch\n\n```go\ntype GitHub struct {\n\tEndpoint string\n\tToken    string\n}\n```\n\n```go\nfunc (g *GitHub) CreateStatus(status *Status, org, repo, ref string) error\n```\n\n```go\nfunc (g *GitHub) DownloadContents(org, repo, path, branch string) (string, error)\n```\n\n```go\nfunc (g *GitHub) GetEndpoint() string\n```\n\n```go\ntype GitHubClient interface {\n\tDownloadContents(string, string, string, string) (string, error)\n\tCreateStatus(*Status, string, string, string) error\n\tGetEndpoint() string\n}\n```\n\n```go\ntype Push struct {\n\tCommits     []Commit   `json:\"commits\"`\n\tRepository  Repository `json:\"repository\"`\n\tRef         string     `json:\"ref\"`\n\tGitHub      GitHub\n\tDeckBaseURL string\n\tLogger      logrus.FieldLogger\n}\n```\nPush is the payload received from a GitHub webhook.\n\n```go\nfunc (p *Push) Branch() string\n```\nBranch returns the branch of the push\n\n```go\nfunc (p *Push) ContainsFile(file string) bool\n```\nContainsFile checks to see if a given file is in the push.\n\n```go\nfunc (p *Push) Files() []string\n```\nFiles returns a slice containing filenames that were added/modified\n\n```go\nfunc (p *Push) IsMaster() bool\n```\nIsMaster detects if the branch is master.\n\n```go\nfunc (p *Push) Name() string\n```\nName returns the name of the provider to be used in configuration\n\n```go\nfunc (p *Push) Org() string\n```\nOrg returns the organization of the push\n\n```go\nfunc (p *Push) Repo() string\n```\nRepo returns the name of the repo.\n\n```go\nfunc (p *Push) SetCommitStatus(status git.Status)\n```\nSetCommitStatus sets the commit status TODO: this function needs to return an error but it's currently attached to an interface that does not and changes will affect other types\n\n```go\ntype Repository struct {\n\tName         string          `json:\"name\"`\n\tOrganization string          `json:\"organization\"`\n\tOwner        RepositoryOwner `json:\"owner\"`\n}\n```\nRepository is a repo received from Github webhook\n\n```go\ntype RepositoryOwner struct {\n\tLogin string `json:\"login\"`\n}\n```\n\n```go\ntype Status struct {\n\tState       string\n\tDeckBaseURL string\n\tDescription string\n\tContext     string\n}\n```\nStatus is a type that contains information relevant to the commit status\n\n","path":"github.com/armory/dinghy/pkg/git/github","name":"github","synopsis":"","isRedistributable":true}
