Initial commit

This commit is contained in:
Mrixs committed 2026-10-14 23:04:51 +03:00
commit 02a6dabcfb
62 files changed
+15751

No files matched your search

+348
View File
@@ -0,0 +1,348 @@
package yandexmusic
import (
"gitea.mrixs.me/Mrixs/yandex-music-api-go/internal/client"
"gitea.mrixs.me/Mrixs/yandex-music-api-go/internal/models"
"gitea.mrixs.me/Mrixs/yandex-music-api-go/internal/utils"
"gitea.mrixs.me/Mrixs/yandex-music-api-go/internal/ynison"
)
// ClientConfig holds configuration for the Client
type ClientConfig = client.ClientConfig
// Client is the main Yandex Music API client
type Client = client.Client
// NewClient creates a new Yandex Music client
func NewClient(config ClientConfig) *Client {
return client.NewClient(config)
}
// Request is the HTTP request handler
type Request = client.Request
// DeviceCode represents the device authorization response
type DeviceCode = client.DeviceCode
// OAuthToken represents an OAuth token response
type OAuthToken = client.OAuthToken
// Status represents account status
type Status = client.Status
// Account represents a user account
type Account = client.Account
// Track represents a music track
type Track = models.Track
// Artist represents an artist
type Artist = models.Artist
// Album represents an album
type Album = models.Album
// Playlist represents a playlist
type Playlist = models.Playlist
// User represents a user
type User = models.User
// DownloadInfo represents file download info
type DownloadInfo = models.DownloadInfo
// SupplementLyrics represents lyrics content from supplement
type SupplementLyrics = models.SupplementLyrics
// Major represents major label info
type Major = models.Major
// Label represents a label
type Label = models.Label
// Availability represents availability info
type Availability = models.Availability
// Upsell represents upsell info
type Upsell = models.Upsell
// AlbumMeta represents album metadata
type AlbumMeta = models.AlbumMeta
// Best represents best tracks info
type Best = models.Best
// Ratings represents artist ratings
type Ratings = models.Ratings
// Counts represents artist counts
type Counts = models.Counts
// TrackShort represents a lightweight track
type TrackShort = models.TrackShort
// TracksList represents a list of tracks with metadata
type TracksList = models.TracksList
// Pager represents pagination info
type Pager = models.Pager
// TrackPosition represents track position
type TrackPosition = models.TrackPosition
// TrailerInfo represents trailer info
type TrailerInfo = models.TrailerInfo
// Cover represents cover image info
type Cover = models.Cover
// ArtistBriefInfo represents brief artist info
type ArtistBriefInfo = models.ArtistBriefInfo
// ArtistDonations represents artist donations info
type ArtistDonations = models.ArtistDonations
// DonationItem represents a donation item
type DonationItem = models.DonationItem
// Concert represents a concert (minimal)
type Concert = models.Concert
// Clip represents a clip (short video)
type Clip = models.Clip
// SearchResult represents search results
type SearchResult = models.SearchResult
// SearchTracksResult represents track search results
type SearchTracksResult = models.SearchTracksResult
// SearchAlbumsResult represents album search results
type SearchAlbumsResult = models.SearchAlbumsResult
// SearchArtistsResult represents artist search results
type SearchArtistsResult = models.SearchArtistsResult
// SearchPlaylistsResult represents playlist search results
type SearchPlaylistsResult = models.SearchPlaylistsResult
// SearchVideosResult represents video search results
type SearchVideosResult = models.SearchVideosResult
// SearchUsersResult represents user search results
type SearchUsersResult = models.SearchUsersResult
// SearchBanner represents a search banner
type SearchBanner = models.SearchBanner
// Tag represents a search tag
type Tag = models.Tag
// Video represents a video
type Video = models.Video
// ChartInfoMenu represents a chart info menu
type ChartInfoMenu = models.ChartInfoMenu
// ChartInfoMenuItem represents a chart info menu item
type ChartInfoMenuItem = models.ChartInfoMenuItem
// ChartItems represents chart items response
type ChartItems = models.ChartItems
// AccountSettings represents account settings
type AccountSettings = models.AccountSettings
// Subscription represents subscription info
type Subscription = models.Subscription
// PlusInfo represents Plus subscription info
type PlusInfo = models.PlusInfo
// PromoCodeStatus represents promo code status
type PromoCodeStatus = models.PromoCodeStatus
// Queue represents a playback queue
type Queue = models.Queue
// QueueItem represents a queue item
type QueueItem = models.QueueItem
// PlayContext represents a play context
type PlayContext = models.PlayContext
// PlayContextsData represents play contexts data
type PlayContextsData = models.PlayContextsData
// Feed represents the main feed
type Feed = models.Feed
// Day represents a day in the feed
type Day = models.Day
// DayBlock represents a block in a day
type DayBlock = models.DayBlock
// DayBlockData represents data in a day block
type DayBlockData = models.DayBlockData
// GeneratedPlaylist represents a generated playlist
type GeneratedPlaylist = models.GeneratedPlaylist
// Event represents a feed event
type Event = models.Event
// AlbumEvent represents an album event
type AlbumEvent = models.AlbumEvent
// ArtistEvent represents an artist event
type ArtistEvent = models.ArtistEvent
// TrackWithAds represents a track with ads
type TrackWithAds = models.TrackWithAds
// Ad represents an ad
type Ad = models.Ad
// AdParams represents ad parameters
type AdParams = models.AdParams
// Landing represents a landing page
type Landing = models.Landing
// LandingBlock represents a block in a landing
type LandingBlock = models.LandingBlock
// LandingBlockData represents data in a landing block
type LandingBlockData = models.LandingBlockData
// LandingList represents a list of landings
type LandingList = models.LandingList
// LyricsInfo represents lyrics information
type LyricsInfo = models.LyricsInfo
// VideoSupplement represents video supplement
type VideoSupplement = models.VideoSupplement
// Supplement represents track supplement
type Supplement = models.Supplement
// LyricsMajor represents a lyrics provider (e.g., Genius, Musixmatch)
type LyricsMajor = models.LyricsMajor
// TrackLyrics represents lyrics information from /tracks/{id}/lyrics endpoint
type TrackLyrics = models.TrackLyrics
// Credits represents track credits
type Credits = models.Credits
// Credit represents a credit item
type Credit = models.Credit
// RadioStation represents a radio station
type RadioStation = models.RadioStation
// StationTracksResult represents station tracks result
type StationTracksResult = models.StationTracksResult
// RotorStation represents a rotor (generative) station
type RotorStation = models.RotorStation
// RotorSettings represents rotor station settings
type RotorSettings = models.RotorSettings
// RotorStationTracksResult represents rotor station tracks result
type RotorStationTracksResult = models.RotorStationTracksResult
// RotorSession represents a rotor session
type RotorSession = models.RotorSession
// SessionFeedback represents session feedback
type SessionFeedback = models.SessionFeedback
// SessionFeedbacks represents multiple session feedbacks
type SessionFeedbacks = models.SessionFeedbacks
// Experiments represents experiments
type Experiments = models.Experiments
// ExperimentDetail represents experiment details
type ExperimentDetail = models.ExperimentDetail
// Permissions represents user permissions
type Permissions = models.Permissions
// PermissionAlerts represents permission alerts
type PermissionAlerts = models.PermissionAlerts
// PermissionAlert represents a permission alert
type PermissionAlert = models.PermissionAlert
// ContentRestrictions represents content restrictions
type ContentRestrictions = models.ContentRestrictions
// JSONBackend defines the interface for JSON encoding/decoding
type JSONBackend = utils.JSONBackend
// GetDefaultJSONBackend returns the default JSON backend
func GetDefaultJSONBackend() JSONBackend {
return utils.GetDefaultJSONBackend()
}
// SchemaMismatchConfig holds configuration for schema mismatch handling
type SchemaMismatchConfig = utils.SchemaMismatchConfig
// DefaultSchemaMismatchConfig returns the default configuration
func DefaultSchemaMismatchConfig() SchemaMismatchConfig {
return utils.DefaultSchemaMismatchConfig()
}
// SchemaMismatchHandler is a callback for handling schema mismatches
type SchemaMismatchHandler = utils.SchemaMismatchHandler
// SchemaMismatch represents a mismatch between expected and actual API response
type SchemaMismatch = utils.SchemaMismatch
// YnisonClient represents a Ynison WebSocket client
type YnisonClient = ynison.YnisonClient
// DeviceConfig holds device configuration for Ynison
type DeviceConfig = ynison.DeviceConfig
// Example usage:
//
// client := yandexmusic.NewClient(yandexmusic.ClientConfig{
// Token: "your-oauth-token",
// Language: "en",
// })
//
// ctx := context.Background()
// if err := client.Init(ctx); err != nil {
// log.Fatal(err)
// }
//
// // Get liked tracks
// tracks, err := client.GetLikedTracks(ctx)
// if err != nil {
// log.Fatal(err)
// }
//
// for _, track := range tracks {
// fmt.Println(track.Title, "-", track.Artists[0].Name)
// }
//
// // Search for tracks
// results, err := client.SearchTracks(ctx, "Daft Punk", 10)
// if err != nil {
// log.Fatal(err)
// }
//
// // Download a track
// if len(tracks) > 0 {
// data, err := client.DownloadTrack(ctx, tracks[0].ID, "mp3", 320)
// if err != nil {
// log.Fatal(err)
// }
// os.WriteFile("track.mp3", data, 0644)
// }