/
request.go
62 lines (48 loc) · 1.34 KB
/
request.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
package listeningSession
import (
. "github.com/47-11/spotifete/shared"
. "github.com/47-11/spotifete/webapp/apiv2/shared"
)
type NewSessionRequest struct {
AuthenticatedRequest
ListeningSessionTitle string `json:"listening_session_title"`
}
func (r NewSessionRequest) Validate() *SpotifeteError {
if "" == r.ListeningSessionTitle {
return NewUserError("Missing parameter listening_session_title.")
}
return nil
}
type RequestTrackRequest struct {
TrackId string `json:"track_id"`
}
func (r RequestTrackRequest) Validate() *SpotifeteError {
if "" == r.TrackId {
return NewUserError("Missing parameter track_id.")
}
return nil
}
type ChangeFallbackPlaylistRequest struct {
AuthenticatedRequest
NewFallbackPlaylistId string `json:"new_fallback_playlist_id"`
}
func (r ChangeFallbackPlaylistRequest) Validate() *SpotifeteError {
if "" == r.NewFallbackPlaylistId {
return NewUserError("Missing parameter new_fallback_playlist_id.")
}
return nil
}
type SetFallbackPlaylistShuffleRequest struct {
AuthenticatedRequest
Shuffle bool `json:"shuffle"`
}
type DeleteRequestFromQueueRequest struct {
AuthenticatedRequest
SpotifyTrackId string `json:"spotify_track_id""`
}
func (r DeleteRequestFromQueueRequest) Validate() *SpotifeteError {
if "" == r.SpotifyTrackId {
return NewUserError("Missing parameter spotify_track_id.")
}
return nil
}