lunify.js
Version:
A basic api wrapper for the spotify api covering the oauth routes.
31 lines (30 loc) • 1.51 kB
TypeScript
import type { StructureFetchOptions } from "../../../interfaces/rest";
import type { Lunify } from "../..";
import { Track } from "../../structures/track";
import { CacheManager } from "../cache";
export declare class TracksManager {
client: Lunify;
cache: CacheManager<string, Track>;
constructor(client: Lunify);
/**
* Fetch a track with a track id
* @param {string} trackId - spotify track id: https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT <-- last part after /track/
* @param {StructureFetchOptions?} options
* @example ```ts
* // will try to get cached track to avoid requesting the spotify api
* const track = await lunify.tracks.fetch("4cOdK2wGLETKBW3PvgPWqT");
* ```
*/
fetch(trackId: string, options?: StructureFetchOptions): Promise<Track>;
/**
* Fetch multiple tracks with a list track of id, the api will only be requested once no matter how many tracks are provided
* @param {string[]} trackIds - list of spotify track ids: https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT <-- last part after /track/
* @param {StructureFetchOptions?} options
* @example ```ts
* // will try to get cached tracks* to avoid requesting the spotify api,
* // *only works if all tracks were cached already
* const tracks = await lunify.tracks.list(["4cOdK2wGLETKBW3PvgPWqT", "1jcp5qEaDLT4gsIUjDPJo9"]);
* ```
*/
list(trackIds: string[], options?: StructureFetchOptions): Promise<Track[]>;
}