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
+69
-61
@@ -8,21 +8,24 @@ import (
|
||||
// Clip represents a clip (short video) from the Yandex Music API.
|
||||
type Clip struct {
|
||||
BaseModel
|
||||
ID JSONID `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Duration int `json:"duration"`
|
||||
CoverURI string `json:"cover_uri"`
|
||||
PreviewURI string `json:"preview_uri"`
|
||||
Available bool `json:"available"`
|
||||
Views int `json:"views"`
|
||||
Likes int `json:"likes"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
Artist *Artist `json:"artist"`
|
||||
Track *Track `json:"track"`
|
||||
Playlist *Playlist `json:"playlist"`
|
||||
ClipType string `json:"clip_type"`
|
||||
IsVertical bool `json:"is_vertical"`
|
||||
AspectRatio string `json:"aspect_ratio"`
|
||||
ID JSONID `json:"id"`
|
||||
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"`
|
||||
TrackIDs []int `json:"track_ids"`
|
||||
Artists []Artist `json:"artists"`
|
||||
Disclaimers []string `json:"disclaimers"`
|
||||
Explicit bool `json:"explicit"`
|
||||
Cover *Cover `json:"cover"`
|
||||
ContentRestrictions *ContentRestrictions `json:"content_restrictions"`
|
||||
Client *ClientInterface `json:"-"`
|
||||
ClipType string `json:"clip_type"`
|
||||
IsVertical bool `json:"is_vertical"`
|
||||
AspectRatio string `json:"aspect_ratio"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes a Clip from JSON data.
|
||||
@@ -40,26 +43,47 @@ func (c *Clip) DeJSON(data []byte, client ClientInterface) (Model, error) {
|
||||
if v, ok := raw["title"]; ok {
|
||||
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 {
|
||||
json.Unmarshal(v, &clip.Duration)
|
||||
}
|
||||
if v, ok := raw["cover_uri"]; ok {
|
||||
json.Unmarshal(v, &clip.CoverURI)
|
||||
if v, ok := raw["track_ids"]; ok {
|
||||
json.Unmarshal(v, &clip.TrackIDs)
|
||||
}
|
||||
if v, ok := raw["preview_uri"]; ok {
|
||||
json.Unmarshal(v, &clip.PreviewURI)
|
||||
if v, ok := raw["artists"]; ok {
|
||||
var artists []Artist
|
||||
json.Unmarshal(v, &artists)
|
||||
clip.Artists = artists
|
||||
}
|
||||
if v, ok := raw["available"]; ok {
|
||||
json.Unmarshal(v, &clip.Available)
|
||||
if v, ok := raw["disclaimers"]; ok {
|
||||
json.Unmarshal(v, &clip.Disclaimers)
|
||||
}
|
||||
if v, ok := raw["views"]; ok {
|
||||
json.Unmarshal(v, &clip.Views)
|
||||
if v, ok := raw["explicit"]; ok {
|
||||
json.Unmarshal(v, &clip.Explicit)
|
||||
}
|
||||
if v, ok := raw["likes"]; ok {
|
||||
json.Unmarshal(v, &clip.Likes)
|
||||
if v, ok := raw["cover"]; ok {
|
||||
var cover Cover
|
||||
json.Unmarshal(v, &cover)
|
||||
clip.Cover = &cover
|
||||
}
|
||||
if v, ok := raw["created_at"]; ok {
|
||||
json.Unmarshal(v, &clip.CreatedAt)
|
||||
if v, ok := raw["content_restrictions"]; ok {
|
||||
var cr ContentRestrictions
|
||||
json.Unmarshal(v, &cr)
|
||||
clip.ContentRestrictions = &cr
|
||||
}
|
||||
if v, ok := raw["clip_type"]; ok {
|
||||
json.Unmarshal(v, &clip.ClipType)
|
||||
@@ -71,22 +95,6 @@ func (c *Clip) DeJSON(data []byte, client ClientInterface) (Model, error) {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -132,23 +140,23 @@ type ArtistClipItem struct {
|
||||
// Shot represents a shot (short video).
|
||||
type Shot struct {
|
||||
BaseModel
|
||||
ID JSONID `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Duration int `json:"duration"`
|
||||
CoverURI string `json:"cover_uri"`
|
||||
PreviewURI string `json:"preview_uri"`
|
||||
Available bool `json:"available"`
|
||||
Views int `json:"views"`
|
||||
Likes int `json:"likes"`
|
||||
Comments int `json:"comments"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
Author *User `json:"author"`
|
||||
Track *Track `json:"track"`
|
||||
ShotType string `json:"shot_type"`
|
||||
Tags []string `json:"tags"`
|
||||
IsVertical bool `json:"is_vertical"`
|
||||
AspectRatio string `json:"aspect_ratio"`
|
||||
ID JSONID `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Duration int `json:"duration"`
|
||||
CoverURI string `json:"cover_uri"`
|
||||
PreviewURI string `json:"preview_uri"`
|
||||
Available bool `json:"available"`
|
||||
Views int `json:"views"`
|
||||
Likes int `json:"likes"`
|
||||
Comments int `json:"comments"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
Author *User `json:"author"`
|
||||
Track *Track `json:"track"`
|
||||
ShotType string `json:"shot_type"`
|
||||
Tags []string `json:"tags"`
|
||||
IsVertical bool `json:"is_vertical"`
|
||||
AspectRatio string `json:"aspect_ratio"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes a Shot from JSON data.
|
||||
@@ -258,7 +266,7 @@ type ShotEvent struct {
|
||||
// ShotType represents a shot type.
|
||||
type ShotType struct {
|
||||
BaseModel
|
||||
ID JSONID `json:"id"`
|
||||
ID JSONID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Icon string `json:"icon"`
|
||||
|
||||
Reference in new issue
Block a user