notifications

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	FirebaseCredentialsFilePath string `yaml:"firebase_credentials_file_path"`
	PersistHistory              bool   `yaml:"persist_history"`
}

func ParseConfig

func ParseConfig(bz []byte) (*Config, error)

type Database

type Database interface {
	SaveNotification(recipient types.NotificationRecipient, notification types.NotificationData) error
	SaveToken(token types.NotificationToken) error
	GetUserTokens(userAddress string) ([]types.NotificationToken, error)
}

type Module

type Module struct {
	// contains filtered or unexported fields
}

func NewModule

func NewModule(
	junoCfg config.Config,
	postsModule PostsModule, reactionsModule ReactionsModule,
	cdc codec.Codec, db Database,
) *Module

NewModule returns a new Module instance

func (*Module) BuildMessage

BuildMessage builds the notification message that should be sent based on the given recipient, notification and data

func (*Module) HandleMsg

func (m *Module) HandleMsg(index int, msg sdk.Msg, tx *juno.Tx) error

HandleMsg implements modules.MessageModule

func (*Module) HandleMsgExec

func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error

HandleMsgExec implements modules.AuthzMessageModule

func (*Module) HandleTx

func (m *Module) HandleTx(tx *juno.Tx) error

HandleTx implements modules.TransactionModule

func (*Module) Name

func (m *Module) Name() string

Name implements modules.Module

func (*Module) SendAndStoreNotification

func (m *Module) SendAndStoreNotification(recipient types.NotificationRecipient, notification types.NotificationData) error

SendAndStoreNotification sends the given notification to the given recipient and stores it inside the database.

func (*Module) SendPostNotifications

func (m *Module) SendPostNotifications(height int64, subspaceID uint64, postID uint64) error

SendPostNotifications sends all the notifications to the users that are somehow involved with the given post. These include: - the author of the original post to which the post is a reply (if any) - the users mentioned inside the post - the authors of the various referenced posts (if this post is a reply/repost/quote)

func (*Module) SendReactionNotifications

func (m *Module) SendReactionNotifications(reaction types.Reaction) error

SendReactionNotifications sends all the notifications to the author of the post that has been reacted to

func (*Module) SendRelationshipNotifications

func (m *Module) SendRelationshipNotifications(relationship types.Relationship) error

SendRelationshipNotifications sends the notification to the user towards which a relationship has just been created

func (*Module) SendTransactionNotifications

func (m *Module) SendTransactionNotifications(tx *juno.Tx, user string) error

SendTransactionNotifications notifies the user involved in the transaction

func (*Module) WithMessagesBuilder

func (m *Module) WithMessagesBuilder(builder notificationsbuilder.MessagesBuilder) *Module

WithMessagesBuilder sets the given builder as the messages builder

func (*Module) WithNotificationSender

func (m *Module) WithNotificationSender(sender notificationssender.NotificationSender) *Module

WithNotificationSender sets the given sender as the notification sender

func (*Module) WithNotificationsBuilder

func (m *Module) WithNotificationsBuilder(builder notificationsbuilder.NotificationsBuilder) *Module

WithNotificationsBuilder sets the given builder as the notifications builder

type PostsModule

type PostsModule interface {
	GetPost(height int64, subspaceID uint64, postID uint64) (types.Post, error)
}

type ProfilesModule

type ProfilesModule interface {
	GetUserProfile(userAddress string) (*types.Profile, error)
}

type ReactionsModule

type ReactionsModule interface {
	GetReactionID(tx *juno.Tx, index int) (uint32, error)
	GetReaction(height int64, subspaceID uint64, postID uint64, reactionID uint32) (types.Reaction, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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