UNPKG

@musicorum/lastfm

Version:

Fully typed [Last.fm](https://last.fm) api client library written and made for Typescript!

27 lines (26 loc) 1.3 kB
import { User } from './packages/User.js'; import { Track } from './packages/Track.js'; import { Album } from './packages/Album.js'; import { Artist } from './packages/Artist.js'; import { Auth } from './packages/Auth.js'; import { Utilities } from './packages/Utilities.js'; import type { GetOriginalResponse, LastfmApiMethod, LastfmResponses } from './types/responses'; export declare class LastClient { apiKey: string; apiSecret?: string | undefined; private apiUrl; user: User; track: Track; album: Album; artist: Artist; auth: Auth; utilities: Utilities; private readonly headers; constructor(apiKey: string, apiSecret?: string | undefined, appName?: string); onRequestStarted(method: LastfmApiMethod | string, params: Record<string, string>, internalData: Record<string, never>): void; onRequestFinished(method: LastfmApiMethod | string, params: Record<string, string>, internalData: Record<string, never>, response: Record<string, never>): void; /** * @todo implement signed requests */ request<M extends string = LastfmApiMethod>(method: M, params?: Record<string, string | number | undefined>, signed?: boolean, write?: boolean): Promise<M extends keyof LastfmResponses ? GetOriginalResponse<LastfmResponses[M]> : unknown>; }