Skip to content

Commit d5b174d

Browse files
committed
Fix doxygen. Added playlist folders test
1 parent 6338a2b commit d5b174d

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

tests/test_user.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ def test_get_user_playlists(session):
6060
assert playlist_ids | favourite_ids == both_ids
6161

6262

63+
def test_get_playlist_folders(session):
64+
folder = session.user.create_folder(title="testfolder")
65+
assert folder
66+
folder_ids = [folder.id for folder in session.user.playlist_folders()]
67+
assert folder.id in folder_ids
68+
folder.remove()
69+
assert folder.id not in folder_ids
70+
71+
6372
def test_get_user_playlist_creator(session):
6473
playlist = session.playlist("944dd087-f65c-4954-a9a3-042a574e86e3")
6574
creator = playlist.creator

tidalapi/user.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,13 @@ def playlists(self) -> List[Union["Playlist", "UserPlaylist"]]:
155155
def playlist_folders(
156156
self, offset: int = 0, limit: int = 50, parent_folder_id: str = "root"
157157
) -> List["Folder"]:
158-
"""Get the playlists created by the user.
158+
"""
159+
Get a list of folders created by the user.
159160
160-
:return: Returns a list of :class:`~tidalapi.playlist.Playlist` objects containing the playlists.
161+
:param offset: The amount of items you want returned.
162+
:param limit: The index of the first item you want included.
163+
:param parent_folder_id: Parent folder ID. Default: 'root' playlist folder
164+
:return: Returns a list of :class:`~tidalapi.playlist.Folder` objects containing the Folders.
161165
"""
162166
params = {
163167
"folderId": parent_folder_id,
@@ -184,6 +188,8 @@ def public_playlists(
184188
) -> List[Union["Playlist", "UserPlaylist"]]:
185189
"""Get the (public) playlists created by the user.
186190
191+
:param offset: The amount of items you want returned.
192+
:param limit: The index of the first item you want included.
187193
:return: List of public playlists.
188194
"""
189195
params = {"limit": limit, "offset": offset}
@@ -204,7 +210,7 @@ def public_playlists(
204210
)
205211

206212
def playlist_and_favorite_playlists(
207-
self, offset: int = 0, limit: int = 50
213+
self, limit: Optional[int] = None, offset: int = 0
208214
) -> List[Union["Playlist", "UserPlaylist"]]:
209215
"""Get the playlists created by the user, and the playlists favorited by the
210216
user. This function is limited to 50 by TIDAL, requiring pagination.
@@ -228,6 +234,14 @@ def playlist_and_favorite_playlists(
228234
def create_playlist(
229235
self, title: str, description: str, parent_id: str = "root"
230236
) -> "UserPlaylist":
237+
"""
238+
Create a playlist
239+
240+
:param title: Playlist title
241+
:param description: Playlist description
242+
:param parent_id: Parent folder ID. Default: 'root' playlist folder
243+
:return: Returns an object of :class:`~tidalapi.playlist.UserPlaylist` containing the newly created playlist
244+
"""
231245
params = {"name": title, "description": description, "folderId": parent_id}
232246
endpoint = "my-collection/playlists/folders/create-playlist"
233247

@@ -245,6 +259,13 @@ def create_playlist(
245259
raise ObjectNotFound("Playlist not found after creation")
246260

247261
def create_folder(self, title: str, parent_id: str = "root") -> "Folder":
262+
"""
263+
Create folder
264+
265+
:param title: Folder title
266+
:param parent_id: Folder parent ID. Default: 'root' playlist folder
267+
:return: Returns an object of :class:`~tidalapi.playlist.Folder` containing the newly created object
268+
"""
248269
params = {"name": title, "folderId": parent_id}
249270
endpoint = "my-collection/playlists/folders/create-folder"
250271

0 commit comments

Comments
 (0)