{"modulePath":"github.com/Didstopia/githubby","version":"v1.1.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\nPackage github provides interfaces and implementation for GitHub API operations\n\n## Functions\n\n```go\nfunc GraphQL(ctx context.Context, client *gh.Client, query string, vars map[string]any, out any) error\n```\nGraphQL posts a query to the API's /graphql endpoint with the client's auth, and decodes the \"data\" part into out\n\n```go\nfunc NewRESTClient(token string) *gh.Client\n```\nNewRESTClient returns a plain go-github client that sends the token\n\n## Types\n\n```go\ntype Client interface {\n\t// GetReleases returns all releases for a repository\n\tGetReleases(ctx context.Context, owner, repo string) ([]*gh.RepositoryRelease, error)\n\n\t// RemoveRelease deletes a release and its associated tag\n\tRemoveRelease(ctx context.Context, owner, repo string, release *gh.RepositoryRelease) error\n\n\t// ListUserRepos returns all repositories for a user\n\tListUserRepos(ctx context.Context, username string, opts *ListOptions) ([]*gh.Repository, error)\n\n\t// ListOrgRepos returns all repositories for an organization\n\tListOrgRepos(ctx context.Context, org string, opts *ListOptions) ([]*gh.Repository, error)\n\n\t// ListUserOrgs returns all organizations the authenticated user belongs to\n\tListUserOrgs(ctx context.Context) ([]*gh.Organization, error)\n\n\t// GetRepository returns information about a single repository\n\tGetRepository(ctx context.Context, owner, repo string) (*gh.Repository, error)\n\n\t// GetRateLimit returns the current rate limit status\n\tGetRateLimit(ctx context.Context) (*gh.RateLimits, error)\n\n\t// GetBranchRef returns the SHA of a branch (used for fast sync check)\n\tGetBranchRef(ctx context.Context, owner, repo, branch string) (string, error)\n\n\t// GetAuthenticatedUser returns the account the token belongs to\n\tGetAuthenticatedUser(ctx context.Context) (*gh.User, error)\n\n\t// ListGists returns all gists of the authenticated user, secret ones included\n\tListGists(ctx context.Context) ([]*gh.Gist, error)\n\n\t// GetIssuePRCounts returns how many issues and pull requests (all states) a repo has\n\tGetIssuePRCounts(ctx context.Context, owner, repo string) (issues, pulls int, err error)\n}\n```\nClient defines the interface for GitHub API operations\n\n```go\nfunc NewClient(token string) Client\n```\nNewClient creates a new GitHub client with the provided token\n\n```go\ntype GraphQLError struct {\n\tErrors []GraphQLErrorItem\n\tRate   gh.Rate\n}\n```\nGraphQLError is returned when a GraphQL reply carries errors. The data that did come back is still decoded.\n\n```go\nfunc (e *GraphQLError) Error() string\n```\n\n```go\nfunc (e *GraphQLError) HasType(types ...string) bool\n```\nHasType reports whether any error has one of the given types\n\n```go\ntype GraphQLErrorItem struct {\n\tType    string `json:\"type\"`\n\tMessage string `json:\"message\"`\n}\n```\nGraphQLErrorItem is one entry of a GraphQL \"errors\" list\n\n```go\ntype ListOptions struct {\n\t// Type of repositories to list: all, owner, member (default: all)\n\tType string\n\n\t// Include private repositories\n\tIncludePrivate bool\n\n\t// PerPage specifies the number of results per page (max 100)\n\tPerPage int\n}\n```\nListOptions specifies optional parameters for list operations\n\n```go\nfunc DefaultListOptions() *ListOptions\n```\nDefaultListOptions returns default list options\n\n```go\ntype MockCall struct {\n\tMethod string\n\tArgs   []interface{}\n}\n```\nMockCall records a method call for verification\n\n```go\ntype MockClient struct {\n\t// GetReleasesFunc can be set to mock GetReleases behavior\n\tGetReleasesFunc func(ctx context.Context, owner, repo string) ([]*gh.RepositoryRelease, error)\n\n\t// RemoveReleaseFunc can be set to mock RemoveRelease behavior\n\tRemoveReleaseFunc func(ctx context.Context, owner, repo string, release *gh.RepositoryRelease) error\n\n\t// ListUserReposFunc can be set to mock ListUserRepos behavior\n\tListUserReposFunc func(ctx context.Context, username string, opts *ListOptions) ([]*gh.Repository, error)\n\n\t// ListOrgReposFunc can be set to mock ListOrgRepos behavior\n\tListOrgReposFunc func(ctx context.Context, org string, opts *ListOptions) ([]*gh.Repository, error)\n\n\t// ListUserOrgsFunc can be set to mock ListUserOrgs behavior\n\tListUserOrgsFunc func(ctx context.Context) ([]*gh.Organization, error)\n\n\t// GetRepositoryFunc can be set to mock GetRepository behavior\n\tGetRepositoryFunc func(ctx context.Context, owner, repo string) (*gh.Repository, error)\n\n\t// GetRateLimitFunc can be set to mock GetRateLimit behavior\n\tGetRateLimitFunc func(ctx context.Context) (*gh.RateLimits, error)\n\n\t// GetBranchRefFunc can be set to mock GetBranchRef behavior\n\tGetBranchRefFunc func(ctx context.Context, owner, repo, branch string) (string, error)\n\n\t// GetAuthenticatedUserFunc can be set to mock GetAuthenticatedUser behavior\n\tGetAuthenticatedUserFunc func(ctx context.Context) (*gh.User, error)\n\n\t// ListGistsFunc can be set to mock ListGists behavior\n\tListGistsFunc func(ctx context.Context) ([]*gh.Gist, error)\n\n\t// GetIssuePRCountsFunc can be set to mock GetIssuePRCounts behavior\n\tGetIssuePRCountsFunc func(ctx context.Context, owner, repo string) (int, int, error)\n\n\t// Call tracking\n\tCalls []MockCall\n}\n```\nMockClient is a mock implementation of the Client interface for testing\n\n```go\nfunc NewMockClient() *MockClient\n```\nNewMockClient creates a new mock client\n\n```go\nfunc (m *MockClient) CallCount(method string) int\n```\nCallCount returns the number of times a method was called\n\n```go\nfunc (m *MockClient) GetAuthenticatedUser(ctx context.Context) (*gh.User, error)\n```\nGetAuthenticatedUser implements Client.GetAuthenticatedUser\n\n```go\nfunc (m *MockClient) GetBranchRef(ctx context.Context, owner, repo, branch string) (string, error)\n```\nGetBranchRef implements Client.GetBranchRef\n\n```go\nfunc (m *MockClient) GetIssuePRCounts(ctx context.Context, owner, repo string) (int, int, error)\n```\nGetIssuePRCounts implements Client.GetIssuePRCounts\n\n```go\nfunc (m *MockClient) GetRateLimit(ctx context.Context) (*gh.RateLimits, error)\n```\nGetRateLimit implements Client.GetRateLimit\n\n```go\nfunc (m *MockClient) GetReleases(ctx context.Context, owner, repo string) ([]*gh.RepositoryRelease, error)\n```\nGetReleases implements Client.GetReleases\n\n```go\nfunc (m *MockClient) GetRepository(ctx context.Context, owner, repo string) (*gh.Repository, error)\n```\nGetRepository implements Client.GetRepository\n\n```go\nfunc (m *MockClient) ListGists(ctx context.Context) ([]*gh.Gist, error)\n```\nListGists implements Client.ListGists\n\n```go\nfunc (m *MockClient) ListOrgRepos(ctx context.Context, org string, opts *ListOptions) ([]*gh.Repository, error)\n```\nListOrgRepos implements Client.ListOrgRepos\n\n```go\nfunc (m *MockClient) ListUserOrgs(ctx context.Context) ([]*gh.Organization, error)\n```\nListUserOrgs implements Client.ListUserOrgs\n\n```go\nfunc (m *MockClient) ListUserRepos(ctx context.Context, username string, opts *ListOptions) ([]*gh.Repository, error)\n```\nListUserRepos implements Client.ListUserRepos\n\n```go\nfunc (m *MockClient) RemoveRelease(ctx context.Context, owner, repo string, release *gh.RepositoryRelease) error\n```\nRemoveRelease implements Client.RemoveRelease\n\n```go\nfunc (m *MockClient) Reset()\n```\nReset clears all recorded calls\n\n","path":"github.com/Didstopia/githubby/internal/github","name":"github","synopsis":"Package github provides interfaces and implementation for GitHub API operations","isRedistributable":true}
