gh

package
v0.0.1-beta4 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to the argument. It's a convenience function to make working with the API easier: since Go disallows pointers-to-literals, and optional input fields are expressed as pointers, this function can be used to easily set optional fields to non-nil primitives. For example, githubv4.CreatePullRequestInput{Draft: Ptr(true)}

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(token string) (*Client, error)

func (*Client) CreatePullRequest

func (c *Client) CreatePullRequest(ctx context.Context, input githubv4.CreatePullRequestInput) (*PullRequest, error)

func (*Client) GetRepositoryBySlug

func (c *Client) GetRepositoryBySlug(ctx context.Context, slug string) (*Repository, error)

func (*Client) PullRequest

func (c *Client) PullRequest(ctx context.Context, opts PullRequestOpts) (*PullRequest, error)

func (*Client) RepoPullRequests

func (c *Client) RepoPullRequests(ctx context.Context, opts RepoPullRequestOpts) (RepoPullRequestsResponse, error)

type PageInfo

type PageInfo struct {
	EndCursor       string
	HasNextPage     bool
	HasPreviousPage bool
	StartCursor     string
}

type PullRequest

type PullRequest struct {
	ID     string
	Number int64
	Author struct {
		Login string
	}
	HeadRefName string
	HeadRefOID  string
	BaseRefName string
	IsDraft     bool
	Mergeable   githubv4.MergeableState
	Merged      bool
	Permalink   string
	State       githubv4.PullRequestState
	Title       string
}

func (*PullRequest) BaseBranchName

func (p *PullRequest) BaseBranchName() string

func (*PullRequest) HeadBranchName

func (p *PullRequest) HeadBranchName() string

type PullRequestOpts

type PullRequestOpts struct {
	Owner  string
	Repo   string
	Number int64
}

type RepoPullRequestOpts

type RepoPullRequestOpts struct {
	Owner  string
	Repo   string
	First  int64
	After  string
	States []githubv4.PullRequestState
}

type RepoPullRequestsResponse

type RepoPullRequestsResponse struct {
	PageInfo
	TotalCount   int64
	PullRequests []PullRequest
}

type Repository

type Repository struct {
	ID    string
	Owner struct {
		Login string
	}
	Name string
}

Jump to

Keyboard shortcuts

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