Documentation ¶
Index ¶
- Constants
- Variables
- func Clone(wd string, repo Repo) (*git.Repository, error)
- func GitHubHubRepoFullNameByURL(htmlURL string) string
- func IsGitRepo(path string) (*git.Worktree, error)
- func Update(repo LocalRepo) error
- type Auth
- func (auth *Auth) Anonymous() bool
- func (auth *Auth) OTP() string
- func (auth *Auth) Password() string
- func (auth *Auth) SetAnonymous(anonymous bool) *Auth
- func (auth *Auth) SetOTP(otp string) *Auth
- func (auth *Auth) SetPassword(password string) *Auth
- func (auth *Auth) SetToken(token string) *Auth
- func (auth *Auth) SetUser(user User) *Auth
- func (auth *Auth) SetUsername(username string) *Auth
- func (auth *Auth) Token() string
- func (auth *Auth) User() User
- func (auth *Auth) Username() string
- type Client
- func (client *Client) Auth() *Auth
- func (client *Client) Authenticate() error
- func (client *Client) Ctx() context.Context
- func (client *Client) GitHub() *githubV3.Client
- func (client *Client) SetAnonymous(anonymous bool) *Client
- func (client *Client) SetAuth(auth *Auth) *Client
- func (client *Client) SetCtx(ctx context.Context) *Client
- func (client *Client) SetGitHubClient(ghclient *githubV3.Client) *Client
- type Gist
- type Gists
- type GistsService
- type Issue
- type Issues
- type IssuesService
- type LocalRepo
- type LocalRepoScanner
- type LocalRepos
- type Organization
- type OrganizationsService
- type Pull
- type Pulls
- type PullsService
- type RateLimits
- type RateLimitsService
- type Repo
- type Repos
- type ReposService
- func (s *ReposService) Get(userStr string, repoStr string) (Repo, error)
- func (s *ReposService) ListByOrg(orgStr string, visibility string, orderBy string, limit int) (Repos, error)
- func (s *ReposService) ListByUser(userStr string, repoType string, visibility string, orderBy string, limit int) (Repos, error)
- type SearchService
- type Service
- type User
- type UsersService
Constants ¶
const ( GitHubGistURL = "https://gist.github.com" GitHubIssuesURL = "https://github.com/issues" GitHubPullsURL = "https://github.com/pulls" GitHubRepoIssuesURLSuffix = "%s/issues" GitHubRepoPullsURLSuffix = "%s/pulls" )
GitHubGistURL is the base GitHub Gist URL. GitHubIssuesURL is the GitHub issues URL. GitHubPullsURL is GitHub URL for user pulls. GitHubRepoIssuesURLSuffix is the suffix for issues. GitHubRepoPullsURLSuffix is the suffix for pulls.
const ( ErrStrAuthFailed = "Can not login at GitHub: %s" ErrStrNoValidFilter = "%s is no valid filter" ErrStrNoValidOrderByAttribute = "%s is no valid order attribute" ErrStrNoValidStateFilter = "%s is no valid state filter" ErrStrNoValidVisibilityFilter = "%s is no valid visibility filter" )
ErrStrAuthFailed is the error when the authentication failed. ErrStrNoValidFilter is the error message if no valid filter is present. ErrStrNoValidOrderByAttribute is the error message if no valid order attribute is present. ErrStrNoValidStateFilter is the error message if no valid state filter is present. ErrStrNoValidVisibilityFilter is the error message if no valid visibility filter is present.
const ( IssuesFilterAssigned = "assigned" IssuesFilterCreated = "created" IssuesFilterMentioned = "mentioned" IssuesFilterSubscribed = "subscribed" )
IssueFilterAssigned is the filter for issues which are assigned to an user. IssueFilterCreated is the filter for issues that are created by an user. IssueFilterMentioned is the filter for issues where an user is mentioned. IssueFilterSubscribed is the filter for issues where an user has subscribed.
const ( IssuesOrderByComments = "comments" IssuesOrderByCreatedAt = "created" IssuesOrderByUpdatedAt = "updated" )
IssueOrderByComments orders issues by the amount of comments. IssueOrderByCreatedAt orders issues by their created at date and time. IssueOrderByUpdatedAt orders issues by their last update date and time.
const ( IssuesStateAll = "all" IssuesStateClosed = "closed" IssuesStateOpen = "open" )
IssuesStateAll is the state for all issues. IssuesStateClosed is the state for all closed issues. IssuesStateOpen is the state for all open issues.
const ( PullsFilterAssigned = "assigned" PullsFilterCreated = "created" PullsFilterMentioned = "mentioned" PullsFilterReviewRequested = "review-requested" )
PullsFilterAssigned is the filter for pulls which are assigned to an user. PullsFilterCreated is the filter for pulls that are created by an user. PullsFilterMentioned is the filter for pulls where an user is mentioned. PullsFilterReviewRequested is the filter for pulls where an review is requested by for an user.
const ( PullsOrderByCreatedAt = "created" PullsOrderByLongRunning = "long-running" PullsOrderByPopularity = "popularity" PullsOrderByUpdatedAt = "updated" )
PullsOrderByCreatedAt orders pulls by their created at date and time. PullsOrderByLongRunning orders pulls by long-running. PullsOrderByPopularity orders pulls by their popularity. PullsOrderByUpdatedAt orders pulls by their last updated at date and time.
const ( PullsStateAll = "all" PullsStateClosed = "closed" PullsStateOpen = "open" )
PullsStateAll is the state for all pull requests. PullsStateClosed is the state for all closed pull requests. PullsStateOpen is the state for all open pull requests.
const ( RepoTypeAll = "all" RepoTypeDefault = "" RepoTypeMember = "member" RepoTypeOwner = "owner" RepoTypePrivate = "private" RepoTypePublic = "public" )
RepoTypeAll is the filter type for all. RepoTypeDefault is the filter type for the default. RepoTypeMember is the filter type for member. RepoTypeOwner is the filter type for owner. RepoTypePrivate is the filter type for private. RepoTypePublic is the filter type for public.
const ( ReposOrderByCreatedAt = "created" ReposOrderByName = "name" ReposOrderByPushed = "pushed" ReposOrderByUpdatedAt = "updated" )
ReposOrderByCreatedAt orders repos by their created at date and time. ReposOrderByName orders repos by their full name. ReposOrderByPushed orders repos by their pushed state ReposOrderByUpdatedAt orders repos by their last update date and time.
const ( RepoVisibilityAll = "all" RepoVisibilityDefault = "" RepoVisibilityPrivate = "private" RepoVisibilityPublic = "public" )
RepoVisibilityAll is the state for all repos. RepoVisibilityDefault is the filter type for the default. RepoVisibilityPrivate is the state for all private repos. RepoVisibilityPublic is the state for all public repos.
const GitHubDefaultItemLimit = 50
GitHubDefaultItemLimit is defining the maximum amount of items to fetch per API request.
Variables ¶
var ( ErrNoGistsFound = errors.New("Can not find gists") NullGists = []Gist{} )
ErrNoGistsFound is the error when no gists can be found. NullGists is an empty response if no GitHub gists are present.
var ( ErrNoIssuesFound = errors.New("Can not find issues") NullIssues = []Issue{} )
ErrNoIssuesFound is the error when issues can't be found. NullIssues is an empty response if no GitHub issues are present.
var ( ErrNoPullFound = errors.New("Can not find pull request") ErrNoPullsFound = errors.New("Can not find pull requests") NullPull = Pull{} NullPulls = []Pull{} )
ErrNoPullsFound is the error when pulls can't be found. ErrStrNoValidPullStateFilter is the error message string if no valid pr filter is present. NullPull is an empty response if no GitHub pull is present. NullPulls is an empty response if no GitHub pulls are present.
var ( ErrRepoNotFound = errors.New("Can not find repository") NullRepo Repo NullRepos = []Repo{} )
ErrRepoNotFound is the error when a repository can't be found. NullRepo is an empty response if no GitHub repo is present. NullRepos is an empty response if no GitHub repos are present.
var NullGitHubResponse = githubV3.Response{}
NullGitHubResponse is an empty github response.
var NullGitWorktree *git.Worktree
NullGitWorktree is an empty git worktree.
Functions ¶
func GitHubHubRepoFullNameByURL ¶
GitHubHubRepoFullNameByURL is generating the same result like *githubV3.Repository.GetFullName() This is used to limit the requests to the GitHub API when no repository object is present.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is the struct for the GitHub authentication.
func (*Auth) SetAnonymous ¶
SetAnonymous is setting the authentication to anonymous.
func (*Auth) SetPassword ¶
SetPassword is setting the password.
func (*Auth) SetUsername ¶
SetUsername is setting the username.
type Client ¶
type Client struct { Gists *GistsService Issues *IssuesService Organizations *OrganizationsService Pulls *PullsService RateLimits *RateLimitsService Repos *ReposService Search *SearchService Users *UsersService // contains filtered or unexported fields }
Client is the struct for the lazygithub Client. The ideas for the service based architecture is taken from go-github.
func (*Client) Authenticate ¶
Authenticate doing the authentication against GitHub and setting the Client which should be used. This can be either an oauth2 http client (when using a token) or a basic auth client (when using a username and password).
func (*Client) SetAnonymous ¶
SetAnonymous is invalidating all credentials and setting the GitHub client to a new and empty one.
func (*Client) SetAuth ¶
SetAuth is setting the authentication details for the GitHub client. Authenticate should be called to load and validate new values.
type Gists ¶
type Gists []Gist
Gists represents multiple GitHub gists.
type Issue ¶
Issue represents a GitHub issue.
func (Issue) GetFullRepoName ¶
GetFullRepoName is a wrapper for issues which don't have a valid repo.
func (Issue) GetFullRepoNameLen ¶
GetFullRepoNameLen is a wrapper to get the count of the full repo name.
func (Issue) GetTitleLen ¶
GetTitleLen is getting the count of the title.
type Issues ¶
type Issues []Issue
Issues represents multiple GitHub issues.
type IssuesService ¶
type IssuesService Service
IssuesService handles all issues related communication.
func (*IssuesService) ListByAuthenticatedUser ¶
func (s *IssuesService) ListByAuthenticatedUser(all bool, filter string, state string, orderBy string, limit int) (Issues, error)
ListByAuthenticatedUser is getting issues for the authenticated user.
func (*IssuesService) ListByRepo ¶
func (s *IssuesService) ListByRepo(userStr string, repoStr string, state string, orderBy string, limit int) (Issues, error)
ListByRepo is getting issues from a repo.
type LocalRepo ¶
type LocalRepo struct {
// contains filtered or unexported fields
}
LocalRepo is the struct for a local git repo.
func NewLocalRepo ¶
func NewLocalRepo() *LocalRepo
NewLocalRepo is returning a new LocalRepo struct.
type LocalRepoScanner ¶
type LocalRepoScanner struct {
// contains filtered or unexported fields
}
LocalRepoScanner is the struct for the local git repo scanner.
func NewLocalRepoScanner ¶
func NewLocalRepoScanner() *LocalRepoScanner
NewLocalRepoScanner is returning a new LocalRepoScanner struct.
func (*LocalRepoScanner) Scan ¶
func (lgrs *LocalRepoScanner) Scan() (LocalRepos, error)
Scan is scanning for local git repos.
func (*LocalRepoScanner) SetWD ¶
func (lgrs *LocalRepoScanner) SetWD(wd string) *LocalRepoScanner
SetWD is setting the working directory of the local git repo scanner.
func (*LocalRepoScanner) WD ¶
func (lgrs *LocalRepoScanner) WD() string
WD is returning the working directory of the local git repo scanner.
type LocalRepos ¶
type LocalRepos []LocalRepo
LocalRepos represents multiple local git repos.
var NullLocalRepos LocalRepos
NullLocalRepos is an empty local git repo scanner.
func (LocalRepos) Filter ¶
func (repos LocalRepos) Filter(filters []string) LocalRepos
Filter filters repos based on one or more strings which can be a RegExp.
type Organization ¶
type Organization struct {
*githubV3.Organization
}
Organization represents a GitHub organization.
var ( ErrOrganizationNotFound = errors.New("Can not find organization") NullOrganization Organization )
ErrOrgNotFound is the error when an organization can't be found. NullOrganization an empty response if no GitHub organization is present.
type OrganizationsService ¶
type OrganizationsService Service
OrganizationsService handles all user related communication.
func (*OrganizationsService) Get ¶
func (s *OrganizationsService) Get(orgStr string) (Organization, error)
Get is getting a organization.
type Pull ¶
type Pull struct {
githubV3.PullRequest
}
Pull represents a GitHub pull request.
func (Pull) GetFullRepoName ¶
GetFullRepoName is a wrapper to get the full repo name.
func (Pull) GetFullRepoNameLen ¶
GetFullRepoNameLen is a wrapper to get the count of the full repo name.
func (Pull) GetTitleLen ¶
GetTitleLen is getting the count of the title.
type Pulls ¶
type Pulls []Pull
Pulls represents multiple GitHub pull requests.
type PullsService ¶
type PullsService Service
PullsService handles all pull requests related communication.
type RateLimits ¶
type RateLimits struct {
githubV3.RateLimits
}
RateLimits represents GitHub rate limits.
var ( ErrCanNotGetRateLimits = errors.New("Can not get rate limits") NullRateLimits RateLimits )
ErrCanNotGetRateLimits is the error when rates limits can't be queried. NullRateLimits is an empty response if no GitHub rate limits are present.
type RateLimitsService ¶
type RateLimitsService Service
RateLimitsService handles all rate limits related communication.
func (*RateLimitsService) Get ¶
func (s *RateLimitsService) Get() (RateLimits, error)
Get is getting the rate limits information.
type Repos ¶
type Repos []Repo
Repos represents multiple GitHub repos.
type ReposService ¶
type ReposService Service
ReposService handles all repositories related communication.
func (*ReposService) Get ¶
func (s *ReposService) Get(userStr string, repoStr string) (Repo, error)
Get is getting a single repo.
func (*ReposService) ListByOrg ¶
func (s *ReposService) ListByOrg(orgStr string, visibility string, orderBy string, limit int) (Repos, error)
ListByOrg is getting repos for an organization.
func (*ReposService) ListByUser ¶
func (s *ReposService) ListByUser(userStr string, repoType string, visibility string, orderBy string, limit int) (Repos, error)
ListByUser is getting repos for an user.
type SearchService ¶
type SearchService Service
SearchService handles all search related communication.
func (*SearchService) IssuesByUser ¶
func (s *SearchService) IssuesByUser(userStr string, filter string, state string, orderBy string, limit int) (Issues, error)
IssuesByUser is searching for issues for a user.
func (*SearchService) PullsByUser ¶
func (s *SearchService) PullsByUser(userStr string, state string, filter string, orderBy string, limit int) (Pulls, error)
PullsByUser is searching for pulls for a user.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the struct for the generic service.
type User ¶
User represents a GitHub user.
ErrUserNotFound is the error when a user can't be found. NullUser is an empty response if no GitHub user is present.
func (User) GetGistsHTMLURL ¶
GetGistsHTMLURL returns the Gists URL for an GitHub user.