Documentation ¶
Overview ¶
Package notifiers contain the domain concept definitions needed to support Magistrala notifications functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMessage = errors.New("failed to convert to Magistrala message")
ErrMessage indicates an error converting a message to Magistrala message.
View Source
var ErrNotify = errors.New("error sending notification")
ErrNotify wraps sending notification errors.
Functions ¶
This section is empty.
Types ¶
type Notifier ¶
type Notifier interface { // Notify method is used to send notification for the // received message to the provided list of receivers. Notify(from string, to []string, msg *messaging.Message) error }
Notifier represents an API for sending notification.
type Page ¶
type Page struct { PageMetadata Total uint Subscriptions []Subscription }
Page represents page metadata with content.
type PageMetadata ¶
type PageMetadata struct { Offset uint // Limit values less than 0 indicate no limit. Limit int Topic string Contact string }
PageMetadata contains page metadata that helps navigation.
type Service ¶
type Service interface { // CreateSubscription persists a subscription. // Successful operation is indicated by non-nil error response. CreateSubscription(ctx context.Context, token string, sub Subscription) (string, error) // ViewSubscription retrieves the subscription for the given user and id. ViewSubscription(ctx context.Context, token, id string) (Subscription, error) // ListSubscriptions lists subscriptions having the provided user token and search params. ListSubscriptions(ctx context.Context, token string, pm PageMetadata) (Page, error) // RemoveSubscription removes the subscription having the provided identifier. RemoveSubscription(ctx context.Context, token, id string) error consumers.BlockingConsumer }
Service reprents a notification service.
func New ¶
func New(auth magistrala.AuthServiceClient, subs SubscriptionsRepository, idp magistrala.IDProvider, notifier Notifier, from string) Service
New instantiates the subscriptions service implementation.
type Subscription ¶
Subscription represents a user Subscription.
type SubscriptionsRepository ¶
type SubscriptionsRepository interface { // Save persists a subscription. Successful operation is indicated by non-nil // error response. Save(ctx context.Context, sub Subscription) (string, error) // Retrieve retrieves the subscription for the given id. Retrieve(ctx context.Context, id string) (Subscription, error) // RetrieveAll retrieves all the subscriptions for the given page metadata. RetrieveAll(ctx context.Context, pm PageMetadata) (Page, error) // Remove removes the subscription for the given ID. Remove(ctx context.Context, id string) error }
SubscriptionsRepository specifies a Subscription persistence API.
Directories ¶
Path | Synopsis |
---|---|
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations.
|
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations. |
Package mocks contains mocks for testing purposes.
|
Package mocks contains mocks for testing purposes. |
Package postgres contains repository implementations using PostgreSQL as the underlying database.
|
Package postgres contains repository implementations using PostgreSQL as the underlying database. |
Package smpp contains the domain concept definitions needed to support Magistrala SMS notifications.
|
Package smpp contains the domain concept definitions needed to support Magistrala SMS notifications. |
Package smtp contains the domain concept definitions needed to support Magistrala SMTP notifications.
|
Package smtp contains the domain concept definitions needed to support Magistrala SMTP notifications. |
Package tracing provides tracing instrumentation for Magistrala WebSocket adapter service.
|
Package tracing provides tracing instrumentation for Magistrala WebSocket adapter service. |
Click to show internal directories.
Click to hide internal directories.