 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func AddReview(client *Client, repo ghrepo.Interface, pr *PullRequest, ...) error
- func BranchDeleteRemote(client *Client, repo ghrepo.Interface, branch string) error
- func CanPushToRepo(httpClient *http.Client, repo ghrepo.Interface) (bool, error)
- func CommentCreate(client *Client, repoHost string, params CommentCreateInput) (string, error)
- func CurrentLoginName(client *Client, hostname string) (string, error)
- func CurrentUserID(client *Client, hostname string) (string, error)
- func HandleHTTPError(resp *http.Response) error
- func IssueClose(client *Client, repo ghrepo.Interface, issue Issue) error
- func IssueReopen(client *Client, repo ghrepo.Interface, issue Issue) error
- func NewHTTPClient(opts ...ClientOption) *http.Client
- func PullRequestClose(client *Client, repo ghrepo.Interface, pr *PullRequest) error
- func PullRequestMerge(client *Client, repo ghrepo.Interface, pr *PullRequest, ...) error
- func PullRequestReady(client *Client, repo ghrepo.Interface, pr *PullRequest) error
- func PullRequestReopen(client *Client, repo ghrepo.Interface, pr *PullRequest) error
- func RepoDefaultBranch(client *Client, repo ghrepo.Interface) (string, error)
- func RepoParent(client *Client, repo ghrepo.Interface) (ghrepo.Interface, error)
- type Author
- type BranchRef
- type Client
- func (c Client) GraphQL(hostname string, query string, variables map[string]interface{}, ...) error
- func (c Client) HasMinimumScopes(hostname string) error
- func (c Client) PullRequestDiff(baseRepo ghrepo.Interface, prNumber int) (io.ReadCloser, error)
- func (c Client) REST(hostname string, method string, p string, body io.Reader, data interface{}) error
 
- type ClientOption
- func AddHeader(name, value string) ClientOption
- func AddHeaderFunc(name string, getValue func(*http.Request) (string, error)) ClientOption
- func CacheResponse(ttl time.Duration, dir string) ClientOption
- func ReplaceTripper(tr http.RoundTripper) ClientOption
- func VerboseLog(out io.Writer, logTraffic bool, colorize bool) ClientOption
 
- type Comment
- type CommentCreateInput
- type Comments
- type GraphQLError
- type GraphQLErrorResponse
- type HTTPError
- type Issue
- type IssuesAndTotalCount
- type IssuesDisabledError
- type IssuesPayload
- type MissingScopesError
- type NotFoundError
- type OrgTeam
- type PageInfo
- 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, baseBranch, headBranch string, ...) (*PullRequest, error)
 
- func (pr *PullRequest) ChecksStatus() (summary PullRequestChecksStatus)
- func (pr *PullRequest) DisplayableReviews() PullRequestReviews
- func (pr PullRequest) HeadLabel() string
- func (pr PullRequest) Identifier() string
- func (pr PullRequest) Link() string
- func (pr *PullRequest) ReviewStatus() PullRequestReviewStatus
 
- type PullRequestAndTotalCount
- type PullRequestChecksStatus
- type PullRequestMergeMethod
- type PullRequestReview
- func (prr PullRequestReview) Association() string
- func (prr PullRequestReview) AuthorLogin() string
- func (prr PullRequestReview) Content() string
- func (prr PullRequestReview) Created() time.Time
- func (prr PullRequestReview) IsEdited() bool
- func (prr PullRequestReview) Link() string
- func (prr PullRequestReview) Reactions() ReactionGroups
- func (prr PullRequestReview) Status() string
 
