@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
43 lines • 1.45 kB
JavaScript
// ---------------------------------------------------------------------------
// Types
// ---------------------------------------------------------------------------
import ExpoSpotifySDKModule from "../ExpoSpotifySDKModule";
import { ContentError } from "./error";
import { createNativeErrorRethrow } from "../internal/native-errors";
export { ContentError } from "./error";
const rethrowAsContentError = createNativeErrorRethrow({
ErrorClass: ContentError,
unknownCode: "UNKNOWN",
validCodes: new Set([
"NOT_CONNECTED",
"CONNECTION_LOST",
"CONTENT_API_UNAVAILABLE",
"UNKNOWN",
]),
});
/**
* Spotify Content namespace. Browse Spotify's curated content tree.
* Requires `AppRemote.connect()` to be resolved before any call.
*
* @example
* ```ts
* import { Content } from "@wwdrew/expo-spotify-sdk";
*
* const items = await Content.getRecommendedContentItems("default");
* ```
*/
export const Content = {
/**
* Returns Spotify-curated recommended content for the given feed type.
*/
getRecommendedContentItems(type) {
return ExpoSpotifySDKModule.contentGetRecommendedContentItems(type).catch(rethrowAsContentError);
},
/**
* Returns children of a browsable (container) content item.
*/
getChildren(item) {
return ExpoSpotifySDKModule.contentGetChildren(item).catch(rethrowAsContentError);
},
};
//# sourceMappingURL=index.js.map