Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/spotify

src/index.ts

59 lines · 1.9 KB · TypeScript
import {
	DEFAULT_SPOTIFY_INTEGRATION,
	SPOTIFY_ALLOWED_HOSTS,
	SPOTIFY_API_BASE_URL,
	SPOTIFY_AUTHORIZE_URL,
	SPOTIFY_CALLBACK_URL,
	SPOTIFY_DASHBOARD_URL,
	SPOTIFY_FULL_CONNECT_URL,
	SPOTIFY_FULL_SCOPES,
	SPOTIFY_GUIDE_SCOPES,
	SPOTIFY_READ_CONNECT_URL,
	SPOTIFY_READ_SCOPES,
	SPOTIFY_TOKEN_URL,
	accounts,
} from './lib/accounts.ts'

/** Describe the Spotify helpers package, PKCE connect URLs, and export surface. */
export default async function describeSpotifyPackage() {
	return {
		package: '@kody/spotify',
		kodyId: 'spotify',
		purpose:
			'Official Spotify helpers for profile, search, library, playlists, devices, and playback.',
		defaultIntegration: DEFAULT_SPOTIFY_INTEGRATION,
		callbackUrl: SPOTIFY_CALLBACK_URL,
		authorizeUrl: SPOTIFY_AUTHORIZE_URL,
		tokenUrl: SPOTIFY_TOKEN_URL,
		apiBaseUrl: SPOTIFY_API_BASE_URL,
		dashboardUrl: SPOTIFY_DASHBOARD_URL,
		requiredHosts: [...SPOTIFY_ALLOWED_HOSTS],
		flow: 'pkce',
		connectUrl: SPOTIFY_FULL_CONNECT_URL,
		readConnectUrl: SPOTIFY_READ_CONNECT_URL,
		scopes: {
			guide: [...SPOTIFY_GUIDE_SCOPES],
			read: [...SPOTIFY_READ_SCOPES],
			full: [...SPOTIFY_FULL_SCOPES],
		},
		accounts: accounts(),
		publicUrl: 'https://kody.codes/@kody/spotify',
		exports: {
			'get-profile': 'Read the connected Spotify user profile.',
			search: 'Search tracks, albums, artists, or playlists.',
			'get-saved-tracks': 'Read liked/saved library tracks.',
			'save-tracks': 'Save tracks to the library (dryRun supported).',
			'list-playlists': 'List the user’s playlists.',
			'get-devices': 'List Spotify Connect devices.',
			'playback-state': 'Read current playback.',
			'play-context': 'Start album/playlist/artist playback (dryRun supported).',
		},
		safety: {
			dryRunAvailable: true,
			mutations:
				'Playlist writes and playback helpers accept dryRun: true to preview without writing.',
			multiAccount:
				'Pass integration: "spotify" (default) or a spotify-* connection name. No personal aliases.',
		},
	}
}