github

package
v0.3.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package github implements a client SDK for the Github API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// BaseURL is the base URL used to construct the final URL of endpoints.
	// If not set, then api.github.com is used.
	BaseURL string

	// HTTPClient sets the HTTP client used and then allows for advanced
	// connection reuse schemes. If not set, a new http.Client is used.
	HTTPClient *http.Client

	// Token is the Github token (usually provided by the GH_TOKEN environment
	// variable.
	Token string
}

Client is a Github HTTP client wrapper.

func (*Client) OIDCToken

func (c *Client) OIDCToken(ctx context.Context, cfg OIDCVars) (token string, err error)

OIDCToken requests a new OIDC token.

func (*Client) PullsForCommit

func (c *Client) PullsForCommit(ctx context.Context, repository, commit string) (pulls []Pull, err error)

PullsForCommit returns a list of pull request objects associated with the given commit SHA.

type OIDCVars

type OIDCVars struct {
	ReqURL   string
	ReqToken string
}

OIDCVars is the variables used for issuing new OIDC tokens.

type Pull

type Pull struct {
	URL       string    `json:"url"`
	HTMLURL   string    `json:"html_url"`
	Number    int       `json:"number"`
	Title     string    `json:"title"`
	Body      string    `json:"body"`
	State     string    `json:"state"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Pull represents a pull request object.

type Pulls

type Pulls []Pull

Pulls represents a list of pull objects.

Jump to

Keyboard shortcuts

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