client

package
v0.0.0-...-1552b08 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package client is an encapsulation of the go-github library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	IssueAPI
	RepositoryAPI
	PullRequestAPI
	UserAPI
	OrganizationAPI
	TeamAPI
	WithFields(fields logrus.Fields) Client
	ForPlugin(plugin string) Client
}

func NewClient

func NewClient(getToken func() []byte) Client

NewClient create a github client.

func NewClientWithFields

func NewClientWithFields(fields logrus.Fields, getToken func() []byte) Client

NewClientWithFields create a github client.with added logging fields. `getToken` is a generator for the GitHub access token to use.

func NewClientWithSecretAndLogFields

func NewClientWithSecretAndLogFields(secretAgent *secret.Agent, fields logrus.Fields, tokenPath string) (Client, error)

NewClientWithSecretAndLogFields create a github client. 'secretAgent' a agent for get token by file path 'tokenPath' the path of token storage location

type IssueAPI

type IssueAPI interface {
	CreateIssue(owner, repo, title, body string, milestone int, labels, assignees []string) (int, error)
	GetIssueLabels(owner, repo string, number int) ([]*github.Label, error)
	AssignIssue(owner, repo string, number int, assignees []string) error
	ListIssueComments(owner, repo string, number int) ([]*github.IssueComment, error)
	AddLabel(owner, repo string, number int, label string) error
	RemoveLabel(owner, repo string, number int, label string) error
	CreateComment(owner, repo string, number int, comment string) error
	DeleteComment(owner, repo string, commentID int64) error
}

IssueAPI interface for issue related API actions

type OrganizationAPI

type OrganizationAPI interface {
	IsMember(owner, user string) (bool, error)
}

OrganizationAPI interface for organisation related API actions

type PullRequestAPI

type PullRequestAPI interface {
	ListPRCommits(owner, repo string, number int) ([]*github.RepositoryCommit, error)
	GetPullRequest(owner, repo string, number int) (*github.PullRequest, error)
	GetPullRequestChanges(owner, repo string, number int) ([]*github.CommitFile, error)
}

PullRequestAPI interface for pull request related API actions

type RepositoryAPI

type RepositoryAPI interface {
	IsCollaborator(owner, repo, login string) (bool, error)
	GetSingleCommit(owner, repo, SHA string) (*github.RepositoryCommit, error)
}

RepositoryAPI interface for repository related API actions

type TeamAPI

type TeamAPI interface {
	ListTeams(owner string) ([]*github.Team, error)
	ListTeamMembers(org, slug, role string) ([]*github.User, error)
}

TeamAPI interface for team related API actions

type UserAPI

type UserAPI interface {
	BotName() (string, error)
	BotUser() (*github.User, error)
}

UserAPI interface for user related API actions

Jump to

Keyboard shortcuts

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