v2controllers

package
v0.0.0-...-9551b9e Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddInvoiceRequestBody

type AddInvoiceRequestBody struct {
	Amount          int64  `json:"amount" validate:"gte=0"`
	Description     string `json:"description"`
	DescriptionHash string `json:"description_hash" validate:"omitempty,hexadecimal,len=64"`
}

type AddInvoiceResponseBody

type AddInvoiceResponseBody struct {
	PaymentHash    string    `json:"payment_hash"`
	PaymentRequest string    `json:"payment_request"`
	ExpiresAt      time.Time `json:"expires_at"`
	CreatedAt      time.Time `json:"created_at"`
}

type BalanceController

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

BalanceController : BalanceController struct

func NewBalanceController

func NewBalanceController(svc *service.LndhubService) *BalanceController

func (*BalanceController) Balance

func (controller *BalanceController) Balance(c echo.Context) error

Balance godoc @Summary Retrieve balance @Description Current user's balance in satoshi @Accept json @Produce json @Tags Account @Success 200 {object} BalanceResponse @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /v2/balance [get] @Security OAuth2Password

type BalanceResponse

type BalanceResponse struct {
	Balance  int64  `json:"balance"`
	Currency string `json:"currency"`
	Unit     string `json:"unit"`
}

type CreateUserController

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

CreateUserController : Create user controller struct

func NewCreateUserController

func NewCreateUserController(svc *service.LndhubService) *CreateUserController

func (*CreateUserController) CreateUser

func (controller *CreateUserController) CreateUser(c echo.Context) error

CreateUser godoc @Summary Create an account @Description Create a new account with a login and password @Accept json @Produce json @Tags Account @Param account body CreateUserRequestBody false "Create User" @Success 200 {object} CreateUserResponseBody @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /v2/users [post]

type CreateUserRequestBody

type CreateUserRequestBody struct {
	Login    string `json:"login"`
	Password string `json:"password"`
}

type CreateUserResponseBody

type CreateUserResponseBody struct {
	Login    string `json:"login"`
	Password string `json:"password"`
	ID       int64  `json:"id"`
}

type Invoice

type Invoice struct {
	PaymentHash     string            `json:"payment_hash"`
	PaymentRequest  string            `json:"payment_request"`
	Description     string            `json:"description"`
	DescriptionHash string            `json:"description_hash,omitempty"`
	PaymentPreimage string            `json:"payment_preimage,omitempty"`
	Destination     string            `json:"destination"`
	Amount          int64             `json:"amount"`
	Fee             int64             `json:"fee"`
	Status          string            `json:"status"`
	Type            string            `json:"type"`
	ErrorMessage    string            `json:"error_message,omitempty"`
	SettledAt       time.Time         `json:"settled_at"`
	ExpiresAt       time.Time         `json:"expires_at"`
	IsPaid          bool              `json:"is_paid"`
	Keysend         bool              `json:"keysend"`
	CustomRecords   map[uint64][]byte `json:"custom_records,omitempty"`
}

type InvoiceController

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

InvoiceController : Add invoice controller struct

func NewInvoiceController

func NewInvoiceController(svc *service.LndhubService) *InvoiceController

func (*InvoiceController) AddInvoice

func (controller *InvoiceController) AddInvoice(c echo.Context) error

AddInvoice godoc @Summary Generate a new invoice @Description Returns a new bolt11 invoice @Accept json @Produce json @Tags Invoice @Param invoice body AddInvoiceRequestBody True "Add Invoice" @Success 200 {object} AddInvoiceResponseBody @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /v2/invoices [post] @Security OAuth2Password

func (*InvoiceController) GetIncomingInvoices

func (controller *InvoiceController) GetIncomingInvoices(c echo.Context) error

GetIncomingInvoices godoc @Summary Retrieve incoming invoices @Description Returns a list of incoming invoices for a user @Accept json @Produce json @Tags Invoice @Success 200 {object} []Invoice @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /v2/invoices/incoming [get] @Security OAuth2Password

func (*InvoiceController) GetInvoice

func (controller *InvoiceController) GetInvoice(c echo.Context) error

GetInvoice godoc @Summary Get a specific invoice @Description Retrieve information about a specific invoice by payment hash @Accept json @Produce json @Tags Invoice @Param payment_hash path string true "Payment hash" @Success 200 {object} Invoice @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /v2/invoices/{payment_hash} [get] @Security OAuth2Password

func (*InvoiceController) GetOutgoingInvoices

func (controller *InvoiceController) GetOutgoingInvoices(c echo.Context) error

GetOutgoingInvoices godoc @Summary Retrieve outgoing payments @Description Returns a list of outgoing payments for a user @Accept json @Produce json @Tags Invoice @Success 200 {object} []Invoice @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /v2/invoices/outgoing [get] @Security OAuth2Password

type KeySendController

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

KeySendController : Key send controller struct

func NewKeySendController

func NewKeySendController(svc *service.LndhubService) *KeySendController

func (*KeySendController) KeySend

func (controller *KeySendController) KeySend(c echo.Context) error

