Add comprehensive godoc documentation to all exported symbols
- Document all exported types, functions, methods, and constants across 52 files - Add package-level doc comments to client, models, utils, and ynison packages - Document HTTP method and endpoint path for each API client method - Document model struct fields and DeJSON/DeList/ToJSON/ToMap methods - Fix duplicate package doc comment in internal/models/base.go Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
1 parent
7a68ad86cb
commit
0456ca0665
54 files changed
+1097
-652
No files matched your search
@@ -1,10 +1,11 @@
|
||||
// Package models provides data models for the Yandex Music API.
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// LyricsMajor represents a lyrics provider (e.g., Genius, Musixmatch)
|
||||
// LyricsMajor represents a lyrics provider (e.g., Genius, Musixmatch).
|
||||
type LyricsMajor struct {
|
||||
BaseModel
|
||||
ID int `json:"id"`
|
||||
@@ -12,7 +13,7 @@ type LyricsMajor struct {
|
||||
PrettyName string `json:"pretty_name"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes LyricsMajor from JSON
|
||||
// DeJSON deserializes LyricsMajor from JSON data.
|
||||
func (lm *LyricsMajor) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
@@ -34,7 +35,7 @@ func (lm *LyricsMajor) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
return major, nil
|
||||
}
|
||||
|
||||
// DeList deserializes a list of LyricsMajor
|
||||
// DeList deserializes a list of LyricsMajor from JSON data.
|
||||
func (lm *LyricsMajor) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
var rawList []json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawList); err != nil {
|
||||
@@ -52,7 +53,7 @@ func (lm *LyricsMajor) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// TrackLyrics represents lyrics information from /tracks/{id}/lyrics endpoint
|
||||
// TrackLyrics represents lyrics information from /tracks/{id}/lyrics endpoint.
|
||||
type TrackLyrics struct {
|
||||
BaseModel
|
||||
DownloadURL string `json:"download_url"`
|
||||
@@ -62,7 +63,7 @@ type TrackLyrics struct {
|
||||
Major *LyricsMajor `json:"major"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes TrackLyrics from JSON
|
||||
// DeJSON deserializes TrackLyrics from JSON data.
|
||||
func (tl *TrackLyrics) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
@@ -92,7 +93,7 @@ func (tl *TrackLyrics) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
return lyrics, nil
|
||||
}
|
||||
|
||||
// DeList deserializes a list of TrackLyrics
|
||||
// DeList deserializes a list of TrackLyrics from JSON data.
|
||||
func (tl *TrackLyrics) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
var rawList []json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawList); err != nil {
|
||||
@@ -110,7 +111,7 @@ func (tl *TrackLyrics) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SupplementLyrics represents the actual lyrics content (from supplement)
|
||||
// SupplementLyrics represents the actual lyrics content from supplement.
|
||||
type SupplementLyrics struct {
|
||||
BaseModel
|
||||
ID int `json:"id"`
|
||||
@@ -123,7 +124,7 @@ type SupplementLyrics struct {
|
||||
Major *LyricsMajor `json:"major"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes SupplementLyrics from JSON
|
||||
// DeJSON deserializes SupplementLyrics from JSON data.
|
||||
func (l *SupplementLyrics) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
@@ -162,7 +163,7 @@ func (l *SupplementLyrics) DeJSON(data []byte, c ClientInterface) (Model, error)
|
||||
return lyrics, nil
|
||||
}
|
||||
|
||||
// DeList deserializes a list of SupplementLyrics
|
||||
// DeList deserializes a list of SupplementLyrics from JSON data.
|
||||
func (l *SupplementLyrics) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
var rawList []json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawList); err != nil {
|
||||
@@ -180,7 +181,7 @@ func (l *SupplementLyrics) DeList(data []byte, c ClientInterface) ([]Model, erro
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// LyricsInfo represents lyrics availability information
|
||||
// LyricsInfo represents lyrics availability information.
|
||||
type LyricsInfo struct {
|
||||
BaseModel
|
||||
TrackID string `json:"track_id"`
|
||||
@@ -196,7 +197,7 @@ type LyricsInfo struct {
|
||||
HasAvailableTextLyrics bool `json:"has_available_text_lyrics"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes LyricsInfo from JSON
|
||||
// DeJSON deserializes LyricsInfo from JSON data.
|
||||
func (li *LyricsInfo) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
@@ -247,7 +248,7 @@ func (li *LyricsInfo) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
// DeList deserializes a list of LyricsInfo
|
||||
// DeList deserializes a list of LyricsInfo from JSON data.
|
||||
func (li *LyricsInfo) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
var rawList []json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawList); err != nil {
|
||||
@@ -265,7 +266,7 @@ func (li *LyricsInfo) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// VideoSupplement represents a video supplement (from supplement endpoint)
|
||||
// VideoSupplement represents a video supplement from supplement endpoint.
|
||||
type VideoSupplement struct {
|
||||
BaseModel
|
||||
Cover string `json:"cover"`
|
||||
@@ -277,7 +278,7 @@ type VideoSupplement struct {
|
||||
Embed string `json:"embed"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes VideoSupplement from JSON
|
||||
// DeJSON deserializes VideoSupplement from JSON data.
|
||||
func (vs *VideoSupplement) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
@@ -311,7 +312,7 @@ func (vs *VideoSupplement) DeJSON(data []byte, c ClientInterface) (Model, error)
|
||||
return supp, nil
|
||||
}
|
||||
|
||||
// DeList deserializes a list of VideoSupplements
|
||||
// DeList deserializes a list of VideoSupplements from JSON data.
|
||||
func (vs *VideoSupplement) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
var rawList []json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawList); err != nil {
|
||||
@@ -329,7 +330,7 @@ func (vs *VideoSupplement) DeList(data []byte, c ClientInterface) ([]Model, erro
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Supplement represents a track supplement
|
||||
// Supplement represents a track supplement.
|
||||
type Supplement struct {
|
||||
BaseModel
|
||||
ID string `json:"id"`
|
||||
@@ -340,7 +341,7 @@ type Supplement struct {
|
||||
Available bool `json:"available"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes Supplement from JSON
|
||||
// DeJSON deserializes Supplement from JSON data.
|
||||
func (s *Supplement) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
@@ -376,7 +377,7 @@ func (s *Supplement) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
return supp, nil
|
||||
}
|
||||
|
||||
// DeList deserializes a list of Supplements
|
||||
// DeList deserializes a list of Supplements from JSON data.
|
||||
func (s *Supplement) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
var rawList []json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawList); err != nil {
|
||||
|
||||
Reference in new issue
Block a user