- type PullRequestReviewInput
- type PullRequestReviewState
- type PullRequestReviewStatus
- type PullRequestReviews
- type PullRequestsPayload
- type ReactionGroup
- type ReactionGroupUsers
- type ReactionGroups
- type RepoAssignee
- type RepoLabel
- type RepoMetadataInput
- type RepoMetadataResult
- func (m *RepoMetadataResult) LabelsToIDs(names []string) ([]string, error)
- func (m *RepoMetadataResult) MembersToIDs(names []string) ([]string, error)
- func (m *RepoMetadataResult) Merge(m2 *RepoMetadataResult)
- func (m *RepoMetadataResult) MilestoneToID(title string) (string, error)
- func (m *RepoMetadataResult) ProjectsToIDs(names []string) ([]string, error)
- func (m *RepoMetadataResult) TeamsToIDs(names []string) ([]string, error)
 
- type RepoMilestone
- func MilestoneByNumber(client *Client, repo ghrepo.Interface, number int32) (*RepoMilestone, error)
- func MilestoneByTitle(client *Client, repo ghrepo.Interface, state, title string) (*RepoMilestone, error)
- func RepoMilestones(client *Client, repo ghrepo.Interface, state string) ([]RepoMilestone, error)
 
- type RepoNetworkResult
- type RepoProject
- type RepoResolveInput
- type Repository
- func ForkRepo(client *Client, repo ghrepo.Interface) (*Repository, error)
- func GitHubRepo(client *Client, repo ghrepo.Interface) (*Repository, error)
- func InitRepoHostname(repo *Repository, hostname string) *Repository
- func RepoFindForks(client *Client, repo ghrepo.Interface, limit int) ([]*Repository, error)
 
- type RepositoryOwner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddReview ¶ added in v0.8.0
func AddReview(client *Client, repo ghrepo.Interface, pr *PullRequest, input *PullRequestReviewInput) error
func BranchDeleteRemote ¶ added in v0.9.0
func CanPushToRepo ¶ added in v1.0.0
func CommentCreate ¶ added in v1.5.0
func CommentCreate(client *Client, repoHost string, params CommentCreateInput) (string, error)
func CurrentLoginName ¶ added in v0.10.0
func CurrentUserID ¶ added in v0.12.0
func HandleHTTPError ¶ added in v1.0.0
func IssueClose ¶ added in v0.8.0
func IssueReopen ¶ added in v0.8.0
func NewHTTPClient ¶ added in v0.10.0
func NewHTTPClient(opts ...ClientOption) *http.Client
NewHTTPClient initializes an http.Client
func PullRequestClose ¶ added in v0.8.0
func PullRequestClose(client *Client, repo ghrepo.Interface, pr *PullRequest) error
func PullRequestMerge ¶ added in v0.9.0
func PullRequestMerge(client *Client, repo ghrepo.Interface, pr *PullRequest, m PullRequestMergeMethod) error
func PullRequestReady ¶ added in v0.9.0
func PullRequestReady(client *Client, repo ghrepo.Interface, pr *PullRequest) error
func PullRequestReopen ¶ added in v0.8.0
func PullRequestReopen(client *Client, repo ghrepo.Interface, pr *PullRequest) error
func RepoDefaultBranch ¶ added in v0.11.0
Types ¶
type BranchRef ¶ added in v0.12.0
type BranchRef struct {
	Name string
}
    BranchRef is the branch name in a GitHub repository
type Client ¶
type Client struct {
	// contains filtered or unexported fields
}
    Client facilitates making HTTP requests to the GitHub API
func NewClientFromHTTP ¶ added in v0.11.1
NewClientFromHTTP takes in an http.Client instance
func (Client) GraphQL ¶
func (c Client) GraphQL(hostname string, query string, variables map[string]interface{}, data interface{}) error
GraphQL performs a GraphQL request and parses the response
func (Client) HasMinimumScopes ¶ added in v0.12.0
func (Client) PullRequestDiff ¶ added in v0.9.0
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 AddHeaderFunc ¶ added in v0.8.0
AddHeaderFunc is an AddHeader that gets the string value from a function
func CacheResponse ¶ added in v1.3.0
func CacheResponse(ttl time.Duration, dir string) ClientOption
CacheResponse produces a RoundTripper that caches HTTP responses to disk for a specified amount of time
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 Comment ¶ added in v1.4.0
type Comment struct {
	Author              Author
	AuthorAssociation   string
	Body                string
	CreatedAt           time.Time
	IncludesCreatedEdit bool
	ReactionGroups      ReactionGroups
}
    func (Comment) Association ¶ added in v1.5.0
