Files
yandex-music-api-go/internal/models/search.go
T
Mrixs dbb823ade3 Fix R128 and remaining ID fields to accept both JSON types
- Track.R128 and TrackShort.R128: float64 → JSONR128 (accepts both JSON number and object)
- All remaining primary ID fields: string → JSONID (accepts both JSON string and number)
  Fixed in: account, artist, clip, concert, feed, label, landing, metatag,
  music_history, pin, queue, radio, search, settings, supplement
2026-10-18 11:01:26 +03:00

84 lines
2.3 KiB
Go

// Package models provides data models for the Yandex Music API.
package models
// SearchResult represents search results from the Yandex Music API.
type SearchResult struct {
Tracks *SearchTracksResult `json:"tracks"`
Albums *SearchAlbumsResult `json:"albums"`
Artists *SearchArtistsResult `json:"artists"`
Playlists *SearchPlaylistsResult `json:"playlists"`
Videos *SearchVideosResult `json:"videos"`
Users *SearchUsersResult `json:"users"`
}
// SearchTracksResult represents track search results.
type SearchTracksResult struct {
Total int `json:"total"`
Results []Track `json:"results"`
}
// SearchAlbumsResult represents album search results.
type SearchAlbumsResult struct {
Total int `json:"total"`
Results []Album `json:"results"`
}
// SearchArtistsResult represents artist search results.
type SearchArtistsResult struct {
Total int `json:"total"`
Results []Artist `json:"results"`
}
// SearchPlaylistsResult represents playlist search results.
type SearchPlaylistsResult struct {
Total int `json:"total"`
Results []Playlist `json:"results"`
}
// SearchVideosResult represents video search results.
type SearchVideosResult struct {
Total int `json:"total"`
Results []Video `json:"results"`
}
// SearchUsersResult represents user search results.
type SearchUsersResult struct {
Total int `json:"total"`
Results []User `json:"results"`
}
// SearchBanner represents a search banner.
type SearchBanner struct {
ID JSONID `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Image string `json:"image"`
URL string `json:"url"`
Action string `json:"action"`
Type string `json:"type"`
}
// Tag represents a search tag.
type Tag struct {
ID JSONID `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Count int `json:"count"`
Type string `json:"type"`
}
// Video represents a video (minimal).
type Video 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"`
Owner *User `json:"owner"`
}