navidrome/api/responses/responses.go

249 lines
14 KiB
Go
Raw Normal View History

2016-03-02 17:11:46 +01:00
package responses
import (
"encoding/xml"
"time"
)
2016-03-02 17:11:46 +01:00
type Subsonic struct {
2016-03-11 06:37:07 +01:00
XMLName xml.Name `xml:"http://subsonic.org/restapi subsonic-response" json:"-"`
Status string `xml:"status,attr" json:"status"`
Version string `xml:"version,attr" json:"version"`
Error *Error `xml:"error,omitempty" json:"error,omitempty"`
License *License `xml:"license,omitempty" json:"license,omitempty"`
MusicFolders *MusicFolders `xml:"musicFolders,omitempty" json:"musicFolders,omitempty"`
Indexes *Indexes `xml:"indexes,omitempty" json:"indexes,omitempty"`
Directory *Directory `xml:"directory,omitempty" json:"directory,omitempty"`
User *User `xml:"user,omitempty" json:"user,omitempty"`
AlbumList *AlbumList `xml:"albumList,omitempty" json:"albumList,omitempty"`
2016-03-28 05:04:05 +02:00
AlbumList2 *AlbumList `xml:"albumList2,omitempty" json:"albumList2,omitempty"`
2016-03-11 06:37:07 +01:00
Playlists *Playlists `xml:"playlists,omitempty" json:"playlists,omitempty"`
Playlist *PlaylistWithSongs `xml:"playlist,omitempty" json:"playlist,omitempty"`
SearchResult2 *SearchResult2 `xml:"searchResult2,omitempty" json:"searchResult2,omitempty"`
Starred *Starred `xml:"starred,omitempty" json:"starred,omitempty"`
NowPlaying *NowPlaying `xml:"nowPlaying,omitempty" json:"nowPlaying,omitempty"`
2016-03-25 05:04:22 +01:00
Song *Child `xml:"song,omitempty" json:"song,omitempty"`
2016-03-28 02:35:10 +02:00
// ID3
2016-03-28 03:27:45 +02:00
Artist *Indexes `xml:"artists,omitempty" json:"artists,omitempty"`
ArtistWithAlbumsID3 *ArtistWithAlbumsID3 `xml:"artist,omitempty" json:"artist,omitempty"`
2016-03-28 15:16:03 +02:00
AlbumWithSongsID3 *AlbumWithSongsID3 `xml:"album,omitempty" json:"album,omitempty"`
}
type JsonWrapper struct {
Subsonic Subsonic `json:"subsonic-response"`
}
type Error struct {
2016-03-22 03:45:56 +01:00
Code int `xml:"code,attr" json:"code"`
Message string `xml:"message,attr" json:"message"`
2016-03-02 17:11:46 +01:00
}
type License struct {
2016-03-22 03:45:56 +01:00
Valid bool `xml:"valid,attr" json:"valid"`
2016-03-02 17:11:46 +01:00
}
type MusicFolder struct {
2016-03-22 03:45:56 +01:00
Id string `xml:"id,attr" json:"id"`
Name string `xml:"name,attr" json:"name"`
2016-03-02 17:11:46 +01:00
}
type MusicFolders struct {
2016-03-22 03:45:56 +01:00
Folders []MusicFolder `xml:"musicFolder" json:"musicFolder,omitempty"`
2016-03-02 17:11:46 +01:00
}
type Artist struct {
2016-03-28 02:13:00 +02:00
Id string `xml:"id,attr" json:"id"`
Name string `xml:"name,attr" json:"name"`
AlbumCount int `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"`
2016-03-11 16:03:33 +01:00
/*
<xs:attribute name="starred" type="xs:dateTime" use="optional"/> <!-- Added in 1.10.1 -->
<xs:attribute name="userRating" type="sub:UserRating" use="optional"/> <!-- Added in 1.13.0 -->
<xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.13.0 -->
*/
2016-03-02 17:11:46 +01:00
}
type Index struct {
2016-03-02 19:18:39 +01:00
Name string `xml:"name,attr" json:"name"`
Artists []Artist `xml:"artist" json:"artist"`
2016-03-02 17:11:46 +01:00
}
type Indexes struct {
2016-03-22 03:45:56 +01:00
Index []Index `xml:"index" json:"index,omitempty"`
LastModified string `xml:"lastModified,attr" json:"lastModified"`
IgnoredArticles string `xml:"ignoredArticles,attr" json:"ignoredArticles"`
2016-03-02 17:11:46 +01:00
}
type Child struct {
Id string `xml:"id,attr" json:"id"`
Parent string `xml:"parent,attr,omitempty" json:"parent,omitempty"`
IsDir bool `xml:"isDir,attr" json:"isDir"`
2016-03-28 03:40:09 +02:00
Title string `xml:"title,attr,omitempty" json:"title,omitempty"`
Name string `xml:"name,attr,omitempty" json:"name,omitempty"`
Album string `xml:"album,attr,omitempty" json:"album,omitempty"`
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
Track int `xml:"track,attr,omitempty" json:"track,omitempty"`
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
Size string `xml:"size,attr,omitempty" json:"size,omitempty"`
ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"`
Suffix string `xml:"suffix,attr,omitempty" json:"suffix,omitempty"`
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
TranscodedContentType string `xml:"transcodedContentType,attr,omitempty" json:"transcodedContentType,omitempty"`
TranscodedSuffix string `xml:"transcodedSuffix,attr,omitempty" json:"transcodedSuffix,omitempty"`
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
BitRate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"`
Path string `xml:"path,attr,omitempty" json:"path,omitempty"`
PlayCount int32 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"`
DiscNumber int `xml:"discNumber,attr,omitempty" json:"discNumber,omitempty"`
Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
AlbumId string `xml:"albumId,attr,omitempty" json:"albumId,omitempty"`
ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
Type string `xml:"type,attr,omitempty" json:"type,omitempty"`
2016-03-21 15:24:40 +01:00
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
2016-03-28 02:13:00 +02:00
SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`
/*
<xs:attribute name="isVideo" type="xs:boolean" use="optional"/> <!-- Added in 1.4.1 -->
<xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.6.0 -->
<xs:attribute name="bookmarkPosition" type="xs:long" use="optional"/> <!-- In millis. Added in 1.10.1 -->
<xs:attribute name="originalWidth" type="xs:int" use="optional"/> <!-- Added in 1.13.0 -->
<xs:attribute name="originalHeight" type="xs:int" use="optional"/> <!-- Added in 1.13.0 -->
*/
}
type Directory struct {
2016-03-22 03:45:56 +01:00
Child []Child `xml:"child" json:"child,omitempty"`
Id string `xml:"id,attr" json:"id"`
Name string `xml:"name,attr" json:"name"`
Parent string `xml:"parent,attr,omitempty" json:"parent,omitempty"`
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
PlayCount int32 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"`
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
2016-03-28 03:27:45 +02:00
// ID3
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`
AlbumCount int `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"`
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
/*
<xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.13.0 -->
*/
2016-03-03 06:46:23 +01:00
}
2016-03-28 15:16:03 +02:00
type ArtistID3 struct {
2016-03-28 03:27:45 +02:00
Id string `xml:"id,attr" json:"id"`
Name string `xml:"name,attr" json:"name"`
2016-03-28 15:16:03 +02:00
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
2016-03-28 03:27:45 +02:00
AlbumCount int `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"`
2016-03-28 15:16:03 +02:00
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
}
type AlbumID3 struct {
Id string `xml:"id,attr" json:"id"`
Name string `xml:"name,attr" json:"name"`
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
PlayCount int32 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"`
Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
}
type ArtistWithAlbumsID3 struct {
ArtistID3
Album []Child `xml:"album" json:"album,omitempty"`
}
type AlbumWithSongsID3 struct {
AlbumID3
Song []Child `xml:"song" json:"song,omitempty"`
2016-03-28 03:27:45 +02:00
}
type AlbumList struct {
2016-03-22 03:45:56 +01:00
Album []Child `xml:"album" json:"album,omitempty"`
}
type Playlist struct {
Id string `xml:"id,attr" json:"id"`
Name string `xml:"name,attr" json:"name"`
Comment string `xml:"comment,attr,omitempty" json:"comment,omitempty"`
SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`
2016-03-21 17:26:55 +01:00
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
Public bool `xml:"public,attr,omitempty" json:"public,omitempty"`
Owner string `xml:"owner,attr,omitempty" json:"owner,omitempty"`
/*
<xs:sequence>
<xs:element name="allowedUser" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <!--Added in 1.8.0-->
</xs:sequence>
<xs:attribute name="comment" type="xs:string" use="optional"/> <!--Added in 1.8.0-->
<xs:attribute name="created" type="xs:dateTime" use="required"/> <!--Added in 1.8.0-->
<xs:attribute name="changed" type="xs:dateTime" use="required"/> <!--Added in 1.13.0-->
<xs:attribute name="coverArt" type="xs:string" use="optional"/> <!--Added in 1.11.0-->
*/
}
type Playlists struct {
2016-03-22 03:45:56 +01:00
Playlist []Playlist `xml:"playlist" json:"playlist,omitempty"`
}
2016-03-10 00:28:11 +01:00
type PlaylistWithSongs struct {
Playlist
2016-03-22 03:45:56 +01:00
Entry []Child `xml:"entry" json:"entry,omitempty"`
2016-03-10 00:28:11 +01:00
}
2016-03-11 06:37:07 +01:00
type SearchResult2 struct {
2016-03-22 03:45:56 +01:00
Artist []Artist `xml:"artist" json:"artist,omitempty"`
Album []Child `xml:"album" json:"album,omitempty"`
Song []Child `xml:"song" json:"song,omitempty"`
2016-03-11 06:37:07 +01:00
}
type Starred struct {
2016-03-22 03:45:56 +01:00
Artist []Artist `xml:"artist" json:"artist,omitempty"`
Album []Child `xml:"album" json:"album,omitempty"`
Song []Child `xml:"song" json:"song,omitempty"`
}
type NowPlayingEntry struct {
Child
2016-03-22 03:45:56 +01:00
UserName string `xml:"username,attr" json:"username,omitempty"`
MinutesAgo int `xml:"minutesAgo,attr" json:"minutesAgo,omitempty"`
PlayerId int `xml:"playerId,attr" json:"playerId,omitempty"`
PlayerName string `xml:"playerName,attr" json:"playerName,omitempty"`
}
type NowPlaying struct {
2016-03-22 03:45:56 +01:00
Entry []NowPlayingEntry `xml:"entry" json:"entry,omitempty"`
}
type User struct {
2016-03-22 03:45:56 +01:00
Username string `xml:"username,attr" json:"username"`
Email string `xml:"email,attr,omitempty" json:"email,omitempty"`
ScrobblingEnabled bool `xml:"scrobblingEnabled,attr" json:"scrobblingEnabled"`
MaxBitRate int `xml:"maxBitRate,attr,omitempty" json:"maxBitRate,omitempty"`
AdminRole bool `xml:"adminRole,attr" json:"adminRole"`
SettingsRole bool `xml:"settingsRole,attr" json:"settingsRole"`
DownloadRole bool `xml:"downloadRole,attr" json:"downloadRole"`
UploadRole bool `xml:"uploadRole,attr" json:"uploadRole"`
PlaylistRole bool `xml:"playlistRole,attr" json:"playlistRole"`
CoverArtRole bool `xml:"coverArtRole,attr" json:"coverArtRole"`
CommentRole bool `xml:"commentRole,attr" json:"commentRole"`
PodcastRole bool `xml:"podcastRole,attr" json:"podcastRole"`
StreamRole bool `xml:"streamRole,attr" json:"streamRole"`
JukeboxRole bool `xml:"jukeboxRole,attr" json:"jukeboxRole"`
ShareRole bool `xml:"shareRole,attr" json:"shareRole"`
VideoConversionRole bool `xml:"videoConversionRole,attr" json:"videoConversionRole"`
Folder []int `xml:"folder,omitempty" json:"folder,omitempty"`
}