repohooks

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package repohooks manages webhooks for VCS events

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(ctx context.Context, opts Options) *service

Types

type CreateRepohookOptions

type CreateRepohookOptions struct {
	VCSProviderID string // vcs provider of repo
	RepoPath      string
}

type EventUnmarshaler

type EventUnmarshaler func(w http.ResponseWriter, r *http.Request, secret string) *vcs.EventPayload

EventUnmarshaler does two things: (a) handles incoming request (containing a VCS event) and sends appropriate response (b) unmarshals event from the request; if the event is irrelevant or invalid then nil is returned.

type RepohookService

type RepohookService = Service

type Service

type Service interface {
	// CreateRepohook creates a webhook on a VCS repository. If the webhook
	// already exists, it is updated if there are discrepancies; otherwise
	// no action is taken. In any case an identifier is returned uniquely
	// identifying the webhook.
	CreateRepohook(ctx context.Context, opts CreateRepohookOptions) (uuid.UUID, error)
	// RegisterCloudHandler registers a new cloud handler, to handle VCS
	// events for a specific vcs hosting provider.
	RegisterCloudHandler(kind vcs.Kind, h EventUnmarshaler)
	// DeleteUnreferencedRepohooks deletes any repohooks no longer used
	// by a VCS connection
	DeleteUnreferencedRepohooks(ctx context.Context) error
}

RepohookService manages webhooks

Jump to

Keyboard shortcuts

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