musora-content-services 2.6.2 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [2.7.0](https://github.com/railroadmedia/musora-content-services/compare/v2.6.4...v2.7.0) (2025-05-21)
6
+
7
+
8
+ ### Features
9
+
10
+ * **BEH-398:** delete & undelete playlist endpoints ([#260](https://github.com/railroadmedia/musora-content-services/issues/260)) ([338434e](https://github.com/railroadmedia/musora-content-services/commit/338434e42f200fd2a1f1379727c6d14315406676))
11
+
12
+ ### [2.6.4](https://github.com/railroadmedia/musora-content-services/compare/v2.6.3...v2.6.4) (2025-05-21)
13
+
14
+ ### [2.6.3](https://github.com/railroadmedia/musora-content-services/compare/v2.6.2...v2.6.3) (2025-05-21)
15
+
5
16
  ### [2.6.2](https://github.com/railroadmedia/musora-content-services/compare/v2.6.1...v2.6.2) (2025-05-21)
6
17
 
7
18
 
package/link_mcs.sh CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.6.2",
3
+ "version": "2.7.0",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.d.ts CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  addItemToPlaylist,
10
10
  createPlaylist,
11
11
  deleteItemsFromPlaylist,
12
+ deletePlaylist,
12
13
  duplicatePlaylist,
13
14
  fetchPlaylist,
14
15
  fetchPlaylistItems,
@@ -16,6 +17,7 @@ import {
16
17
  likePlaylist,
17
18
  reportPlaylist,
18
19
  togglePlaylistPrivate,
20
+ undeletePlaylist,
19
21
  unlikePlaylist,
20
22
  updatePlaylist
21
23
  } from './services/content-org/playlists.js';
@@ -276,6 +278,7 @@ declare module 'musora-content-services' {
276
278
  createPracticeNotes,
277
279
  deleteComment,
278
280
  deleteItemsFromPlaylist,
281
+ deletePlaylist,
279
282
  deletePracticeSession,
280
283
  deleteUserActivity,
281
284
  duplicatePlaylist,
@@ -441,6 +444,7 @@ declare module 'musora-content-services' {
441
444
  togglePlaylistPrivate,
442
445
  unassignModeratorToComment,
443
446
  unblockUser,
447
+ undeletePlaylist,
444
448
  unlikeComment,
445
449
  unlikeContent,
446
450
  unlikePlaylist,
package/src/index.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  addItemToPlaylist,
10
10
  createPlaylist,
11
11
  deleteItemsFromPlaylist,
12
+ deletePlaylist,
12
13
  duplicatePlaylist,
13
14
  fetchPlaylist,
14
15
  fetchPlaylistItems,
@@ -16,6 +17,7 @@ import {
16
17
  likePlaylist,
17
18
  reportPlaylist,
18
19
  togglePlaylistPrivate,
20
+ undeletePlaylist,
19
21
  unlikePlaylist,
20
22
  updatePlaylist
21
23
  } from './services/content-org/playlists.js';
@@ -275,6 +277,7 @@ export {
275
277
  createPracticeNotes,
276
278
  deleteComment,
277
279
  deleteItemsFromPlaylist,
280
+ deletePlaylist,
278
281
  deletePracticeSession,
279
282
  deleteUserActivity,
280
283
  duplicatePlaylist,
@@ -440,6 +443,7 @@ export {
440
443
  togglePlaylistPrivate,
441
444
  unassignModeratorToComment,
442
445
  unblockUser,
446
+ undeletePlaylist,
443
447
  unlikeComment,
444
448
  unlikeContent,
445
449
  unlikePlaylist,
@@ -27,9 +27,7 @@
27
27
  * @typedef AddItemToPlaylistDTO
28
28
  * @property {number} content_id - The ID of the content to add to the playlist(s).
29
29
  * @property {Array<number>} playlist_id - An array of playlist IDs where the content should be added.
30
- * @property {boolean} import_full_soundslice_assignment - Flag to include full Soundslice assignments.
31
- * @property {boolean} import_instrumentless_soundslice_assignment - Flag to include instrumentless Soundslice assignments.
30
+ * @property {number} position - Optional playlist position requirement
32
31
  * @property {boolean} import_high_routine - Flag to include high routine content.
33
32
  * @property {boolean} import_low_routine - Flag to include low routine content.
34
- * @property {boolean} import_all_assignments - Flag to include all Soundslice assignments if true.
35
33
  */
@@ -70,6 +70,17 @@ export async function createPlaylist(playlistData) {
70
70
  return await fetchHandler(url, 'POST', null, playlistData)
71
71
  }
72
72
 
73
+ export async function deletePlaylist(playlist) {
74
+ const url = `${BASE_PATH}/v1/user/playlists/delete/${playlist}`
75
+ return await fetchHandler(url, 'POST', null, playlist)
76
+ }
77
+
78
+ export async function undeletePlaylist(playlist) {
79
+ const url = `${BASE_PATH}/v1/user/playlists/undelete/${playlist}`
80
+ return await fetchHandler(url, 'POST', null, playlist)
81
+ }
82
+
83
+
73
84
  /**
74
85
  * Likes a playlist for the current user.
75
86
  *
@@ -140,14 +151,14 @@ export async function reportPlaylist(playlistId) {
140
151
  }
141
152
 
142
153
  /**
143
- * Adds an item to one or more playlists by making a POST request to the `/playlists/add-item` endpoint.
154
+ * Adds an item to one or more playlists
144
155
  *
145
156
  * @param {AddItemToPlaylistDTO} payload - The request payload containing necessary parameters.
146
157
  *
147
158
  * @returns {Promise<Object|null>} - A promise that resolves to an object with the response data, including:
148
- * - `success` (boolean): Indicates if the items were added successfully (`true` on success).
149
- * - `limit_excedeed` (Array): A list of playlists where the item limit was exceeded, if any.
150
- * - `successful` (Array): A list of successfully added items (empty if none).
159
+ * - `added` (Array): Playlist ids that we were success
160
+ * - `limit_exceeded` (Array): A list of playlists where the item limit was exceeded, if any.
161
+ * - `unauthorized` (Array): A list of successfully added items (empty if none).
151
162
  *
152
163
  * Resolves to `null` if the request fails.
153
164
  * @throws {Error} - Throws an error if the request encounters issues during the operation.
@@ -156,7 +167,8 @@ export async function reportPlaylist(playlistId) {
156
167
  * const payload = {
157
168
  * content_id: 123,
158
169
  * playlist_id: [1, 2, 3],
159
- * import_all_assignments: true
170
+ * position: 2,
171
+ *
160
172
  * };
161
173
  *
162
174
  * addItemToPlaylist(payload)
@@ -164,8 +176,8 @@ export async function reportPlaylist(playlistId) {
164
176
  * if (response?.success) {
165
177
  * console.log("Item(s) added to playlist successfully");
166
178
  * }
167
- * if (response?.limit_excedeed) {
168
- * console.warn("Some playlists exceeded the item limit:", response.limit_excedeed);
179
+ * if (response?.limit_exceeded) {
180
+ * console.warn("Some playlists exceeded the item limit:", response.limit_exceeded);
169
181
  * }
170
182
  * })
171
183
  * .catch(error => {