Add missing model fields from Python reference
Feed: Added can_get_more_events, pumpkin, is_wizard_passed, headlines, today, next_revision Label: Added description_formatted, image, links ([]Link), type Landing: Added pumpkin, content_id Pin: Added content_restrictions Search: Added search_request_id, text, best, podcasts, podcast_episodes, clips, banner, page, per_page, misspell fields Clip: Rewrote with all missing fields (version, player_id, uuid, thumbnail, track_ids, disclaimers, explicit, cover, content_restrictions) Concert: Added datetime, afisha_url, city, place, address, content_rating, data_session_id, event_info
This commit is contained in:
1 parent
bc026d82b4
commit
463e0bcd1a
7 files changed
+198
-95
No files matched your search
+27
-3
@@ -8,9 +8,15 @@ import (
|
||||
// Feed represents the main feed from the Yandex Music API.
|
||||
type Feed struct {
|
||||
BaseModel
|
||||
Days []Day `json:"days"`
|
||||
GeneratedPlaylists []GeneratedPlaylist `json:"generated_playlists"`
|
||||
PlayContexts []PlayContext `json:"play_contexts"`
|
||||
CanGetMoreEvents bool `json:"can_get_more_events"`
|
||||
Pumpkin bool `json:"pumpkin"`
|
||||
IsWizardPassed bool `json:"is_wizard_passed"`
|
||||
Headlines []string `json:"headlines"`
|
||||
Today string `json:"today"`
|
||||
Days []Day `json:"days"`
|
||||
GeneratedPlaylists []GeneratedPlaylist `json:"generated_playlists"`
|
||||
PlayContexts []PlayContext `json:"play_contexts"`
|
||||
NextRevision string `json:"next_revision"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes a Feed from JSON data.
|
||||
@@ -22,6 +28,21 @@ func (f *Feed) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
|
||||
feed := &Feed{BaseModel: *NewBaseModel(c)}
|
||||
|
||||
if v, ok := raw["can_get_more_events"]; ok {
|
||||
json.Unmarshal(v, &feed.CanGetMoreEvents)
|
||||
}
|
||||
if v, ok := raw["pumpkin"]; ok {
|
||||
json.Unmarshal(v, &feed.Pumpkin)
|
||||
}
|
||||
if v, ok := raw["is_wizard_passed"]; ok {
|
||||
json.Unmarshal(v, &feed.IsWizardPassed)
|
||||
}
|
||||
if v, ok := raw["headlines"]; ok {
|
||||
json.Unmarshal(v, &feed.Headlines)
|
||||
}
|
||||
if v, ok := raw["today"]; ok {
|
||||
json.Unmarshal(v, &feed.Today)
|
||||
}
|
||||
if v, ok := raw["days"]; ok {
|
||||
var days []Day
|
||||
json.Unmarshal(v, &days)
|
||||
@@ -37,6 +58,9 @@ func (f *Feed) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
json.Unmarshal(v, &contexts)
|
||||
feed.PlayContexts = contexts
|
||||
}
|
||||
if v, ok := raw["next_revision"]; ok {
|
||||
json.Unmarshal(v, &feed.NextRevision)
|
||||
}
|
||||
|
||||
return feed, nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user