Documentation ¶
Overview ¶
Package notifiers contain the domain concept definitions needed to support Mainflux notifications functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // when accessing a protected resource. ErrUnauthorizedAccess = errors.New("missing or invalid credentials provided") // ErrCreateID indicates error in creating id for entity creation ErrCreateID = errors.New("failed to create id") // ErrConflict indicates usage of the existing subscription. ErrConflict = errors.New("subscription already exist") // ErrSave indicates error saving entity. ErrSave = errors.New("failed to subscription") // ErrNotFound indicates a non-existent entity request. ErrNotFound = errors.New("non-existent entity") // ErrSelectEntity indicates problem with scanning data from db. ErrSelectEntity = errors.New("failed to select entity") // ErrRemoveEntity indicates error in removing entity ErrRemoveEntity = errors.New("remove entity failed") // ErrMessage indicates an error converting a message to Mainflux message. ErrMessage = errors.New("failed to convert to Mainflux 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.Consumer }
Service reprents a notification service.
func New ¶
func New(auth mainflux.AuthServiceClient, subs SubscriptionsRepository, idp mainflux.IDProvider, notifier Notifier) 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 postgres contains repository implementations using PostgreSQL as the underlying database.
|
Package postgres contains repository implementations using PostgreSQL as the underlying database. |
Package smtp contains the domain concept definitions needed to support Mainflux SMTP notifications.
|
Package smtp contains the domain concept definitions needed to support Mainflux SMTP notifications. |
Package tracing contains middlewares that will add spans to existing traces.
|
Package tracing contains middlewares that will add spans to existing traces. |
Click to show internal directories.
Click to hide internal directories.