publisher

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: AGPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SingleNotificationIngestTopic represents a topic that should be used to send single notification.
	SingleNotificationIngestTopic = NotificationIngestTopic{"notification_ingest"}
	// BulkNotificationIngestTopic represents a topic that should be used to send bulk notification.
	BulkNotificationIngestTopic = NotificationIngestTopic{"notification_bulk_ingest"}
)

Functions

func AddUsersToCircle

func AddUsersToCircle(circleID string, userIDs []string) (*v1.NotificationEvent, error)

AddUsersToCircle creates AddUsersToCircle notification event.

func AddUsersToGroupChat

func AddUsersToGroupChat(groupChatID string, userIDs []string) (*v1.NotificationEvent, error)

AddUsersToGroupChat creates AddUsersToGroupChat notification event.

func CreateCircleHasANewDirectorEvent

func CreateCircleHasANewDirectorEvent(circleID, circleName, newDirectorID string) (*v1.NotificationEvent, error)

CreateCircleHasANewDirectorEvent creates CircleHasANewDirector notification event.

func CreateCircleMessageRemovedByPicnicEvent

func CreateCircleMessageRemovedByPicnicEvent(messageID, messageOwnerID, circleID, circleName, actionID, reason string) (*v1.NotificationEvent, error)

CreateCircleMessageRemovedByPicnicEvent creates CircleMessageRemovedByPicnic notification event.

func CreateCommentLikedEvent

func CreateCommentLikedEvent(commentID, commentOwnerID, userID, thumbnail string) (*v1.NotificationEvent, error)

CreateCommentLikedEvent creates CommentLiked notification event.

func CreateCommentRemovedByPicnicEvent

func CreateCommentRemovedByPicnicEvent(commentID, commentOwnerID, postID, circleID, circleName, actionID, reason string) (*v1.NotificationEvent, error)

CreateCommentRemovedByPicnicEvent creates CommentRemovedByPicnic notification event.

func CreateCommentUnlikedEvent

func CreateCommentUnlikedEvent(commentID, commentOwnerID, userID string) (*v1.NotificationEvent, error)

CreateCommentUnlikedEvent creates CommentLiked notification event.

func CreateElectionAboutToLoseEvent

func CreateElectionAboutToLoseEvent(circleID, circleName, currentDirectorID, possibleWinnerID string) (*v1.NotificationEvent, error)

CreateElectionAboutToLoseEvent creates ElectionAboutToLose notification event.

func CreateElectionSomeonePassedEvent

func CreateElectionSomeonePassedEvent(circleID, circleName, currentDirectorID, newDirectorID string) (*v1.NotificationEvent, error)

CreateElectionSomeonePassedEvent creates ElectionSomeonePassed notification event.

func CreateGlitterBombSendEvent

func CreateGlitterBombSendEvent(senderID, senderName, receiverID, glitterBombID, thumbnail string) (*v1.NotificationEvent, error)

CreateGlitterBombSendEvent creates GlitterBombSend notification event.

func CreateGroupChatCreatedEvent

func CreateGroupChatCreatedEvent(groupChatID string, userIDs []string) (*v1.NotificationEvent, error)

CreateGroupChatCreatedEvent creates GroupChatCreated notification event.

func CreateGroupChatMessageSentEvent

func CreateGroupChatMessageSentEvent(
	groupChatID, senderID, messageID, messageText, thumbnailURL string,
) (*v1.NotificationEvent, error)

CreateGroupChatMessageSentEvent creates GroupChatMessageSent notification event.

func CreateInvitedToACircleEvent

func CreateInvitedToACircleEvent(userID, circleID, circleName, InvitedUserID string) (*v1.NotificationEvent, error)

CreateInvitedToACircleEvent creates InvitedToACircle notification event.

func CreateNotifyCircleModeratorsForWaitingReportsEvent

func CreateNotifyCircleModeratorsForWaitingReportsEvent(moderatorIDs []string, circleName string, waitingReportsCount int32) (*v1.NotificationEvent, error)

CreateNotifyCircleModeratorsForWaitingReportsEvent creates NotifyCircleModeratorsForWaitingReports notification event.

func CreatePostCommentDeletedEvent

func CreatePostCommentDeletedEvent(postID, postOwnerID, commentID, commenterID string) (*v1.NotificationEvent, error)

CreatePostCommentDeletedEvent creates PostCommented notification event.

func CreatePostCommentedEvent

func CreatePostCommentedEvent(postID, postOwnerID, commentID, commentText, commenterID, thumbnail string) (*v1.NotificationEvent, error)

CreatePostCommentedEvent creates PostCommented notification event.

func CreatePostLikedEvent

func CreatePostLikedEvent(postID, postOwnerID, userID, thumbnail string) (*v1.NotificationEvent, error)

CreatePostLikedEvent creates PostLiked notification event.

func CreatePostRemovedFromAppByPicnicEvent

func CreatePostRemovedFromAppByPicnicEvent(postID, postOwnerID, circleID, reason string) (*v1.NotificationEvent, error)

CreatePostRemovedFromAppByPicnicEvent creates PostRemovedFromAppByPicnic notification event.

func CreatePostRemovedFromCircleByModeratorEvent

func CreatePostRemovedFromCircleByModeratorEvent(postID, postOwnerID, circleID, circleName, reason string) (*v1.NotificationEvent, error)

CreatePostRemovedFromCircleByModeratorEvent creates PostRemovedFromCircleByModerator notification event.

func CreatePostReportedToCircleModeratorsEvent

func CreatePostReportedToCircleModeratorsEvent(postID, reporterID, circleID, circleName, reportType string, moderatorIDs []string) (*v1.NotificationEvent, error)

CreatePostReportedToCircleModeratorsEvent creates PostReportedToCircleModerators notification event.

func CreatePostUnlikedEvent

func CreatePostUnlikedEvent(postID, postOwnerID, userID string) (*v1.NotificationEvent, error)

CreatePostUnlikedEvent creates PostLiked notification event.

func CreatePrivateMessageSentEvent

func CreatePrivateMessageSentEvent(
	senderID, receiverID, chatID, messageID, messageText, thumbnailURL string,
) (*v1.NotificationEvent, error)

CreatePrivateMessageSentEvent creates PrivateMessageSent notification event.

func CreateSeedsReceived

func CreateSeedsReceived(senderID, receiverID, circleID, circleName string, amount int64) (*v1.NotificationEvent, error)

CreateSeedsReceived creates SeedsReceived notification event.

func CreateThreadCommentDeletedEvent

func CreateThreadCommentDeletedEvent(parentCommentID, parentCommentOwnerID, commentID, commenterID string) (*v1.NotificationEvent, error)

CreateThreadCommentDeletedEvent creates ThreadCommented notification event.

func CreateThreadCommentedEvent

func CreateThreadCommentedEvent(parentCommentID, parentCommentOwnerID, commentID, threadText, commenterID, thumbnail string) (*v1.NotificationEvent, error)

CreateThreadCommentedEvent creates ThreadCommented notification event.

func CreateTrendingPostEvent added in v0.3.2

func CreateTrendingPostEvent(userID, postID, templateID, title, body, thumbnail string) (*v1.NotificationEvent, error)

CreateTrendingPostEvent creates trending post event.

func CreateUserBannedFromAppEvent

func CreateUserBannedFromAppEvent(userID, reason string) (*v1.NotificationEvent, error)

CreateUserBannedFromAppEvent creates UserBannedFromApp notification event.

func CreateUserBannedFromCircle

func CreateUserBannedFromCircle(userID, circleID, circleName, reason string) (*v1.NotificationEvent, error)

CreateUserBannedFromCircle creates UserBannedFromCircle notification event.

func CreateUserFollowedEvent

func CreateUserFollowedEvent(followerID, followerName, followeeID, thumbnail string) (*v1.NotificationEvent, error)

