github

package
v0.0.0-...-0d8e09b Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright (C) 2017 The BlameWarrior Authors. This file is a part of BlameWarrior service. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRateLimitReached = errors.New("GitHub API request rate limit reached")
	ErrNoSuchRepository = errors.New("no such repository")
)

Functions

func SplitRepositoryName

func SplitRepositoryName(fullName string) (owner, repo string)

SplitRepositoryName splits full GitHub repository name into owner and name parts.

Types

type Collaborator

type Collaborator struct {
	Id    int    `json:"id"`
	Login string `json:"login"`
	Admin bool   `json:"admin"`
}

type Context

type Context struct {
	context.Context
	// BaseURL overrides GitHub API endpoint and is intended for use in tests.
	BaseURL *url.URL
}

type GithubMemberHook

type GithubMemberHook struct {
	Action string       `json:"action"`
	Member Collaborator `json:"member"`

	Repository struct {
		FullName string `json:"full_name"`
	} `json:"repository"`
}

type GithubPullRequestHook

type GithubPullRequestHook struct {
	PullRequest gh.PullRequest `json:"pull_request"`

	Repository struct {
		FullName string `json:"full_name"`
	} `json:"repository"`

	RequestedReviewers []Collaborator `json:"requested_reviewers"`

	ReviewComments []ReviewComment `json:"review_comments"`
}

type GithubRepositories

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

func NewGithubRepositories

func NewGithubRepositories(tokenClient tokens.Client) *GithubRepositories

NewClient returns a new copy of github repositories service that uses given http.Client to make GitHub API requests.

func (*GithubRepositories) Track

func (service *GithubRepositories) Track(ctx Context, repoFullName, callbackURL string) (err error)

Tracks pull requests sets up "pull_request" event to be sent to callback

func (*GithubRepositories) Untrack

func (service *GithubRepositories) Untrack(ctx Context, repoFullName, callbackURL string) (err error)

type GithubReviewers

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

func NewGithubReviewers

func NewGithubReviewers(tokenClient tokens.Client) *GithubReviewers

func (*GithubReviewers) RequestReviewers

func (service *GithubReviewers) RequestReviewers(ctx Context, repoFullName string, pullNumber int, reviewers []Collaborator) (err error)

func (*GithubReviewers) ReviewComments

func (service *GithubReviewers) ReviewComments(ctx Context, repoFullName string, pullNumber int) ([]ReviewComment, error)

type Repositories

type Repositories interface {
	Track(ctx Context, repoFullName, callbackURL string) error
	Untrack(ctx Context, repoFullName, callbackURL string) error
}

type ReviewComment

type ReviewComment gh.PullRequestComment

type Reviewers

type Reviewers interface {
	RequestReviewers(ctx Context, repoFullName string, pullNumber int, reviewers []Collaborator) (err error)
	ReviewComments(ctx Context, repoFullName string, pullNumber int) ([]ReviewComment, error)
}

Jump to

Keyboard shortcuts

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