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:
Mrixs committed 2026-10-18 13:14:15 +03:00
1 parent bc026d82b4
commit 463e0bcd1a
7 files changed
+144 -41

No files matched your search

+45 -37
View File
@@ -10,16 +10,19 @@ type Clip struct {
BaseModel BaseModel
ID JSONID `json:"id"` ID JSONID `json:"id"`
Title string `json:"title"` Title string `json:"title"`
Version string `json:"version"`
PlayerID string `json:"player_id"`
UUID string `json:"uuid"`
Thumbnail string `json:"thumbnail"`
PreviewURL string `json:"preview_url"`
Duration int `json:"duration"` Duration int `json:"duration"`
CoverURI string `json:"cover_uri"` TrackIDs []int `json:"track_ids"`
PreviewURI string `json:"preview_uri"` Artists []Artist `json:"artists"`
Available bool `json:"available"` Disclaimers []string `json:"disclaimers"`
Views int `json:"views"` Explicit bool `json:"explicit"`
Likes int `json:"likes"` Cover *Cover `json:"cover"`
CreatedAt string `json:"created_at"` ContentRestrictions *ContentRestrictions `json:"content_restrictions"`
Artist *Artist `json:"artist"` Client *ClientInterface `json:"-"`
Track *Track `json:"track"`
Playlist *Playlist `json:"playlist"`
ClipType string `json:"clip_type"` ClipType string `json:"clip_type"`
IsVertical bool `json:"is_vertical"` IsVertical bool `json:"is_vertical"`
AspectRatio string `json:"aspect_ratio"` AspectRatio string `json:"aspect_ratio"`
@@ -40,26 +43,47 @@ func (c *Clip) DeJSON(data []byte, client ClientInterface) (Model, error) {
if v, ok := raw["title"]; ok { if v, ok := raw["title"]; ok {
json.Unmarshal(v, &clip.Title) json.Unmarshal(v, &clip.Title)
} }
if v, ok := raw["version"]; ok {
json.Unmarshal(v, &clip.Version)
}
if v, ok := raw["player_id"]; ok {
json.Unmarshal(v, &clip.PlayerID)
}
if v, ok := raw["uuid"]; ok {
json.Unmarshal(v, &clip.UUID)
}
if v, ok := raw["thumbnail"]; ok {
json.Unmarshal(v, &clip.Thumbnail)
}
if v, ok := raw["preview_url"]; ok {
json.Unmarshal(v, &clip.PreviewURL)
}
if v, ok := raw["duration"]; ok { if v, ok := raw["duration"]; ok {
json.Unmarshal(v, &clip.Duration) json.Unmarshal(v, &clip.Duration)
} }
if v, ok := raw["cover_uri"]; ok { if v, ok := raw["track_ids"]; ok {
json.Unmarshal(v, &clip.CoverURI) json.Unmarshal(v, &clip.TrackIDs)
} }
if v, ok := raw["preview_uri"]; ok { if v, ok := raw["artists"]; ok {
json.Unmarshal(v, &clip.PreviewURI) var artists []Artist
json.Unmarshal(v, &artists)
clip.Artists = artists
} }
if v, ok := raw["available"]; ok { if v, ok := raw["disclaimers"]; ok {
json.Unmarshal(v, &clip.Available) json.Unmarshal(v, &clip.Disclaimers)
} }
if v, ok := raw["views"]; ok { if v, ok := raw["explicit"]; ok {
json.Unmarshal(v, &clip.Views) json.Unmarshal(v, &clip.Explicit)
} }
if v, ok := raw["likes"]; ok { if v, ok := raw["cover"]; ok {
json.Unmarshal(v, &clip.Likes) var cover Cover
json.Unmarshal(v, &cover)
clip.Cover = &cover
} }
if v, ok := raw["created_at"]; ok { if v, ok := raw["content_restrictions"]; ok {
json.Unmarshal(v, &clip.CreatedAt) var cr ContentRestrictions
json.Unmarshal(v, &cr)
clip.ContentRestrictions = &cr
} }
if v, ok := raw["clip_type"]; ok { if v, ok := raw["clip_type"]; ok {
json.Unmarshal(v, &clip.ClipType) json.Unmarshal(v, &clip.ClipType)
@@ -71,22 +95,6 @@ func (c *Clip) DeJSON(data []byte, client ClientInterface) (Model, error) {
json.Unmarshal(v, &clip.AspectRatio) json.Unmarshal(v, &clip.AspectRatio)
} }
if v, ok := raw["artist"]; ok {
var artist Artist
json.Unmarshal(v, &artist)
clip.Artist = &artist
}
if v, ok := raw["track"]; ok {
var track Track
json.Unmarshal(v, &track)
clip.Track = &track
}
if v, ok := raw["playlist"]; ok {
var playlist Playlist
json.Unmarshal(v, &playlist)
clip.Playlist = &playlist
}
return clip, nil return clip, nil
} }
+32
View File
@@ -13,6 +13,7 @@ type Concert struct {
Description string `json:"description"` Description string `json:"description"`
Date string `json:"date"` Date string `json:"date"`
Time string `json:"time"` Time string `json:"time"`
Datetime string `json:"datetime"`
Venue *ConcertVenue `json:"venue"` Venue *ConcertVenue `json:"venue"`
Location *ConcertLocation `json:"location"` Location *ConcertLocation `json:"location"`
MinPrice int `json:"min_price"` MinPrice int `json:"min_price"`
@@ -27,6 +28,13 @@ type Concert struct {
Cashback *ConcertCashback `json:"cashback"` Cashback *ConcertCashback `json:"cashback"`
Tabs []ConcertTabConfig `json:"tabs"` Tabs []ConcertTabConfig `json:"tabs"`
Skeleton *ConcertSkeleton `json:"skeleton"` Skeleton *ConcertSkeleton `json:"skeleton"`
AfishaURL string `json:"afisha_url"`
City string `json:"city"`
Place string `json:"place"`
Address string `json:"address"`
ContentRating string `json:"content_rating"`
DataSessionID string `json:"data_session_id"`
EventInfo *ConcertEventInfo `json:"event_info"`
} }
// DeJSON deserializes a Concert from JSON data. // DeJSON deserializes a Concert from JSON data.
@@ -77,6 +85,30 @@ func (c *Concert) DeJSON(data []byte, client ClientInterface) (Model, error) {
if v, ok := raw["genres"]; ok { if v, ok := raw["genres"]; ok {
json.Unmarshal(v, &concert.Genres) json.Unmarshal(v, &concert.Genres)
} }
if v, ok := raw["datetime"]; ok {
json.Unmarshal(v, &concert.Datetime)
}
if v, ok := raw["afisha_url"]; ok {
json.Unmarshal(v, &concert.AfishaURL)
}
if v, ok := raw["city"]; ok {
json.Unmarshal(v, &concert.City)
}
if v, ok := raw["place"]; ok {
json.Unmarshal(v, &concert.Place)
}
if v, ok := raw["address"]; ok {
json.Unmarshal(v, &concert.Address)
}
if v, ok := raw["content_rating"]; ok {
json.Unmarshal(v, &concert.ContentRating)
}
if v, ok := raw["data_session_id"]; ok {
json.Unmarshal(v, &concert.DataSessionID)
}
if v, ok := raw["event_info"]; ok {
json.Unmarshal(v, &concert.EventInfo)
}
if v, ok := raw["venue"]; ok { if v, ok := raw["venue"]; ok {
var venue ConcertVenue var venue ConcertVenue
+24
View File
@@ -8,9 +8,15 @@ import (
// Feed represents the main feed from the Yandex Music API. // Feed represents the main feed from the Yandex Music API.
type Feed struct { type Feed struct {
BaseModel BaseModel
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"` Days []Day `json:"days"`
GeneratedPlaylists []GeneratedPlaylist `json:"generated_playlists"` GeneratedPlaylists []GeneratedPlaylist `json:"generated_playlists"`
PlayContexts []PlayContext `json:"play_contexts"` PlayContexts []PlayContext `json:"play_contexts"`
NextRevision string `json:"next_revision"`
} }
// DeJSON deserializes a Feed from JSON data. // 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)} 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 { if v, ok := raw["days"]; ok {
var days []Day var days []Day
json.Unmarshal(v, &days) json.Unmarshal(v, &days)
@@ -37,6 +58,9 @@ func (f *Feed) DeJSON(data []byte, c ClientInterface) (Model, error) {
json.Unmarshal(v, &contexts) json.Unmarshal(v, &contexts)
feed.PlayContexts = contexts feed.PlayContexts = contexts
} }
if v, ok := raw["next_revision"]; ok {
json.Unmarshal(v, &feed.NextRevision)
}
return feed, nil return feed, nil
} }
+16 -4
View File
@@ -12,8 +12,11 @@ type Label struct {
Name string `json:"name"` Name string `json:"name"`
CoverURI string `json:"cover_uri"` CoverURI string `json:"cover_uri"`
Description string `json:"description"` Description string `json:"description"`
DescriptionFormatted string `json:"description_formatted"`
Image string `json:"image"`
Website string `json:"website"` Website string `json:"website"`
SocialLinks []SocialLink `json:"social_links"` Links []Link `json:"links"`
Type string `json:"type"`
Available bool `json:"available"` Available bool `json:"available"`
Owner *User `json:"owner"` Owner *User `json:"owner"`
} }
@@ -45,10 +48,19 @@ func (l *Label) DeJSON(data []byte, client ClientInterface) (Model, error) {
if v, ok := raw["available"]; ok { if v, ok := raw["available"]; ok {
json.Unmarshal(v, &label.Available) json.Unmarshal(v, &label.Available)
} }
if v, ok := raw["social_links"]; ok { if v, ok := raw["description_formatted"]; ok {
var links []SocialLink json.Unmarshal(v, &label.DescriptionFormatted)
}
if v, ok := raw["image"]; ok {
json.Unmarshal(v, &label.Image)
}
if v, ok := raw["links"]; ok {
var links []Link
json.Unmarshal(v, &links) json.Unmarshal(v, &links)
label.SocialLinks = links label.Links = links
}
if v, ok := raw["type"]; ok {
json.Unmarshal(v, &label.Type)
} }
if v, ok := raw["owner"]; ok { if v, ok := raw["owner"]; ok {
var user User var user User
+8
View File
@@ -15,6 +15,8 @@ type Landing struct {
Type string `json:"type"` Type string `json:"type"`
Blocks []LandingBlock `json:"blocks"` Blocks []LandingBlock `json:"blocks"`
Available bool `json:"available"` Available bool `json:"available"`
Pumpkin bool `json:"pumpkin"`
ContentID string `json:"content_id"`
} }
// DeJSON deserializes a Landing from JSON data. // DeJSON deserializes a Landing from JSON data.
@@ -44,6 +46,12 @@ func (l *Landing) DeJSON(data []byte, c ClientInterface) (Model, error) {
if v, ok := raw["available"]; ok { if v, ok := raw["available"]; ok {
json.Unmarshal(v, &landing.Available) json.Unmarshal(v, &landing.Available)
} }
if v, ok := raw["pumpkin"]; ok {
json.Unmarshal(v, &landing.Pumpkin)
}
if v, ok := raw["content_id"]; ok {
json.Unmarshal(v, &landing.ContentID)
}
if v, ok := raw["blocks"]; ok { if v, ok := raw["blocks"]; ok {
var blocks []LandingBlock var blocks []LandingBlock
+6
View File
@@ -21,6 +21,7 @@ type Pin struct {
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
ExpiresAt string `json:"expires_at"` ExpiresAt string `json:"expires_at"`
Active bool `json:"active"` Active bool `json:"active"`
ContentRestrictions *ContentRestrictions `json:"content_restrictions"`
} }
// DeJSON deserializes a Pin from JSON data. // DeJSON deserializes a Pin from JSON data.
@@ -59,6 +60,11 @@ func (p *Pin) DeJSON(data []byte, client ClientInterface) (Model, error) {
if v, ok := raw["active"]; ok { if v, ok := raw["active"]; ok {
json.Unmarshal(v, &pin.Active) json.Unmarshal(v, &pin.Active)
} }
if v, ok := raw["content_restrictions"]; ok {
var cr ContentRestrictions
json.Unmarshal(v, &cr)
pin.ContentRestrictions = &cr
}
if v, ok := raw["track"]; ok { if v, ok := raw["track"]; ok {
var track Track var track Track
+13
View File
@@ -3,12 +3,25 @@ package models
// SearchResult represents search results from the Yandex Music API. // SearchResult represents search results from the Yandex Music API.
type SearchResult struct { type SearchResult struct {
SearchRequestID string `json:"search_request_id"`
Text string `json:"text"`
Best *Best `json:"best"`
Tracks *SearchTracksResult `json:"tracks"` Tracks *SearchTracksResult `json:"tracks"`
Albums *SearchAlbumsResult `json:"albums"` Albums *SearchAlbumsResult `json:"albums"`
Artists *SearchArtistsResult `json:"artists"` Artists *SearchArtistsResult `json:"artists"`
Playlists *SearchPlaylistsResult `json:"playlists"` Playlists *SearchPlaylistsResult `json:"playlists"`
Videos *SearchVideosResult `json:"videos"` Videos *SearchVideosResult `json:"videos"`
Users *SearchUsersResult `json:"users"` Users *SearchUsersResult `json:"users"`
Podcasts *SearchAlbumsResult `json:"podcasts"`
PodcastEpisodes *SearchTracksResult `json:"podcast_episodes"`
Clips *SearchVideosResult `json:"clips"`
Banner *SearchBanner `json:"banner"`
Page int `json:"page"`
PerPage int `json:"per_page"`
MisspellResult bool `json:"misspell_result"`
MisspellOriginal string `json:"misspell_original"`
MisspellCorrected bool `json:"misspell_corrected"`
Nocorrect bool `json:"nocorrect"`
} }
// SearchTracksResult represents track search results. // SearchTracksResult represents track search results.