UNPKG

yandex-music

Version:

Creative and progressive Node.js framework for applications that interact with yandex music

104 lines 4.26 kB
/// <reference types="node" /> import { Languages, Requset } from "./request"; import { CoverSize } from "./interfaces"; import { Account } from "./account"; import { Albums } from "./albums"; import { Artist } from "./artist"; import { Feed } from "./feed"; import { Genre } from "./interfaces"; import { Landing } from "./landing"; import { Rotor } from "./rotor"; import { Track } from "./track"; import { Users } from "./users"; import { SeacrhResult, SearchSuggest, SearchType } from "./interfaces"; interface Config { auth: { type: "LOGIN" | "TOKEN"; username?: string; password?: string; token?: string; }; language: keyof typeof Languages; } interface Settings { inAppProducts: Array<any>; nativeProducts: Array<any>; webPaymentUrl: string; promoCodesEnabled: boolean; } export declare class YandexMusicClient { readonly token: string; readonly uid: number; readonly lang: keyof typeof Languages; private readonly url; readonly request: Requset; readonly account: Account; readonly track: Track; readonly artist: Artist; readonly users: Users; readonly landing: Landing; readonly feed: Feed; readonly albums: Albums; readonly rotor: Rotor; constructor(token: string, uid: number, lang: keyof typeof Languages); static get(config: Config): Promise<{ uid: number; language: "en" | "uz" | "uk" | "us" | "ru" | "kk" | "hy"; token: string; }>; /** * Loading the track cover. * @param {string} uri Image uri * @param {CoverSize} size Image Size * @returns Buffer */ cover(uri: string, size: CoverSize): Promise<Buffer>; /** * Loading the track video. * @param {string} url Video uri * @returns Buffer */ video(url: string): Promise<Buffer>; /** * Getting genres of music. * @returns Genres of music */ genres(url: string): Promise<Array<Genre>>; /** * Receiving purchase offers. There are no required parameters. * @returns Information about the products offered if the account is valid. */ settings(): Promise<Settings>; /** * Performing search by query and type, obtaining results. * @param {string} text The text of the request. * @param {boolean} nocorrect If аalse, the erroneous request will be corrected. * @param {SearchType} type Among what type to search (track, playlist, album, artist, user, podcast, all). * @param {number} page Page number. * @param {boolean} playlist_in_best Whether to give out playlists is the best search option. * @returns Search results. */ search(text: string, nocorrect?: boolean, type?: SearchType, page?: number, playlist_in_best?: boolean): Promise<SeacrhResult>; /** * Getting hints for the entered part of the search query. * @param {string} part Part of the search query. * @returns Suggestions for the request. */ suggest(part: string): Promise<SearchSuggest>; /** * A method for sending the current state of the track being listened to. * @param {string} track_id The unique ID of the track. * @param {string} from The name of the client from which the listening takes place. * @param {string} album_id The unique ID of the album. * @param {string} playlist_id The unique ID of the playlist, if one is being listened to. * @param {boolean} from_cache Whether the track is played from the cache. * @param {string} play_id The unique ID of the playback. * @param {number} track_length_seconds Track duration in seconds. * @param {number} total_played_seconds How many tracks were played in total in seconds. * @param {number} end_position_seconds The final value of the seconds played. * @returns OK if the request is successful. */ play(track_id: string, from: string, album_id: string, playlist_id?: string, from_cache?: boolean, play_id?: string, track_length_seconds?: number, total_played_seconds?: number, end_position_seconds?: number): Promise<string>; } export {}; //# sourceMappingURL=client.d.ts.map