-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
216 lines (190 loc) · 7.1 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
package spotifyclient
import "time"
type Meta struct {
HREF HREF
ExternalURLs map[string]string `json:"external_urls"`
ID string `json:"id"`
Type string `json:"type"`
URI string `json:"uri"`
}
type PagingMeta struct {
HREF HREF
Limit int `json:"limit"`
Next string `json:"next"`
Offset int `json:"offset"`
Previous string `json:"previous"`
Total int `json:"total"`
}
type AlbumPage struct {
PagingMeta
Items []*Album `json:"items"`
}
type TrackPage struct {
PagingMeta
Items []*Track `json:"items"`
}
type PlaylistPage struct {
PagingMeta
Items []*Playlist `json:"items"`
}
type PlaylistTrackPage struct {
PagingMeta
Items []*PlaylistTrack `json:"items"`
}
type ExplicitContent struct {
FilterEnabled bool `json:"filter_enabled"`
FilterLocked bool `json:"filter_locked"`
}
type ExternalUrls struct {
Spotify string `json:"spotify"`
}
type Me struct {
Country string `json:"country"`
DisplayName string `json:"display_name"`
ExplicitContent *ExplicitContent `json:"explicit_content"`
ExternalUrls *ExternalUrls `json:"external_urls"`
Followers *Followers `json:"followers"`
Href string `json:"href"`
ID string `json:"id"`
Images []*Image `json:"images"`
Product string `json:"product"`
Type string `json:"type"`
URI string `json:"uri"`
}
// Album represents an AlbumObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-albumobject
type Album struct {
Meta
AlbumType string `json:"album_type"`
AvailableMarkets []string `json:"available_markets"`
Images []Image `json:"images"`
Label string `json:"label"`
Popularity int `json:"popularity"`
ReleaseDate string `json:"release_date"`
ReleaseDatePrecision string `json:"release_date_precision"`
TotalTracks int `json:"total_tracks"`
Tracks TrackPage `json:"tracks"`
Name string `json:"name"`
}
// Artist represents an ArtistObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-artistobject
type Artist struct {
Meta
Genres []string `json:"genres"`
Popularity int `json:"popularity"`
Name string `json:"name"`
}
type Devices struct {
Devices []Device `json:"devices"`
}
// Device represents a DeviceObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-deviceobject
type Device struct {
ID string `json:"id"`
IsActive bool `json:"is_active"`
IsPrivateSession bool `json:"is_private_session"`
IsRestricted bool `json:"is_restricted"`
Name string `json:"name"`
Type string `json:"type"`
VolumePercent int `json:"volume_percent"`
}
// HttpError represents an ErrorObject in the Spotify API.
//
// https://developer.spotify.com/documentation/web-api/reference/#object-errorobject
type HttpError struct {
Status int `json:"status"`
Message string `json:"message"`
}
// ExplicitContentSettings represents a ExplicitContentSettingsObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-explicitcontentsettingsobject
type ExplicitContentSettings struct {
FilterEnabled bool `json:"filter_enabled"`
FilterLocked bool `json:"filter_locked"`
}
// Followers represents a FollowersObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-followersobject
type Followers struct {
HREF HREF `json:"href"`
Total int `json:"total"`
}
// Image represents an ImageObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-imageobject
type Image struct {
Height int `json:"height"`
URL string `json:"url"`
Width int `json:"width"`
}
// Paging represents a PagingObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-pagingobject
type Paging struct {
Albums AlbumPage `json:"albums"`
Tracks TrackPage `json:"tracks"`
}
// Playlist represents a PlaylistObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-playlistobject
type Playlist struct {
Meta
Collaborative bool `json:"collaborative"`
Description string `json:"description"`
Images []Image `json:"images"`
Name string `json:"name"`
Owner PublicUser `json:"owner"`
Public bool `json:"public"`
SnapshotID string `json:"snapshot_id"`
Tracks PlaylistTrackPage `json:"tracks"`
}
// PlaylistTrack represents a PlaylistTrackObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-playlisttrackobject
type PlaylistTrack struct {
AddedAt time.Time `json:"added_at"`
AddedBy Meta `json:"added_by"`
IsLocal bool `json:"is_local"`
Track Track `json:"track"`
URI string `json:"uri"`
}
// PrivateUser represents a PrivateUserObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-privateuserobject
type PrivateUser struct {
Meta
Country string `json:"country"`
DisplayName string `json:"display_name"`
Email string `json:"email"`
ExplicitContent ExplicitContentSettings `json:"explicit_content"`
Followers Followers `json:"followers"`
Images []*Image `json:"images"`
Product string `json:"product"`
}
// PublicUser represents a PublicUserObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-publicuserobject
type PublicUser struct {
Meta
DisplayName string `json:"display_name"`
Images []Image `json:"images"`
}
// Show represents a ShowObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-showobject
type Show struct {
Name string `json:"name"`
}
// Track represents a TrackObject in the Spotify API.
// https://developer.spotify.com/documentation/web-api/reference/#object-trackobject
type Track struct {
Meta
Album Album `json:"albumomitempty"`
Artists []Artist `json:"artists"`
AvailableMarkets []string `json:"available_markets"`
DiscNumber int `json:"disc_number"`
Duration *Duration `json:"duration_ms"`
Explicit bool `json:"explicit"`
ExternalIDs map[string]string `json:"external_ids"`
Name string `json:"name"`
Popularity int `json:"popularity"`
PreviewURL string `json:"preview_url"`
}
type SetPlay struct {
ContextURI string `json:"context_uri"`
Offset struct {
Position int `json:"position"`
} `json:"offset"`
PositionMs int `json:"position_ms"`
}