Add getShares and createShare Subsonic endpoints
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","shares":{"share":[{"entry":[{"id":"1","isDir":false,"title":"title","album":"album","artist":"artist","duration":120,"isVideo":false},{"id":"2","isDir":false,"title":"title 2","album":"album","artist":"artist","duration":300,"isVideo":false}],"id":"ABC123","url":"http://localhost/p/ABC123","description":"Check it out!","username":"deluan","created":"0001-01-01T00:00:00Z","expires":"0001-01-01T00:00:00Z","lastVisited":"0001-01-01T00:00:00Z","visitCount":2}]}}
|
||||
@@ -0,0 +1 @@
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><shares><share id="ABC123" url="http://localhost/p/ABC123" description="Check it out!" username="deluan" created="0001-01-01T00:00:00Z" expires="0001-01-01T00:00:00Z" lastVisited="0001-01-01T00:00:00Z" visitCount="2"><entry id="1" isDir="false" title="title" album="album" artist="artist" duration="120" isVideo="false"></entry><entry id="2" isDir="false" title="title 2" album="album" artist="artist" duration="300" isVideo="false"></entry></share></shares></subsonic-response>
|
||||
@@ -0,0 +1 @@
|
||||
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","shares":{}}
|
||||
@@ -0,0 +1 @@
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><shares></shares></subsonic-response>
|
||||
@@ -45,6 +45,7 @@ type Subsonic struct {
|
||||
TopSongs *TopSongs `xml:"topSongs,omitempty" json:"topSongs,omitempty"`
|
||||
|
||||
PlayQueue *PlayQueue `xml:"playQueue,omitempty" json:"playQueue,omitempty"`
|
||||
Shares *Shares `xml:"shares,omitempty" json:"shares,omitempty"`
|
||||
Bookmarks *Bookmarks `xml:"bookmarks,omitempty" json:"bookmarks,omitempty"`
|
||||
ScanStatus *ScanStatus `xml:"scanStatus,omitempty" json:"scanStatus,omitempty"`
|
||||
Lyrics *Lyrics `xml:"lyrics,omitempty" json:"lyrics,omitempty"`
|
||||
@@ -359,6 +360,22 @@ type Bookmarks struct {
|
||||
Bookmark []Bookmark `xml:"bookmark,omitempty" json:"bookmark,omitempty"`
|
||||
}
|
||||
|
||||
type Share struct {
|
||||
Entry []Child `xml:"entry,omitempty" json:"entry,omitempty"`
|
||||
ID string `xml:"id,attr" json:"id"`
|
||||
Url string `xml:"url,attr" json:"url"`
|
||||
Description string `xml:"description,omitempty,attr" json:"description,omitempty"`
|
||||
Username string `xml:"username,attr" json:"username"`
|
||||
Created time.Time `xml:"created,attr" json:"created"`
|
||||
Expires *time.Time `xml:"expires,omitempty,attr" json:"expires,omitempty"`
|
||||
LastVisited time.Time `xml:"lastVisited,attr" json:"lastVisited"`
|
||||
VisitCount int `xml:"visitCount,attr" json:"visitCount"`
|
||||
}
|
||||
|
||||
type Shares struct {
|
||||
Share []Share `xml:"share,omitempty" json:"share,omitempty"`
|
||||
}
|
||||
|
||||
type ScanStatus struct {
|
||||
Scanning bool `xml:"scanning,attr" json:"scanning"`
|
||||
Count int64 `xml:"count,attr" json:"count"`
|
||||
|
||||
@@ -527,6 +527,47 @@ var _ = Describe("Responses", func() {
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Shares", func() {
|
||||
BeforeEach(func() {
|
||||
response.Shares = &Shares{}
|
||||
})
|
||||
|
||||
Context("without data", func() {
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
|
||||
Context("with data", func() {
|
||||
BeforeEach(func() {
|
||||
t := time.Time{}
|
||||
share := Share{
|
||||
ID: "ABC123",
|
||||
Url: "http://localhost/p/ABC123",
|
||||
Description: "Check it out!",
|
||||
Username: "deluan",
|
||||
Created: t,
|
||||
Expires: &t,
|
||||
LastVisited: t,
|
||||
VisitCount: 2,
|
||||
}
|
||||
share.Entry = make([]Child, 2)
|
||||
share.Entry[0] = Child{Id: "1", Title: "title", Album: "album", Artist: "artist", Duration: 120}
|
||||
share.Entry[1] = Child{Id: "2", Title: "title 2", Album: "album", Artist: "artist", Duration: 300}
|
||||
response.Shares.Share = []Share{share}
|
||||
})
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Bookmarks", func() {
|
||||
BeforeEach(func() {
|
||||
response.Bookmarks = &Bookmarks{}
|
||||
|
||||
Reference in New Issue
Block a user