provider

package
v0.0.0-...-c0cfa63 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoVCS = httperror.Error{Message: "no VCS provider found for the given app ID"}
	ErrNoApp = &httperror.Error{Message: "no app found for the given app ID"}
)

Functions

This section is empty.

Types

type Adapter

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

Adapter is a unified interface for all VCS providers. We maintain a map of app IDs to VCS providers, and the appropriate provider is chosen based on the app ID in the request. The adapter then delegates the request to the chosen provider.

func NewAdapter

func NewAdapter(apps map[string]*App, githubProvider *github.Handler) *Adapter

New creates a new provider facade.

func (*Adapter) AuthenticatedRemoteURL

func (a *Adapter) AuthenticatedRemoteURL(appID, installationID, srcURL string) (string, error)

AuthenticatedRemoteURL returns an authenticated remote URL for a specific app, installation, and source URL.

func (*Adapter) HandleAPI

func (a *Adapter) HandleAPI(c echo.Context) error

HandleAPI handles API requests for a specific app.

func (*Adapter) HandleInstallation

func (a *Adapter) HandleInstallation(c echo.Context) error

HandleInstallation handles installation requests for a specific app. This is only implemented by some providers.

func (*Adapter) HandleWebhook

func (a *Adapter) HandleWebhook(c echo.Context) error

HandleWebhook handles webhook requests for a specific app.

type App

type App struct {
	Provider string
}

App represents an application with a specific VCS provider.

type Facade

type Facade struct {
	Adapter *Adapter
}

func NewFacade

func NewFacade(apps map[string]*App, githubProvider *github.Handler) *Facade

func (*Facade) AddRoutes

func (f *Facade) AddRoutes(r Router) Router

type Provider

type Provider interface {
	HandleAPI(c echo.Context) error
	HandleWebhook(c echo.Context) error
	HandleInstallation(c echo.Context) error
	AuthenticatedRemoteURL(appID, installationID, srcURL string) (string, error)
}

Provider interface defines the methods that each VCS provider should implement.

type Router

type Router interface {
	AddRoute(method string, path string, handlerFunc echo.HandlerFunc, middleware ...echo.MiddlewareFunc)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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