File size: 1,660 Bytes
d6f631f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | package subscription
import (
"context"
"github.com/openmeterio/openmeter/pkg/models"
)
type SubscriptionCommandHook interface {
// These happen before the fact
BeforeCreate(context.Context, string, SubscriptionSpec) error
BeforeContinue(context.Context, SubscriptionView) error
BeforeUpdate(context.Context, models.NamespacedID, SubscriptionSpec) error
BeforeDelete(context.Context, SubscriptionView) error
// These happen after the fact
AfterCreate(context.Context, SubscriptionView) error
AfterUpdate(context.Context, SubscriptionView) error
AfterCancel(context.Context, SubscriptionView) error
AfterContinue(context.Context, SubscriptionView) error
}
var _ SubscriptionCommandHook = (*NoOpSubscriptionCommandHook)(nil)
type NoOpSubscriptionCommandHook struct{}
func (NoOpSubscriptionCommandHook) BeforeCreate(context.Context, string, SubscriptionSpec) error {
return nil
}
func (NoOpSubscriptionCommandHook) BeforeContinue(context.Context, SubscriptionView) error {
return nil
}
func (NoOpSubscriptionCommandHook) BeforeUpdate(context.Context, models.NamespacedID, SubscriptionSpec) error {
return nil
}
func (NoOpSubscriptionCommandHook) AfterCreate(context.Context, SubscriptionView) error {
return nil
}
func (NoOpSubscriptionCommandHook) AfterUpdate(context.Context, SubscriptionView) error {
return nil
}
func (NoOpSubscriptionCommandHook) AfterCancel(context.Context, SubscriptionView) error {
return nil
}
func (NoOpSubscriptionCommandHook) AfterContinue(context.Context, SubscriptionView) error {
return nil
}
func (NoOpSubscriptionCommandHook) BeforeDelete(context.Context, SubscriptionView) error {
return nil
}
|