UNPKG

yandex-music

Version:

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

55 lines 2.17 kB
import { AxiosInstance } from "axios"; import { YandexMusicClient } from "../client"; export declare enum Languages { en = "en", uz = "uz", uk = "uk", us = "us", ru = "ru", kk = "kk", hy = "hy" } declare type data = Record<string, any> | null; export declare class Requset { protected readonly client: YandexMusicClient; protected readonly url: string; protected readonly axios: AxiosInstance; protected _headers: Map<string, any>; constructor(client: YandexMusicClient, url: string); /** * @returns {Map<string, any>} Headers from the request client class */ get headers(): Map<string, any>; /** * Add language header for each requset. * @param {Languages} lang Avlibale variants: en/uz/uk/us/ru/kk/hy. * @returns {void} Void functions that set header. */ setLanguage(lang?: keyof typeof Languages): void; /** * Add token header for each requset. * @returns {void} Void functions that set header. */ setAuthorization(): void; /** * Throws the necessary exceptions, returns a response. Passes custom arguments to the request. * * @param {"GET" | "POST"} type HTTP request method ("GET" | "POST"). * @param {string} url Url for the request. * @param {data} data Search and additional date for the post request. * @param {data} params Search and additional params for the all requests. * @returns {Promise<T>} Data from the yandex music api. * * @throws UnauthorizedError, when token is invalid, or a long wait for a direct link to the file. * @throws BadRequestError, when the request is incorrect. * @throws NotFoundError, when the page is not found * @throws NetworkError, when there are problems with the network */ private wrapper; get<T>(url: string, params?: data): Promise<T>; post<T>(url: string, data?: data, params?: data): Promise<T>; directLink<T>(url: string, params: data): Promise<T>; } export declare const baseClient: (url: string) => AxiosInstance; export {}; //# sourceMappingURL=base.request.d.ts.map