request

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestUuidKey = "request_uuid"
	RequestNameKey = "request_name"
)

Variables

This section is empty.

Functions

func EncodeMoneysocketRequest

func EncodeMoneysocketRequest(msg MoneysocketRequest, toEncode map[string]interface{}) error

create a moneysocket request

func RequestFromText

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

handling it this way is idiotic.

Types

type BaseMoneySocketRequest

type BaseMoneySocketRequest struct {
	base.BaseMoneysocketMessage
	BaseUuid    string
	RequestType base.MessageType
}

func DecodeRequest

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

func NewBaseMoneySocketRequest

func NewBaseMoneySocketRequest(requestType base.MessageType) BaseMoneySocketRequest

generate a new base moneysocket request. Should only be used by other message classes

func (BaseMoneySocketRequest) MessageClass

func (b BaseMoneySocketRequest) MessageClass() base.MessageClass

func (BaseMoneySocketRequest) MessageType

func (b BaseMoneySocketRequest) MessageType() base.MessageType

get the message type

func (BaseMoneySocketRequest) RequestName

func (b BaseMoneySocketRequest) RequestName() string

func (BaseMoneySocketRequest) Uuid

func (b BaseMoneySocketRequest) Uuid() string

type MoneysocketRequest

type MoneysocketRequest interface {
	base.MoneysocketMessage
	Uuid() string
	RequestName() string
	MessageType() base.MessageType
}

type PingRequest

type PingRequest struct {
	BaseMoneySocketRequest
}

func DecodePing

func DecodePing(payload []byte) (PingRequest, error)

func NewPingRequest

func NewPingRequest() PingRequest

func (PingRequest) ToJson

func (p PingRequest) ToJson() ([]byte, error)

type RequestInvoice

type RequestInvoice struct {
	BaseMoneySocketRequest
	Msats int64
}

func DecodeRequestInvoice

func DecodeRequestInvoice(payload []byte) (r RequestInvoice, err error)

turn a byte slice into a request invoice, return an error if not possible

func NewRequestInvoice

func NewRequestInvoice(msats int64) RequestInvoice

func (RequestInvoice) ToJson

func (r RequestInvoice) ToJson() ([]byte, error)

type RequestOpinionInvoice

type RequestOpinionInvoice struct {
	BaseMoneySocketRequest
	ItemId string
}

func DecodeRequestOpinionInvoice

func DecodeRequestOpinionInvoice(payload []byte) (r RequestOpinionInvoice, err error)

func NewRequestOpinionInvoice

func NewRequestOpinionInvoice(itemId, requestUuid string) RequestOpinionInvoice

func (RequestOpinionInvoice) ToJson

func (r RequestOpinionInvoice) ToJson() ([]byte, error)

type RequestPay

type RequestPay struct {
	BaseMoneySocketRequest
	Bolt11 string
}

func DecodeRequestPay

func DecodeRequestPay(payload []byte) (r RequestPay, err error)

func NewRequestPay

func NewRequestPay(bolt11 string) RequestPay

create a new request pay with a given bolt 11 bolt 11 is not validated client (moneysocket) side

func (RequestPay) ToJson

func (r RequestPay) ToJson() ([]byte, error)

type RequestProvider

type RequestProvider struct {
	BaseMoneySocketRequest
}

func DecodeRequestProvider

func DecodeRequestProvider(payload []byte) (RequestProvider, error)

decode a request provider from json

func NewRequestProvider

func NewRequestProvider() RequestProvider

func (RequestProvider) ToJson

func (rp RequestProvider) ToJson() ([]byte, error)

encode a request provider to json

type RequestRendezvous

type RequestRendezvous struct {
	BaseMoneySocketRequest
	// the id of the rendezvous we're requesting (normally derived  from the shared seed)
	RendezvousId string
}

func DecodeRendezvousRequest

func DecodeRendezvousRequest(payload []byte) (r RequestRendezvous, err error)

func NewRendezvousRequest

func NewRendezvousRequest(id string) RequestRendezvous

request the server start a rendezvous w/ a given rendezvous id

func (RequestRendezvous) MustBeClearText

func (r RequestRendezvous) MustBeClearText() bool

func (RequestRendezvous) ToJson

func (r RequestRendezvous) ToJson() ([]byte, error)

Jump to

Keyboard shortcuts

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