notifications

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotificationTypeProvider = 'P'
	NotificationTypeFeature  = 'F'
	NotificationTypeField    = 'f'
)

NotificationType strings

Variables

This section is empty.

Functions

This section is empty.

Types

type FeatureNotification

type FeatureNotification struct {
	Notification *notification
	Description  Fields
	Values       features.ChangeableFeatureValueS
}

FeatureNotification is a notifier for certain features. It implements INotification

func NewFeatureNotification

func NewFeatureNotification(features []string, mail string, values features.ChangeableFeatureValueS, html bool) (fn *FeatureNotification, ma *mailactivation.MailActivation, err error)

NewFeatureNotification creates a new FeatureNotification

func (*FeatureNotification) ActivateMail

func (n *FeatureNotification) ActivateMail()

ActivateMail activates the mail for this notification

func (*FeatureNotification) ChangeValue

ChangeValue changes a value to update the Last and Current properties

func (*FeatureNotification) GetDescription

func (n *FeatureNotification) GetDescription() Fields

GetDescription returns the feature names for this notification

func (*FeatureNotification) GetID

func (n *FeatureNotification) GetID() string

GetID returns the notification id

func (*FeatureNotification) GetNotificationSubject

func (n *FeatureNotification) GetNotificationSubject() string

GetNotificationSubject returns the subject of the notification email

func (*FeatureNotification) GetValue

GetValue returns the Value for the specified Field

func (*FeatureNotification) MarshalBinary

func (n *FeatureNotification) MarshalBinary() ([]byte, error)

MarshalBinary marshals FeatureNotification into bytes

func (*FeatureNotification) SendNotificationMail

func (n *FeatureNotification) SendNotificationMail()

SendNotificationMail sends a notification mail

func (*FeatureNotification) SendWelcomeMail

func (n *FeatureNotification) SendWelcomeMail()

SendWelcomeMail sends a welcome mail

func (*FeatureNotification) UnmarshalBinary

func (n *FeatureNotification) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshalls bytes into FeatureNotification.

type Field

type Field struct {
	Provider string `json:"provider"`
	Feature  string `json:"feature"`
}

Field describes a field in the comparison table

type FieldNotification

type FieldNotification struct {
	Notification *notification
	Description  Fields
	Values       features.ChangeableFeatureValueS
}

FieldNotification is a notifier for certain fields. It implements INotification

func NewFieldNotification

func NewFieldNotification(fields Fields, mail string, values features.ChangeableFeatureValueS, html bool) (fn *FieldNotification, ma *mailactivation.MailActivation, err error)

NewFieldNotification creates a new FeatureNotification

func (*FieldNotification) ActivateMail

func (n *FieldNotification) ActivateMail()

ActivateMail activates the mail for this notification

func (*FieldNotification) ChangeValue

ChangeValue changes a value to update the Last and Current properties

func (*FieldNotification) GetDescription

func (n *FieldNotification) GetDescription() Fields

GetDescription returns the field names for this notification

func (*FieldNotification) GetID

func (n *FieldNotification) GetID() string

GetID returns the notification id

func (*FieldNotification) GetNotificationSubject

func (n *FieldNotification) GetNotificationSubject() string

GetNotificationSubject returns the subject of the notification email

func (*FieldNotification) GetValue

GetValue returns the Value for the specified Field

func (*FieldNotification) MarshalBinary

func (n *FieldNotification) MarshalBinary() ([]byte, error)

MarshalBinary marshals FieldNotification into bytes

func (*FieldNotification) SendNotificationMail

func (n *FieldNotification) SendNotificationMail()

SendNotificationMail sends a notification mail

func (*FieldNotification) SendWelcomeMail

func (n *FieldNotification) SendWelcomeMail()

SendWelcomeMail sends a welcome mail

func (*FieldNotification) UnmarshalBinary

func (n *FieldNotification) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshalls bytes into FieldNotification.

type Fields

type Fields []Field

Fields is a slice of Field

func FeaturesToFields

func FeaturesToFields(featureNames []string) (fields Fields)

FeaturesToFields transforms a slice of features names into a slice of Fields

func ProvidersToFields

func ProvidersToFields(providerNames []string) (fields Fields)

ProvidersToFields transforms a slice of provider names into a slice of Fields

func (Fields) Features

func (fs Fields) Features() (features []string)

Features returns a list of all features in Fields

func (Fields) Providers

func (fs Fields) Providers() (providers []string)

Providers returns a list of all providers in Fields

type INotification

type INotification interface {
	GetID() string
	SendNotificationMail()
	SendWelcomeMail()
	GetNotificationSubject() string
	ChangeValue(features.ChangeableFeatureValue)
	GetValue(Field) (*features.ChangeableFeatureValue, bool)
	GetDescription() Fields
	ActivateMail()
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
}

INotification is an interface for all notification types.

func GetNotificationTypeDummyFromID

func GetNotificationTypeDummyFromID(id string) INotification

GetNotificationTypeDummyFromID creates a dummy notification with the correct type from an given id

type NotificationPostData

type NotificationPostData struct {
	Email     string   `json:"email"`
	HTML      bool     `json:"html"`
	Type      string   `json:"type"`
	Providers []string `json:"providers"`
	Features  []string `json:"features"`
	Fields    Fields   `json:"fields"`
}

NotificationPostData holds the PostData for notifications

func (*NotificationPostData) MarshalBinary

func (v *NotificationPostData) MarshalBinary() ([]byte, error)

MarshalBinary marshals NotificationPostData into bytes.

func (*NotificationPostData) UnmarshalBinary

func (v *NotificationPostData) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshalls bytes into NotificationPostData.

func (*NotificationPostData) Validate

func (v *NotificationPostData) Validate() error

Validate validates the given NotificationPostData

type ProviderNotification

type ProviderNotification struct {
	Notification *notification
	Description  Fields
	Values       features.ChangeableFeatureValueS
}

ProviderNotification is a notifier for certain providers. It implements INotification

func NewProviderNotification

func NewProviderNotification(providers []string, mail string, values features.ChangeableFeatureValueS, html bool) (pn *ProviderNotification, ma *mailactivation.MailActivation, err error)

NewProviderNotification creates a new FeatureNotification

func (*ProviderNotification) ActivateMail

func (n *ProviderNotification) ActivateMail()

ActivateMail activates the mail for this notification

func (*ProviderNotification) ChangeValue

ChangeValue changes a value to update the Last and Current properties

func (*ProviderNotification) GetDescription

func (n *ProviderNotification) GetDescription() Fields

GetDescription returns the providers for this notification

func (*ProviderNotification) GetID

func (n *ProviderNotification) GetID() string

GetID returns the notification id

func (*ProviderNotification) GetNotificationSubject

func (n *ProviderNotification) GetNotificationSubject() string

GetNotificationSubject returns the subject of the notification email

func (*ProviderNotification) GetValue

GetValue returns the Value for the specified Field

func (*ProviderNotification) MarshalBinary

func (n *ProviderNotification) MarshalBinary() ([]byte, error)

MarshalBinary marshals ProviderNotification into bytes

func (*ProviderNotification) SendNotificationMail

func (n *ProviderNotification) SendNotificationMail()

SendNotificationMail sends a notification mail

func (*ProviderNotification) SendWelcomeMail

func (n *ProviderNotification) SendWelcomeMail()

SendWelcomeMail sends a welcome mail

func (*ProviderNotification) UnmarshalBinary

func (n *ProviderNotification) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshalls bytes into ProviderNotification.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL