notification

package
v0.87.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UUIDKey is the notification uuid in json.
	UUIDKey = "notification_uuid"
	// RequestReferenceUUIDKey is the json key for encoding the notification messages.
	RequestReferenceUUIDKey = "request_reference_uuid"
	// NameKey is the notification name key.
	NameKey = "notification_name"
)

Variables

This section is empty.

Functions

func EncodeMoneySocketNotification added in v0.63.0

func EncodeMoneySocketNotification(msg MoneysocketNotification, toEncode map[string]interface{}) error

EncodeMoneySocketNotification encodes a MoneysocketNotification to json. This is used by sub-structs and should not be called directly.

func FromText added in v0.54.0

func FromText(payload []byte) (base.MoneysocketMessage, base.MessageType, error)

FromText converts a json payload to a message.

Types

type BaseMoneySocketNotification

type BaseMoneySocketNotification struct {
	base.MoneysocketMessage
	// BaseNotificationUUID is the uuid for this message
	BaseNotificationUUID string
	// BaseRequestReferenceUUID is the request reference id
	BaseRequestReferenceUUID string
	// contains filtered or unexported fields
}

BaseMoneySocketNotification is the notification type.

func DecodeRequest

func DecodeRequest(request []byte) (b BaseMoneySocketNotification, err error)

DecodeRequest decodes a BaseMoneySocketNotification from json.

func NewBaseMoneySocketNotification

func NewBaseMoneySocketNotification(notificationType base.MessageType, requestUUID string) BaseMoneySocketNotification

NewBaseMoneySocketNotification creates a.

func (BaseMoneySocketNotification) MessageClass

MessageClass is the base.MessageClass of the notification. This is always notification.

func (BaseMoneySocketNotification) NotificationName

func (b BaseMoneySocketNotification) NotificationName() string

NotificationName gets the name of the notification (from the BaseMoneySocketNotification.RequestType).

func (BaseMoneySocketNotification) NotificationUUID added in v0.54.0

func (b BaseMoneySocketNotification) NotificationUUID() string

NotificationUUID returns the uuid of the notification.

func (BaseMoneySocketNotification) RequestReferenceUUID added in v0.54.0

func (b BaseMoneySocketNotification) RequestReferenceUUID() string

RequestReferenceUUID gets the uuid of the request.

func (BaseMoneySocketNotification) RequestType

RequestType is the base.MessageType of the Notification.

type Item

type Item struct {
	// ItemID is the items id
	ItemID string `json:"item_id"`
	// Name is the name of the item
	Name string `json:"name"`
	// Msats is the price of the item
	Msats int `json:"msats"`
}

Item is an item from the seller.

type MoneysocketNotification

type MoneysocketNotification interface {
	base.MoneysocketMessage
	// NotificationUUID gets the notification uuid
	NotificationUUID() string
	// RequestReferenceUUID gets the request reference uuid
	RequestReferenceUUID() string
	// NotificationName gets the notification name
	NotificationName() string
	// RequestType gets the request type
	RequestType() base.MessageType
}

MoneysocketNotification is a notification for a message.

type NotifyInvoice

type NotifyInvoice struct {
	BaseMoneySocketNotification
	Bolt11 string
}

NotifyInvoice gets a Bolt11 invoice from a payload.

func DecodeNotifyInvoice

func DecodeNotifyInvoice(payload []byte) (NotifyInvoice, error)

DecodeNotifyInvoice gets a NotifyInvoice from a payload.

func NewNotifyInvoice

func NewNotifyInvoice(bolt11, requestUUID string) NotifyInvoice

NewNotifyInvoice creates a NotifyInvoice bolt11/requestUUID.

func (NotifyInvoice) IsValid

func (o NotifyInvoice) IsValid() (bool, error)

IsValid determines if the NotifyInvoice is valid.

func (NotifyInvoice) MustBeClearText

func (o NotifyInvoice) MustBeClearText() bool

MustBeClearText says NotifyInvoice can be encrypted.

func (NotifyInvoice) ToJSON added in v0.54.0

func (o NotifyInvoice) ToJSON() ([]byte, error)

ToJSON gets a json payload from NotifyInvoice.

type NotifyOpinionInvoice

type NotifyOpinionInvoice struct {
	BaseMoneySocketNotification
	// Bolt11 is the bolt11 invoice
	Bolt11 string
}