CreateUserFollowedEvent creates UserFollowed notification event.

func CreateUserJoinedACircleEvent

func CreateUserJoinedACircleEvent(circleID, circleName, userID, directorID string) (*v1.NotificationEvent, error)

CreateUserJoinedACircleEvent creates UserJoinedACircle notification event.

func CreateUserMentionedEvent

func CreateUserMentionedEvent(userID, mentionedUserID, postID, userProfileURL string) (*v1.NotificationEvent, error)

CreateUserMentionedEvent creates UserMentioned notification event.

func CreateUserSavedPostEvent

func CreateUserSavedPostEvent(postID, postOwnerID, postThumbnailHTTPSURL string, savedCount int) (*v1.NotificationEvent, error)

CreateUserSavedPostEvent creates UserSavedPost notification event.

func CreateUserSharedPostEvent

func CreateUserSharedPostEvent(postID, postOwnerID, postThumbnailHTTPSURL string, sharedCount int) (*v1.NotificationEvent, error)

CreateUserSharedPostEvent creates UserSharedPost notification event.

func CreateUserTaggedEvent

func CreateUserTaggedEvent(
	entityID, taggerUserID, taggerUsername, TaggedUserID, entityThumbnailHTTPSURL, subEntityID string, entityType v1.EntityType,
) (*v1.NotificationEvent, error)

CreateUserTaggedEvent created UserTagged notification event.

func CreateUserUnbannedFromAppEvent

func CreateUserUnbannedFromAppEvent(userID string) (*v1.NotificationEvent, error)

CreateUserUnbannedFromAppEvent creates UserUnbannedFromApp notification event.

func CreateUserUnbannedFromCircle

func CreateUserUnbannedFromCircle(userID, circleID, circleName string) (*v1.NotificationEvent, error)

CreateUserUnbannedFromCircle creates UserUnbannedFromCircle notification event.

func CreateUserUnfollowedEvent

func CreateUserUnfollowedEvent(followerID, followeeID string) (*v1.NotificationEvent, error)

CreateUserUnfollowedEvent creates UserFollowed notification event.

func DontLoseStreakEvent added in v0.3.1

func DontLoseStreakEvent(userStreakID, streakID, userID, title, body string) (*v1.NotificationEvent, error)

DontLoseStreakEvent ...

func NewPubSubClient

func NewPubSubClient(ctx context.Context, projectID, adcCredPath string) (*pubsub.Client, error)

NewPubSubClient creates a new PubSub client.

func RemoveUsersFromCircle

func RemoveUsersFromCircle(circleID string, userIDs []string) (*v1.NotificationEvent, error)

RemoveUsersFromCircle creates RemoveUsersFromCircle notification event.

func RemoveUsersFromGroupChat

func RemoveUsersFromGroupChat(groupChatID string, userIDs []string) (*v1.NotificationEvent, error)

RemoveUsersFromGroupChat creates AddUserRemoveUsersFromGroupChatsToGroupChat notification event.

func StreakLvlUppedEvent added in v0.3.1

func StreakLvlUppedEvent(userStreakID, streakID, userID, title, body string) (*v1.NotificationEvent, error)

StreakLvlUppedEvent ...

Types

type NotificationIngestTopic

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

NotificationIngestTopic is an enum that represents available topics for the publisher to use.

func (NotificationIngestTopic) String

func (n NotificationIngestTopic) String() string

type Publisher

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

Publisher represents struct that is responsible for publishing messages to Google Pub?Sub topic.

func NewPublisher

func NewPublisher(ctx context.Context, envID string, client *pubsub.Client, topic NotificationIngestTopic) (*Publisher, error)

NewPublisher returns a new publisher.

func (*Publisher) Close

func (p *Publisher) Close() error

Close shuts down the publisher gracefully.

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, notificationEvent *v1.NotificationEvent) error

Publish sends a message to a Google Cloud Pub/Sub topic.

Jump to

Keyboard shortcuts

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