mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 05:37:05 +02:00
Restructured code, moved all modules into internal
For now all modules are considered internal. This might change later
This commit is contained in:
parent
f94e0f1e85
commit
857661ebf9
76 changed files with 121 additions and 68 deletions
90
internal/backends/deezer/models.go
Normal file
90
internal/backends/deezer/models.go
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
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"`
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue