github

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package github is http client for GitHub API. This package is wrapper for google/go-github package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoPullRequest means "there is no pull request in this repository"
	ErrNoPullRequest = errors.New("there is no pull request in this repository")
	// ErrNoCommit means "there is no commit in this repository"
	ErrNoCommit = errors.New("there is no commit in this repository")
)

Functions

func NewGitHubRepository

func NewGitHubRepository(client *Client) repository.GitHubRepository

NewGitHubRepository initialize repository.GitHubRepository

Types

type APIError

type APIError struct {
	// StatusCode is HTTP status code from GitHub.
	StatusCode int
	// Message is error message
	Message string
}

APIError is error for GitHub API.

func (*APIError) Error

func (e *APIError) Error() string

Error return string that represents a GitHub API error

type Client

type Client struct {
	*github.Client
}

Client is http client for GitHub API.

func NewClient

func NewClient(token model.Token) *Client

NewClient return http client for GitHub API.

type GitHubRepository

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

GitHubRepository is http client for GitHub API

func (*GitHubRepository) GetFirstCommit added in v0.0.2

func (c *GitHubRepository) GetFirstCommit(ctx context.Context, owner, repository string, number int) (*model.Commit, error)

GetFirstCommit return first commit in the pull request.

func (*GitHubRepository) ListCommitsInPR

func (c *GitHubRepository) ListCommitsInPR(ctx context.Context, owner, repo string, number int) ([]*model.Commit, error)

ListCommitsInPR return List the commits in the PR. oreder is newest to oldest.

func (*GitHubRepository) ListPullRequests

func (c *GitHubRepository) ListPullRequests(ctx context.Context, owner, repo string) ([]*model.PullRequest, error)

ListPullRequests return List the pull requests.

func (*GitHubRepository) ListRepositories

func (c *GitHubRepository) ListRepositories(ctx context.Context) ([]*model.Repository, error)

ListRepositories return List the repositories for a user.

Jump to

Keyboard shortcuts

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