expose gonic name and version

closes #18
This commit is contained in:
sentriz
2020-01-21 13:40:50 +00:00
parent 2abd3cf70b
commit 4af1e43389

View File

@@ -3,6 +3,8 @@ package spec
import ( import (
"fmt" "fmt"
"time" "time"
"senan.xyz/g/gonic/version"
) )
var ( var (
@@ -14,6 +16,8 @@ type Response struct {
Status string `xml:"status,attr" json:"status"` Status string `xml:"status,attr" json:"status"`
Version string `xml:"version,attr" json:"version"` Version string `xml:"version,attr" json:"version"`
XMLNS string `xml:"xmlns,attr" json:"-"` XMLNS string `xml:"xmlns,attr" json:"-"`
Type string `xml:"type,attr" json:"type"`
GonicVersion string `xml:"gonicVersion,attr" json:"gonicVersion"`
Error *Error `xml:"error" json:"error,omitempty"` Error *Error `xml:"error" json:"error,omitempty"`
Albums *Albums `xml:"albumList" json:"albumList,omitempty"` Albums *Albums `xml:"albumList" json:"albumList,omitempty"`
AlbumsTwo *Albums `xml:"albumList2" json:"albumList2,omitempty"` AlbumsTwo *Albums `xml:"albumList2" json:"albumList2,omitempty"`
@@ -39,6 +43,8 @@ func NewResponse() *Response {
Status: "ok", Status: "ok",
XMLNS: xmlns, XMLNS: xmlns,
Version: apiVersion, Version: apiVersion,
Type: version.NAME,
GonicVersion: version.VERSION,
} }
} }
@@ -67,6 +73,8 @@ func NewError(code int, message string, a ...interface{}) *Response {
Code: code, Code: code,
Message: fmt.Sprintf(message, a...), Message: fmt.Sprintf(message, a...),
}, },
Type: version.NAME,
GonicVersion: version.VERSION,
} }
} }