@@ -3,6 +3,8 @@ package spec
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"senan.xyz/g/gonic/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -11,34 +13,38 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Response struct {
|
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:"-"`
|
||||||
Error *Error `xml:"error" json:"error,omitempty"`
|
Type string `xml:"type,attr" json:"type"`
|
||||||
Albums *Albums `xml:"albumList" json:"albumList,omitempty"`
|
GonicVersion string `xml:"gonicVersion,attr" json:"gonicVersion"`
|
||||||
AlbumsTwo *Albums `xml:"albumList2" json:"albumList2,omitempty"`
|
Error *Error `xml:"error" json:"error,omitempty"`
|
||||||
Album *Album `xml:"album" json:"album,omitempty"`
|
Albums *Albums `xml:"albumList" json:"albumList,omitempty"`
|
||||||
Track *TrackChild `xml:"song" json:"song,omitempty"`
|
AlbumsTwo *Albums `xml:"albumList2" json:"albumList2,omitempty"`
|
||||||
Indexes *Indexes `xml:"indexes" json:"indexes,omitempty"`
|
Album *Album `xml:"album" json:"album,omitempty"`
|
||||||
Artists *Artists `xml:"artists" json:"artists,omitempty"`
|
Track *TrackChild `xml:"song" json:"song,omitempty"`
|
||||||
Artist *Artist `xml:"artist" json:"artist,omitempty"`
|
Indexes *Indexes `xml:"indexes" json:"indexes,omitempty"`
|
||||||
Directory *Directory `xml:"directory" json:"directory,omitempty"`
|
Artists *Artists `xml:"artists" json:"artists,omitempty"`
|
||||||
RandomTracks *RandomTracks `xml:"randomSongs" json:"randomSongs,omitempty"`
|
Artist *Artist `xml:"artist" json:"artist,omitempty"`
|
||||||
MusicFolders *MusicFolders `xml:"musicFolders" json:"musicFolders,omitempty"`
|
Directory *Directory `xml:"directory" json:"directory,omitempty"`
|
||||||
ScanStatus *ScanStatus `xml:"scanStatus" json:"scanStatus,omitempty"`
|
RandomTracks *RandomTracks `xml:"randomSongs" json:"randomSongs,omitempty"`
|
||||||
Licence *Licence `xml:"license" json:"license,omitempty"`
|
MusicFolders *MusicFolders `xml:"musicFolders" json:"musicFolders,omitempty"`
|
||||||
SearchResultTwo *SearchResultTwo `xml:"searchResult2" json:"searchResult2,omitempty"`
|
ScanStatus *ScanStatus `xml:"scanStatus" json:"scanStatus,omitempty"`
|
||||||
SearchResultThree *SearchResultThree `xml:"searchResult3" json:"searchResult3,omitempty"`
|
Licence *Licence `xml:"license" json:"license,omitempty"`
|
||||||
User *User `xml:"user" json:"user,omitempty"`
|
SearchResultTwo *SearchResultTwo `xml:"searchResult2" json:"searchResult2,omitempty"`
|
||||||
Playlists *Playlists `xml:"playlists" json:"playlists,omitempty"`
|
SearchResultThree *SearchResultThree `xml:"searchResult3" json:"searchResult3,omitempty"`
|
||||||
Playlist *Playlist `xml:"playlist" json:"playlist,omitempty"`
|
User *User `xml:"user" json:"user,omitempty"`
|
||||||
|
Playlists *Playlists `xml:"playlists" json:"playlists,omitempty"`
|
||||||
|
Playlist *Playlist `xml:"playlist" json:"playlist,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewResponse() *Response {
|
func NewResponse() *Response {
|
||||||
return &Response{
|
return &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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user