event

package
v0.0.0-...-15beef2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause Imports: 2 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWebhookAlreadyExists = errors.New("webhook already exists with the same name")
	ErrWebhookNotFound      = errors.New("webhook not found")
)

Functions

This section is empty.

Types

type Webhook

type Webhook struct {
	Name        string             `json:"name" form:"name"`
	Description string             `json:"description" form:"description"`
	TeamOwner   string             `json:"team_owner" form:"team_owner"`
	EventFilter WebhookEventFilter `json:"event_filter" form:"event_filter"`
	URL         string             `json:"url" form:"url"`
	ProxyURL    string             `json:"proxy_url" form:"proxy_url"`
	Headers     http.Header        `json:"headers" form:"headers"`
	Method      string             `json:"method" form:"method"`
	Body        string             `json:"body" form:"body"`
	Insecure    bool               `json:"insecure" form:"insecure"`
}

type WebhookEventFilter

type WebhookEventFilter struct {
	TargetTypes  []string `json:"target_types" form:"target_types"`
	TargetValues []string `json:"target_values" form:"target_values"`
	KindTypes    []string `json:"kind_types" form:"kind_types"`
	KindNames    []string `json:"kind_names" form:"kind_names"`
	ErrorOnly    bool     `json:"error_only" form:"error_only"`
	SuccessOnly  bool     `json:"success_only" form:"success_only"`
}

type WebhookService

type WebhookService interface {
	Notify(evtID string)
	Create(Webhook) error
	Update(Webhook) error
	Delete(string) error
	Find(string) (Webhook, error)
	List([]string) ([]Webhook, error)
}

type WebhookStorage

type WebhookStorage interface {
	Insert(Webhook) error
	Update(Webhook) error
	FindAllByTeams([]string) ([]Webhook, error)
	FindByName(string) (*Webhook, error)
	FindByEvent(f WebhookEventFilter, isSuccess bool) ([]Webhook, error)
	Delete(string) error
}

Jump to

Keyboard shortcuts

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