queries

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IssueOrPullRequestID

func IssueOrPullRequestID(client api.GQLClient, rawURL string) (string, error)

IssueOrPullRequestID returns the ID of the issue or pull request from a URL.

func NewClient

func NewClient() (api.GQLClient, error)

func OwnerID

func OwnerID(client api.GQLClient, login string, t OwnerType) (string, error)

OwnerID returns the ID of an OwnerType. If the OwnerType is VIEWER, no login is required.

func ViewerLoginName

func ViewerLoginName(client api.GQLClient) (string, error)

ViewerLoginName returns the login name of the viewer.

Types

type ClientOptions

type ClientOptions struct {
	Timeout time.Duration
}

type DraftIssue

type DraftIssue struct {
	Body  string
	Title string
}

type Issue

type Issue struct {
	Body       string
	Title      string
	Number     int
	Repository struct {
		NameWithOwner string
	}
}

type Owner

type Owner struct {
	Login string
	Type  OwnerType
	ID    string
}

func NewOwner

func NewOwner(client api.GQLClient, userLogin, orgLogin string) (*Owner, error)

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

type PageInfo struct {
	EndCursor   githubv4.String
	HasNextPage bool
}

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
	}
	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

func NewProject(client api.GQLClient, o *Owner, number int) (*Project, error)

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

func Projects

func Projects(client api.GQLClient, login string, t OwnerType) ([]Project, error)

Projects returns all the projects for an Owner. If the OwnerType is VIEWER, no login is required.

func ProjectsLimit

func ProjectsLimit(client api.GQLClient, login string, t OwnerType, limit int) ([]Project, error)

ProjectsLimit returns up to limit projects for an Owner. If the OwnerType is VIEWER, no login is required.

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

func ProjectFields(client api.GQLClient, o *Owner, number int, first int) ([]ProjectField, error)

ProjectFields returns the fields of a project. If the OwnerType is VIEWER, no login is required.

func (ProjectField) ID

func (p ProjectField) ID() string

ID is the ID of the project field.

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 {
	Id       string
	TypeName string `graphql:"type"`
	Content  struct {
		DraftIssue  DraftIssue  `graphql:"... on DraftIssue"`
		PullRequest PullRequest `graphql:"... on PullRequest"`
		Issue       Issue       `graphql:"... on Issue"`
	}
}

ProjectItem is a ProjectV2Item GraphQL object https://docs.github.com/en/graphql/reference/objects#projectv2item.

func ProjectItems

func ProjectItems(client api.GQLClient, o *Owner, number int, first int) ([]ProjectItem, error)

ProjectItems returns the items of a project. If the OwnerType is VIEWER, no login is required.

func (ProjectItem) Body

func (p ProjectItem) Body() string

Body is the body of the project item.

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 PullRequest

type PullRequest struct {
	Body       string
	Title      string
	Number     int
	Repository struct {
		NameWithOwner string
	}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL