Documentation ¶
Index ¶
- Constants
- Variables
- func AuthorizationMiddleware(database *gorm.DB, authType AuthType, accessType AccessKeyType, ...) http.HandlerFunc
- func LoggingMiddleware(prefix string, next http.HandlerFunc) http.HandlerFunc
- func NotFoundHandler(writer http.ResponseWriter, err error)
- func Proxy(wr http.ResponseWriter, req *http.Request, rawUrl string) error
- func RespondError(w http.ResponseWriter, message string)
- func WriteResponse(writer http.ResponseWriter, response interface{}) error
- type AccessKeyType
- type AuthType
- type BalanceResponse
- type CreateInvoiceRequest
- type CreateInvoiceResponse
- type ErrorResponse
- type InvoiceStatusResponse
- type InvoiceStream
- type PayInvoiceRequest
- type Server
- func (w *Server) AppendAuthorizedRoute(path string, authType AuthType, accessType AccessKeyType, database *gorm.DB, ...)
- func (w *Server) AppendRoute(path string, handler func(http.ResponseWriter, *http.Request), ...)
- func (w *Server) ListenAndServe()
- func (w *Server) PathPrefix(path string, handler http.Handler)
- type Service
- func (s Service) Balance(w http.ResponseWriter, r *http.Request)
- func (s Service) CreateInvoice(w http.ResponseWriter, r *http.Request)
- func (s Service) InvoiceStatus(w http.ResponseWriter, r *http.Request)
- func (s Service) InvoiceStream(w http.ResponseWriter, r *http.Request)
- func (s Service) PayInvoice(w http.ResponseWriter, r *http.Request)
- func (s Service) PaymentStatus(w http.ResponseWriter, r *http.Request)
Constants ¶
View Source
const ( StatusError = "ERROR" StatusOk = "OK" )
Variables ¶
View Source
var AccessKeyTypeAdmin = AccessKeyType{Type: "admin"}
View Source
var AccessKeyTypeInvoice = AccessKeyType{Type: "invoice"}
View Source
var AccessKeyTypeNone = AccessKeyType{Type: "none"} // no authorization required
View Source
var AuthTypeBasic = AuthType{Type: "Basic"}
View Source
var AuthTypeBearerBase64 = AuthType{Type: "Bearer", Decoder: base64.StdEncoding.DecodeString}
View Source
var AuthTypeNone = AuthType{}
Functions ¶
func AuthorizationMiddleware ¶
func AuthorizationMiddleware(database *gorm.DB, authType AuthType, accessType AccessKeyType, next http.HandlerFunc) http.HandlerFunc
func LoggingMiddleware ¶
func LoggingMiddleware(prefix string, next http.HandlerFunc) http.HandlerFunc
func NotFoundHandler ¶
func NotFoundHandler(writer http.ResponseWriter, err error)
func RespondError ¶
func RespondError(w http.ResponseWriter, message string)
func WriteResponse ¶
func WriteResponse(writer http.ResponseWriter, response interface{}) error
Types ¶
type BalanceResponse ¶
type BalanceResponse struct {
Balance int64 `json:"balance"`
}
type CreateInvoiceRequest ¶
type CreateInvoiceResponse ¶
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"error"`
}
type InvoiceStatusResponse ¶
type InvoiceStream ¶
type InvoiceStream struct { CheckingID string `json:"checking_id"` Pending bool `json:"pending"` Amount int `json:"amount"` Fee int `json:"fee"` Memo string `json:"memo"` Time int `json:"time"` Bolt11 string `json:"bolt11"` Preimage string `json:"preimage"` PaymentHash string `json:"payment_hash"` Extra struct { } `json:"extra"` WalletID string `json:"wallet_id"` Webhook string `json:"webhook"` WebhookStatus interface{} `json:"webhook_status"` }
type PayInvoiceRequest ¶
type PayInvoiceRequest struct {
PayRequest string `json:"pay_req"`
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AppendAuthorizedRoute ¶
func (*Server) AppendRoute ¶
func (*Server) ListenAndServe ¶
func (w *Server) ListenAndServe()
type Service ¶
func (Service) CreateInvoice ¶
func (s Service) CreateInvoice(w http.ResponseWriter, r *http.Request)
func (Service) InvoiceStatus ¶
func (s Service) InvoiceStatus(w http.ResponseWriter, r *http.Request)
InvoiceStatus
func (Service) InvoiceStream ¶
func (s Service) InvoiceStream(w http.ResponseWriter, r *http.Request)
func (Service) PayInvoice ¶
func (s Service) PayInvoice(w http.ResponseWriter, r *http.Request)
func (Service) PaymentStatus ¶
func (s Service) PaymentStatus(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.