229 lines
11 KiB
Go
229 lines
11 KiB
Go
package notificationintent
|
|
|
|
// GeoReviewRecommendedPayload stores the normalized payload for
|
|
// `geo.review_recommended`.
|
|
type GeoReviewRecommendedPayload struct {
|
|
UserID string `json:"user_id"`
|
|
UserEmail string `json:"user_email"`
|
|
ObservedCountry string `json:"observed_country"`
|
|
UsualConnectionCountry string `json:"usual_connection_country"`
|
|
ReviewReason string `json:"review_reason"`
|
|
}
|
|
|
|
// GameTurnReadyPayload stores the normalized payload for `game.turn.ready`.
|
|
type GameTurnReadyPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
TurnNumber int64 `json:"turn_number"`
|
|
}
|
|
|
|
// GameFinishedPayload stores the normalized payload for `game.finished`.
|
|
type GameFinishedPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
FinalTurnNumber int64 `json:"final_turn_number"`
|
|
}
|
|
|
|
// GameGenerationFailedPayload stores the normalized payload for
|
|
// `game.generation_failed`.
|
|
type GameGenerationFailedPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
FailureReason string `json:"failure_reason"`
|
|
}
|
|
|
|
// LobbyRuntimePausedAfterStartPayload stores the normalized payload for
|
|
// `lobby.runtime_paused_after_start`.
|
|
type LobbyRuntimePausedAfterStartPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
}
|
|
|
|
// LobbyApplicationSubmittedPayload stores the normalized payload for
|
|
// `lobby.application.submitted`.
|
|
type LobbyApplicationSubmittedPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
ApplicantUserID string `json:"applicant_user_id"`
|
|
ApplicantName string `json:"applicant_name"`
|
|
}
|
|
|
|
// LobbyMembershipApprovedPayload stores the normalized payload for
|
|
// `lobby.membership.approved`.
|
|
type LobbyMembershipApprovedPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
}
|
|
|
|
// LobbyMembershipRejectedPayload stores the normalized payload for
|
|
// `lobby.membership.rejected`.
|
|
type LobbyMembershipRejectedPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
}
|
|
|
|
// LobbyMembershipBlockedPayload stores the normalized payload for
|
|
// `lobby.membership.blocked` published by the user-lifecycle cascade
|
|
// when an active membership is blocked because the underlying user was
|
|
// permanently blocked or deleted.
|
|
type LobbyMembershipBlockedPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
MembershipUserID string `json:"membership_user_id"`
|
|
MembershipUserName string `json:"membership_user_name"`
|
|
// Reason captures the upstream lifecycle event that triggered the
|
|
// cascade. Frozen vocabulary: `permanent_blocked`, `deleted`.
|
|
Reason string `json:"reason"`
|
|
}
|
|
|
|
// LobbyInviteCreatedPayload stores the normalized payload for
|
|
// `lobby.invite.created`.
|
|
type LobbyInviteCreatedPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
InviterUserID string `json:"inviter_user_id"`
|
|
InviterName string `json:"inviter_name"`
|
|
}
|
|
|
|
// LobbyInviteRedeemedPayload stores the normalized payload for
|
|
// `lobby.invite.redeemed`.
|
|
type LobbyInviteRedeemedPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
InviteeUserID string `json:"invitee_user_id"`
|
|
InviteeName string `json:"invitee_name"`
|
|
}
|
|
|
|
// LobbyInviteExpiredPayload stores the normalized payload for
|
|
// `lobby.invite.expired`.
|
|
type LobbyInviteExpiredPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
InviteeUserID string `json:"invitee_user_id"`
|
|
InviteeName string `json:"invitee_name"`
|
|
}
|
|
|
|
// LobbyRaceNameRegistrationEligiblePayload stores the normalized payload
|
|
// for `lobby.race_name.registration_eligible`.
|
|
type LobbyRaceNameRegistrationEligiblePayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
RaceName string `json:"race_name"`
|
|
EligibleUntilMs int64 `json:"eligible_until_ms"`
|
|
}
|
|
|
|
// LobbyRaceNameRegisteredPayload stores the normalized payload for
|
|
// `lobby.race_name.registered`.
|
|
type LobbyRaceNameRegisteredPayload struct {
|
|
RaceName string `json:"race_name"`
|
|
}
|
|
|
|
// LobbyRaceNameRegistrationDeniedPayload stores the normalized payload for
|
|
// `lobby.race_name.registration_denied`.
|
|
type LobbyRaceNameRegistrationDeniedPayload struct {
|
|
GameID string `json:"game_id"`
|
|
GameName string `json:"game_name"`
|
|
RaceName string `json:"race_name"`
|
|
Reason string `json:"reason"`
|
|
}
|
|
|
|
// NewGeoReviewRecommendedIntent builds the admin-email intent published by Geo
|
|
// Profile Service when a user becomes review-worthy.
|
|
func NewGeoReviewRecommendedIntent(metadata Metadata, payload GeoReviewRecommendedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeGeoReviewRecommended, ProducerGeoProfile, AudienceKindAdminEmail, nil, metadata, payload)
|
|
}
|
|
|
|
// NewGameTurnReadyIntent builds the user-targeted intent published by Game
|
|
// Master when a new turn is ready for active accepted participants.
|
|
func NewGameTurnReadyIntent(metadata Metadata, recipientUserIDs []string, payload GameTurnReadyPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeGameTurnReady, ProducerGameMaster, AudienceKindUser, recipientUserIDs, metadata, payload)
|
|
}
|
|
|
|
// NewGameFinishedIntent builds the user-targeted intent published by Game
|
|
// Master when a running game finishes.
|
|
func NewGameFinishedIntent(metadata Metadata, recipientUserIDs []string, payload GameFinishedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeGameFinished, ProducerGameMaster, AudienceKindUser, recipientUserIDs, metadata, payload)
|
|
}
|
|
|
|
// NewGameGenerationFailedIntent builds the admin-email intent published by
|
|
// Game Master when turn generation fails.
|
|
func NewGameGenerationFailedIntent(metadata Metadata, payload GameGenerationFailedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeGameGenerationFailed, ProducerGameMaster, AudienceKindAdminEmail, nil, metadata, payload)
|
|
}
|
|
|
|
// NewLobbyRuntimePausedAfterStartIntent builds the admin-email intent
|
|
// published by Game Lobby when a game is paused after runtime startup.
|
|
func NewLobbyRuntimePausedAfterStartIntent(metadata Metadata, payload LobbyRuntimePausedAfterStartPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyRuntimePausedAfterStart, ProducerGameLobby, AudienceKindAdminEmail, nil, metadata, payload)
|
|
}
|
|
|
|
// NewPrivateLobbyApplicationSubmittedIntent builds the private-game owner
|
|
// intent published by Game Lobby when an application is submitted.
|
|
func NewPrivateLobbyApplicationSubmittedIntent(metadata Metadata, ownerUserID string, payload LobbyApplicationSubmittedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyApplicationSubmitted, ProducerGameLobby, AudienceKindUser, []string{ownerUserID}, metadata, payload)
|
|
}
|
|
|
|
// NewPublicLobbyApplicationSubmittedIntent builds the public-game admin-email
|
|
// intent published by Game Lobby when an application is submitted.
|
|
func NewPublicLobbyApplicationSubmittedIntent(metadata Metadata, payload LobbyApplicationSubmittedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyApplicationSubmitted, ProducerGameLobby, AudienceKindAdminEmail, nil, metadata, payload)
|
|
}
|
|
|
|
// NewLobbyMembershipApprovedIntent builds the applicant-user intent published
|
|
// by Game Lobby when membership is approved.
|
|
func NewLobbyMembershipApprovedIntent(metadata Metadata, applicantUserID string, payload LobbyMembershipApprovedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyMembershipApproved, ProducerGameLobby, AudienceKindUser, []string{applicantUserID}, metadata, payload)
|
|
}
|
|
|
|
// NewLobbyMembershipRejectedIntent builds the applicant-user intent published
|
|
// by Game Lobby when membership is rejected.
|
|
func NewLobbyMembershipRejectedIntent(metadata Metadata, applicantUserID string, payload LobbyMembershipRejectedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyMembershipRejected, ProducerGameLobby, AudienceKindUser, []string{applicantUserID}, metadata, payload)
|
|
}
|
|
|
|
// NewLobbyMembershipBlockedIntent builds the private-game owner intent
|
|
// published by Game Lobby when an active membership is blocked by the
|
|
// user-lifecycle cascade. ownerUserID is the recipient (private-game
|
|
// owner whose roster lost the affected member).
|
|
func NewLobbyMembershipBlockedIntent(metadata Metadata, ownerUserID string, payload LobbyMembershipBlockedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyMembershipBlocked, ProducerGameLobby, AudienceKindUser, []string{ownerUserID}, metadata, payload)
|
|
}
|
|
|
|
// NewLobbyInviteCreatedIntent builds the invited-user intent published by Game
|
|
// Lobby when a private-game invite is created.
|
|
func NewLobbyInviteCreatedIntent(metadata Metadata, invitedUserID string, payload LobbyInviteCreatedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyInviteCreated, ProducerGameLobby, AudienceKindUser, []string{invitedUserID}, metadata, payload)
|
|
}
|
|
|
|
// NewLobbyInviteRedeemedIntent builds the private-game owner intent published
|
|
// by Game Lobby when an invite is redeemed.
|
|
func NewLobbyInviteRedeemedIntent(metadata Metadata, ownerUserID string, payload LobbyInviteRedeemedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyInviteRedeemed, ProducerGameLobby, AudienceKindUser, []string{ownerUserID}, metadata, payload)
|
|
}
|
|
|
|
// NewLobbyInviteExpiredIntent builds the private-game owner intent published
|
|
// by Game Lobby when an invite expires.
|
|
func NewLobbyInviteExpiredIntent(metadata Metadata, ownerUserID string, payload LobbyInviteExpiredPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyInviteExpired, ProducerGameLobby, AudienceKindUser, []string{ownerUserID}, metadata, payload)
|
|
}
|
|
|
|
// NewLobbyRaceNameRegistrationEligibleIntent builds the capable-member intent
|
|
// published by Game Lobby at game finish when a reservation is promoted to
|
|
// `pending_registration`.
|
|
func NewLobbyRaceNameRegistrationEligibleIntent(metadata Metadata, recipientUserID string, payload LobbyRaceNameRegistrationEligiblePayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyRaceNameRegistrationEligible, ProducerGameLobby, AudienceKindUser, []string{recipientUserID}, metadata, payload)
|
|
}
|
|
|
|
// NewLobbyRaceNameRegisteredIntent builds the registering-user intent
|
|
// published by Game Lobby on successful `lobby.race_name.register` commit.
|
|
func NewLobbyRaceNameRegisteredIntent(metadata Metadata, recipientUserID string, payload LobbyRaceNameRegisteredPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyRaceNameRegistered, ProducerGameLobby, AudienceKindUser, []string{recipientUserID}, metadata, payload)
|
|
}
|
|
|
|
// NewLobbyRaceNameRegistrationDeniedIntent builds the incapable-member intent
|
|
// published by Game Lobby at game finish when a reservation is released
|
|
// without a pending-registration window.
|
|
func NewLobbyRaceNameRegistrationDeniedIntent(metadata Metadata, recipientUserID string, payload LobbyRaceNameRegistrationDeniedPayload) (Intent, error) {
|
|
return newIntent(NotificationTypeLobbyRaceNameRegistrationDenied, ProducerGameLobby, AudienceKindUser, []string{recipientUserID}, metadata, payload)
|
|
}
|