func (Comment) AuthorLogin ¶ added in v1.5.0
func (Comment) Reactions ¶ added in v1.5.0
func (c Comment) Reactions() ReactionGroups
type CommentCreateInput ¶ added in v1.5.0
type Comments ¶ added in v1.4.0
func CommentsForIssue ¶ added in v1.4.0
func CommentsForPullRequest ¶ added in v1.4.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 {
	ID        string
	Number    int
	Title     string
	URL       string
	State     string
	Closed    bool
	Body      string
	CreatedAt time.Time
	UpdatedAt time.Time
	Comments  Comments
	Author    Author
	Assignees struct {
		Nodes []struct {
			Login string
		}
		TotalCount int
	}
	Labels struct {
		Nodes []struct {
			Name string
		}
		TotalCount int
	}
	ProjectCards struct {
		Nodes []struct {
			Project struct {
				Name string
			}
			Column struct {
				Name string
			}
		}
		TotalCount int
	}
	Milestone struct {
		Title string
	}
	ReactionGroups ReactionGroups
}
    func IssueByNumber ¶
func IssueCreate ¶
func IssueCreate(client *Client, repo *Repository, params map[string]interface{}) (*Issue, error)
IssueCreate creates an issue in a GitHub repository
func (Issue) Identifier ¶ added in v1.5.0
type IssuesAndTotalCount ¶
type IssuesDisabledError ¶ added in v0.8.0
type IssuesDisabledError struct {
	// contains filtered or unexported fields
}
    type IssuesPayload ¶
type IssuesPayload struct {
	Assigned  IssuesAndTotalCount
	Mentioned IssuesAndTotalCount
	Authored  IssuesAndTotalCount
}
    func IssueStatus ¶
type MissingScopesError ¶ added in v0.12.0
type MissingScopesError struct {
	MissingScopes []string
}
    func (MissingScopesError) Error ¶ added in v1.2.0
func (e MissingScopesError) Error() string
type NotFoundError ¶
type NotFoundError struct {
	// contains filtered or unexported fields
}
    func (*NotFoundError) Unwrap ¶ added in v0.11.1
func (err *NotFoundError) Unwrap() error
type PullRequest ¶
type PullRequest struct {
	ID          string
	Number      int
	Title       string
	State       string
	Closed      bool
	URL         string
	BaseRefName string
	HeadRefName string
	Body        string
	Mergeable   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 {
				Oid               string
				StatusCheckRollup struct {
					Contexts struct {
						Nodes []struct {
							Name        string
							Context     string
							State       string
							Status      string
							Conclusion  string
							StartedAt   time.Time
							CompletedAt time.Time
							DetailsURL  string
							TargetURL   string
						}
					}
				}
			}
		}
	}
	ReviewRequests struct {
		Nodes []struct {
			RequestedReviewer struct {
				TypeName string `json:"__typename"`
				Login    string
				Name     string
			}
		}
		TotalCount int
	}
	Assignees struct {
		Nodes []struct {
			Login string
		}
		TotalCount int
	}
	Labels struct {
		Nodes []struct {
			Name string
		}
		TotalCount int
	}
	ProjectCards struct {
		Nodes []struct {
			Project struct {
				Name string
			}
			Column struct {
				Name string
			}
		}
		TotalCount int
	}
	Milestone struct {
		Title string
	}
	Comments       Comments
	ReactionGroups ReactionGroups
	Reviews        PullRequestReviews
}
    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) DisplayableReviews ¶ added in v1.5.0
