import { EventSubscription } from "expo-modules-core"; import { SpotifyConfig, SpotifyError, SpotifyRefreshConfig, SpotifySession, SpotifySessionChangeEvent } from "./ExpoSpotifySDK.types"; /** * Returns `true` if the Spotify app is installed on the device. * Always returns `false` on web. */ declare function isAvailable(): boolean; /** * Starts a Spotify OAuth flow. Resolves with a {@link SpotifySession}; * rejects with a {@link SpotifyError} carrying a `code`. */ declare function authenticateAsync(config: SpotifyConfig): Promise; /** * Forcibly cancel any in-flight `authenticateAsync` call. Resolves once the * native coordinator's pending continuation has been cleared. No-op when * nothing is in flight, and a no-op on Android (the Android coordinator * self-cleans via structured concurrency). * * Recovery hatch for the iOS coordinator's stuck-state class of bugs: the * SPTSessionManager delegate callbacks are not guaranteed to fire — e.g. when * Spotify never redirects back to the host app — leaving the coordinator's * `pending` continuation set forever and every subsequent `authenticateAsync` * rejecting with `AUTH_IN_PROGRESS` until the process restarts. Call this * before `authenticateAsync` to defensively clear any leaked state. */ declare function cancelPendingAuthAsync(): Promise; /** * Exchanges a refresh token for a new access token via your token refresh * server. Resolves with a fresh {@link SpotifySession}; rejects with a * {@link SpotifyError}. */ declare function refreshSessionAsync(config: SpotifyRefreshConfig): Promise; /** * Subscribes to session lifecycle events emitted by the native module. * * Events are fired for every `authenticateAsync` and `refreshSessionAsync` * call, regardless of whether the call was awaited. Useful for persisting * tokens in a central store without coupling the store to the call sites. * * Returns a {@link Subscription} — call `.remove()` to unsubscribe. * * @example * ```ts * const sub = addSessionChangeListener((event) => { * if (event.type === "didInitiate" || event.type === "didRenew") { * store.setSession(event.session); * } * }); * // later: * sub.remove(); * ``` */ declare function addSessionChangeListener(listener: (event: SpotifySessionChangeEvent) => void): EventSubscription; declare const Authenticate: { authenticateAsync: typeof authenticateAsync; }; export { isAvailable, authenticateAsync, cancelPendingAuthAsync, refreshSessionAsync, addSessionChangeListener, Authenticate, SpotifyError, }; export type { SpotifyConfig, SpotifyRefreshConfig, SpotifySession, SpotifySessionChangeEvent, SpotifyErrorCode, SpotifyScope, } from "./ExpoSpotifySDK.types"; //# sourceMappingURL=index.d.ts.map