mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-18 21:07:44 +03:00
Add bookmark API repsonse
This commit is contained in:
parent
2d3ed85311
commit
924ada0dab
@ -0,0 +1 @@
|
|||||||
|
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","bookmarks":{"bookmark":[{"entry":[{"id":"1","isDir":false,"title":"title","isVideo":false}],"position":123,"username":"user2","comment":"a comment","created":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z"}]}}
|
@ -0,0 +1 @@
|
|||||||
|
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><bookmarks><bookmark position="123" username="user2" comment="a comment" created="0001-01-01T00:00:00Z" changed="0001-01-01T00:00:00Z"><entry id="1" isDir="false" title="title" isVideo="false"></entry></bookmark></bookmarks></subsonic-response>
|
@ -0,0 +1 @@
|
|||||||
|
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","bookmarks":{}}
|
@ -0,0 +1 @@
|
|||||||
|
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><bookmarks></bookmarks></subsonic-response>
|
@ -40,6 +40,7 @@ type Subsonic struct {
|
|||||||
ArtistInfo2 *ArtistInfo2 `xml:"artistInfo2,omitempty" json:"artistInfo2,omitempty"`
|
ArtistInfo2 *ArtistInfo2 `xml:"artistInfo2,omitempty" json:"artistInfo2,omitempty"`
|
||||||
|
|
||||||
PlayQueue *PlayQueue `xml:"playQueue,omitempty" json:"playQueue,omitempty"`
|
PlayQueue *PlayQueue `xml:"playQueue,omitempty" json:"playQueue,omitempty"`
|
||||||
|
Bookmarks *Bookmarks `xml:"bookmarks,omitempty" json:"bookmarks,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type JsonWrapper struct {
|
type JsonWrapper struct {
|
||||||
@ -304,3 +305,16 @@ type PlayQueue struct {
|
|||||||
Changed *time.Time `xml:"changed,attr,omitempty" json:"changed,omitempty"`
|
Changed *time.Time `xml:"changed,attr,omitempty" json:"changed,omitempty"`
|
||||||
ChangedBy string `xml:"changedBy,attr" json:"changedBy"`
|
ChangedBy string `xml:"changedBy,attr" json:"changedBy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Bookmark struct {
|
||||||
|
Entry []Child `xml:"entry,omitempty" json:"entry,omitempty"`
|
||||||
|
Position int64 `xml:"position,attr,omitempty" json:"position,omitempty"`
|
||||||
|
Username string `xml:"username,attr" json:"username"`
|
||||||
|
Comment string `xml:"comment,attr" json:"comment"`
|
||||||
|
Created time.Time `xml:"created,attr" json:"created"`
|
||||||
|
Changed time.Time `xml:"changed,attr" json:"changed"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Bookmarks struct {
|
||||||
|
Bookmark []Bookmark `xml:"bookmark,omitempty" json:"bookmark,omitempty"`
|
||||||
|
}
|
||||||
|
@ -356,7 +356,41 @@ var _ = Describe("Responses", func() {
|
|||||||
child := make([]Child, 1)
|
child := make([]Child, 1)
|
||||||
child[0] = Child{Id: "1", Title: "title", IsDir: false}
|
child[0] = Child{Id: "1", Title: "title", IsDir: false}
|
||||||
response.PlayQueue.Entry = child
|
response.PlayQueue.Entry = child
|
||||||
|
})
|
||||||
|
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{}
|
||||||
|
})
|
||||||
|
|
||||||
|
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() {
|
||||||
|
bmk := Bookmark{
|
||||||
|
Position: 123,
|
||||||
|
Username: "user2",
|
||||||
|
Comment: "a comment",
|
||||||
|
Created: time.Time{},
|
||||||
|
Changed: time.Time{},
|
||||||
|
}
|
||||||
|
bmk.Entry = []Child{{Id: "1", Title: "title", IsDir: false}}
|
||||||
|
response.Bookmarks.Bookmark = []Bookmark{bmk}
|
||||||
})
|
})
|
||||||
It("should match .XML", func() {
|
It("should match .XML", func() {
|
||||||
Expect(xml.Marshal(response)).To(MatchSnapshot())
|
Expect(xml.Marshal(response)).To(MatchSnapshot())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user