UNPKG

lunify.js

Version:

A basic api wrapper for the spotify api covering the oauth routes.

26 lines (25 loc) 893 B
import type { Lunify, UserOauth } from "../.."; import { User } from "../.."; import { CacheManager } from "../cache"; export * from "./Playlists"; export declare class UsersManager { client: Lunify; cache: CacheManager<string, User>; constructor(client: Lunify); /** * Fetch a user accociated with its access token * @example ```ts * // will try to get cached user to avoid requesting the spotify api * const access = await lunify.oauth.fetchToken(code); * const user = await lunify.users.fetch(access); * ``` * @example ```ts * // will fetch from the spotify api regardless if it's cached or not * const access = await lunify.oauth.fetchToken(code); * const user = await lunify.users.fetch(access, { force: true }); * ``` */ fetch(access: UserOauth, options?: { force: boolean; }): Promise<User>; }