-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmodel.go
221 lines (198 loc) · 5.58 KB
/
model.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
217
218
219
220
221
package kkbox
import (
"time"
)
// Summary page data
type Summary struct {
Total int `json:"total"`
}
// Owner data
type Owner struct {
ID string `json:"id"`
Name string `json:"name"`
}
// Image for music
type Image struct {
Height int `json:"height"`
Width int `json:"width"`
URL string `json:"url"`
}
// Paging data
type Paging struct {
Offset int `json:"offset"`
Limit int `json:"limit"`
Previous string `json:"previous"`
Next string `json:"next"`
}
// Artist struct
type Artist struct {
ID string `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
Images []Image `json:"images"`
}
// Album data
type Album struct {
ID string `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
Explicitness bool `json:"explicitness"`
AvailableTerritories []string `json:"available_territories"`
ReleaseDate string `json:"release_date"`
Images []Image `json:"images"`
Artist Artist `json:"artist"`
}
// Track data
type Track struct {
ID string `json:"id"`
Name string `json:"name"`
Duration int `json:"duration"`
URL string `json:"url"`
TrackNumber int `json:"track_number"`
Explicitness bool `json:"explicitness"`
AvailableTerritories []string `json:"available_territories"`
Album Album `json:"album"`
}
// Song for play list
type Song struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
URL string `json:"url"`
Images []Image `json:"images"`
UpdatedAt time.Time `json:"updated_at"`
Owner Owner `json:"owner"`
}
// GroupListData for song list
type GroupListData struct {
Data []Song `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
}
// PlayListData to retrieve information of playlist
type PlayListData struct {
Tracks struct {
Data []Track `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
} `json:"tracks"`
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
URL string `json:"url"`
Images []Image `json:"images"`
UpdatedAt time.Time `json:"updated_at"`
Owner Owner `json:"owner"`
}
// TrackData List tracks of a chart playlist.
type TrackData struct {
Data []Track `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
}
// Param for http get parameter
type Param struct {
// The search keywords, URL encoded.
Q string
// The content type. Content type could be track, album, artist, or playlist.
Type string
// Territory code, i.e. TW, HK, SG, MY, JP, of search content.
Territory string
Page int
// The number of items to return per page, not to exceed 50.
PerPage int
}
// SearchData for search results
type SearchData struct {
Artists struct {
Data []Artist `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
} `json:"artists"`
Tracks struct {
Data []Track `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
} `json:"tracks"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
}
// AlbumTrackData list of tracks of an album.
type AlbumTrackData struct {
Data []Track `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
}
// ArtistAlbumData list of albums of an artist.
type ArtistAlbumData struct {
Data []Album `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
}
// CategoryListData for category
type CategoryListData struct {
ID string `json:"id"`
Title string `json:"title"`
Images []Image `json:"images"`
Playlists GroupListData `json:"playlists"`
}
// MoodListData mood stations.
type MoodListData struct {
Data []struct {
ID string `json:"id"`
Name string `json:"name"`
Images []Image `json:"images"`
} `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
}
// MoodData retrieve information of the mood station with {station_id}.
type MoodData struct {
ID string `json:"id"`
Name string `json:"name"`
Tracks struct {
Data []Track `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
} `json:"tracks"`
}
// GenreList List of genre stations.
type GenreList struct {
Data []struct {
ID string `json:"id"`
Category string `json:"category"`
Name string `json:"name"`
} `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
}
// GenreData retrieve information of the genre station with {station_id}.
type GenreData struct {
Category string `json:"category"`
ID string `json:"id"`
Name string `json:"name"`
Tracks struct {
Data []Track `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
} `json:"tracks"`
}
// ReleaseCategoryList List of new release categories.
type ReleaseCategoryList struct {
Data []struct {
ID string `json:"id"`
Title string `json:"title"`
} `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
}
// AlbumList retrieve information of the new release category with {category_id}.
type AlbumList struct {
ID string `json:"id"`
Title string `json:"title"`
Albums struct {
Data []Album `json:"data"`
Paging Paging `json:"paging"`
Summary Summary `json:"summary"`
} `json:"albums"`
}