Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrForward = errors.New("failed to forward message")
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 mfjson.Message, wh Webhook) error
}
func NewForwarder ¶
func NewForwarder() Forwarder
type PageMetadata ¶ added in v0.23.0
type Service ¶
type Service interface {
// CreateWebhooks creates webhooks for certain group identified by the provided ID
CreateWebhooks(ctx context.Context, token string, webhooks ...Webhook) ([]Webhook, error)
// ListWebhooksByGroup retrieves data about a subset of webhooks
// related to a certain group identified by the provided ID.
ListWebhooksByGroup(ctx context.Context, token, groupID string, pm PageMetadata) (WebhooksPage, error)
// ViewWebhook retrieves data about the webhook identified with the provided
// ID, that belongs to the user identified by the provided key.
ViewWebhook(ctx context.Context, token, id string) (Webhook, error)
// UpdateWebhook updates the webhook identified by the provided ID, that
// belongs to the user identified by the provided key.
UpdateWebhook(ctx context.Context, token string, webhook Webhook) error
// RemoveWebhooks removes the webhooks identified with the provided IDs, that
// belongs to the user identified by the provided key.
RemoveWebhooks(ctx context.Context, token, groupID string, id ...string) 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 protomfx.ThingsServiceClient, webhooks WebhookRepository, forwarder Forwarder, idp uuid.IDProvider) 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)
// RetrieveByGroupID retrieves webhooks related to
// a certain group identified by a given ID.
RetrieveByGroupID(ctx context.Context, groupID string, pm PageMetadata) (WebhooksPage, error)
// RetrieveByID retrieves the webhook having the provided identifier
RetrieveByID(ctx context.Context, id string) (Webhook, error)
// Update performs an update to the existing webhook. A non-nil error is
// returned to indicate operation failure.
Update(ctx context.Context, w Webhook) error
// Remove removes the webhooks having the provided identifiers
Remove(ctx context.Context, ids ...string) error
}
type WebhooksPage ¶ added in v0.23.0
type WebhooksPage struct {
PageMetadata
Webhooks []Webhook
}
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.