musora-content-services 2.3.23 → 2.3.25
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 +4 -0
- package/package.json +1 -1
- package/src/index.d.ts +5 -3
- package/src/index.js +5 -3
- package/src/services/content-org/playlists.js +107 -258
- package/src/services/contentAggregator.js +3 -3
- package/src/services/contentProgress.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.3.25](https://github.com/railroadmedia/musora-content-services/compare/v2.3.24...v2.3.25) (2025-05-07)
|
|
6
|
+
|
|
7
|
+
### [2.3.24](https://github.com/railroadmedia/musora-content-services/compare/v2.3.23...v2.3.24) (2025-05-06)
|
|
8
|
+
|
|
5
9
|
### [2.3.23](https://github.com/railroadmedia/musora-content-services/compare/v2.3.22...v2.3.23) (2025-05-06)
|
|
6
10
|
|
|
7
11
|
### [2.3.22](https://github.com/railroadmedia/musora-content-services/compare/v2.3.21...v2.3.22) (2025-05-05)
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -8,15 +8,16 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
addItemToPlaylist,
|
|
10
10
|
createPlaylist,
|
|
11
|
+
deleteItemsFromPlaylist,
|
|
11
12
|
duplicatePlaylist,
|
|
12
13
|
fetchPlaylist,
|
|
13
14
|
fetchPlaylistItems,
|
|
14
15
|
fetchUserPlaylists,
|
|
15
16
|
likePlaylist,
|
|
16
|
-
reorderPlaylistItems,
|
|
17
17
|
reportPlaylist,
|
|
18
18
|
togglePlaylistPrivate,
|
|
19
|
-
unlikePlaylist
|
|
19
|
+
unlikePlaylist,
|
|
20
|
+
updatePlaylist
|
|
20
21
|
} from './services/content-org/playlists.js';
|
|
21
22
|
|
|
22
23
|
import {
|
|
@@ -255,6 +256,7 @@ declare module 'musora-content-services' {
|
|
|
255
256
|
createPlaylist,
|
|
256
257
|
createPracticeNotes,
|
|
257
258
|
deleteComment,
|
|
259
|
+
deleteItemsFromPlaylist,
|
|
258
260
|
deletePracticeSession,
|
|
259
261
|
duplicatePlaylist,
|
|
260
262
|
editComment,
|
|
@@ -397,7 +399,6 @@ declare module 'musora-content-services' {
|
|
|
397
399
|
recordUserPractice,
|
|
398
400
|
recordWatchSession,
|
|
399
401
|
removeUserPractice,
|
|
400
|
-
reorderPlaylistItems,
|
|
401
402
|
replyToComment,
|
|
402
403
|
reportComment,
|
|
403
404
|
reportPlaylist,
|
|
@@ -411,6 +412,7 @@ declare module 'musora-content-services' {
|
|
|
411
412
|
unlikeComment,
|
|
412
413
|
unlikeContent,
|
|
413
414
|
unlikePlaylist,
|
|
415
|
+
updatePlaylist,
|
|
414
416
|
updatePracticeNotes,
|
|
415
417
|
updateUserPractice,
|
|
416
418
|
verifyImageSRC,
|
package/src/index.js
CHANGED
|
@@ -8,15 +8,16 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
addItemToPlaylist,
|
|
10
10
|
createPlaylist,
|
|
11
|
+
deleteItemsFromPlaylist,
|
|
11
12
|
duplicatePlaylist,
|
|
12
13
|
fetchPlaylist,
|
|
13
14
|
fetchPlaylistItems,
|
|
14
15
|
fetchUserPlaylists,
|
|
15
16
|
likePlaylist,
|
|
16
|
-
reorderPlaylistItems,
|
|
17
17
|
reportPlaylist,
|
|
18
18
|
togglePlaylistPrivate,
|
|
19
|
-
unlikePlaylist
|
|
19
|
+
unlikePlaylist,
|
|
20
|
+
updatePlaylist
|
|
20
21
|
} from './services/content-org/playlists.js';
|
|
21
22
|
|
|
22
23
|
import {
|
|
@@ -254,6 +255,7 @@ export {
|
|
|
254
255
|
createPlaylist,
|
|
255
256
|
createPracticeNotes,
|
|
256
257
|
deleteComment,
|
|
258
|
+
deleteItemsFromPlaylist,
|
|
257
259
|
deletePracticeSession,
|
|
258
260
|
duplicatePlaylist,
|
|
259
261
|
editComment,
|
|
@@ -396,7 +398,6 @@ export {
|
|
|
396
398
|
recordUserPractice,
|
|
397
399
|
recordWatchSession,
|
|
398
400
|
removeUserPractice,
|
|
399
|
-
reorderPlaylistItems,
|
|
400
401
|
replyToComment,
|
|
401
402
|
reportComment,
|
|
402
403
|
reportPlaylist,
|
|
@@ -410,6 +411,7 @@ export {
|
|
|
410
411
|
unlikeComment,
|
|
411
412
|
unlikeContent,
|
|
412
413
|
unlikePlaylist,
|
|
414
|
+
updatePlaylist,
|
|
413
415
|
updatePracticeNotes,
|
|
414
416
|
updateUserPractice,
|
|
415
417
|
verifyImageSRC,
|
|
@@ -70,72 +70,6 @@ export async function createPlaylist(playlistData) {
|
|
|
70
70
|
return await fetchHandler(url, 'POST', null, playlistData)
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
/**
|
|
74
|
-
* Adds an item to one or more playlists by making a POST request to the `/playlists/add-item` endpoint.
|
|
75
|
-
*
|
|
76
|
-
* @param {AddItemToPlaylistDTO} payload - The request payload containing necessary parameters.
|
|
77
|
-
*
|
|
78
|
-
* @returns {Promise<Object|null>} - A promise that resolves to an object with the response data, including:
|
|
79
|
-
* - `success` (boolean): Indicates if the items were added successfully (`true` on success).
|
|
80
|
-
* - `limit_excedeed` (Array): A list of playlists where the item limit was exceeded, if any.
|
|
81
|
-
* - `successful` (Array): A list of successfully added items (empty if none).
|
|
82
|
-
*
|
|
83
|
-
* Resolves to `null` if the request fails.
|
|
84
|
-
* @throws {Error} - Throws an error if the request encounters issues during the operation.
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* const payload = {
|
|
88
|
-
* content_id: 123,
|
|
89
|
-
* playlist_id: [1, 2, 3],
|
|
90
|
-
* import_all_assignments: true
|
|
91
|
-
* };
|
|
92
|
-
*
|
|
93
|
-
* addItemToPlaylist(payload)
|
|
94
|
-
* .then(response => {
|
|
95
|
-
* if (response?.success) {
|
|
96
|
-
* console.log("Item(s) added to playlist successfully");
|
|
97
|
-
* }
|
|
98
|
-
* if (response?.limit_excedeed) {
|
|
99
|
-
* console.warn("Some playlists exceeded the item limit:", response.limit_excedeed);
|
|
100
|
-
* }
|
|
101
|
-
* })
|
|
102
|
-
* .catch(error => {
|
|
103
|
-
* console.error("Error adding item to playlist:", error);
|
|
104
|
-
* });
|
|
105
|
-
*/
|
|
106
|
-
export async function addItemToPlaylist(payload) {
|
|
107
|
-
const url = `${BASE_PATH}/v1/user/playlists/items`
|
|
108
|
-
return await fetchHandler(url, 'POST', null, payload)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Updates a playlist's privacy setting by toggling its public/private status.
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
* @async
|
|
116
|
-
* @function togglePlaylistPrivate
|
|
117
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to update.
|
|
118
|
-
* @param {boolean} [is_private=true] - is public flag
|
|
119
|
-
*
|
|
120
|
-
* @returns {Promise<Object>}
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* // Make playlist with ID '81111' public
|
|
124
|
-
* try {
|
|
125
|
-
* const response = await togglePublic(81111, true);
|
|
126
|
-
* console.log('Playlist is now private:', response);
|
|
127
|
-
* } catch (error) {
|
|
128
|
-
* console.error('Failed to update playlist visibility:', error);
|
|
129
|
-
* }
|
|
130
|
-
*/
|
|
131
|
-
export async function togglePlaylistPrivate(playlistId, is_private = true) {
|
|
132
|
-
const url = `${BASE_PATH}/v1/user/playlists/update/${playlistId}`
|
|
133
|
-
const payload = {
|
|
134
|
-
private: is_private,
|
|
135
|
-
}
|
|
136
|
-
return await fetchHandler(url, 'POST', null, payload)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
73
|
/**
|
|
140
74
|
* Likes a playlist for the current user.
|
|
141
75
|
*
|
|
@@ -206,30 +140,121 @@ export async function reportPlaylist(playlistId) {
|
|
|
206
140
|
}
|
|
207
141
|
|
|
208
142
|
/**
|
|
209
|
-
*
|
|
143
|
+
* Adds an item to one or more playlists by making a POST request to the `/playlists/add-item` endpoint.
|
|
144
|
+
*
|
|
145
|
+
* @param {AddItemToPlaylistDTO} payload - The request payload containing necessary parameters.
|
|
146
|
+
*
|
|
147
|
+
* @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).
|
|
151
|
+
*
|
|
152
|
+
* Resolves to `null` if the request fails.
|
|
153
|
+
* @throws {Error} - Throws an error if the request encounters issues during the operation.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* const payload = {
|
|
157
|
+
* content_id: 123,
|
|
158
|
+
* playlist_id: [1, 2, 3],
|
|
159
|
+
* import_all_assignments: true
|
|
160
|
+
* };
|
|
161
|
+
*
|
|
162
|
+
* addItemToPlaylist(payload)
|
|
163
|
+
* .then(response => {
|
|
164
|
+
* if (response?.success) {
|
|
165
|
+
* console.log("Item(s) added to playlist successfully");
|
|
166
|
+
* }
|
|
167
|
+
* if (response?.limit_excedeed) {
|
|
168
|
+
* console.warn("Some playlists exceeded the item limit:", response.limit_excedeed);
|
|
169
|
+
* }
|
|
170
|
+
* })
|
|
171
|
+
* .catch(error => {
|
|
172
|
+
* console.error("Error adding item to playlist:", error);
|
|
173
|
+
* });
|
|
174
|
+
*/
|
|
175
|
+
export async function addItemToPlaylist(payload) {
|
|
176
|
+
const url = `${BASE_PATH}/v1/user/playlists/items`
|
|
177
|
+
return await fetchHandler(url, 'POST', null, payload)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Toggles a playlists public/private state
|
|
182
|
+
*
|
|
183
|
+
* @param {string|number} playlistId
|
|
184
|
+
* @param {Boolean} is_private - flag for private/public
|
|
185
|
+
|
|
186
|
+
* @returns {Promise<Playlist>} - A promise that resolves to the updated playlist data if successful, or an error response if validation fails.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* togglePlaylistPrivate(11541, true)
|
|
190
|
+
* .then(response => console.log(response))
|
|
191
|
+
* .catch(error => console.error('Error creating playlist:', error));
|
|
192
|
+
*/
|
|
193
|
+
export async function togglePlaylistPrivate(playlistId, is_private)
|
|
194
|
+
{
|
|
195
|
+
return await updatePlaylist(playlistId, {is_private})
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Updates a playlists values
|
|
201
|
+
*
|
|
202
|
+
* @param {string|number} playlistId
|
|
203
|
+
* @param {Object} updateData - An object containing fields to update on the playlist:
|
|
204
|
+
* - `name` (string): The name of the new playlist (required, max 255 characters).
|
|
205
|
+
* - `description` (string): A description of the playlist (optional, max 1000 characters).
|
|
206
|
+
* - `category` (string): The category of the playlist.
|
|
207
|
+
* + * - `deleted_items` (array): List of playlist item IDs to delete.
|
|
208
|
+
* + * - `item_order` (array): Updated order of playlist items (ids, not railcontent_ids).
|
|
209
|
+
*
|
|
210
|
+
* @returns {Promise<object>} - A promise that resolves to the created playlist data and lessons if successful, or an error response if validation fails.
|
|
211
|
+
*
|
|
212
|
+
* The server response includes:
|
|
213
|
+
* - `playlist`: Playlist metadata (same as fetchPlaylist)
|
|
214
|
+
* - `lessons`: Updated list of plalyist lessons (same as fetchPlaylistItems)
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* updatePlaylist(661113 { name: "My Playlist", description: "A cool playlist", is_private: true, deleted_items : [2189832, 221091] })
|
|
218
|
+
* .then(response => console.log(response.playlist); console.log(response.lessons))
|
|
219
|
+
* .catch(error => console.error('Error updating playlist:', error));
|
|
220
|
+
*/
|
|
221
|
+
export async function updatePlaylist(playlistId, {
|
|
222
|
+
name = null, description = null, is_private = null, brand = null, category = null, deleted_items = null, item_order = null
|
|
223
|
+
})
|
|
224
|
+
{
|
|
225
|
+
const data = {
|
|
226
|
+
...name && { name },
|
|
227
|
+
...description && { description },
|
|
228
|
+
...is_private !== null && { private: is_private},
|
|
229
|
+
...brand && { brand },
|
|
230
|
+
...category && { category},
|
|
231
|
+
...deleted_items && { deleted_items },
|
|
232
|
+
...item_order && { item_order },
|
|
233
|
+
}
|
|
234
|
+
const url = `${BASE_PATH}/v1/user/playlists/${playlistId}`
|
|
235
|
+
return await fetchHandler(url, 'POST', null, data);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Delete Items from playlist
|
|
240
|
+
*
|
|
210
241
|
* @async
|
|
211
|
-
* @function
|
|
212
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to
|
|
213
|
-
* @param {
|
|
214
|
-
* All items in the playlist must present in this list for the BE to handle the reorder.
|
|
242
|
+
* @function togglePlaylistPrivate
|
|
243
|
+
* @param {string|number} playlistId - The unique identifier of the playlist to update.
|
|
244
|
+
* @param {array} deleted_items - list of playlist ids to delete (user_playlist_item_id, not the railcontent_id)
|
|
215
245
|
*
|
|
216
246
|
* @returns {Promise<Object>}
|
|
247
|
+
*
|
|
217
248
|
* @example
|
|
218
|
-
* //
|
|
249
|
+
* // Delete items 8462221 and 8462222 from playlist 81111
|
|
219
250
|
* try {
|
|
220
|
-
* const
|
|
221
|
-
* const response = await reorderPlaylistItems('123', newOrder);
|
|
222
|
-
* console.log('Playlist items reordered successfully:', response);
|
|
251
|
+
* const response = await deleteItemsFromPlaylist(81111, [8462221, 8462222]);
|
|
223
252
|
* } catch (error) {
|
|
224
|
-
* console.error('Failed to
|
|
253
|
+
* console.error('Failed to delete playlist items:', error);
|
|
225
254
|
* }
|
|
226
255
|
*/
|
|
227
|
-
export async function
|
|
228
|
-
|
|
229
|
-
const payload = {
|
|
230
|
-
items: playlistItemIds,
|
|
231
|
-
}
|
|
232
|
-
return await fetchHandler(url, 'POST')
|
|
256
|
+
export async function deleteItemsFromPlaylist(playlistId, deleted_items) {
|
|
257
|
+
return await updatePlaylist(playlistId, {deleted_items})
|
|
233
258
|
}
|
|
234
259
|
|
|
235
260
|
/**
|
|
@@ -294,179 +319,3 @@ export async function fetchPlaylistItems(playlistId) {
|
|
|
294
319
|
const url = `${BASE_PATH}/v1/user/playlists/items/${playlistId}`
|
|
295
320
|
return await fetchHandler(url, 'GET')
|
|
296
321
|
}
|
|
297
|
-
|
|
298
|
-
// Unsupported playlist endpoints are here and will need to be implemented one by one
|
|
299
|
-
//
|
|
300
|
-
//
|
|
301
|
-
// /**
|
|
302
|
-
// * Deletes a user’s playlist along with all associated items by sending a DELETE request to the API.
|
|
303
|
-
// *
|
|
304
|
-
// * This function calls the `/playlists/playlist` endpoint, where the server verifies the user’s ownership of the specified playlist.
|
|
305
|
-
// * If the user is authorized, it deletes both the playlist and its associated items.
|
|
306
|
-
// *
|
|
307
|
-
// * @param {string|number} playlistId - The unique identifier of the playlist to be deleted.
|
|
308
|
-
// *
|
|
309
|
-
// * @returns {Promise<Object>} - A promise that resolves to an object containing:
|
|
310
|
-
// * - `success` (boolean): Indicates if the deletion was successful (`true` for success).
|
|
311
|
-
// * - `message` (string): Success confirmation message (e.g., "Playlist and associated items deleted successfully").
|
|
312
|
-
// *
|
|
313
|
-
// * If the user is unauthorized or the playlist does not exist, the promise rejects with an error.
|
|
314
|
-
// *
|
|
315
|
-
// * @example
|
|
316
|
-
// * deletePlaylist(12345)
|
|
317
|
-
// * .then(response => {
|
|
318
|
-
// * if (response.success) {
|
|
319
|
-
// * console.log(response.message);
|
|
320
|
-
// * }
|
|
321
|
-
// * })
|
|
322
|
-
// * .catch(error => console.error('Error deleting playlist:', error));
|
|
323
|
-
// */
|
|
324
|
-
// export async function deletePlaylist(playlistId) {
|
|
325
|
-
// let url = `/playlists/playlist/${playlistId}`
|
|
326
|
-
// return await fetchHandler(url, 'delete')
|
|
327
|
-
// }
|
|
328
|
-
//
|
|
329
|
-
// /**
|
|
330
|
-
// * Updates a user’s playlist by sending a PUT request with updated data to the API.
|
|
331
|
-
// *
|
|
332
|
-
// * This function calls the `/playlists/playlist/{playlistId}` endpoint, where the server validates the incoming data
|
|
333
|
-
// * and verifies that the authenticated user is the playlist owner. If authorized, it updates the playlist details with the provided data.
|
|
334
|
-
// *
|
|
335
|
-
// * @param {string|number} playlistId - The unique identifier of the playlist to be updated.
|
|
336
|
-
// * @param {Object} updatedData - An object containing the playlist data to update. The possible fields include:
|
|
337
|
-
// * - `name` (string): The new name of the playlist (max 255 characters).
|
|
338
|
-
// * - `description` (string): A new description for the playlist (max 1000 characters).
|
|
339
|
-
// * - `category` (string): The updated category of the playlist (max 255 characters).
|
|
340
|
-
// * - `private` (boolean): Whether the playlist is private.
|
|
341
|
-
// * - `thumbnail_url` (string): The URL of the playlist thumbnail.
|
|
342
|
-
// *
|
|
343
|
-
// * @returns {Promise<Object>} - A promise that resolves to an object containing:
|
|
344
|
-
// * - `success` (boolean): Indicates if the update was successful (`true` for success).
|
|
345
|
-
// * - `message` (string): Success confirmation message if the update is successful.
|
|
346
|
-
// * - Other fields containing the updated playlist data.
|
|
347
|
-
// *
|
|
348
|
-
// * If the user is unauthorized or the data validation fails, the promise rejects with an error.
|
|
349
|
-
// *
|
|
350
|
-
// * @example
|
|
351
|
-
// * updatePlaylist(12345, { name: "My New Playlist Name", description: "Updated description" })
|
|
352
|
-
// * .then(response => {
|
|
353
|
-
// * if (response.success) {
|
|
354
|
-
// * console.log(response.message);
|
|
355
|
-
// * }
|
|
356
|
-
// * })
|
|
357
|
-
// * .catch(error => console.error('Error updating playlist:', error));
|
|
358
|
-
// */
|
|
359
|
-
// export async function updatePlaylist(playlistId, updatedData) {
|
|
360
|
-
// const url = `/playlists/playlist/${playlistId}`
|
|
361
|
-
// return await fetchHandler(url, 'PUT', null, updatedData)
|
|
362
|
-
// }
|
|
363
|
-
//
|
|
364
|
-
//
|
|
365
|
-
//
|
|
366
|
-
// /**
|
|
367
|
-
// * Updates a playlist item with the provided data.
|
|
368
|
-
// *
|
|
369
|
-
// * @param {Object} updatedData - The data to update the playlist item with.
|
|
370
|
-
// * @param {number} updatedData.user_playlist_item_id - The ID of the playlist item to update.
|
|
371
|
-
// * @param {number} [updatedData.start_second] - (Optional) The start time in seconds for the item.
|
|
372
|
-
// * @param {number} [updatedData.end_second] - (Optional) The end time in seconds for the item.
|
|
373
|
-
// * @param {string} [updatedData.playlist_item_name] - (Optional) The new name for the playlist item.
|
|
374
|
-
// * @param {number} [updatedData.position] - (Optional) The new position for the playlist item within the playlist.
|
|
375
|
-
// * @returns {Promise<Object|null>} - A promise that resolves to an object containing:
|
|
376
|
-
// * - `success` (boolean): Indicates if the update was successful (`true` for success).
|
|
377
|
-
// * - `data` (Object): The updated playlist item data.
|
|
378
|
-
// *
|
|
379
|
-
// * Resolves to `null` if the request fails.
|
|
380
|
-
// * @throws {Error} - Throws an error if the request fails.
|
|
381
|
-
// *
|
|
382
|
-
// * @example
|
|
383
|
-
// * const updatedData = {
|
|
384
|
-
// * user_playlist_item_id: 123,
|
|
385
|
-
// * start_second: 30,
|
|
386
|
-
// * end_second: 120,
|
|
387
|
-
// * playlist_item_name: "Updated Playlist Item Name",
|
|
388
|
-
// * position: 2
|
|
389
|
-
// * };
|
|
390
|
-
// *
|
|
391
|
-
// * updatePlaylistItem(updatedData)
|
|
392
|
-
// * .then(response => {
|
|
393
|
-
// * if (response.success) {
|
|
394
|
-
// * console.log("Playlist item updated successfully:", response.data);
|
|
395
|
-
// * }
|
|
396
|
-
// * })
|
|
397
|
-
// * .catch(error => {
|
|
398
|
-
// * console.error("Error updating playlist item:", error);
|
|
399
|
-
// * });
|
|
400
|
-
// */
|
|
401
|
-
// export async function updatePlaylistItem(updatedData) {
|
|
402
|
-
// const url = `/playlists/item`
|
|
403
|
-
// return await fetchHandler(url, 'POST', null, updatedData)
|
|
404
|
-
// }
|
|
405
|
-
//
|
|
406
|
-
// /**
|
|
407
|
-
// * Deletes a playlist item and repositions other items in the playlist if necessary.
|
|
408
|
-
// *
|
|
409
|
-
// * @param {Object} payload - The data required to delete the playlist item.
|
|
410
|
-
// * @param {number} payload.user_playlist_item_id - The ID of the playlist item to delete.
|
|
411
|
-
// * @returns {Promise<Object|null>} - A promise that resolves to an object containing:
|
|
412
|
-
// * - `success` (boolean): Indicates if the deletion was successful (`true` for success).
|
|
413
|
-
// * - `message` (string): A success message if the item is deleted successfully.
|
|
414
|
-
// * - `error` (string): An error message if the deletion fails.
|
|
415
|
-
// *
|
|
416
|
-
// * Resolves to `null` if the request fails.
|
|
417
|
-
// * @throws {Error} - Throws an error if the request fails.
|
|
418
|
-
// *
|
|
419
|
-
// * @example
|
|
420
|
-
// * const payload = {
|
|
421
|
-
// * user_playlist_item_id: 123
|
|
422
|
-
// * };
|
|
423
|
-
// *
|
|
424
|
-
// * deletePlaylistItem(payload)
|
|
425
|
-
// * .then(response => {
|
|
426
|
-
// * if (response.success) {
|
|
427
|
-
// * console.log("Playlist item deleted successfully:", response.message);
|
|
428
|
-
// * } else {
|
|
429
|
-
// * console.error("Error:", response.error);
|
|
430
|
-
// * }
|
|
431
|
-
// * })
|
|
432
|
-
// * .catch(error => {
|
|
433
|
-
// * console.error("Error deleting playlist item:", error);
|
|
434
|
-
// * });
|
|
435
|
-
// */
|
|
436
|
-
// export async function deletePlaylistItem(payload) {
|
|
437
|
-
// const url = `/playlists/item`
|
|
438
|
-
// return await fetchHandler(url, 'DELETE', null, payload)
|
|
439
|
-
// }
|
|
440
|
-
//
|
|
441
|
-
// /**
|
|
442
|
-
// * Fetches detailed data for a specific playlist item, including associated Sanity and Assignment information if available.
|
|
443
|
-
// *
|
|
444
|
-
// * @param {Object} payload - The request payload containing necessary parameters.
|
|
445
|
-
// * @param {number} payload.user_playlist_item_id - The unique ID of the playlist item to fetch.
|
|
446
|
-
// * @returns {Promise<Object|null>} - A promise that resolves to an object with the fetched playlist item data, including:
|
|
447
|
-
// * - `success` (boolean): Indicates if the data retrieval was successful (`true` on success).
|
|
448
|
-
// * - `data` (Object): Contains the detailed playlist item data enriched with Sanity and Assignment details, if available.
|
|
449
|
-
// *
|
|
450
|
-
// * Resolves to `null` if the request fails.
|
|
451
|
-
// * @throws {Error} - Throws an error if the request encounters issues during retrieval.
|
|
452
|
-
// *
|
|
453
|
-
// * @example
|
|
454
|
-
// * const payload = { user_playlist_item_id: 123 };
|
|
455
|
-
// *
|
|
456
|
-
// * fetchPlaylistItem(payload)
|
|
457
|
-
// * .then(response => {
|
|
458
|
-
// * if (response?.success) {
|
|
459
|
-
// * console.log("Fetched playlist item data:", response.data);
|
|
460
|
-
// * } else {
|
|
461
|
-
// * console.log("Failed to fetch playlist item data.");
|
|
462
|
-
// * }
|
|
463
|
-
// * })
|
|
464
|
-
// * .catch(error => {
|
|
465
|
-
// * console.error("Error fetching playlist item:", error);
|
|
466
|
-
// * });
|
|
467
|
-
// */
|
|
468
|
-
// export async function fetchPlaylistItem(payload) {
|
|
469
|
-
// const playlistItemId = payload.user_playlist_item_id
|
|
470
|
-
// const url = `/playlists/item/${playlistItemId}`
|
|
471
|
-
// return await fetchHandler(url)
|
|
472
|
-
// }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getProgressStateByIds, getProgressPercentageByIds, getResumeTimeSecondsByIds } from "./
|
|
2
|
-
import { isContentLikedByIds } from "./
|
|
3
|
-
import { fetchLikeCount } from "./
|
|
1
|
+
import { getProgressStateByIds, getProgressPercentageByIds, getResumeTimeSecondsByIds } from "./contentProgress"
|
|
2
|
+
import { isContentLikedByIds } from "./contentLikes"
|
|
3
|
+
import { fetchLikeCount } from "./railcontent"
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|