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

+11 -6
View File
@@ -1,3 +1,4 @@
// Package client provides methods for interacting with Yandex Music API endpoints.
package client
import (
@@ -8,7 +9,8 @@ import (
"gitea.mrixs.me/Mrixs/yandex-music-api-go/internal/utils"
)
// GetTracks gets tracks by IDs
// GetTracks gets tracks by their IDs (GET /tracks).
// Returns a slice of Track pointers, or nil if no IDs are provided.
func (c *Client) GetTracks(ctx context.Context, trackIDs []string) ([]*models.Track, error) {
if len(trackIDs) == 0 {
return nil, nil
@@ -31,7 +33,8 @@ func (c *Client) GetTracks(ctx context.Context, trackIDs []string) ([]*models.Tr
return tracks, nil
}
// GetTrack gets a single track by ID
// GetTrack gets a single track by ID using GetTracks.
// Returns an error if no track is found with the given ID.
func (c *Client) GetTrack(ctx context.Context, trackID string) (*models.Track, error) {
tracks, err := c.GetTracks(ctx, []string{trackID})
if err != nil {
@@ -43,7 +46,8 @@ func (c *Client) GetTrack(ctx context.Context, trackID string) (*models.Track, e
return tracks[0], nil
}
// GetTrackDownloadInfo gets download info for a track
// GetTrackDownloadInfo gets download info for a track (GET /tracks/{track_id}/download-info).
// The quality parameter specifies the desired audio quality (e.g., "mp3").
func (c *Client) GetTrackDownloadInfo(ctx context.Context, trackID, quality string) ([]models.DownloadInfo, error) {
// This requires signing - use the sign utility
// For now, return basic implementation
@@ -58,7 +62,8 @@ func (c *Client) GetTrackDownloadInfo(ctx context.Context, trackID, quality stri
return result, nil
}
// DownloadTrack downloads a track
// DownloadTrack downloads a track by ID.
// It first fetches download info, finds a matching format/bitrate, then downloads the file content.
func (c *Client) DownloadTrack(ctx context.Context, trackID, format string, bitrate int) ([]byte, error) {
info, err := c.GetTrackDownloadInfo(ctx, trackID, format)
if err != nil {
@@ -85,12 +90,12 @@ func (c *Client) DownloadTrack(ctx context.Context, trackID, format string, bitr
return c.request.Download(ctx, url)
}
// SearchResult represents search results
// SearchResult represents search results containing tracks.
type SearchResult struct {
Tracks *SearchTracksResult `json:"tracks"`
}
// SearchTracksResult represents track search results
// SearchTracksResult represents track search results with total count and results list.
type SearchTracksResult struct {
Total int `json:"total"`
Results []models.Track `json:"results"`