func (pr *PullRequest) DisplayableReviews() PullRequestReviews
func (PullRequest) HeadLabel ¶
func (pr PullRequest) HeadLabel() string
func (PullRequest) Identifier ¶ added in v1.5.0
func (pr PullRequest) Identifier() string
func (PullRequest) Link ¶ added in v1.5.0
func (pr PullRequest) Link() string
func (*PullRequest) ReviewStatus ¶
func (pr *PullRequest) ReviewStatus() PullRequestReviewStatus
type PullRequestAndTotalCount ¶
type PullRequestAndTotalCount struct {
	TotalCount   int
	PullRequests []PullRequest
}
    func PullRequestList ¶
type PullRequestChecksStatus ¶
type PullRequestMergeMethod ¶ added in v0.9.0
type PullRequestMergeMethod int
const ( PullRequestMergeMethodMerge PullRequestMergeMethod = iota PullRequestMergeMethodRebase PullRequestMergeMethodSquash )
type PullRequestReview ¶ added in v1.5.0
type PullRequestReview struct {
	Author              Author
	AuthorAssociation   string
	Body                string
	CreatedAt           time.Time
	IncludesCreatedEdit bool
	ReactionGroups      ReactionGroups
	State               string
	URL                 string
}
    func (PullRequestReview) Association ¶ added in v1.5.0
func (prr PullRequestReview) Association() string
func (PullRequestReview) AuthorLogin ¶ added in v1.5.0
func (prr PullRequestReview) AuthorLogin() string
func (PullRequestReview) Content ¶ added in v1.5.0
func (prr PullRequestReview) Content() string
func (PullRequestReview) Created ¶ added in v1.5.0
func (prr PullRequestReview) Created() time.Time
func (PullRequestReview) IsEdited ¶ added in v1.5.0
func (prr PullRequestReview) IsEdited() bool
func (PullRequestReview) Link ¶ added in v1.5.0
func (prr PullRequestReview) Link() string
func (PullRequestReview) Reactions ¶ added in v1.5.0
func (prr PullRequestReview) Reactions() ReactionGroups
func (PullRequestReview) Status ¶ added in v1.5.0
func (prr PullRequestReview) Status() string
type PullRequestReviewInput ¶ added in v0.8.0
type PullRequestReviewInput struct {
	Body  string
	State PullRequestReviewState
}
    type PullRequestReviewState ¶ added in v0.8.0
type PullRequestReviewState int
const ( ReviewApprove PullRequestReviewState = iota ReviewRequestChanges ReviewComment )
type PullRequestReviewStatus ¶
type PullRequestReviews ¶ added in v1.5.0
type PullRequestReviews struct {
	Nodes      []PullRequestReview
	PageInfo   PageInfo
	TotalCount int
}
    func ReviewsForPullRequest ¶ added in v1.5.0
func ReviewsForPullRequest(client *Client, repo ghrepo.Interface, pr *PullRequest) (*PullRequestReviews, error)
type PullRequestsPayload ¶
type PullRequestsPayload struct {
	ViewerCreated   PullRequestAndTotalCount
	ReviewRequested PullRequestAndTotalCount
	CurrentPR       *PullRequest
	DefaultBranch   string
}
    func PullRequests ¶
type ReactionGroup ¶ added in v1.4.0
type ReactionGroup struct {
	Content string
	Users   ReactionGroupUsers
}
    func (ReactionGroup) Count ¶ added in v1.4.0
func (rg ReactionGroup) Count() int
func (ReactionGroup) Emoji ¶ added in v1.4.0
func (rg ReactionGroup) Emoji() string
type ReactionGroupUsers ¶ added in v1.4.0
type ReactionGroupUsers struct {
	TotalCount int
}
    type ReactionGroups ¶ added in v1.4.0
