import { Client } from '[email protected]';
type Spotify = {
token: string;
}
export async function main(
spotifyCredentials: Spotify,
playlistName: string,
playlistDescription: string = "Created by windmill",
) {
const client = await Client.create({
token: spotifyCredentials.token,
userAuthorizedToken: true
});
console.log(`Creating public playlist with name '${playlistName}'`);
const newPlaylist = await client.user.createPlaylist({
name: playlistName,
description: playlistDescription
});
if (!newPlaylist) {
throw new Error(`Failed to create playlist with name '${playlistName}'`);
}
return newPlaylist;
}Submitted by alec minchington932 473 days ago