Documentation ¶
Index ¶
- func ListenGeneral(parentCtx context.Context, db *ent.Client, youTubeConfig *oauth2.Config, ...) error
- func NewPubSubMembershipChangeHandler(ctx context.Context, topic *pubsub.Topic) membership.ChangeHandler
- func ProcessUserDelete(ctx context.Context, db *ent.Client, topic *pubsub.Topic, userID uint64, ...) error
- func ProcessYouTubeDelete(ctx context.Context, db *ent.Client, topic *pubsub.Topic, userID uint64) error
- func ProcessYouTubeRegistration(ctx context.Context, db *ent.Client, youTubeConfig *oauth2.Config, ...) error
- func PublishApplyMembershipMessage(ctx context.Context, topic *pubsub.Topic, message ApplyMembershipPSMessage) error
- func PublishGeneralMessage(ctx context.Context, topic *pubsub.Topic, message GeneralPSMessage) error
- type ApplyMembershipPSMessage
- type ApplySingleMessage
- type DeleteUserMessage
- type EnforceAllMessage
- type GeneralPSMessage
- type PSMessageType
- type YouTubeRegistrationMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenGeneral ¶
func ListenGeneral( parentCtx context.Context, db *ent.Client, youTubeConfig *oauth2.Config, subscription *pubsub.Subscription, botTopic *pubsub.Topic, setChangeReason func(string), ) error
ListenGeneral polls a pubsub subscription for GeneralType messages.
func NewPubSubMembershipChangeHandler ¶
func NewPubSubMembershipChangeHandler(ctx context.Context, topic *pubsub.Topic) membership.ChangeHandler
func ProcessUserDelete ¶
func ProcessUserDelete(ctx context.Context, db *ent.Client, topic *pubsub.Topic, userID uint64, reason string) error
ProcessUserDelete revokes tokens and tells the bot to delete the user. The bot has to delete the user because it'll communicate the final role removals + user deletion, and at that point why have the async queue require another message?
func ProcessYouTubeDelete ¶
func ProcessYouTubeDelete(ctx context.Context, db *ent.Client, topic *pubsub.Topic, userID uint64) error
ProcessUserDelete revokes tokens and deletes all membership edges.
func ProcessYouTubeRegistration ¶
func ProcessYouTubeRegistration(ctx context.Context, db *ent.Client, youTubeConfig *oauth2.Config, userID uint64, setChangeReason func(string)) error
ProcessYouTubeRegistration really only checks memberships and triggers changes. One day it might do something else?
func PublishGeneralMessage ¶
Types ¶
type ApplyMembershipPSMessage ¶
type ApplyMembershipPSMessage struct { ApplySingle *ApplySingleMessage `json:",omitempty"` DeleteSingle *DeleteUserMessage `json:",omitempty"` EnforceAll *EnforceAllMessage `json:",omitempty"` }
type ApplySingleMessage ¶
type DeleteUserMessage ¶
type EnforceAllMessage ¶
type GeneralPSMessage ¶
type GeneralPSMessage struct { UserDelete *DeleteUserMessage `json:",omitempty"` YouTubeRegistration *YouTubeRegistrationMessage `json:",omitempty"` YouTubeDelete json.Number `json:",omitempty"` }
type PSMessageType ¶
type PSMessageType string
PSMessageType is a Pub/Sub message type enum, packed into the attributes field.
const ( GeneralType PSMessageType = "general" ApplyMembershipType PSMessageType = "apply-membership" )
Click to show internal directories.
Click to hide internal directories.