// KeySend godoc @Summary Make a keysend payment @Description Pay a node without an invoice using it's public key @Accept json @Produce json @Tags Payment @Param KeySendRequestBody body KeySendRequestBody True "Invoice to pay" @Success 200 {object} KeySendResponseBody @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /v2/payments/keysend [post] @Security OAuth2Password

func (*KeySendController) MultiKeySend

func (controller *KeySendController) MultiKeySend(c echo.Context) error

// MultiKeySend godoc @Summary Make multiple keysend payments @Description Pay multiple nodes without an invoice using their public key @Accept json @Produce json @Tags Payment @Param MultiKeySendRequestBody body MultiKeySendRequestBody True "Invoice to pay" @Success 200 {object} MultiKeySendResponseBody @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /v2/payments/keysend/multi [post] @Security OAuth2Password

func (*KeySendController) SingleKeySend

func (controller *KeySendController) SingleKeySend(ctx context.Context, reqBody *KeySendRequestBody, userID int64) (result *KeySendResponseBody, resp *responses.ErrorResponse)

type KeySendRequestBody

type KeySendRequestBody struct {
	Amount                  int64             `json:"amount" validate:"required,gt=0"`
	Destination             string            `json:"destination" validate:"required"`
	Memo                    string            `json:"memo" validate:"omitempty"`
	DeprecatedCustomRecords map[string]string `json:"customRecords" validate:"omitempty"`
	CustomRecords           map[string]string `json:"custom_records" validate:"omitempty"`
}

type KeySendResponseBody

type KeySendResponseBody struct {
	Amount          int64             `json:"amount"`
	Fee             int64             `json:"fee"`
	Description     string            `json:"description,omitempty"`
	DescriptionHash string            `json:"description_hash,omitempty"`
	Destination     string            `json:"destination,omitempty"`
	CustomRecords   map[string]string `json:"custom_records" validate:"omitempty"`
	PaymentPreimage string            `json:"payment_preimage,omitempty"`
	PaymentHash     string            `json:"payment_hash,omitempty"`
}

type KeySendResult

type KeySendResult struct {
	Keysend *KeySendResponseBody     `json:"keysend,omitempty"`
	Error   *responses.ErrorResponse `json:"error,omitempty"`
}

type MultiKeySendRequestBody

type MultiKeySendRequestBody struct {
	Keysends []KeySendRequestBody `json:"keysends"`
}

type MultiKeySendResponseBody

type MultiKeySendResponseBody struct {
	Keysends []KeySendResult `json:"keysends"`
}

type PayInvoiceController

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

PayInvoiceController : Pay invoice controller struct

func NewPayInvoiceController

func NewPayInvoiceController(svc *service.LndhubService) *PayInvoiceController

func (*PayInvoiceController) PayInvoice

func (controller *PayInvoiceController) PayInvoice(c echo.Context) error

PayInvoice godoc @Summary Pay an invoice @Description Pay a bolt11 invoice @Accept json @Produce json @Tags Payment @Param PayInvoiceRequest body PayInvoiceRequestBody True "Invoice to pay" @Success 200 {object} PayInvoiceResponseBody @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /v2/payments/bolt11 [post] @Security OAuth2Password

type PayInvoiceRequestBody

type PayInvoiceRequestBody struct {
	Invoice string `json:"invoice" validate:"required"`
	Amount  int64  `json:"amount" validate:"omitempty,gte=0"`
}

type PayInvoiceResponseBody

type PayInvoiceResponseBody struct {
	PaymentRequest  string `json:"payment_request,omitempty"`
	Amount          int64  `json:"amount,omitempty"`
	Fee             int64  `json:"fee"`
	Description     string `json:"description,omitempty"`
	DescriptionHash string `json:"description_hash,omitempty"`
	Destination     string `json:"destination,omitempty"`
	PaymentPreimage string `json:"payment_preimage,omitempty"`
	PaymentHash     string `json:"payment_hash,omitempty"`
}

type UpdateUserController

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

UpdateUserController : Update user controller struct

func NewUpdateUserController

func NewUpdateUserController(svc *service.LndhubService) *UpdateUserController

func (*UpdateUserController) UpdateUser

func (controller *UpdateUserController) UpdateUser(c echo.Context) error

UpdateUser godoc @Summary Update an account @Description Update an account with a new a login, password and activation status. Requires Authorization header with admin token. @Accept json @Produce json @Tags Account @Param account body UpdateUserRequestBody false "Update User" @Success 200 {object} UpdateUserResponseBody @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /v2/admin/users [put]

type UpdateUserRequestBody

type UpdateUserRequestBody struct {
	Login       *string `json:"login,omitempty"`
	Password    *string `json:"password,omitempty"`
	Deactivated *bool   `json:"deactivated,omitempty"`
	Deleted     *bool   `json:"deleted,omitempty"`
	ID          int64   `json:"id" validate:"required"`
}

type UpdateUserResponseBody

type UpdateUserResponseBody struct {
	Login       string `json:"login"`
	Deactivated bool   `json:"deactivated"`
	Deleted     bool   `json:"deleted"`
	ID          int64  `json:"id"`
}

Jump to

Keyboard shortcuts

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