NotifyOpinionInvoice message.

func DecodeNotifyOpinionInvoice

func DecodeNotifyOpinionInvoice(payload []byte) (NotifyOpinionInvoice, error)

DecodeNotifyOpinionInvoice creates a new NotifyOpinionInvoice from a payload.

func NewNotifyOpinionInvoice

func NewNotifyOpinionInvoice(requestUUID, bolt11 string) NotifyOpinionInvoice

NewNotifyOpinionInvoice creates a new NotifyOpinionInvoice message.

func (NotifyOpinionInvoice) ToJSON added in v0.54.0

func (n NotifyOpinionInvoice) ToJSON() ([]byte, error)

ToJSON converts a NotifyOpinionInvoice to a json payload.

type NotifyOpinionSeller

type NotifyOpinionSeller struct {
	BaseMoneySocketNotification
	// contains filtered or unexported fields
}

NotifyOpinionSeller is a message notifying an item from the seller.

func DecodeNotifyOpinionSeller

func DecodeNotifyOpinionSeller(payload []byte) (NotifyOpinionSeller, error)

DecodeNotifyOpinionSeller converts a json payload to a NotifyOpinionSeller message.

func NewNotifyOpinionSeller

func NewNotifyOpinionSeller(sellerUUID string, items []Item, requestReferenceUUID string) NotifyOpinionSeller

NewNotifyOpinionSeller creates an opinion seller message.

func (NotifyOpinionSeller) ToJSON added in v0.54.0

func (o NotifyOpinionSeller) ToJSON() ([]byte, error)

ToJSON encodes a NotifyOpinionSeller message to a json payload.

type NotifyOpinionSellerNotReady

type NotifyOpinionSellerNotReady struct {
	BaseMoneySocketNotification
}

NotifyOpinionSellerNotReady is.

func DecodeNotifyOpinionSellerNotReady

func DecodeNotifyOpinionSellerNotReady(payload []byte) (NotifyOpinionSellerNotReady, error)

DecodeNotifyOpinionSellerNotReady creates a NotifyOpinionSellerNotReady from a payload.

func NewNotifyOpinionSellerNotReady

func NewNotifyOpinionSellerNotReady(requestUUID string) NotifyOpinionSellerNotReady

NewNotifyOpinionSellerNotReady create a new NotifyOpinionSellerNotReady end notification with a given rendezvous id.

func (NotifyOpinionSellerNotReady) MustBeClearText

func (r NotifyOpinionSellerNotReady) MustBeClearText() bool

MustBeClearText determines a NotifyOpinionSellerNotReady.

func (NotifyOpinionSellerNotReady) ToJSON added in v0.54.0

func (r NotifyOpinionSellerNotReady) ToJSON() ([]byte, error)

ToJSON marshals a json payload from NotifyOpinionSellerNotReady.

type NotifyPong

type NotifyPong struct {
	BaseMoneySocketNotification
}

NotifyPong is the pong message.

func DecodeNotifyPong

func DecodeNotifyPong(payload []byte) (NotifyPong, error)

DecodeNotifyPong decodes a notify pong message from a json payload.

func NewNotifyPong

func NewNotifyPong(requestUUID string) NotifyPong

NewNotifyPong is the pong message.

func (NotifyPong) ToJSON added in v0.54.0

func (n NotifyPong) ToJSON() ([]byte, error)

ToJSON converts the notify pong into a json payload.

type NotifyPreimage

type NotifyPreimage struct {
	BaseMoneySocketNotification
	Preimage string
	Ext      string
}

NotifyPreimage is a notification that a preimage is ready.

func NewNotifyPreimage

func NewNotifyPreimage(preimage, ext, requestUUID string) NotifyPreimage

NewNotifyPreimage creates a notify preimages.

func (NotifyPreimage) IsValid

func (n NotifyPreimage) IsValid() (bool, error)

IsValid determines whether the notification is valid.

func (NotifyPreimage) MustBeClearText

func (n NotifyPreimage) MustBeClearText() bool

MustBeClearText determines wether the message must be clear text.

func (NotifyPreimage) ToJSON added in v0.54.0

func (n NotifyPreimage) ToJSON() ([]byte, error)

ToJSON converts the message to json.

type NotifyProvider

