push

package
v1.13.28 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendFlipcashCurrencyReceivedFromDepositPush added in v1.13.28

func SendFlipcashCurrencyReceivedFromDepositPush(ctx context.Context, pusher Pusher, user *commonpb.UserId, currencyName string, usdMarketValue float64) error

func SendFlipcashCurrencyReceivedFromSwapPush added in v1.13.28

func SendFlipcashCurrencyReceivedFromSwapPush(ctx context.Context, pusher Pusher, user *commonpb.UserId, currencyName string, region codecurrency.Code, nativeAmount float64) error

func SendLostBettingPoolPushes added in v1.8.20

func SendLostBettingPoolPushes(ctx context.Context, pusher Pusher, poolName string, amountLost *commonpb.FiatPaymentAmount, losers ...*commonpb.UserId) error

func SendTieBettingPoolPushes added in v1.10.3

func SendTieBettingPoolPushes(ctx context.Context, pusher Pusher, poolName string, participants ...*commonpb.UserId) error

func SendUsdcReceivedFromDepositPush added in v1.13.28

func SendUsdcReceivedFromDepositPush(ctx context.Context, pusher Pusher, user *commonpb.UserId, usdMarketValue float64) error

func SendUsdcReceivedFromSwapPush added in v1.13.28

func SendUsdcReceivedFromSwapPush(ctx context.Context, pusher Pusher, user *commonpb.UserId, region codecurrency.Code, nativeAmount float64) error

func SendWinBettingPoolPushes added in v1.8.20

func SendWinBettingPoolPushes(ctx context.Context, pusher Pusher, poolName string, amountWon *commonpb.FiatPaymentAmount, winners ...*commonpb.UserId) error

Types

type FCMClient added in v1.5.0

type FCMClient interface {
	SendEachForMulticast(ctx context.Context, message *messaging.MulticastMessage) (*messaging.BatchResponse, error)
}

type FCMPusher added in v1.5.0

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

func NewFCMPusher added in v1.5.0

func NewFCMPusher(log *zap.Logger, tokens TokenStore, client FCMClient) *FCMPusher

func (*FCMPusher) SendBasicPushes added in v1.5.0

func (p *FCMPusher) SendBasicPushes(ctx context.Context, title, body string, users ...*commonpb.UserId) error

todo: Some duplicated code, but the existing push per message flow is likely going away anyways. We'll refactor when we get to that.

type NoOpPusher added in v1.5.0

type NoOpPusher struct{}

func (*NoOpPusher) SendBasicPushes added in v1.5.0

func (n *NoOpPusher) SendBasicPushes(_ context.Context, _, _ string, _ ...*commonpb.UserId) error

type Pusher added in v1.5.0

type Pusher interface {
	SendBasicPushes(ctx context.Context, title, body string, users ...*commonpb.UserId) error
}

func NewNoOpPusher added in v1.8.20

func NewNoOpPusher() Pusher

type Server

type Server struct {
	pushpb.UnimplementedPushServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(log *zap.Logger, authz auth.Authorizer, tokens TokenStore) *Server

func (*Server) AddToken

func (*Server) DeleteTokens

type Token

type Token struct {
	Type         pushpb.TokenType
	Token        string
	AppInstallID string
}

Token represents a push notification token.

Tokens are bound to a (user, device) pair, identified by the AppInstallID.

type TokenStore

type TokenStore interface {
	// GetTokens returns all tokens for a user.
	GetTokens(ctx context.Context, userID *commonpb.UserId) ([]Token, error)

	// GetTokensBatch returns all tokens for a batch of users.
	GetTokensBatch(ctx context.Context, userIDs ...*commonpb.UserId) ([]Token, error)

	// AddToken adds a token for a user.
	//
	// If the token already exists for the same user and device, it will be updated.
	AddToken(ctx context.Context, userID *commonpb.UserId, appInstallID *commonpb.AppInstallId, tokenType pushpb.TokenType, token string) error

	// DeleteToken deletes a token for a user.
	DeleteToken(ctx context.Context, tokenType pushpb.TokenType, token string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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