Documentation
¶
Index ¶
- Constants
- Variables
- func GetNotificationID(notificationType NotificationType, userID *commonpb.UserId, ...) (*activitypb.NotificationId, error)
- func InjectLocalizedText(ctx context.Context, notification *activitypb.Notification) error
- func NotificationIDString(id *activitypb.NotificationId) string
- func SendNotification(ctx context.Context, activityFeeds Store, ...) (*activitypb.Notification, error)
- type NotificationBuilder
- func NewCreateGroupNotificationBuilder(ctx context.Context, userID *commonpb.UserId, chatID *commonpb.ChatId, ...) NotificationBuilder
- func NewPromotedToSpeakerNotificationBuilder(ctx context.Context, promotee, promoter *commonpb.UserId, ...) NotificationBuilder
- func NewReceivedTipNotificationBuilder(ctx context.Context, userID *commonpb.UserId, chatID *commonpb.ChatId, ...) NotificationBuilder
- func NewSendListenerMessageNotificationBuilder(ctx context.Context, userID *commonpb.UserId, chatID *commonpb.ChatId, ...) NotificationBuilder
- func NewSendTipNotificationBuilder(ctx context.Context, userID *commonpb.UserId, chatID *commonpb.ChatId, ...) NotificationBuilder
- func NewWeeklyBonusNotificationBuilder(ctx context.Context, userID *commonpb.UserId, quarks uint64, ts time.Time) NotificationBuilder
- func NewWelcomeBonusNotificationBuilder(ctx context.Context, userID *commonpb.UserId, quarks uint64, ts time.Time) NotificationBuilder
- type NotificationType
- type Server
- type Store
Constants ¶
View Source
const ( NotificationTypeUnknown = iota NotificationTypeWelcomeBonus NotificationTypeWeeklyBonus NotificationTypeCreateGroup NotificationTypeSendListenerMessage NotificationTypeSendTip NotificationTypeReceivedTip NotificationTypePromotedToSpeaker )
Variables ¶
View Source
var ( ErrInvalidActivityFeedType = errors.New("activity feed type not supported") ErrInvalidNotificationType = errors.New("notification type not supported") )
Functions ¶
func GetNotificationID ¶
func GetNotificationID(notificationType NotificationType, userID *commonpb.UserId, additionalSeeds ...[]byte) (*activitypb.NotificationId, error)
func InjectLocalizedText ¶
func InjectLocalizedText(ctx context.Context, notification *activitypb.Notification) error
func NotificationIDString ¶
func NotificationIDString(id *activitypb.NotificationId) string
func SendNotification ¶
func SendNotification(ctx context.Context, activityFeeds Store, activityFeedType activitypb.ActivityFeedType, userID *commonpb.UserId, builder NotificationBuilder) (*activitypb.Notification, error)
SendNotification sends a notification to a user's activity feed
Types ¶
type NotificationBuilder ¶
type NotificationBuilder func() (*activitypb.Notification, error)
type NotificationType ¶
type NotificationType uint32
type Server ¶
type Server struct { activitypb.UnimplementedActivityFeedServer // contains filtered or unexported fields }
func (*Server) GetLatestNotifications ¶
func (s *Server) GetLatestNotifications(ctx context.Context, req *activitypb.GetLatestNotificationsRequest) (*activitypb.GetLatestNotificationsResponse, error)
type Store ¶
type Store interface { // SaveNotification inserts or updates a notification depending on whether // the notification supports grouping SaveNotification(ctx context.Context, activityFeedType activitypb.ActivityFeedType, userID *commonpb.UserId, notification *activitypb.Notification) (*activitypb.Notification, error) // GetLatestNotifications gets the latest N notifications for a user's // activity feed type GetLatestNotifications(ctx context.Context, activityFeedType activitypb.ActivityFeedType, userID *commonpb.UserId, limit int) ([]*activitypb.Notification, error) }
Click to show internal directories.
Click to hide internal directories.