Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrForward = errors.New("failed to forward message") ErrSendRequest = errors.New("failed to send request") )
Functions ¶
This section is empty.
Types ¶
type Forwarder ¶
type Forwarder interface { // Forward method is used to forward the received message to a certain url Forward(ctx context.Context, message messaging.Message, whs []Webhook) error }
func NewForwarder ¶
func NewForwarder(webhooks WebhookRepository) Forwarder
type Service ¶
type Service interface { // CreateWebhooks creates webhooks for certain thing // which belongs to the user identified by a given token CreateWebhooks(ctx context.Context, token string, webhooks ...Webhook) ([]Webhook, error) // ListWebhooksByThing retrieves data about a subset of webhooks // related to a certain thing identified by the provided ID. ListWebhooksByThing(ctx context.Context, token string, thingID string) ([]Webhook, error) consumers.Consumer }
Service specifies an API that must be fullfiled by the domain service implementation, and all of its decorators (e.g. logging & metrics).
func New ¶
func New(things mainflux.ThingsServiceClient, webhooks WebhookRepository, forwarder Forwarder) Service
New instantiates the webhooks service implementation.
type WebhookRepository ¶
type WebhookRepository interface { // Save persists multiple webhooks. Webhooks are saved using a transaction. // If one webhook fails then none will be saved. // Successful operation is indicated by non-nil error response. Save(ctx context.Context, whs ...Webhook) ([]Webhook, error) // RetrieveByThingID retrieves webhooks related to // a certain thing identified by a given ID. RetrieveByThingID(ctx context.Context, thingID string) ([]Webhook, error) }
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. |
http
Package http contains implementation of kit service HTTP API.
|
Package http contains implementation of kit service HTTP API. |
Click to show internal directories.
Click to hide internal directories.