type NotifyProvider struct {
	BaseMoneySocketNotification
	// AccountUUID
	AccountUUID string
	// Payer is the provider pay outgoing invoice
	Payer bool
	// Payee is the provider generates invoices for incoming payments
	Payee bool
	// Wad is the balance to advertise as being available
	Wad wad.Wad
}

NotifyProvider notifies a provider is ready.

func NewNotifyProvider

func NewNotifyProvider(accountUUID string, payer, payee bool, wad wad.Wad, requestUUID string) NotifyProvider

NewNotifyProvider creates a NotifyProvider notification.

func (NotifyProvider) MustBeClearText

func (n NotifyProvider) MustBeClearText() bool

MustBeClearText is always false for NotifyProvider messages.

func (NotifyProvider) ToJSON added in v0.54.0

func (n NotifyProvider) ToJSON() ([]byte, error)

ToJSON converts a message to a json payload.

type NotifyProviderNotReady

type NotifyProviderNotReady struct {
	BaseMoneySocketNotification
}

NotifyProviderNotReady notifies a provider is not messaged.

func DecodeNotifyProviderNotReady

func DecodeNotifyProviderNotReady(payload []byte) (NotifyProviderNotReady, error)

DecodeNotifyProviderNotReady unmarshalls json into a NotifyProviderNotReady message.

func NewNotifyProviderNotReady

func NewNotifyProviderNotReady(requestUUID string) NotifyProviderNotReady

NewNotifyProviderNotReady creates a message that a provider is not ready.

func (NotifyProviderNotReady) ToJSON added in v0.54.0

func (n NotifyProviderNotReady) ToJSON() ([]byte, error)

ToJSON marshalls a NotifyProviderNotReady message into a json payload.

type Rendezvous

type Rendezvous struct {
	BaseMoneySocketNotification
	// contains filtered or unexported fields
}

Rendezvous notifies that a rendezvous is ready by id.

func DecodeRendezvous

func DecodeRendezvous(payload []byte) (Rendezvous, error)

DecodeRendezvous decodes a Rendezvous notification from json.

func NewNotifyRendezvous

func NewNotifyRendezvous(rid, requestUUID string) Rendezvous

NewNotifyRendezvous creates a new rendezvous end notification with a given rendezvous id.

func (Rendezvous) MustBeClearText

func (r Rendezvous) MustBeClearText() bool

MustBeClearText text denotes a Rendezvous can be clear text.

func (Rendezvous) ToJSON added in v0.54.0

func (r Rendezvous) ToJSON() ([]byte, error)

ToJSON converts a Rendezvous notification to json.

type RendezvousEnd

type RendezvousEnd struct {
	BaseMoneySocketNotification
	// contains filtered or unexported fields
}

RendezvousEnd ends a rendezvous of a given id.

func DecodeRendezvousEnd

func DecodeRendezvousEnd(payload []byte) (RendezvousEnd, error)

DecodeRendezvousEnd decodes a rendezvous message.

func NewRendezvousEnd

func NewRendezvousEnd(rid, requestUUID string) RendezvousEnd

NewRendezvousEnd creates a new rendezvous end notification with a given rendezvous id.

func (RendezvousEnd) MustBeClearText

func (r RendezvousEnd) MustBeClearText() bool

MustBeClearText determines wether or not the message must be clear text.

func (RendezvousEnd) ToJSON added in v0.54.0

func (r RendezvousEnd) ToJSON() ([]byte, error)

ToJSON converts a RendezvousEnd message to a json payload.

type RendezvousNotReady

type RendezvousNotReady struct {
	BaseMoneySocketNotification
	// contains filtered or unexported fields
}

RendezvousNotReady is a message saying a given rendezvous is not ready.

func DecodeRendezvousNotReady

func DecodeRendezvousNotReady(payload []byte) (RendezvousNotReady, error)

DecodeRendezvousNotReady converts the payload to RendezvousNotReady.

func NewRendezvousNotReady

func NewRendezvousNotReady(rid, requestUUID string) RendezvousNotReady

NewRendezvousNotReady creates a new rendezvous end notification with a given rendezvous id.

func (RendezvousNotReady) MustBeClearText

func (r RendezvousNotReady) MustBeClearText() bool

MustBeClearText is wether or not the message is clear.

func (RendezvousNotReady) ToJSON added in v0.54.0

func (r RendezvousNotReady) ToJSON() ([]byte, error)

ToJSON converts the message to json.

Jump to

Keyboard shortcuts

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