lunify.js
Version:
A basic api wrapper for the spotify api covering the oauth routes.
24 lines (23 loc) • 835 B
TypeScript
import { Lunify, UserOauth, User } from '../..';
import { CacheManager } from '../cache';
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>;
}