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
+13
-12
@@ -1,10 +1,11 @@
|
||||
// Package models provides data models for the Yandex Music API.
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// Album represents a full album
|
||||
// Album represents a full album from the Yandex Music API.
|
||||
type Album struct {
|
||||
BaseModel
|
||||
ID string `json:"id"`
|
||||
@@ -34,7 +35,7 @@ type Album struct {
|
||||
Trailer *TrailerInfo `json:"trailer"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes an Album from JSON
|
||||
// DeJSON deserializes an Album from JSON data.
|
||||
func (a *Album) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
@@ -138,7 +139,7 @@ func (a *Album) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
return album, nil
|
||||
}
|
||||
|
||||
// DeList deserializes a list of Albums
|
||||
// DeList deserializes a list of Albums from JSON data.
|
||||
func (a *Album) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
var rawList []json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawList); err != nil {
|
||||
@@ -156,14 +157,14 @@ func (a *Album) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// AlbumMeta represents album metadata
|
||||
// AlbumMeta represents album metadata.
|
||||
type AlbumMeta struct {
|
||||
BaseModel
|
||||
Availability *Availability `json:"availability"`
|
||||
Upsell *Upsell `json:"upsell"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes an AlbumMeta from JSON
|
||||
// DeJSON deserializes an AlbumMeta from JSON data.
|
||||
func (am *AlbumMeta) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
@@ -186,7 +187,7 @@ func (am *AlbumMeta) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
return meta, nil
|
||||
}
|
||||
|
||||
// DeList deserializes a list of AlbumMeta
|
||||
// DeList deserializes a list of AlbumMeta from JSON data.
|
||||
func (am *AlbumMeta) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
var rawList []json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawList); err != nil {
|
||||
@@ -204,24 +205,24 @@ func (am *AlbumMeta) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Availability represents availability info
|
||||
// Availability represents availability info for an album.
|
||||
type Availability struct {
|
||||
AvailableForPremiumUsers bool `json:"available_for_premium_users"`
|
||||
Territories []string `json:"territories"`
|
||||
}
|
||||
|
||||
// Upsell represents upsell info
|
||||
// Upsell represents upsell info for an album.
|
||||
type Upsell struct {
|
||||
Type string `json:"type"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// Best represents best tracks info
|
||||
// Best represents best tracks info for an album.
|
||||
type Best struct {
|
||||
Tracks []Track `json:"tracks"`
|
||||
}
|
||||
|
||||
// TrailerInfo represents album/track trailer info
|
||||
// TrailerInfo represents album/track trailer info.
|
||||
type TrailerInfo struct {
|
||||
BaseModel
|
||||
PreviewURI string `json:"preview_uri"`
|
||||
@@ -230,7 +231,7 @@ type TrailerInfo struct {
|
||||
Duration int `json:"duration"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes a TrailerInfo from JSON
|
||||
// DeJSON deserializes a TrailerInfo from JSON data.
|
||||
func (ti *TrailerInfo) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
@@ -255,7 +256,7 @@ func (ti *TrailerInfo) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
return trailer, nil
|
||||
}
|
||||
|
||||
// DeList deserializes a list of TrailerInfo
|
||||
// DeList deserializes a list of TrailerInfo from JSON data.
|
||||
func (ti *TrailerInfo) 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