Documentation ¶
Overview ¶
Package github provides idiomatic Go APIs for accessing basic GitHub issue operations.
The entire GitHub API can be accessed by using the Client with GraphQL schema from rsc.io/github/schema.
Package github provides idiomatic Go APIs for accessing basic GitHub issue operations.
The entire GitHub API can be accessed by using the Client with GraphQL schema from rsc.io/github/schema.
Index ¶
- type Client
- func (c *Client) AddIssueComment(issue *Issue, text string) error
- func (c *Client) AddIssueLabels(issue *Issue, labels ...*Label) error
- func (c *Client) CloseIssue(issue *Issue) error
- func (c *Client) CreateIssue(repo *Repo, title, body string, extra ...any) (*Issue, error)
- func (c *Client) DeleteProjectItem(project *Project, item *ProjectItem) error
- func (c *Client) EditIssueComment(comment *IssueComment, body string) error
- func (c *Client) GraphQLMutation(query string, vars Vars) (*schema.Mutation, error)
- func (c *Client) GraphQLQuery(query string, vars Vars) (*schema.Query, error)
- func (c *Client) IssueComments(issue *Issue) ([]*IssueComment, error)
- func (c *Client) ProjectItems(p *Project) ([]*ProjectItem, error)
- func (c *Client) Projects(org, query string) ([]*Project, error)
- func (c *Client) RemilestoneIssue(issue *Issue, milestone *Milestone) error
- func (c *Client) RemoveIssueLabels(issue *Issue, labels ...*Label) error
- func (c *Client) ReopenIssue(issue *Issue) error
- func (c *Client) Repo(org, repo string) (*Repo, error)
- func (c *Client) RetitleIssue(issue *Issue, title string) error
- func (c *Client) SearchLabels(org, repo, query string) ([]*Label, error)
- func (c *Client) SearchMilestones(org, repo, query string) ([]*Milestone, error)
- func (c *Client) SetProjectItemFieldOption(project *Project, item *ProjectItem, field *ProjectField, ...) error
- type Issue
- type IssueComment
- type Label
- type Milestone
- type Project
- type ProjectField
- type ProjectFieldOption
- type ProjectFieldValue
- type ProjectItem
- type ProjectIteration
- type ProjectIterations
- type Repo
- type Vars
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
}
A Client is an authenticated client for accessing the GitHub GraphQL API. Client provides convenient methods for common operations. To build others, see the [GraphQLQuery] and [GraphQLMutation] methods.
func Dial ¶
Dial returns a Client authenticating as user. Authentication credentials are loaded from $HOME/.netrc using the 'api.github.com' entry, which should contain a GitHub personal access token. If user is the empty string, Dial uses the first line in .netrc listed for api.github.com.
For example, $HOME/.netrc might contain:
machine api.github.com login ken password ghp_123456789abcdef123456789abcdef12345
func (*Client) AddIssueLabels ¶
func (*Client) CloseIssue ¶
func (*Client) CreateIssue ¶
func (*Client) DeleteProjectItem ¶
func (c *Client) DeleteProjectItem(project *Project, item *ProjectItem) error
func (*Client) EditIssueComment ¶
func (c *Client) EditIssueComment(comment *IssueComment, body string) error
func (*Client) GraphQLMutation ¶
GraphQLMutation runs a single mutation with the bound variables. For example, to edit an issue comment:
func editComment(commentID, body string) error { graphql := ` mutation($Comment: ID!, $Body: String!) { updateIssueComment(input: {id: $Comment, body: $Body}) { clientMutationId } } ` _, err := c.GraphQLMutation(graphql, Vars{"Comment": commentID, "Body": body}) return err }
(This is roughly the implementation of the Client.EditIssueComment method.)
func (*Client) GraphQLQuery ¶
GraphQLQuery runs a single query with the bound variables. For example, to look up a repository ID:
func repoID(org, name string) (string, error) { graphql := ` query($Org: String!, $Repo: String!) { repository(owner: $Org, name: $Repo) { id } } ` vars := Vars{"Org": org, "Repo": repo} q, err := c.GraphQLQuery(graphql, vars) if err != nil { return "", err } return string(q.Repository.Id), nil }
(This is roughly the implementation of the Client.Repo method.)
func (*Client) IssueComments ¶
func (c *Client) IssueComments(issue *Issue) ([]*IssueComment, error)
func (*Client) ProjectItems ¶
func (c *Client) ProjectItems(p *Project) ([]*ProjectItem, error)
func (*Client) RemilestoneIssue ¶
func (*Client) RemoveIssueLabels ¶
func (*Client) ReopenIssue ¶
func (*Client) SearchLabels ¶
func (*Client) SearchMilestones ¶
func (*Client) SetProjectItemFieldOption ¶
func (c *Client) SetProjectItemFieldOption(project *Project, item *ProjectItem, field *ProjectField, option *ProjectFieldOption) error
type Issue ¶
type Issue struct { ID string Title string Number int Closed bool ClosedAt time.Time CreatedAt time.Time LastEditedAt time.Time Labels []*Label Milestone *Milestone Owner string Repo string Body string }
func (*Issue) LabelByName ¶
type IssueComment ¶
type Project ¶
type Project struct { ID string Closed bool ClosedAt time.Time CreatedAt time.Time UpdatedAt time.Time Fields []*ProjectField Number int Title string URL string Org string }
func (*Project) FieldByName ¶
func (p *Project) FieldByName(name string) *ProjectField
type ProjectField ¶
type ProjectField struct { Kind string // "field", "iteration", "select" CreatedAt time.Time UpdatedAt time.Time DataType schema.ProjectV2FieldType // TODO DatabaseID int ID schema.ID Name string Iterations *ProjectIterations Options []*ProjectFieldOption }
func (*ProjectField) OptionByName ¶
func (f *ProjectField) OptionByName(name string) *ProjectFieldOption
type ProjectFieldOption ¶
func (*ProjectFieldOption) String ¶
func (o *ProjectFieldOption) String() string
type ProjectFieldValue ¶
type ProjectFieldValue struct { CreatedAt time.Time UpdatedAt time.Time Kind string ID string DatabaseID int Field string Option *ProjectFieldOption Date time.Time Text string }
func (*ProjectFieldValue) String ¶
func (v *ProjectFieldValue) String() string
type ProjectItem ¶
type ProjectItem struct { CreatedAt time.Time DatabaseID int ID schema.ID IsArchived bool Type schema.ProjectV2ItemType UpdatedAt time.Time Fields []*ProjectFieldValue Issue *Issue }
func (*ProjectItem) FieldByName ¶
func (it *ProjectItem) FieldByName(name string) *ProjectFieldValue
type ProjectIteration ¶
type ProjectIterations ¶
type ProjectIterations struct { Completed []*ProjectIteration Active []*ProjectIteration Days int StartDay time.Weekday }
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
minutes
Minutes is the program we use to post the proposal review minutes.
|
Minutes is the program we use to post the proposal review minutes. |
minutes2
Module
|
|
minutes3
Module
|
|
Issue is a client for reading and updating issues in a GitHub project issue tracker.
|
Issue is a client for reading and updating issues in a GitHub project issue tracker. |
Package schema is Go data structures corresponding to the GitHub GraphQL schema.
|
Package schema is Go data structures corresponding to the GitHub GraphQL schema. |