@wwdrew/expo-spotify-sdk
Version:
Expo module wrapping the native Spotify iOS (v5) and Android (v4) SDKs for OAuth authentication and App Remote playback control
44 lines • 2.01 kB
TypeScript
import type { EventSubscription } from "expo-modules-core";
import type { SpotifyURI as SpotifyURIType } from "../uri";
export type { UserErrorCode } from "./error";
export { UserError } from "./error";
/** Capabilities of the current user in Spotify's App Remote context. */
export interface Capabilities {
/** `true` for Premium users with on-demand playback capability. */
canPlayOnDemand: boolean;
}
/** Library save state for a specific album/track URI. */
export interface LibraryState {
uri: string;
isAdded: boolean;
canAdd: boolean;
}
/**
* Spotify User namespace. Capabilities and library-state operations.
* Requires `AppRemote.connect()` to be resolved before any call.
*/
export declare const User: {
/** Returns the current user's capabilities. */
readonly getCapabilities: () => Promise<Capabilities>;
/** Returns the current library state for a track or album URI. */
readonly getLibraryState: (uri: SpotifyURIType) => Promise<LibraryState>;
/** Adds a track or album URI to the user's library. */
readonly addToLibrary: (uri: SpotifyURIType) => Promise<void>;
/** Removes a track or album URI from the user's library. */
readonly removeFromLibrary: (uri: SpotifyURIType) => Promise<void>;
/**
* Subscribes to user-scoped events.
* Supported event: `"capabilitiesChange"`.
*/
readonly addListener: (event: "capabilitiesChange", listener: (event: Capabilities) => void) => EventSubscription;
/**
* Subscribes to library state changes for a specific URI.
*
* There is no native push stream for per-URI library state updates on all
* platforms, so this listener is updated whenever library mutations are
* performed via this SDK and can be manually seeded by calling
* `User.getLibraryState(uri)` before subscribing.
*/
readonly addLibraryStateListener: (uri: SpotifyURIType, listener: (state: LibraryState) => void) => EventSubscription;
};
//# sourceMappingURL=index.d.ts.map