webhook

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager provides an API to manage webhooks.

func NewManager

func NewManager(db hub.DB) *Manager

NewManager creates a new Manager instance.

func (*Manager) Add

func (m *Manager) Add(ctx context.Context, orgName string, wh *hub.Webhook) error

Add adds the provided webhook to the database.

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context, webhookID string) error

Delete deletes the provided webhook from the database.

func (*Manager) GetJSON

func (m *Manager) GetJSON(ctx context.Context, webhookID string) ([]byte, error)

GetJSON returns the requested webhook as a json object.

func (*Manager) GetOwnedByOrgJSON

func (m *Manager) GetOwnedByOrgJSON(
	ctx context.Context,
	orgName string,
	p *hub.Pagination,
) (*hub.JSONQueryResult, error)

GetOwnedByOrgJSON returns the webhooks belonging to the provided organization as a json array.

func (*Manager) GetOwnedByUserJSON

func (m *Manager) GetOwnedByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)

GetOwnedByUserJSON returns the webhooks belonging to the requesting user as a json array.

func (*Manager) GetSubscribedTo

func (m *Manager) GetSubscribedTo(ctx context.Context, e *hub.Event) ([]*hub.Webhook, error)

GetSubscribedTo returns the webhooks subscribed to the event provided.

func (*Manager) Update

func (m *Manager) Update(ctx context.Context, wh *hub.Webhook) error

Update updates the provided webhook in the database.

type ManagerMock

type ManagerMock struct {
	mock.Mock
}

ManagerMock is a mock implementation of the WebhookManager interface.

func (*ManagerMock) Add

func (m *ManagerMock) Add(ctx context.Context, orgName string, wh *hub.Webhook) error

Add implements the WebhookManager interface.

func (*ManagerMock) Delete

func (m *ManagerMock) Delete(ctx context.Context, webhookID string) error

Delete implements the WebhookManager interface.

func (*ManagerMock) GetJSON

func (m *ManagerMock) GetJSON(ctx context.Context, webhookID string) ([]byte, error)

GetJSON implements the WebhookManager interface.

func (*ManagerMock) GetOwnedByOrgJSON

func (m *ManagerMock) GetOwnedByOrgJSON(
	ctx context.Context,
	orgName string,
	p *hub.Pagination,
) (*hub.JSONQueryResult, error)

GetOwnedByOrgJSON implements the WebhookManager interface.

func (*ManagerMock) GetOwnedByUserJSON

func (m *ManagerMock) GetOwnedByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)

GetOwnedByUserJSON implements the WebhookManager interface.

func (*ManagerMock) GetSubscribedTo

func (m *ManagerMock) GetSubscribedTo(ctx context.Context, e *hub.Event) ([]*hub.Webhook, error)

GetSubscribedTo implements the WebhookManager interface.

func (*ManagerMock) Update

func (m *ManagerMock) Update(ctx context.Context, wh *hub.Webhook) error

Update implements the WebhookManager interface.

Jump to

Keyboard shortcuts

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