subscription

package
v0.0.0-...-cab28d8 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 7 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 subscriptions.

func NewManager

func NewManager(db hub.DB) *Manager

NewManager creates a new Manager instance.

func (*Manager) Add

func (m *Manager) Add(ctx context.Context, s *hub.Subscription) error

Add adds the provided subscription to the database.

func (*Manager) AddOptOut

func (m *Manager) AddOptOut(ctx context.Context, o *hub.OptOut) error

AddOptOut adds an opt-out entry to the database.

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context, s *hub.Subscription) error

Delete removes a subscription from the database.

func (*Manager) DeleteOptOut

func (m *Manager) DeleteOptOut(ctx context.Context, optOutID string) error

DeleteOptOut deletes an opt-out entry from the database.

func (*Manager) GetByPackageJSON

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

GetByPackageJSON returns the subscriptions the user has for a given package as json array of objects.

func (*Manager) GetByUserJSON

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

GetByUserJSON returns all the subscriptions of the user doing the request as as json array of objects.

func (*Manager) GetOptOutListJSON

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

GetOptOutListJSON returns all the opt-out entries of the user doing the request as as json array of objects.

func (*Manager) GetSubscriptors

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

GetSubscriptors returns the users subscribed to receive notifications for certain kind of events.

type ManagerMock

type ManagerMock struct {
	mock.Mock
}

ManagerMock is a mock implementation of the SubscriptionManager interface.

func (*ManagerMock) Add

func (m *ManagerMock) Add(ctx context.Context, s *hub.Subscription) error

Add implements the SubscriptionManager interface.

func (*ManagerMock) AddOptOut

func (m *ManagerMock) AddOptOut(ctx context.Context, o *hub.OptOut) error

AddOptOut implements the SubscriptionManager interface.

func (*ManagerMock) Delete

func (m *ManagerMock) Delete(ctx context.Context, s *hub.Subscription) error

Delete implements the SubscriptionManager interface.

func (*ManagerMock) DeleteOptOut

func (m *ManagerMock) DeleteOptOut(ctx context.Context, optOutID string) error

DeleteOptOut implements the SubscriptionManager interface.

func (*ManagerMock) GetByPackageJSON

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

GetByPackageJSON implements the SubscriptionManager interface.

func (*ManagerMock) GetByUserJSON

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

GetByUserJSON implements the SubscriptionManager interface.

func (*ManagerMock) GetOptOutListJSON

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

GetOptOutListJSON implements the SubscriptionManager interface.

func (*ManagerMock) GetSubscriptors

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

GetSubscriptors implements the SubscriptionManager interface.

Jump to

Keyboard shortcuts

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