mirror of
https://github.com/muun/recovery.git
synced 2025-02-23 11:32:33 -05:00
38 lines
673 B
Go
38 lines
673 B
Go
|
package lnurl
|
||
|
|
||
|
import (
|
||
|
"net/url"
|
||
|
)
|
||
|
|
||
|
// The base response for all lnurl calls.
|
||
|
type LNURLResponse struct {
|
||
|
Status string `json:"status,omitempty"`
|
||
|
Reason string `json:"reason,omitempty"`
|
||
|
}
|
||
|
|
||
|
type LNURLErrorResponse struct {
|
||
|
Status string `json:"status,omitempty"`
|
||
|
Reason string `json:"reason,omitempty"`
|
||
|
URL *url.URL `json:"-"`
|
||
|
}
|
||
|
|
||
|
func (r LNURLErrorResponse) Error() string {
|
||
|
return r.Reason
|
||
|
}
|
||
|
|
||
|
func OkResponse() LNURLResponse {
|
||
|
return LNURLResponse{Status: "OK"}
|
||
|
}
|
||
|
|
||
|
func ErrorResponse(reason string) LNURLErrorResponse {
|
||
|
return LNURLErrorResponse{
|
||
|
URL: nil,
|
||
|
Status: "ERROR",
|
||
|
Reason: reason,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
type LNURLParams interface {
|
||
|
LNURLKind() string
|
||
|
}
|