Documentation
¶
Index ¶
- type Client
- type ClientOption
- type FakeHTTP
- func (f *FakeHTTP) RoundTrip(req *http.Request) (*http.Response, error)
- func (f *FakeHTTP) StubForkedRepoResponse(forkFullName, parentFullName string)
- func (f *FakeHTTP) StubRepoResponse(owner, repo string)
- func (f *FakeHTTP) StubResponse(status int, body io.Reader)
- func (f *FakeHTTP) StubWithFixture(status int, fixtureFileName string) func()
- type GraphQLError
- type GraphQLErrorResponse
- type Issue
- type IssueLabel
- type IssuesAndTotalCount
- type IssuesPayload
- type NotFoundError
- type PullRequest
- func CreatePullRequest(client *Client, repo *Repository, params map[string]interface{}) (*PullRequest, error)
- func PullRequestByNumber(client *Client, repo ghrepo.Interface, number int) (*PullRequest, error)
- func PullRequestForBranch(client *Client, repo ghrepo.Interface, branch string) (*PullRequest, error)
- type PullRequestAndTotalCount
- type PullRequestChecksStatus
- type PullRequestReviewStatus
- type PullRequestsPayload
- type RepoCreateInput
- type RepoNetworkResult
- type Repository
- type RepositoryOwner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client facilitates making HTTP requests to the GitHub API
type ClientOption ¶
type ClientOption = func(http.RoundTripper) http.RoundTripper
ClientOption represents an argument to NewClient
func AddHeader ¶
func AddHeader(name, value string) ClientOption
AddHeader turns a RoundTripper into one that adds a request header
func ReplaceTripper ¶
func ReplaceTripper(tr http.RoundTripper) ClientOption
ReplaceTripper substitutes the underlying RoundTripper with a custom one
func VerboseLog ¶
func VerboseLog(out io.Writer, logTraffic bool, colorize bool) ClientOption
VerboseLog enables request/response logging within a RoundTripper
type FakeHTTP ¶
type FakeHTTP struct {
// Requests stores references to sequential requests that RoundTrip has received
Requests []*http.Request
// contains filtered or unexported fields
}
FakeHTTP provides a mechanism by which to stub HTTP responses through
func (*FakeHTTP) StubForkedRepoResponse ¶ added in v0.6.0
func (*FakeHTTP) StubRepoResponse ¶ added in v0.5.5
func (*FakeHTTP) StubResponse ¶
StubResponse pre-records an HTTP response
func (*FakeHTTP) StubWithFixture ¶ added in v0.6.0
type GraphQLError ¶
GraphQLError is a single error returned in a GraphQL response
type GraphQLErrorResponse ¶
type GraphQLErrorResponse struct {
Errors []GraphQLError
}
GraphQLErrorResponse contains errors returned in a GraphQL response
func (GraphQLErrorResponse) Error ¶
func (gr GraphQLErrorResponse) Error() string
type Issue ¶
type Issue struct {
Number int
Title string
URL string
State string
Body string
UpdatedAt time.Time
Comments struct {
TotalCount int
}
Author struct {
Login string
}
Labels struct {
Nodes []IssueLabel
TotalCount int
}
}
func IssueByNumber ¶
func IssueCreate ¶
func IssueCreate(client *Client, repo *Repository, params map[string]interface{}) (*Issue, error)
IssueCreate creates an issue in a GitHub repository
type IssueLabel ¶
type IssueLabel struct {
Name string
}
type IssuesAndTotalCount ¶
type IssuesPayload ¶
type IssuesPayload struct {
Assigned IssuesAndTotalCount
Mentioned IssuesAndTotalCount
Authored IssuesAndTotalCount
}
func IssueStatus ¶
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
type PullRequest ¶
type PullRequest struct {
Number int
Title string
State string
URL string
BaseRefName string
HeadRefName string
Body string
Author struct {
Login string
}
HeadRepositoryOwner struct {
Login string
}
HeadRepository struct {
Name string
DefaultBranchRef struct {
Name string
}
}
IsCrossRepository bool
IsDraft bool
MaintainerCanModify bool
ReviewDecision string
Commits struct {
TotalCount int
Nodes []struct {
Commit struct {
StatusCheckRollup struct {
Contexts struct {
Nodes []struct {
State string
Status string
Conclusion string
}
}
}
}
}
}
}
func CreatePullRequest ¶
func CreatePullRequest(client *Client, repo *Repository, params map[string]interface{}) (*PullRequest, error)
CreatePullRequest creates a pull request in a GitHub repository
func PullRequestByNumber ¶
func PullRequestForBranch ¶
func (*PullRequest) ChecksStatus ¶
func (pr *PullRequest) ChecksStatus() (summary PullRequestChecksStatus)
func (PullRequest) HeadLabel ¶
func (pr PullRequest) HeadLabel() string
func (*PullRequest) ReviewStatus ¶
func (pr *PullRequest) ReviewStatus() PullRequestReviewStatus
type PullRequestAndTotalCount ¶
type PullRequestAndTotalCount struct {
TotalCount int
PullRequests []PullRequest
}
func PullRequestList ¶
func PullRequestList(client *Client, vars map[string]interface{}, limit int) (*PullRequestAndTotalCount, error)
type PullRequestChecksStatus ¶
type PullRequestReviewStatus ¶
type PullRequestsPayload ¶
type PullRequestsPayload struct {
ViewerCreated PullRequestAndTotalCount
ReviewRequested PullRequestAndTotalCount
CurrentPR *PullRequest
}
func PullRequests ¶
type RepoCreateInput ¶ added in v0.6.0
type RepoCreateInput struct {
Name string `json:"name"`
Visibility string `json:"visibility"`
HomepageURL string `json:"homepageUrl,omitempty"`
Description string `json:"description,omitempty"`
OwnerID string `json:"ownerId,omitempty"`
TeamID string `json:"teamId,omitempty"`
HasIssuesEnabled bool `json:"hasIssuesEnabled"`
HasWikiEnabled bool `json:"hasWikiEnabled"`
}
RepoCreateInput represents input parameters for RepoCreate
type RepoNetworkResult ¶
type RepoNetworkResult struct {
ViewerLogin string
Repositories []*Repository
}
RepoNetworkResult describes the relationship between related repositories
func RepoNetwork ¶
func RepoNetwork(client *Client, repos []ghrepo.Interface) (RepoNetworkResult, error)
RepoNetwork inspects the relationship between multiple GitHub repositories
type Repository ¶
type Repository struct {
ID string
Name string
URL string
CloneURL string
CreatedAt time.Time
Owner RepositoryOwner
IsPrivate bool
HasIssuesEnabled bool
ViewerPermission string
DefaultBranchRef struct {
Name string
Target struct {
OID string
}
}
Parent *Repository
}
Repository contains information about a GitHub repo
func ForkRepo ¶
func ForkRepo(client *Client, repo ghrepo.Interface) (*Repository, error)
ForkRepo forks the repository on GitHub and returns the new repository
func GitHubRepo ¶
func GitHubRepo(client *Client, repo ghrepo.Interface) (*Repository, error)
func RepoCreate ¶ added in v0.6.0
func RepoCreate(client *Client, input RepoCreateInput) (*Repository, error)
RepoCreate creates a new GitHub repository
func (Repository) IsFork ¶
func (r Repository) IsFork() bool
IsFork is true when this repository has a parent repository
func (Repository) RepoName ¶
func (r Repository) RepoName() string
RepoName is the name of the repository
func (Repository) RepoOwner ¶
func (r Repository) RepoOwner() string
RepoOwner is the login name of the owner
func (Repository) ViewerCanPush ¶
func (r Repository) ViewerCanPush() bool
ViewerCanPush is true when the requesting user has push access
type RepositoryOwner ¶
type RepositoryOwner struct {
Login string
}
RepositoryOwner is the owner of a GitHub repository