Documentation
¶
Index ¶
- Constants
- func BranchCreationEventDef() *eventline.EventDef
- func BranchDeletionEventDef() *eventline.EventDef
- func CountSubscriptionsByHookId(conn pg.Conn, hookId HookId) (int64, error)
- func IsNotFoundAPIError(err error) bool
- func LoadSubscriptionsByParams(conn pg.Conn, ename string, params *Parameters) (eventline.Subscriptions, error)
- func LockHooks(conn pg.Conn) error
- func OAuth2IdentityDef() *eventline.IdentityDef
- func OAuth2Scopes() []string
- func PushEventDef() *eventline.EventDef
- func RawEventDef() *eventline.EventDef
- func RepositoryCreationEventDef() *eventline.EventDef
- func RepositoryDeletionEventDef() *eventline.EventDef
- func RequiredOAuth2Scopes() []string
- func TagCreationEventDef() *eventline.EventDef
- func TagDeletionEventDef() *eventline.EventDef
- func TokenIdentityDef() *eventline.IdentityDef
- type BranchCreationEvent
- type BranchDeletionEvent
- type Connector
- func (c *Connector) CreateEvents(ename string, eventTime *time.Time, eventData eventline.EventData, ...) error
- func (c *Connector) CreateHook(conn pg.Conn, params *Parameters, identity *eventline.Identity) (*HookId, error)
- func (c *Connector) DefaultCfg() eventline.ConnectorCfg
- func (c *Connector) Definition() *eventline.ConnectorDef
- func (c *Connector) DeleteHook(conn pg.Conn, params *Parameters, identity *eventline.Identity, hookId HookId) error
- func (c *Connector) Enabled() bool
- func (c *Connector) Init(ccfg eventline.ConnectorCfg, initData eventline.ConnectorInitData) error
- func (c *Connector) MaybeCreateHook(conn pg.Conn, params *Parameters, identity *eventline.Identity) (*HookId, error)
- func (c *Connector) MaybeDeleteHook(conn pg.Conn, params *Parameters, identity *eventline.Identity, hookId HookId) error
- func (c *Connector) Name() string
- func (c *Connector) NewClient(identity *eventline.Identity) (*github.Client, error)
- func (c *Connector) ProcessWebhookRequest(req *http.Request, params *Parameters) error
- func (c *Connector) Subscribe(conn pg.Conn, sctx *eventline.SubscriptionContext) error
- func (c *Connector) Terminate()
- func (c *Connector) Unsubscribe(conn pg.Conn, sctx *eventline.SubscriptionContext) error
- func (c *Connector) WebhookURI(params *Parameters) string
- type ConnectorCfg
- type HookId
- type InvalidWebhookEventError
- type OAuth2Identity
- func (i *OAuth2Identity) Def() *eventline.IdentityDataDef
- func (i *OAuth2Identity) Environment() map[string]string
- func (i *OAuth2Identity) FetchTokenData(httpClient *http.Client, code, redirectionURI string) error
- func (i *OAuth2Identity) RedirectionURI(httpClient *http.Client, state, redirectionURI string) (string, error)
- func (i *OAuth2Identity) ValidateJSON(v *ejson.Validator)
- type Parameters
- type PushEvent
- type RawEvent
- type RepositoryCreationEvent
- type RepositoryDeletionEvent
- type Subscription
- type TagCreationEvent
- type TagDeletionEvent
- type TokenIdentity
- type UnknownSubscriptionError
Constants ¶
View Source
const PgAdvisoryLockId1 uint32 = 0x0101
View Source
const (
PgAdvisoryLockId2GitHubHooks uint32 = 0x0001
)
Variables ¶
This section is empty.
Functions ¶
func BranchCreationEventDef ¶
func BranchDeletionEventDef ¶
func IsNotFoundAPIError ¶
func LoadSubscriptionsByParams ¶
func LoadSubscriptionsByParams(conn pg.Conn, ename string, params *Parameters) (eventline.Subscriptions, error)
func OAuth2IdentityDef ¶
func OAuth2IdentityDef() *eventline.IdentityDef
func OAuth2Scopes ¶
func OAuth2Scopes() []string
func PushEventDef ¶
func RawEventDef ¶
func RequiredOAuth2Scopes ¶
func RequiredOAuth2Scopes() []string
func TagCreationEventDef ¶
func TagDeletionEventDef ¶
func TokenIdentityDef ¶
func TokenIdentityDef() *eventline.IdentityDef
Types ¶
type BranchCreationEvent ¶
type BranchDeletionEvent ¶
type Connector ¶
type Connector struct {
Def *eventline.ConnectorDef
Cfg *ConnectorCfg
Pg *pg.Client
Log *log.Logger
// contains filtered or unexported fields
}
func NewConnector ¶
func NewConnector() *Connector
func (*Connector) CreateEvents ¶
func (*Connector) CreateHook ¶
func (*Connector) DefaultCfg ¶
func (c *Connector) DefaultCfg() eventline.ConnectorCfg
func (*Connector) Definition ¶
func (c *Connector) Definition() *eventline.ConnectorDef
func (*Connector) DeleteHook ¶
func (*Connector) Init ¶
func (c *Connector) Init(ccfg eventline.ConnectorCfg, initData eventline.ConnectorInitData) error
func (*Connector) MaybeCreateHook ¶
func (*Connector) MaybeDeleteHook ¶
func (*Connector) ProcessWebhookRequest ¶
func (c *Connector) ProcessWebhookRequest(req *http.Request, params *Parameters) error
func (*Connector) Unsubscribe ¶
func (*Connector) WebhookURI ¶
func (c *Connector) WebhookURI(params *Parameters) string
type ConnectorCfg ¶
type ConnectorCfg struct {
Enabled bool `json:"enabled"`
WebhookSecret string `json:"webhook_secret,omitempty"`
}
func (*ConnectorCfg) ValidateJSON ¶ added in v1.1.0
func (cfg *ConnectorCfg) ValidateJSON(v *ejson.Validator)
type HookId ¶
type HookId = int64
func LoadHookIdByParameters ¶
func LoadHookIdByParameters(conn pg.Conn, params *Parameters) (*HookId, error)
type InvalidWebhookEventError ¶
type InvalidWebhookEventError struct {
Msg string
}
func NewInvalidWebhookEventError ¶
func NewInvalidWebhookEventError(format string, args ...interface{}) *InvalidWebhookEventError
func (*InvalidWebhookEventError) Error ¶
func (err *InvalidWebhookEventError) Error() string
type OAuth2Identity ¶
type OAuth2Identity struct {
Username string `json:"username"`
ClientId string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Scopes []string `json:"scopes"`
AccessToken string `json:"access_token,omitempty"`
TTL int `json:"ttl"`
ExpirationTime *time.Time `json:"expiration_time,omitempty"`
}
func (*OAuth2Identity) Def ¶
func (i *OAuth2Identity) Def() *eventline.IdentityDataDef
func (*OAuth2Identity) Environment ¶
func (i *OAuth2Identity) Environment() map[string]string
func (*OAuth2Identity) FetchTokenData ¶
func (i *OAuth2Identity) FetchTokenData(httpClient *http.Client, code, redirectionURI string) error
func (*OAuth2Identity) RedirectionURI ¶
func (*OAuth2Identity) ValidateJSON ¶ added in v1.1.0
func (i *OAuth2Identity) ValidateJSON(v *ejson.Validator)
type Parameters ¶
type Parameters struct {
Organization string `json:"organization"`
Repository string `json:"repository,omitempty"`
}
func (*Parameters) ParseTarget ¶
func (p *Parameters) ParseTarget(s string)
func (*Parameters) Target ¶
func (p *Parameters) Target() string
func (*Parameters) ValidateJSON ¶ added in v1.1.0
func (p *Parameters) ValidateJSON(v *ejson.Validator)
type RepositoryCreationEvent ¶
type RepositoryDeletionEvent ¶
type Subscription ¶
type Subscription struct {
Id eventline.Id
Organization string
Repository string // optional
HookId HookId // either an org hook or a repo hook
}
func (*Subscription) LoadForUpdate ¶
type TagCreationEvent ¶
type TagDeletionEvent ¶
type TokenIdentity ¶
func (*TokenIdentity) Def ¶
func (i *TokenIdentity) Def() *eventline.IdentityDataDef
func (*TokenIdentity) Environment ¶
func (i *TokenIdentity) Environment() map[string]string
func (*TokenIdentity) ValidateJSON ¶ added in v1.1.0
func (i *TokenIdentity) ValidateJSON(v *ejson.Validator)
type UnknownSubscriptionError ¶
func (UnknownSubscriptionError) Error ¶
func (err UnknownSubscriptionError) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.