Documentation
¶
Index ¶
- func SendWeeklyAirdropPush(ctx context.Context, pusher Pusher, quarks uint64, users ...*commonpb.UserId) error
- type EventHandler
- type FCMClient
- type FCMPusher
- func (p *FCMPusher) SendBasicPushes(ctx context.Context, title, body string, users ...*commonpb.UserId) error
- func (p *FCMPusher) SendPushes(ctx context.Context, chatID *commonpb.ChatId, users []*commonpb.UserId, ...) error
- func (p *FCMPusher) SendSilentPushes(ctx context.Context, chatID *commonpb.ChatId, users []*commonpb.UserId, ...) error
- type NoOpPusher
- func (n *NoOpPusher) SendBasicPushes(_ context.Context, _, _ string, _ ...*commonpb.UserId) error
- func (n *NoOpPusher) SendPushes(_ context.Context, _ *commonpb.ChatId, _ []*commonpb.UserId, _, _ string, ...) error
- func (n *NoOpPusher) SendSilentPushes(_ context.Context, _ *commonpb.ChatId, _ []*commonpb.UserId, ...) error
- type Pusher
- type Server
- func (s *Server) AddToken(ctx context.Context, req *pushpb.AddTokenRequest) (*pushpb.AddTokenResponse, error)
- func (s *Server) DeleteToken(ctx context.Context, req *pushpb.DeleteTokenRequest) (*pushpb.DeleteTokenResponse, error)
- func (s *Server) DeleteTokens(ctx context.Context, req *pushpb.DeleteTokensRequest) (*pushpb.DeleteTokensResponse, error)
- type Token
- type TokenStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
func NewPushEventHandler ¶
type FCMClient ¶
type FCMClient interface {
SendEachForMulticast(ctx context.Context, message *messaging.MulticastMessage) (*messaging.BatchResponse, error)
}
type FCMPusher ¶
type FCMPusher struct {
// contains filtered or unexported fields
}
func NewFCMPusher ¶
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.
func (*FCMPusher) SendPushes ¶
type NoOpPusher ¶
type NoOpPusher struct{}
func (*NoOpPusher) SendBasicPushes ¶ added in v1.5.0
func (*NoOpPusher) SendPushes ¶
type Pusher ¶
type Pusher interface { SendBasicPushes(ctx context.Context, title, body string, users ...*commonpb.UserId) error // todo: these are likely going away with a new push stragey SendPushes(ctx context.Context, chatID *commonpb.ChatId, members []*commonpb.UserId, title, body string, sender *string, data map[string]string) error SendSilentPushes(ctx context.Context, chatID *commonpb.ChatId, members []*commonpb.UserId, data map[string]string) error }
type Server ¶
type Server struct { pushpb.UnimplementedPushServer // contains filtered or unexported fields }
func NewServer ¶
func NewServer(log *zap.Logger, auth auth.Authorizer, tokens TokenStore) *Server
func (*Server) AddToken ¶
func (s *Server) AddToken(ctx context.Context, req *pushpb.AddTokenRequest) (*pushpb.AddTokenResponse, error)
func (*Server) DeleteToken ¶
func (s *Server) DeleteToken(ctx context.Context, req *pushpb.DeleteTokenRequest) (*pushpb.DeleteTokenResponse, error)
func (*Server) DeleteTokens ¶
func (s *Server) DeleteTokens(ctx context.Context, req *pushpb.DeleteTokensRequest) (*pushpb.DeleteTokensResponse, error)
type Token ¶
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 // ClearTokens deletes all tokens for a user. ClearTokens(ctx context.Context, userID *commonpb.UserId) error }
Click to show internal directories.
Click to hide internal directories.