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"
|
||||
)
|
||||
|
||||
// Track represents a full track
|
||||
// Track represents a full track from the Yandex Music API.
|
||||
type Track struct {
|
||||
BaseModel
|
||||
ID string `json:"id"`
|
||||
@@ -27,7 +28,7 @@ type Track struct {
|
||||
DownloadInfo []DownloadInfo `json:"download_info"`
|
||||
}
|
||||
|
||||
// DeJSON deserializes a Track from JSON
|
||||
// DeJSON deserializes a Track from JSON data.
|
||||
func (t *Track) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
var raw map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
@@ -115,7 +116,7 @@ func (t *Track) DeJSON(data []byte, c ClientInterface) (Model, error) {
|
||||
return track, nil
|
||||
}
|
||||
|
||||
// DeList deserializes a list of Tracks
|
||||
// DeList deserializes a list of Tracks from JSON data.
|
||||
func (t *Track) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
var rawList []json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawList); err != nil {
|
||||
@@ -133,7 +134,7 @@ func (t *Track) DeList(data []byte, c ClientInterface) ([]Model, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetDownloadInfo returns download info for a specific quality
|
||||
// GetDownloadInfo returns download info for a specific quality, or nil if not found.
|
||||
func (t *Track) GetDownloadInfo(quality string) *DownloadInfo {
|
||||
for _, info := range t.DownloadInfo {
|
||||
if info.Quality == quality {
|
||||
@@ -146,14 +147,14 @@ func (t *Track) GetDownloadInfo(quality string) *DownloadInfo {
|
||||
// Note: Artist and Album types are defined in their respective files
|
||||
// These are imported automatically since they're in the same package
|
||||
|
||||
// Major represents major info
|
||||
// Major represents major label info for a track.
|
||||
type Major struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// TrackLyricsInfo represents minimal lyrics info for a track
|
||||
// TrackLyricsInfo represents minimal lyrics info for a track.
|
||||
type TrackLyricsInfo struct {
|
||||
ID string `json:"id"`
|
||||
Text string `json:"text"`
|
||||
@@ -162,7 +163,7 @@ type TrackLyricsInfo struct {
|
||||
HasText bool `json:"has_text"`
|
||||
}
|
||||
|
||||
// DownloadInfo represents file download info
|
||||
// DownloadInfo represents file download info for a track.
|
||||
type DownloadInfo struct {
|
||||
Quality string `json:"quality"`
|
||||
Codec string `json:"codec"`
|
||||
|
||||
Reference in new issue
Block a user