github

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependencies

type Dependencies struct {
	Logger                zerolog.Logger
	PlatformTokenProvider providers.PlatformTokenProvider
	AuthProvider          providers.RepositoryAuth
}

Dependencies defines the dependencies for the plugin provider.

type Github

type Github struct {
	Dependencies
	// contains filtered or unexported fields
}

Github is a GitHub based platform implementation.

func NewGithubPlatformProvider

func NewGithubPlatformProvider(deps Dependencies) *Github

NewGithubPlatformProvider creates a new hook platform provider for GitHub.

func (*Github) CreateHook

func (g *Github) CreateHook(ctx context.Context, repo *models.Repository) error

CreateHook can create a hook for the GitHub platform.

func (*Github) GetEventID

func (g *Github) GetEventID(ctx context.Context, r *http.Request) (string, error)

GetEventID Based on the platform, retrieve the ID of the event.

func (*Github) GetEventType added in v0.0.11

func (g *Github) GetEventType(ctx context.Context, r *http.Request) (string, error)

GetEventType Based on the platform, retrieve the Type of the event.

func (*Github) ValidateRequest

func (g *Github) ValidateRequest(ctx context.Context, req *http.Request, repoID int) error

ValidateRequest will take a hook and verify it being a valid hook request according to GitHub's rules.

type GoogleGithubClient

type GoogleGithubClient struct {
	Repositories GoogleGithubRepoService
	*ggithub.Client
}

GoogleGithubClient is a client that has the ability to replace the actual git client.

func NewGoogleGithubClient

func NewGoogleGithubClient(httpClient *http.Client, repoMock GoogleGithubRepoService) GoogleGithubClient

NewGoogleGithubClient creates a wrapper around the GitHub client.

type GoogleGithubRepoService

type GoogleGithubRepoService interface {
	CreateHook(ctx context.Context, owner, repo string, hook *ggithub.Hook) (*ggithub.Hook, *ggithub.Response, error)
}

GoogleGithubRepoService is an interface defining the Wrapper Interface needed to test the GitHub client.

Jump to

Keyboard shortcuts

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