notifications

package
v0.0.0-...-9a3af51 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CleanupInterval time.Duration = time.Hour

The interval to clean unused promises and buy registrations.

View Source
var ErrInternal = fmt.Errorf("internal error")
View Source
var ExpiryDuration time.Duration = time.Hour * 24 * 28

The expiry duration is the time until a non-refreshed webhook url expires. Currently set to 4 weeks.

View Source
var File_notifications_proto protoreflect.FileDescriptor
View Source
var Notifications_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "notifications.Notifications",
	HandlerType: (*NotificationsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SubscribeNotifications",
			Handler:    _Notifications_SubscribeNotifications_Handler,
		},
		{
			MethodName: "UnsubscribeNotifications",
			Handler:    _Notifications_UnsubscribeNotifications_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "notifications.proto",
}

Notifications_ServiceDesc is the grpc.ServiceDesc for Notifications service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterNotificationsServer

func RegisterNotificationsServer(s grpc.ServiceRegistrar, srv NotificationsServer)

Types

type CleanupService

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

func NewCleanupService

func NewCleanupService(store Store) *CleanupService

func (*CleanupService) Start

func (c *CleanupService) Start(ctx context.Context)

Periodically cleans up expired webhook urls.

type EncryptedNotificationRequest

type EncryptedNotificationRequest struct {
	Blob []byte `protobuf:"bytes,1,opt,name=blob,proto3" json:"blob,omitempty"`
	// contains filtered or unexported fields
}

func (*EncryptedNotificationRequest) Descriptor deprecated

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

Deprecated: Use EncryptedNotificationRequest.ProtoReflect.Descriptor instead.

func (*EncryptedNotificationRequest) GetBlob

func (x *EncryptedNotificationRequest) GetBlob() []byte

func (*EncryptedNotificationRequest) ProtoMessage

func (*EncryptedNotificationRequest) ProtoMessage()

func (*EncryptedNotificationRequest) ProtoReflect

func (*EncryptedNotificationRequest) Reset

func (x *EncryptedNotificationRequest) Reset()

func (*EncryptedNotificationRequest) String

type NotificationService

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

func NewNotificationService

func NewNotificationService(store Store) *NotificationService

func (*NotificationService) Notify

func (s *NotificationService) Notify(
	pubkey string,
	paymenthash string,
) (bool, error)

func (*NotificationService) Start

func (s *NotificationService) Start(ctx context.Context)

type NotificationsClient

type NotificationsClient interface {
	SubscribeNotifications(ctx context.Context, in *EncryptedNotificationRequest, opts ...grpc.CallOption) (*SubscribeNotificationsReply, error)
	UnsubscribeNotifications(ctx context.Context, in *EncryptedNotificationRequest, opts ...grpc.CallOption) (*UnsubscribeNotificationsReply, error)
}

NotificationsClient is the client API for Notifications service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type NotificationsServer

type NotificationsServer interface {
	SubscribeNotifications(context.Context, *EncryptedNotificationRequest) (*SubscribeNotificationsReply, error)
	UnsubscribeNotifications(context.Context, *EncryptedNotificationRequest) (*UnsubscribeNotificationsReply, error)
	// contains filtered or unexported methods
}

NotificationsServer is the server API for Notifications service. All implementations must embed UnimplementedNotificationsServer for forward compatibility

func NewNotificationsServer

func NewNotificationsServer(store Store) NotificationsServer

type PaymentReceivedPayload

type PaymentReceivedPayload struct {
	Template string `json:"template" binding:"required,eq=payment_received"`
	Data     struct {
		PaymentHash string `json:"payment_hash" binding:"required"`
	} `json:"data"`
}

type Store

type Store interface {
	Register(ctx context.Context, pubkey string, url string) error
	GetRegistrations(ctx context.Context, pubkey string) ([]string, error)
	Unsubscribe(ctx context.Context, pubkey string, url string) error
	RemoveExpired(ctx context.Context, before time.Time) error
}

type SubscribeNotificationsReply

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

func (*SubscribeNotificationsReply) Descriptor deprecated

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

Deprecated: Use SubscribeNotificationsReply.ProtoReflect.Descriptor instead.

func (*SubscribeNotificationsReply) ProtoMessage

func (*SubscribeNotificationsReply) ProtoMessage()

func (*SubscribeNotificationsReply) ProtoReflect

func (*SubscribeNotificationsReply) Reset

func (x *SubscribeNotificationsReply) Reset()

func (*SubscribeNotificationsReply) String

func (x *SubscribeNotificationsReply) String() string

type SubscribeNotificationsRequest

type SubscribeNotificationsRequest struct {
	Url       string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	Signature string `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

func (*SubscribeNotificationsRequest) Descriptor deprecated

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

Deprecated: Use SubscribeNotificationsRequest.ProtoReflect.Descriptor instead.

func (*SubscribeNotificationsRequest) GetSignature

func (x *SubscribeNotificationsRequest) GetSignature() string

func (*SubscribeNotificationsRequest) GetUrl

func (*SubscribeNotificationsRequest) ProtoMessage

func (*SubscribeNotificationsRequest) ProtoMessage()

func (*SubscribeNotificationsRequest) ProtoReflect

func (*SubscribeNotificationsRequest) Reset

func (x *SubscribeNotificationsRequest) Reset()

func (*SubscribeNotificationsRequest) String

type UnimplementedNotificationsServer

type UnimplementedNotificationsServer struct {
}

UnimplementedNotificationsServer must be embedded to have forward compatible implementations.

type UnsafeNotificationsServer

type UnsafeNotificationsServer interface {
	// contains filtered or unexported methods
}

UnsafeNotificationsServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to NotificationsServer will result in compilation errors.

type UnsubscribeNotificationsReply

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

func (*UnsubscribeNotificationsReply) Descriptor deprecated

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

Deprecated: Use UnsubscribeNotificationsReply.ProtoReflect.Descriptor instead.

func (*UnsubscribeNotificationsReply) ProtoMessage

func (*UnsubscribeNotificationsReply) ProtoMessage()

func (*UnsubscribeNotificationsReply) ProtoReflect

func (*UnsubscribeNotificationsReply) Reset

func (x *UnsubscribeNotificationsReply) Reset()

func (*UnsubscribeNotificationsReply) String

type UnsubscribeNotificationsRequest

type UnsubscribeNotificationsRequest struct {
	Url       string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	Signature string `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

func (*UnsubscribeNotificationsRequest) Descriptor deprecated

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

Deprecated: Use UnsubscribeNotificationsRequest.ProtoReflect.Descriptor instead.

func (*UnsubscribeNotificationsRequest) GetSignature

func (x *UnsubscribeNotificationsRequest) GetSignature() string

func (*UnsubscribeNotificationsRequest) GetUrl

func (*UnsubscribeNotificationsRequest) ProtoMessage

func (*UnsubscribeNotificationsRequest) ProtoMessage()

func (*UnsubscribeNotificationsRequest) ProtoReflect

func (*UnsubscribeNotificationsRequest) Reset

func (*UnsubscribeNotificationsRequest) String

Jump to

Keyboard shortcuts

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