Documentation ¶
Index ¶
- func IssueOrPullRequestID(client api.GQLClient, rawURL string) (string, error)
- func NewClient() (api.GQLClient, error)
- func OwnerID(client api.GQLClient, login string, t OwnerType) (string, error)
- func ViewerLoginName(client api.GQLClient) (string, error)
- type ClientOptions
- type DraftIssue
- type FieldValueNodes
- type Issue
- type Owner
- type OwnerType
- type PageInfo
- type Project
- type ProjectField
- type ProjectItem
- type ProjectWithItems
- type PullRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IssueOrPullRequestID ¶
IssueOrPullRequestID returns the ID of the issue or pull request from a URL.
Types ¶
type ClientOptions ¶
type DraftIssue ¶
type FieldValueNodes ¶ added in v1.2.0
type FieldValueNodes struct { Type string `graphql:"__typename"` ProjectV2ItemFieldDateValue struct { Date string Field ProjectField } `graphql:"... on ProjectV2ItemFieldDateValue"` ProjectV2ItemFieldIterationValue struct { StartDate string Duration int Field ProjectField } `graphql:"... on ProjectV2ItemFieldIterationValue"` ProjectV2ItemFieldLabelValue struct { Labels struct { Nodes []struct { Name string } } `graphql:"labels(first: 10)"` // experienced issues with larger limits, 10 seems like enough for now Field ProjectField } `graphql:"... on ProjectV2ItemFieldLabelValue"` ProjectV2ItemFieldNumberValue struct { Number float32 Field ProjectField } `graphql:"... on ProjectV2ItemFieldNumberValue"` ProjectV2ItemFieldSingleSelectValue struct { Name string Field ProjectField } `graphql:"... on ProjectV2ItemFieldSingleSelectValue"` ProjectV2ItemFieldTextValue struct { Text string Field ProjectField } `graphql:"... on ProjectV2ItemFieldTextValue"` ProjectV2ItemFieldMilestoneValue struct { Milestone struct { Description string DueOn string } Field ProjectField } `graphql:"... on ProjectV2ItemFieldMilestoneValue"` ProjectV2ItemFieldPullRequestValue struct { PullRequests struct { Nodes []struct { Url string } } `graphql:"pullRequests(first:10)"` // experienced issues with larger limits, 10 seems like enough for now Field ProjectField } `graphql:"... on ProjectV2ItemFieldPullRequestValue"` ProjectV2ItemFieldRepositoryValue struct { Repository struct { Url string } Field ProjectField } `graphql:"... on ProjectV2ItemFieldRepositoryValue"` ProjectV2ItemFieldUserValue struct { Users struct { Nodes []struct { Login string } } `graphql:"users(first: 10)"` // experienced issues with larger limits, 10 seems like enough for now Field ProjectField } `graphql:"... on ProjectV2ItemFieldUserValue"` ProjectV2ItemFieldReviewerValue struct { Reviewers struct { Nodes []struct { Type string `graphql:"__typename"` Team struct { Name string } `graphql:"... on Team"` User struct { Login string } `graphql:"... on User"` } } `graphql:"reviewers(first: 10)"` // experienced issues with larger limits, 10 seems like enough for now Field ProjectField } `graphql:"... on ProjectV2ItemFieldReviewerValue"` }
func (FieldValueNodes) Data ¶ added in v1.2.0
func (v FieldValueNodes) Data() any
func (FieldValueNodes) ID ¶ added in v1.2.0
func (v FieldValueNodes) ID() string
type Owner ¶
func NewOwner ¶
NewOwner creates a project Owner When userLogin == "@me", userLogin becomes the current viewer If userLogin is not empty, it is used to lookup the user owner If orgLogin is not empty, it is used to lookup the org owner If both userLogin and orgLogin are empty, interative mode is used to select an owner from the current viewer and their organizations
type OwnerType ¶
type OwnerType string
OwnerType is the type of the owner of a project, which can be either a user or an organization. Viewer is the current user.
const OrgOwner OwnerType = "ORGANIZATION"
const UserOwner OwnerType = "USER"
const ViewerOwner OwnerType = "VIEWER"
type PageInfo ¶
PageInfo is a PageInfo GraphQL object https://docs.github.com/en/graphql/reference/objects#pageinfo.
type Project ¶
type Project struct { Number int URL string ShortDescription string Public bool Closed bool Title string ID string Readme string Items struct { TotalCount int } `graphql:"items(first: 100)"` Fields struct { Nodes []ProjectField } `graphql:"fields(first:100)"` Owner struct { User struct { Login string } `graphql:"... on User"` Organization struct { Login string } `graphql:"... on Organization"` } }
Project is a ProjectV2 GraphQL object https://docs.github.com/en/graphql/reference/objects#projectv2.
func NewProject ¶
NewProject creates a project based on the owner and project number if number is 0 it will prompt the user to select a project interactively otherwise it will make a request to get the project by number
type ProjectField ¶
type ProjectField struct { TypeName string `graphql:"__typename"` Field struct { ID string Name string DataType string } `graphql:"... on ProjectV2Field"` IterationField struct { ID string Name string DataType string } `graphql:"... on ProjectV2IterationField"` SingleSelectField struct { ID string Name string DataType string } `graphql:"... on ProjectV2SingleSelectField"` }
ProjectField is a ProjectV2FieldConfiguration GraphQL object https://docs.github.com/en/graphql/reference/unions#projectv2fieldconfiguration.
func ProjectFields ¶
ProjectFields returns the fields of a project. If the OwnerType is VIEWER, no login is required.
func (ProjectField) Name ¶
func (p ProjectField) Name() string
Name is the name of the project field.
func (ProjectField) Type ¶
func (p ProjectField) Type() string
Type is the typename of the project field.
type ProjectItem ¶
type ProjectItem struct { Content struct { TypeName string `graphql:"__typename"` DraftIssue DraftIssue `graphql:"... on DraftIssue"` PullRequest PullRequest `graphql:"... on PullRequest"` Issue Issue `graphql:"... on Issue"` } Id string TypeName string `graphql:"type"` FieldValues struct { Nodes []FieldValueNodes } `graphql:"fieldValues(first: 100)"` // hardcoded to 100 for now on the assumption that this is a reasonable limit }
ProjectItem is a ProjectV2Item GraphQL object https://docs.github.com/en/graphql/reference/objects#projectv2item.
func (ProjectItem) Data ¶ added in v1.2.0
func (p ProjectItem) Data() any
func (ProjectItem) ID ¶
func (p ProjectItem) ID() string
func (ProjectItem) Number ¶
func (p ProjectItem) Number() int
Number is the number of the project item. It is only valid for issues and pull requests.
func (ProjectItem) Repo ¶
func (p ProjectItem) Repo() string
Repo is the repository of the project item. It is only valid for issues and pull requests.
func (ProjectItem) Title ¶
func (p ProjectItem) Title() string
Title is the title of the project item.
func (ProjectItem) Type ¶
func (p ProjectItem) Type() string
Type is the underlying type of the project item.
type ProjectWithItems ¶ added in v1.2.0
type ProjectWithItems struct { Number int URL string ShortDescription string Public bool Closed bool Title string ID string Readme string Items struct { PageInfo PageInfo TotalCount int Nodes []ProjectItem } `graphql:"items(first: $first, after: $after)"` Fields struct { Nodes []ProjectField } `graphql:"fields(first:100)"` Owner struct { User struct { Login string } `graphql:"... on User"` Organization struct { Login string } `graphql:"... on Organization"` } }
ProjectWithItems is for fetching all of the items in a single project with pagination it fetches a lot of data, be careful with it!
func ProjectItems ¶
ProjectItems returns the items of a project. If the OwnerType is VIEWER, no login is required.