2021-04-01 10:17:46 +00:00
|
|
|
package goscrobble
|
|
|
|
|
|
|
|
type ProfileResponse struct {
|
2021-04-02 09:24:00 +00:00
|
|
|
UUID string `json:"uuid"`
|
|
|
|
Username string `json:"username"`
|
|
|
|
Scrobbles []ScrobbleResponseItem `json:"scrobbles"`
|
2021-04-01 10:17:46 +00:00
|
|
|
}
|
|
|
|
|
2021-04-04 09:54:53 +00:00
|
|
|
func getProfileForUser(user User) (ProfileResponse, error) {
|
2021-04-01 10:17:46 +00:00
|
|
|
resp := ProfileResponse{
|
|
|
|
UUID: user.UUID,
|
|
|
|
Username: user.Username,
|
|
|
|
}
|
2021-04-04 09:54:53 +00:00
|
|
|
scrobbleReq, err := getScrobblesForUser(user.UUID, 10, 1)
|
2021-04-01 10:17:46 +00:00
|
|
|
if err != nil {
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
resp.Scrobbles = scrobbleReq.Items
|
|
|
|
return resp, nil
|
|
|
|
}
|