scotty/internal/backends/deezer/models.go
Philipp Wolfer 857661ebf9
Restructured code, moved all modules into internal
For now all modules are considered internal. This might change later
2023-11-24 01:24:54 +01:00

90 lines
2.2 KiB
Go

/*
Copyright © 2023 Philipp Wolfer <phw@uploadedlobster.com>
Scotty is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later version.
Scotty is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
Scotty. If not, see <https://www.gnu.org/licenses/>.
*/
package deezer
type Result interface {
Error() *Error
}
type BaseResult struct {
Err *Error `json:"error,omitempty"`
}
func (r BaseResult) Error() *Error {
return r.Err
}
type Error struct {
// {"error":{"type":"OAuthException","message":"Invalid OAuth access token.","code":300}}
Type string `json:"type"`
Message string `json:"message"`
Code int `json:"code"`
}
type TracksResult struct {
BaseResult
Next string `json:"next"`
Previous string `json:"prev"`
Total int `json:"total"`
Tracks []LovedTrack `json:"data"`
}
type HistoryResult struct {
BaseResult
Next string `json:"next"`
Previous string `json:"prev"`
Total int `json:"total"`
Tracks []Listen `json:"data"`
}
type Track struct {
Id int `json:"id"`
Type string `json:"type"`
Link string `json:"link"`
Title string `json:"title"`
TitleVersion string `json:"title_version"`
Duration int `json:"duration"`
Rank int `json:"rank"`
Readable bool `json:"readable"`
Explicit bool `json:"explicit_lyrics"`
Album Album `json:"album"`
Artist Artist `json:"artist"`
}
type Listen struct {
Track
Timestamp int64 `json:"timestamp"`
}
type LovedTrack struct {
Track
AddedAt int64 `json:"time_add"`
}
type Album struct {
Id int `json:"id"`
Type string `json:"type"`
Link string `json:"link"`
Title string `json:"title"`
TrackList string `json:"tracklist"`
}
type Artist struct {
Id int `json:"id"`
Type string `json:"type"`
Link string `json:"link"`
Name string `json:"name"`
}