notifications

package
v0.0.0-...-545bd39 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthService        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowService          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group")
)

Functions

func RegisterNotificationsServiceServer

func RegisterNotificationsServiceServer(s grpc1.Server, srv NotificationsServiceServer)

Types

type Database

type Database interface {
	GetApp(appID string) (*types.Application, bool, error)

	GetAppNotificationsRateLimit(appID string) (uint64, error)
	GetAppNotificationsCount(appID string) (uint64, error)
}

type Firebase

type Firebase interface {
	SendNotificationToUsers(application *types.Application, usersAddresses []string, notification *types.Notification) error
}

type Handler

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

func NewHandler

func NewHandler(firebase Firebase, db Database) *Handler

NewHandler allows to build a new Handler instance

func (*Handler) HandleSendNotificationRequest

func (h *Handler) HandleSendNotificationRequest(req *SendAppNotificationRequest) error

HandleSendNotificationRequest handles the request to send a new notification

type NotificationsServiceClient

type NotificationsServiceClient interface {
	SendNotification(ctx context.Context, in *SendNotificationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

NotificationsServiceClient is the client API for NotificationsService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewNotificationsServiceClient

func NewNotificationsServiceClient(cc grpc1.ClientConn) NotificationsServiceClient

type NotificationsServiceServer

type NotificationsServiceServer interface {
	SendNotification(context.Context, *SendNotificationRequest) (*emptypb.Empty, error)
}

NotificationsServiceServer is the server API for NotificationsService service.

type SendAppNotificationRequest

type SendAppNotificationRequest struct {
	AppID         string
	UserAddresses []string
	Notification  *types.Notification
}

func NewSendAppNotificationRequest

func NewSendAppNotificationRequest(appID string, userAddresses []string, notification *types.Notification) *SendAppNotificationRequest

func (SendAppNotificationRequest) Validate

func (r SendAppNotificationRequest) Validate() error

type SendNotificationRequest

type SendNotificationRequest struct {
	// UserAddresses represent the addresses of the users to which send the
	// notification
	UserAddresses []string `protobuf:"bytes,1,rep,name=user_addresses,json=userAddresses,proto3" json:"user_addresses,omitempty"`
	// Notification contains the JSON-encoded data of the notification to be sent.
	Notification []byte `protobuf:"bytes,2,opt,name=notification,proto3" json:"notification,omitempty"`
}

func (*SendNotificationRequest) Descriptor

func (*SendNotificationRequest) Descriptor() ([]byte, []int)

func (*SendNotificationRequest) GetNotification

func (m *SendNotificationRequest) GetNotification() []byte

func (*SendNotificationRequest) GetUserAddresses

func (m *SendNotificationRequest) GetUserAddresses() []string

func (*SendNotificationRequest) Marshal

func (m *SendNotificationRequest) Marshal() (dAtA []byte, err error)

func (*SendNotificationRequest) MarshalTo

func (m *SendNotificationRequest) MarshalTo(dAtA []byte) (int, error)

func (*SendNotificationRequest) MarshalToSizedBuffer

func (m *SendNotificationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SendNotificationRequest) ProtoMessage

func (*SendNotificationRequest) ProtoMessage()

func (*SendNotificationRequest) Reset

func (m *SendNotificationRequest) Reset()

func (*SendNotificationRequest) Size

func (m *SendNotificationRequest) Size() (n int)

func (*SendNotificationRequest) String

func (m *SendNotificationRequest) String() string

func (*SendNotificationRequest) Unmarshal

func (m *SendNotificationRequest) Unmarshal(dAtA []byte) error

func (*SendNotificationRequest) XXX_DiscardUnknown

func (m *SendNotificationRequest) XXX_DiscardUnknown()

func (*SendNotificationRequest) XXX_Marshal

func (m *SendNotificationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SendNotificationRequest) XXX_Merge

func (m *SendNotificationRequest) XXX_Merge(src proto.Message)

func (*SendNotificationRequest) XXX_Size

func (m *SendNotificationRequest) XXX_Size() int

func (*SendNotificationRequest) XXX_Unmarshal

func (m *SendNotificationRequest) XXX_Unmarshal(b []byte) error

type Server

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

func NewServer

func NewServer(handler *Handler) *Server

func NewServerFromEnvVariables

func NewServerFromEnvVariables(firebase Firebase, db Database) *Server

func (Server) SendNotification

func (s Server) SendNotification(ctx context.Context, request *SendNotificationRequest) (*emptypb.Empty, error)

type UnimplementedNotificationsServiceServer

type UnimplementedNotificationsServiceServer struct {
}

UnimplementedNotificationsServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedNotificationsServiceServer) SendNotification

Directories

Path Synopsis
Package testutils is a generated GoMock package.
Package testutils is a generated GoMock package.

Jump to

Keyboard shortcuts

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