gh

package
v0.0.0-...-2b12306 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEndpoint = "https://api.github.com"
)

Variables

This section is empty.

Functions

func ConvertTokenToDiscoverableHash

func ConvertTokenToDiscoverableHash(token string) string

func PrivateKeyFromFile

func PrivateKeyFromFile(filepath string) (*rsa.PrivateKey, error)

Types

type Client

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

func BuildGitHubCloudClient

func BuildGitHubCloudClient(appID string, privateKey *rsa.PrivateKey, logger *slog.Logger) *Client

func (*Client) CreateRequestWithJWT

func (c *Client) CreateRequestWithJWT(ctx context.Context, method string, requestPath string, body io.Reader, token []byte) (*http.Request, error)

func (*Client) GenerateJWT

func (c *Client) GenerateJWT() ([]byte, error)

func (*Client) GetInstallationID

func (c *Client) GetInstallationID(ctx context.Context, owner string, repo string, token []byte) (int, error)

func (*Client) GetInstallationToken

func (c *Client) GetInstallationToken(ctx context.Context, installationID int, token []byte) (string, error)

func (*Client) GetToken

func (c *Client) GetToken(ctx context.Context, owner, repo string) (string, error)

type InstallationAccessTokenResponse

type InstallationAccessTokenResponse struct {
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expires_at"`
}

type InstallationResponse

type InstallationResponse struct {
	ID int `json:"id"`
}

type Transport

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

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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