Refactored responses, implemented getLicense
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package responses
|
||||
|
||||
type valid struct {
|
||||
Valid bool `xml:"valid,attr"`
|
||||
}
|
||||
|
||||
type license struct {
|
||||
Subsonic
|
||||
Body valid `xml:"license"`
|
||||
}
|
||||
|
||||
func NewGetLicense(valid bool) *license {
|
||||
response := new(license)
|
||||
response.Subsonic = NewSubsonic()
|
||||
response.Body.Valid = valid
|
||||
return response
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package responses
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
type Subsonic struct {
|
||||
XMLName xml.Name `xml:"http://subsonic.org/restapi subsonic-response"`
|
||||
Status string `xml:"status,attr"`
|
||||
Version string `xml:"version,attr"`
|
||||
}
|
||||
|
||||
func NewSubsonic() Subsonic {
|
||||
return Subsonic{Status: "ok", Version: beego.AppConfig.String("apiversion")}
|
||||
}
|
||||
Reference in New Issue
Block a user