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:
MrixsandClaude Code committed 2026-10-18 08:57:43 +03:00
1 parent 7a68ad86cb
commit 0456ca0665
54 files changed
+1097 -652

No files matched your search

+18 -17
View File
@@ -1,10 +1,11 @@
// Package models provides data models for the Yandex Music API.
package models
import (
"encoding/json"
)
// Feed represents the main feed
// Feed represents the main feed from the Yandex Music API.
type Feed struct {
BaseModel
Days []Day `json:"days"`
@@ -12,7 +13,7 @@ type Feed struct {
PlayContexts []PlayContext `json:"play_contexts"`
}
// DeJSON deserializes a Feed from JSON
// DeJSON deserializes a Feed from JSON data.
func (f *Feed) DeJSON(data []byte, c ClientInterface) (Model, error) {
var raw map[string]json.RawMessage
if err := json.Unmarshal(data, &raw); err != nil {
@@ -40,7 +41,7 @@ func (f *Feed) DeJSON(data []byte, c ClientInterface) (Model, error) {
return feed, nil
}
// DeList deserializes a list of Feeds
// DeList deserializes a list of Feeds from JSON data.
func (f *Feed) DeList(data []byte, c ClientInterface) ([]Model, error) {
var rawList []json.RawMessage
if err := json.Unmarshal(data, &rawList); err != nil {
@@ -58,7 +59,7 @@ func (f *Feed) DeList(data []byte, c ClientInterface) ([]Model, error) {
return result, nil
}
// Day represents a day in the feed
// Day represents a day in the feed.
type Day struct {
BaseModel
Date string `json:"date"`
@@ -68,7 +69,7 @@ type Day struct {
GeneratedPlaylists []GeneratedPlaylist `json:"generated_playlists"`
}
// DeJSON deserializes a Day from JSON
// DeJSON deserializes a Day from JSON data.
func (d *Day) DeJSON(data []byte, c ClientInterface) (Model, error) {
var raw map[string]json.RawMessage
if err := json.Unmarshal(data, &raw); err != nil {
@@ -100,7 +101,7 @@ func (d *Day) DeJSON(data []byte, c ClientInterface) (Model, error) {
return day, nil
}
// DeList deserializes a list of Days
// DeList deserializes a list of Days from JSON data.
func (d *Day) DeList(data []byte, c ClientInterface) ([]Model, error) {
var rawList []json.RawMessage
if err := json.Unmarshal(data, &rawList); err != nil {
@@ -118,7 +119,7 @@ func (d *Day) DeList(data []byte, c ClientInterface) ([]Model, error) {
return result, nil
}
// DayBlock represents a block in a day
// DayBlock represents a block in a day.
type DayBlock struct {
BaseModel
ID string `json:"id"`
@@ -128,7 +129,7 @@ type DayBlock struct {
Data *DayBlockData `json:"data"`
}
// DayBlockData represents data in a day block
// DayBlockData represents data in a day block.
type DayBlockData struct {
Tracks []Track `json:"tracks"`
Playlists []Playlist `json:"playlists"`
@@ -137,7 +138,7 @@ type DayBlockData struct {
GeneratedPlaylist *GeneratedPlaylist `json:"generated_playlist"`
}
// GeneratedPlaylist represents a generated playlist
// GeneratedPlaylist represents a generated playlist.
type GeneratedPlaylist struct {
BaseModel
ID string `json:"id"`
@@ -153,7 +154,7 @@ type GeneratedPlaylist struct {
Tracks []Track `json:"tracks"`
}
// DeJSON deserializes a GeneratedPlaylist from JSON
// DeJSON deserializes a GeneratedPlaylist from JSON data.
func (gp *GeneratedPlaylist) DeJSON(data []byte, c ClientInterface) (Model, error) {
var raw map[string]json.RawMessage
if err := json.Unmarshal(data, &raw); err != nil {
@@ -201,7 +202,7 @@ func (gp *GeneratedPlaylist) DeJSON(data []byte, c ClientInterface) (Model, erro
return playlist, nil
}
// DeList deserializes a list of GeneratedPlaylists
// DeList deserializes a list of GeneratedPlaylists from JSON data.
func (gp *GeneratedPlaylist) DeList(data []byte, c ClientInterface) ([]Model, error) {
var rawList []json.RawMessage
if err := json.Unmarshal(data, &rawList); err != nil {
@@ -219,7 +220,7 @@ func (gp *GeneratedPlaylist) DeList(data []byte, c ClientInterface) ([]Model, er
return result, nil
}
// Event represents a feed event
// Event represents a feed event.
type Event struct {
BaseModel
Timestamp string `json:"timestamp"`
@@ -231,7 +232,7 @@ type Event struct {
Action string `json:"action"`
}
// AlbumEvent represents an album event
// AlbumEvent represents an album event.
type AlbumEvent struct {
BaseModel
Album *Album `json:"album"`
@@ -240,7 +241,7 @@ type AlbumEvent struct {
Action string `json:"action"`
}
// ArtistEvent represents an artist event
// ArtistEvent represents an artist event.
type ArtistEvent struct {
BaseModel
Artist *Artist `json:"artist"`
@@ -249,7 +250,7 @@ type ArtistEvent struct {
Action string `json:"action"`
}
// TrackWithAds represents a track with ads
// TrackWithAds represents a track with ads.
type TrackWithAds struct {
BaseModel
Track *Track `json:"track"`
@@ -257,7 +258,7 @@ type TrackWithAds struct {
AdParams *AdParams `json:"ad_params"`
}
// Ad represents an ad
// Ad represents an ad.
type Ad struct {
BaseModel
ID string `json:"id"`
@@ -269,7 +270,7 @@ type Ad struct {
Duration int `json:"duration"`
}
// AdParams represents ad parameters
// AdParams represents ad parameters.
type AdParams struct {
BaseModel
Frequency int `json:"frequency"`