Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an update playlist method #12

Open
Bob-vdV opened this issue Sep 7, 2024 · 1 comment
Open

Add an update playlist method #12

Bob-vdV opened this issue Sep 7, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Bob-vdV
Copy link

Bob-vdV commented Sep 7, 2024

There are methods for creating and deleting playlists, but currently there is no way to update an existing playlist.
The official documentation for updating playlists is here: https://developers.soundcloud.com/docs/api/explorer/open-api#/playlists/put_playlists__playlist_id_
Is it possible to add this without an API key?

@Bob-vdV
Copy link
Author

Bob-vdV commented Sep 8, 2024

I've written some draft functions that do appear to update the playlist, but also throw a dacite.MissingValueError for the created_at field. Any idea on how to fix this? It seems like created_at is not set anywhere else.

Update functions:
in ./soundcloud.py:

    def update_playlist(
        self,
        playlist_id: int,
        sharing: Literal["private", "public"],
        title: str,
        tracks: List[int],
    ) -> Optional[BasicAlbumPlaylist]:
        """
        Update a playlist
        """
        body = {"playlist": {"sharing": sharing, "title": title, "tracks": tracks}}
        return PutPlaylistRequest(self, playlist_id=playlist_id, body=body)

In requests.py:

PutPlaylistRequest = Request[BasicAlbumPlaylist](
    "/playlists/{playlist_id}", BasicAlbumPlaylist, method="PUT"
)

@7x11x13 7x11x13 added the enhancement New feature or request label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants