github

package
v0.0.0-...-4552230 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package github provides a wrapper on the GitHub API to make it easier to make HTTP calls when the entire URI of the resources is known in advance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadProjectCardEvent

func ReadProjectCardEvent(path string) (github.ProjectCardEvent, error)

ReadProjectCardEvent reads a ProjectCardEvent from the given path. Events are stored in JSON format by GitHub actions in a given path so they can be read from the action code.

Types

type GitHub

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

GitHub is a small wrapper on top of the GitHub API to make it easier to run API calls when we already have the full URI of the resources to retrieve.

func New

func New(token string, timeout time.Duration) GitHub

New creates a new GitHub wrapper that authenticates to the API using the given token and performs all requests using the configured timeout.

func (GitHub) GetIssue

func (g GitHub) GetIssue(ctx context.Context, url string) (*github.Issue, error)

GetIssue gets a GitHub issue given its URL

type Token

type Token string

Token is the GitHub authentication token It also implements the http.RoundTripper interface to automatically add the credentials to every request.

func (Token) RoundTrip

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

RoundTrip implements the http.RoundTripper interface to automatically add the token as a header to every HTTP request.

Jump to

Keyboard shortcuts

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