type ReactionGroups []ReactionGroup
type RepoAssignee ¶ added in v0.8.0
func RepoAssignableUsers ¶ added in v0.8.0
func RepoAssignableUsers(client *Client, repo ghrepo.Interface) ([]RepoAssignee, error)
RepoAssignableUsers fetches all the assignable users for a repository
type RepoMetadataInput ¶ added in v0.8.0
type RepoMetadataResult ¶ added in v0.8.0
type RepoMetadataResult struct {
	AssignableUsers []RepoAssignee
	Labels          []RepoLabel
	Projects        []RepoProject
	Milestones      []RepoMilestone
	Teams           []OrgTeam
}
    func RepoMetadata ¶ added in v0.8.0
func RepoMetadata(client *Client, repo ghrepo.Interface, input RepoMetadataInput) (*RepoMetadataResult, error)
RepoMetadata pre-fetches the metadata for attaching to issues and pull requests
func RepoResolveMetadataIDs ¶ added in v0.9.0
func RepoResolveMetadataIDs(client *Client, repo ghrepo.Interface, input RepoResolveInput) (*RepoMetadataResult, error)
RepoResolveMetadataIDs looks up GraphQL node IDs in bulk
func (*RepoMetadataResult) LabelsToIDs ¶ added in v0.8.0
func (m *RepoMetadataResult) LabelsToIDs(names []string) ([]string, error)
func (*RepoMetadataResult) MembersToIDs ¶ added in v0.8.0
func (m *RepoMetadataResult) MembersToIDs(names []string) ([]string, error)
func (*RepoMetadataResult) Merge ¶ added in v1.3.1
func (m *RepoMetadataResult) Merge(m2 *RepoMetadataResult)
func (*RepoMetadataResult) MilestoneToID ¶ added in v0.8.0
func (m *RepoMetadataResult) MilestoneToID(title string) (string, error)
func (*RepoMetadataResult) ProjectsToIDs ¶ added in v0.8.0
func (m *RepoMetadataResult) ProjectsToIDs(names []string) ([]string, error)
func (*RepoMetadataResult) TeamsToIDs ¶ added in v0.8.0
func (m *RepoMetadataResult) TeamsToIDs(names []string) ([]string, error)
type RepoMilestone ¶ added in v0.8.0
func MilestoneByNumber ¶ added in v0.12.0
func MilestoneByTitle ¶ added in v0.12.0
func RepoMilestones ¶ added in v0.8.0
RepoMilestones fetches milestones in a repository
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 RepoProject ¶ added in v0.8.0
func OrganizationProjects ¶ added in v0.8.0
func OrganizationProjects(client *Client, repo ghrepo.Interface) ([]RepoProject, error)
OrganizationProjects fetches all open projects for an organization
func RepoProjects ¶ added in v0.8.0
func RepoProjects(client *Client, repo ghrepo.Interface) ([]RepoProject, error)
RepoProjects fetches all open projects for a repository
type RepoResolveInput ¶ added in v0.9.0
type Repository ¶
type Repository struct {
	ID          string
	Name        string
	Description string
	URL         string
	CloneURL    string
	CreatedAt   time.Time
	Owner       RepositoryOwner
	IsPrivate        bool
	HasIssuesEnabled bool
	HasWikiEnabled   bool
	ViewerPermission string
	DefaultBranchRef BranchRef
	Parent *Repository
	// contains filtered or unexported fields
}
    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 InitRepoHostname ¶ added in v0.11.1
func InitRepoHostname(repo *Repository, hostname string) *Repository
func RepoFindForks ¶ added in v1.0.0
RepoFindForks finds forks of the repo that are affiliated with the viewer
func (Repository) IsFork ¶
func (r Repository) IsFork() bool
IsFork is true when this repository has a parent repository
func (Repository) RepoHost ¶ added in v0.11.0
func (r Repository) RepoHost() string
RepoHost is the GitHub hostname of the 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
func (Repository) ViewerCanTriage ¶ added in v0.8.0
func (r Repository) ViewerCanTriage() bool
ViewerCanTriage is true when the requesting user can triage issues and pull requests
type RepositoryOwner ¶
type RepositoryOwner struct {
	Login string
}
    RepositoryOwner is the owner of a GitHub repository