musora-content-services 2.92.3 → 2.92.7
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/.github/workflows/docs.js.yml +64 -47
- package/CHANGELOG.md +23 -0
- package/package.json +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/lib/brands.ts +7 -7
- package/src/services/content/artist.ts +10 -7
- package/src/services/content/genre.ts +10 -7
- package/src/services/content/instructor.ts +7 -7
- package/src/services/content-org/learning-paths.ts +3 -3
- package/src/services/progress-row/method-card.js +1 -1
- package/src/services/reporting/reporting.ts +19 -15
- package/src/services/sync/fetch.ts +3 -0
- package/src/services/user/onboarding.ts +3 -3
- package/docs/Content.html +0 -269
- package/docs/ContentOrganization.html +0 -245
- package/docs/Forums.html +0 -269
- package/docs/Gamification.html +0 -245
- package/docs/TestUser.html +0 -260
- package/docs/UserManagementSystem.html +0 -317
- package/docs/api_types.js.html +0 -97
- package/docs/config.js.html +0 -140
- package/docs/content-org_content-org.js.html +0 -76
- package/docs/content-org_guided-courses.ts.html +0 -110
- package/docs/content-org_learning-paths.ts.html +0 -391
- package/docs/content-org_playlists-types.js.html +0 -128
- package/docs/content-org_playlists.js.html +0 -440
- package/docs/content.js.html +0 -603
- package/docs/content_artist.ts.html +0 -206
- package/docs/content_content.ts.html +0 -77
- package/docs/content_genre.ts.html +0 -209
- package/docs/content_instructor.ts.html +0 -206
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/forums_categories.ts.html +0 -156
- package/docs/forums_discussions.js.html +0 -95
- package/docs/forums_forum.js.html +0 -95
- package/docs/forums_forums.ts.html +0 -160
- package/docs/forums_posts.ts.html +0 -284
- package/docs/forums_threads.ts.html +0 -284
- package/docs/gamification_awards.js.html +0 -165
- package/docs/gamification_awards.ts.html +0 -195
- package/docs/gamification_gamification.js.html +0 -76
- package/docs/gamification_types.js.html +0 -80
- package/docs/global.html +0 -6019
- package/docs/index.html +0 -167
- package/docs/liveTesting.ts.html +0 -103
- package/docs/module-Accounts.html +0 -2283
- package/docs/module-Artist.html +0 -993
- package/docs/module-Awards.html +0 -836
- package/docs/module-Categories.html +0 -711
- package/docs/module-Config.html +0 -431
- package/docs/module-Content-Services-V2.html +0 -2998
- package/docs/module-ForumCategories.html +0 -687
- package/docs/module-ForumDiscussions.html +0 -370
- package/docs/module-Forums.html +0 -16599
- package/docs/module-Genre.html +0 -981
- package/docs/module-GuidedCourses.html +0 -108
- package/docs/module-Instructor.html +0 -929
- package/docs/module-Interests.html +0 -1066
- package/docs/module-LearningPaths.html +0 -2424
- package/docs/module-Onboarding.html +0 -882
- package/docs/module-Payments.html +0 -392
- package/docs/module-Permissions.html +0 -406
- package/docs/module-Playlists.html +0 -3030
- package/docs/module-ProgressRow.html +0 -108
- package/docs/module-Railcontent-Services.html +0 -5876
- package/docs/module-Sanity-Services.html +0 -8244
- package/docs/module-Sessions.html +0 -575
- package/docs/module-Threads.html +0 -1119
- package/docs/module-UserActivity.html +0 -4534
- package/docs/module-UserChat.html +0 -410
- package/docs/module-UserManagement.html +0 -1932
- package/docs/module-UserMemberships.html +0 -829
- package/docs/module-UserNotifications.html +0 -2595
- package/docs/module-UserProfile.html +0 -370
- package/docs/progress-row_method-card.js.html +0 -184
- package/docs/railcontent.js.html +0 -724
- package/docs/sanity.js.html +0 -2322
- package/docs/scripts/collapse.js +0 -39
- package/docs/scripts/commonNav.js +0 -28
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/nav.js +0 -12
- package/docs/scripts/polyfill.js +0 -4
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/lang-css.js +0 -2
- package/docs/scripts/prettify/prettify.js +0 -28
- package/docs/scripts/search.js +0 -99
- package/docs/styles/jsdoc.css +0 -776
- package/docs/styles/prettify.css +0 -80
- package/docs/userActivity.js.html +0 -1512
- package/docs/user_account.ts.html +0 -265
- package/docs/user_chat.js.html +0 -98
- package/docs/user_interests.js.html +0 -150
- package/docs/user_management.js.html +0 -258
- package/docs/user_memberships.js.html +0 -144
- package/docs/user_memberships.ts.html +0 -292
- package/docs/user_notifications.js.html +0 -374
- package/docs/user_onboarding.ts.html +0 -329
- package/docs/user_payments.ts.html +0 -146
- package/docs/user_permissions.js.html +0 -110
- package/docs/user_profile.js.html +0 -115
- package/docs/user_sessions.js.html +0 -170
- package/docs/user_types.js.html +0 -224
- package/docs/user_user-management-system.js.html +0 -79
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<title>content-org/playlists.js - Documentation</title>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<script src="scripts/prettify/prettify.js"></script>
|
|
10
|
-
<script src="scripts/prettify/lang-css.js"></script>
|
|
11
|
-
<!--[if lt IE 9]>
|
|
12
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
13
|
-
<![endif]-->
|
|
14
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
|
-
<script src="scripts/nav.js" defer></script>
|
|
17
|
-
|
|
18
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
|
|
22
|
-
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
23
|
-
<label for="nav-trigger" class="navicon-button x">
|
|
24
|
-
<div class="navicon"></div>
|
|
25
|
-
</label>
|
|
26
|
-
|
|
27
|
-
<label for="nav-trigger" class="overlay"></label>
|
|
28
|
-
|
|
29
|
-
<nav >
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Accounts.html">Accounts</a><ul class='methods'><li data-type='method'><a href="module-Accounts.html#~confirmEmailChange">confirmEmailChange</a></li><li data-type='method'><a href="module-Accounts.html#~deleteAccount">deleteAccount</a></li><li data-type='method'><a href="module-Accounts.html#~numberOfActiveUsers">numberOfActiveUsers</a></li><li data-type='method'><a href="module-Accounts.html#~requestEmailChange">requestEmailChange</a></li><li data-type='method'><a href="module-Accounts.html#~resetPassword">resetPassword</a></li><li data-type='method'><a href="module-Accounts.html#~sendAccountSetupEmail">sendAccountSetupEmail</a></li><li data-type='method'><a href="module-Accounts.html#~sendPasswordResetEmail">sendPasswordResetEmail</a></li><li data-type='method'><a href="module-Accounts.html#~setupAccount">setupAccount</a></li><li data-type='method'><a href="module-Accounts.html#~status">status</a></li><li data-type='method'><a href="module-Accounts.html#~toggleStudentView">toggleStudentView</a></li></ul></li><li><a href="module-Artist.html">Artist</a><ul class='methods'><li data-type='method'><a href="module-Artist.html#~fetchArtistBySlug">fetchArtistBySlug</a></li><li data-type='method'><a href="module-Artist.html#~fetchArtistLessons">fetchArtistLessons</a></li><li data-type='method'><a href="module-Artist.html#~fetchArtists">fetchArtists</a></li></ul></li><li><a href="module-Awards.html">Awards</a><ul class='methods'><li data-type='method'><a href="module-Awards.html#~fetchAwardsForUser">fetchAwardsForUser</a></li><li data-type='method'><a href="module-Awards.html#~fetchCertificate">fetchCertificate</a></li><li data-type='method'><a href="module-Awards.html#~getAwardDataForGuidedContent">getAwardDataForGuidedContent</a></li></ul></li><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#.initializeService">initializeService</a></li></ul></li><li><a href="module-Content-Services-V2.html">Content-Services-V2</a><ul class='methods'><li data-type='method'><a href="module-Content-Services-V2.html#.getContentRows">getContentRows</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getLegacyMethods">getLegacyMethods</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getNewAndUpcoming">getNewAndUpcoming</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getOwnedContent">getOwnedContent</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getRecent">getRecent</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getRecommendedForYou">getRecommendedForYou</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getScheduleContentRows">getScheduleContentRows</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getTabResults">getTabResults</a></li></ul></li><li><a href="module-Forums.html">Forums</a><ul class='methods'><li data-type='method'><a href="module-Forums.html#~createForumCategory">createForumCategory</a></li><li data-type='method'><a href="module-Forums.html#~createPost">createPost</a></li><li data-type='method'><a href="module-Forums.html#~createThread">createThread</a></li><li data-type='method'><a href="module-Forums.html#~deleteForumCategory">deleteForumCategory</a></li><li data-type='method'><a href="module-Forums.html#~deletePost">deletePost</a></li><li data-type='method'><a href="module-Forums.html#~deleteThread">deleteThread</a></li><li data-type='method'><a href="module-Forums.html#~fetchCommunityGuidelines">fetchCommunityGuidelines</a></li><li data-type='method'><a href="module-Forums.html#~fetchFollowedThreads">fetchFollowedThreads</a></li><li data-type='method'><a href="module-Forums.html#~fetchForumCategories">fetchForumCategories</a></li><li data-type='method'><a href="module-Forums.html#~fetchLatestThreads">fetchLatestThreads</a></li><li data-type='method'><a href="module-Forums.html#~fetchPosts">fetchPosts</a></li><li data-type='method'><a href="module-Forums.html#~fetchThreads">fetchThreads</a></li><li data-type='method'><a href="module-Forums.html#~followThread">followThread</a></li><li data-type='method'><a href="module-Forums.html#~jumpToPost">jumpToPost</a></li><li data-type='method'><a href="module-Forums.html#~likePost">likePost</a></li><li data-type='method'><a href="module-Forums.html#~lockThread">lockThread</a></li><li data-type='method'><a href="module-Forums.html#~markThreadAsRead">markThreadAsRead</a></li><li data-type='method'><a href="module-Forums.html#~pinThread">pinThread</a></li><li data-type='method'><a href="module-Forums.html#~search">search</a></li><li data-type='method'><a href="module-Forums.html#~unfollowThread">unfollowThread</a></li><li data-type='method'><a href="module-Forums.html#~unlikePost">unlikePost</a></li><li data-type='method'><a href="module-Forums.html#~unlockThread">unlockThread</a></li><li data-type='method'><a href="module-Forums.html#~unpinThread">unpinThread</a></li><li data-type='method'><a href="module-Forums.html#~updateForumCategory">updateForumCategory</a></li><li data-type='method'><a href="module-Forums.html#~updatePost">updatePost</a></li><li data-type='method'><a href="module-Forums.html#~updateThread">updateThread</a></li></ul></li><li></li><li></li><li><a href="module-Genre.html">Genre</a><ul class='methods'><li data-type='method'><a href="module-Genre.html#~fetchGenreBySlug">fetchGenreBySlug</a></li><li data-type='method'><a href="module-Genre.html#~fetchGenreLessons">fetchGenreLessons</a></li><li data-type='method'><a href="module-Genre.html#~fetchGenres">fetchGenres</a></li></ul></li><li><a href="module-GuidedCourses.html">GuidedCourses</a></li><li><a href="module-Instructor.html">Instructor</a><ul class='methods'><li data-type='method'><a href="module-Instructor.html#~fetchInstructorBySlug">fetchInstructorBySlug</a></li><li data-type='method'><a href="module-Instructor.html#~fetchInstructorLessons">fetchInstructorLessons</a></li><li data-type='method'><a href="module-Instructor.html#~fetchInstructors">fetchInstructors</a></li></ul></li><li><a href="module-Interests.html">Interests</a><ul class='methods'><li data-type='method'><a href="module-Interests.html#.fetchInterests">fetchInterests</a></li><li data-type='method'><a href="module-Interests.html#.fetchUninterests">fetchUninterests</a></li><li data-type='method'><a href="module-Interests.html#.markContentAsInterested">markContentAsInterested</a></li><li data-type='method'><a href="module-Interests.html#.markContentAsNotInterested">markContentAsNotInterested</a></li><li data-type='method'><a href="module-Interests.html#.removeContentAsInterested">removeContentAsInterested</a></li><li data-type='method'><a href="module-Interests.html#.removeContentAsNotInterested">removeContentAsNotInterested</a></li></ul></li><li><a href="module-LearningPaths.html">LearningPaths</a><ul class='methods'><li data-type='method'><a href="module-LearningPaths.html#~completeLearningPathIntroVideo">completeLearningPathIntroVideo</a></li><li data-type='method'><a href="module-LearningPaths.html#~completeMethodIntroVideo">completeMethodIntroVideo</a></li><li data-type='method'><a href="module-LearningPaths.html#~fetchLearningPathLessons">fetchLearningPathLessons</a></li><li data-type='method'><a href="module-LearningPaths.html#~fetchLearningPathProgressCheckLessons">fetchLearningPathProgressCheckLessons</a></li><li data-type='method'><a href="module-LearningPaths.html#~getActivePath">getActivePath</a></li><li data-type='method'><a href="module-LearningPaths.html#~getDailySession">getDailySession</a></li><li data-type='method'><a href="module-LearningPaths.html#~getEnrichedLearningPath">getEnrichedLearningPath</a></li><li data-type='method'><a href="module-LearningPaths.html#~getLearningPathLessonsByIds">getLearningPathLessonsByIds</a></li><li data-type='method'><a href="module-LearningPaths.html#~mapContentToParent">mapContentToParent</a></li><li data-type='method'><a href="module-LearningPaths.html#~resetAllLearningPaths">resetAllLearningPaths</a></li><li data-type='method'><a href="module-LearningPaths.html#~startLearningPath">startLearningPath</a></li><li data-type='method'><a href="module-LearningPaths.html#~updateDailySession">updateDailySession</a></li></ul></li><li><a href="module-Onboarding.html">Onboarding</a><ul class='methods'><li data-type='method'><a href="module-Onboarding.html#~getOnboardingRecommendedContent">getOnboardingRecommendedContent</a></li><li data-type='method'><a href="module-Onboarding.html#~startOnboarding">startOnboarding</a></li><li data-type='method'><a href="module-Onboarding.html#~updateOnboarding">updateOnboarding</a></li><li data-type='method'><a href="module-Onboarding.html#~userOnboardingForBrand">userOnboardingForBrand</a></li></ul></li><li><a href="module-Payments.html">Payments</a><ul class='methods'><li data-type='method'><a href="module-Payments.html#~fetchCustomerPayments">fetchCustomerPayments</a></li></ul></li><li><a href="module-Permissions.html">Permissions</a><ul class='methods'><li data-type='method'><a href="module-Permissions.html#.fetchUserPermissions">fetchUserPermissions</a></li><li data-type='method'><a href="module-Permissions.html#.reset">reset</a></li></ul></li><li><a href="module-Playlists.html">Playlists</a><ul class='methods'><li data-type='method'><a href="module-Playlists.html#.addItemToPlaylist">addItemToPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.createPlaylist">createPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.deletePlaylist">deletePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.duplicatePlaylist">duplicatePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.fetchPlaylist">fetchPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.fetchPlaylistItems">fetchPlaylistItems</a></li><li data-type='method'><a href="module-Playlists.html#.fetchUserPlaylists">fetchUserPlaylists</a></li><li data-type='method'><a href="module-Playlists.html#.togglePlaylistPrivate">togglePlaylistPrivate</a></li><li data-type='method'><a href="module-Playlists.html#.undeletePlaylist">undeletePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.updatePlaylist">updatePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~deleteItemsFromPlaylist">deleteItemsFromPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~likePlaylist">likePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~reportPlaylist">reportPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~restoreItemFromPlaylist">restoreItemFromPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~unlikePlaylist">unlikePlaylist</a></li></ul></li><li><a href="module-ProgressRow.html">ProgressRow</a></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.assignModeratorToComment">assignModeratorToComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.closeComment">closeComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.createComment">createComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deleteComment">deleteComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.editComment">editComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCarouselCardData">fetchCarouselCardData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchComment">fetchComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCommentRelies">fetchCommentRelies</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchComments">fetchComments</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCompletedContent">fetchCompletedContent</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCompletedState">fetchCompletedState</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentPageUserData">fetchContentPageUserData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchNextContentDataForParent">fetchNextContentDataForParent</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchRecentUserActivities">fetchRecentUserActivities</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchTopComment">fetchTopComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserAward">fetchUserAward</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserBadges">fetchUserBadges</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserPracticeNotes">fetchUserPracticeNotes</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.likeComment">likeComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.openComment">openComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.replyToComment">replyToComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.reportComment">reportComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.restoreComment">restoreComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.setStudentViewForUser">setStudentViewForUser</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.unassignModeratorToComment">unassignModeratorToComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.unlikeComment">unlikeComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#~fetchLastInteractedChild">fetchLastInteractedChild</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllPacks">fetchAllPacks</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByReference">fetchByReference</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchComingSoon">fetchComingSoon</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCommentModContentData">fetchCommentModContentData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchFoundation">fetchFoundation</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLeaving">fetchLeaving</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonContent">fetchLessonContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonsFeaturingThisContent">fetchLessonsFeaturingThisContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMetadata">fetchMetadata</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethod">fetchMethod</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildren">fetchMethodChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildrenIds">fetchMethodChildrenIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodPreviousNextLesson">fetchMethodPreviousNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodV2IntroVideo">fetchMethodV2IntroVideo</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodV2Structure">fetchMethodV2Structure</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodV2StructureFromId">fetchMethodV2StructureFromId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNewReleases">fetchNewReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNextPreviousLesson">fetchNextPreviousLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchOtherSongVersions">fetchOtherSongVersions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchOwnedContent">fetchOwnedContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackData">fetchPackData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedRecommendedContent">fetchRelatedRecommendedContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedSongs">fetchRelatedSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchReturning">fetchReturning</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchScheduledReleases">fetchScheduledReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchShowsData">fetchShowsData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSiblingContent">fetchSiblingContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchTopLevelParentId">fetchTopLevelParentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchUpcomingEvents">fetchUpcomingEvents</a></li><li data-type='method'><a href="module-Sanity-Services.html#.jumpToContinueContent">jumpToContinueContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#~fetchRelatedByLicense">fetchRelatedByLicense</a></li><li data-type='method'><a href="module-Sanity-Services.html#~getQueryFromPage">getQueryFromPage</a></li></ul></li><li><a href="module-Sessions.html">Sessions</a><ul class='methods'><li data-type='method'><a href="module-Sessions.html#.login">login</a></li><li data-type='method'><a href="module-Sessions.html#.logout">logout</a></li></ul></li><li><a href="module-UserActivity.html">UserActivity</a><ul class='methods'><li data-type='method'><a href="module-UserActivity.html#.calculateLongestStreaks">calculateLongestStreaks</a></li><li data-type='method'><a href="module-UserActivity.html#.createPracticeNotes">createPracticeNotes</a></li><li data-type='method'><a href="module-UserActivity.html#.deletePracticeSession">deletePracticeSession</a></li><li data-type='method'><a href="module-UserActivity.html#.deleteUserActivity">deleteUserActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.getPracticeNotes">getPracticeNotes</a></li><li data-type='method'><a href="module-UserActivity.html#.getPracticeSessions">getPracticeSessions</a></li><li data-type='method'><a href="module-UserActivity.html#.getProgressRows">getProgressRows</a></li><li data-type='method'><a href="module-UserActivity.html#.getRecentActivity">getRecentActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.getUserMonthlyStats">getUserMonthlyStats</a></li><li data-type='method'><a href="module-UserActivity.html#.getUserWeeklyStats">getUserWeeklyStats</a></li><li data-type='method'><a href="module-UserActivity.html#.pinProgressRow">pinProgressRow</a></li><li data-type='method'><a href="module-UserActivity.html#.recordUserActivity">recordUserActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.recordUserPractice">recordUserPractice</a></li><li data-type='method'><a href="module-UserActivity.html#.removeUserPractice">removeUserPractice</a></li><li data-type='method'><a href="module-UserActivity.html#.restorePracticeSession">restorePracticeSession</a></li><li data-type='method'><a href="module-UserActivity.html#.restoreUserActivity">restoreUserActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.restoreUserPractice">restoreUserPractice</a></li><li data-type='method'><a href="module-UserActivity.html#.unpinProgressRow">unpinProgressRow</a></li><li data-type='method'><a href="module-UserActivity.html#.updatePracticeNotes">updatePracticeNotes</a></li><li data-type='method'><a href="module-UserActivity.html#.updateUserPractice">updateUserPractice</a></li></ul></li><li><a href="module-UserChat.html">UserChat</a><ul class='methods'><li data-type='method'><a href="module-UserChat.html#.fetchChatSettings">fetchChatSettings</a></li></ul></li><li><a href="module-UserManagement.html">UserManagement</a><ul class='methods'><li data-type='method'><a href="module-UserManagement.html#.blockUser">blockUser</a></li><li data-type='method'><a href="module-UserManagement.html#.blockedUsers">blockedUsers</a></li><li data-type='method'><a href="module-UserManagement.html#.deletePicture">deletePicture</a></li><li data-type='method'><a href="module-UserManagement.html#.getUserData">getUserData</a></li><li data-type='method'><a href="module-UserManagement.html#.getUserSignature">getUserSignature</a></li><li data-type='method'><a href="module-UserManagement.html#.isUsernameAvailable">isUsernameAvailable</a></li><li data-type='method'><a href="module-UserManagement.html#.setUserSignature">setUserSignature</a></li><li data-type='method'><a href="module-UserManagement.html#.toggleSignaturePrivate">toggleSignaturePrivate</a></li><li data-type='method'><a href="module-UserManagement.html#.unblockUser">unblockUser</a></li><li data-type='method'><a href="module-UserManagement.html#.updateDisplayName">updateDisplayName</a></li><li data-type='method'><a href="module-UserManagement.html#.uploadPicture">uploadPicture</a></li><li data-type='method'><a href="module-UserManagement.html#.uploadPictureFromS3">uploadPictureFromS3</a></li></ul></li><li><a href="module-UserMemberships.html">UserMemberships</a><ul class='methods'><li data-type='method'><a href="module-UserMemberships.html#~fetchMemberships">fetchMemberships</a></li><li data-type='method'><a href="module-UserMemberships.html#~fetchRechargeTokens">fetchRechargeTokens</a></li><li data-type='method'><a href="module-UserMemberships.html#~restorePurchases">restorePurchases</a></li><li data-type='method'><a href="module-UserMemberships.html#~upgradeSubscription">upgradeSubscription</a></li></ul></li><li><a href="module-UserNotifications.html">UserNotifications</a><ul class='methods'><li data-type='method'><a href="module-UserNotifications.html#.deleteNotification">deleteNotification</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchLiveEventPollingState">fetchLiveEventPollingState</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchNotificationSettings">fetchNotificationSettings</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchNotifications">fetchNotifications</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchUnreadCount">fetchUnreadCount</a></li><li data-type='method'><a href="module-UserNotifications.html#.markAllNotificationsAsRead">markAllNotificationsAsRead</a></li><li data-type='method'><a href="module-UserNotifications.html#.markNotificationAsRead">markNotificationAsRead</a></li><li data-type='method'><a href="module-UserNotifications.html#.markNotificationAsUnread">markNotificationAsUnread</a></li><li data-type='method'><a href="module-UserNotifications.html#.pauseLiveEventPolling">pauseLiveEventPolling</a></li><li data-type='method'><a href="module-UserNotifications.html#.restoreNotification">restoreNotification</a></li><li data-type='method'><a href="module-UserNotifications.html#.startLiveEventPolling">startLiveEventPolling</a></li><li data-type='method'><a href="module-UserNotifications.html#.updateNotificationSetting">updateNotificationSetting</a></li></ul></li><li><a href="module-UserProfile.html">UserProfile</a><ul class='methods'><li data-type='method'><a href="module-UserProfile.html#.deleteProfilePicture">deleteProfilePicture</a></li><li data-type='method'><a href="module-UserProfile.html#.otherStats">otherStats</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="ContentOrganization.html">ContentOrganization</a></li><li><a href="Forums.html">Forums</a></li><li><a href="Gamification.html">Gamification</a></li><li><a href="UserManagementSystem.html">UserManagementSystem</a></li></ul><h3>Interfaces</h3><ul><li><a href="TestUser.html">TestUser</a></li></ul><h3>Global</h3><ul><li><a href="global.html#createTestUser">createTestUser</a></li></ul>
|
|
33
|
-
|
|
34
|
-
</nav>
|
|
35
|
-
|
|
36
|
-
<div id="main">
|
|
37
|
-
|
|
38
|
-
<h1 class="page-title">content-org/playlists.js</h1>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<section>
|
|
47
|
-
<article>
|
|
48
|
-
<pre class="prettyprint source linenums"><code>/**
|
|
49
|
-
* @module Playlists
|
|
50
|
-
*/
|
|
51
|
-
import { globalConfig } from '../config.js'
|
|
52
|
-
import { fetchHandler } from '../railcontent.js'
|
|
53
|
-
import { getNavigateToForPlaylists } from '../contentAggregator.js'
|
|
54
|
-
import './playlists-types.js'
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Exported functions that are excluded from index generation.
|
|
58
|
-
*
|
|
59
|
-
* @type {string[]}
|
|
60
|
-
*/
|
|
61
|
-
const excludeFromGeneratedIndex = []
|
|
62
|
-
|
|
63
|
-
const BASE_PATH = `/api/content-org`
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Fetches user playlists for a specific brand.
|
|
67
|
-
*
|
|
68
|
-
* Allows optional pagination, sorting, and search parameters to control the result set.
|
|
69
|
-
*
|
|
70
|
-
* @param {string} brand - The brand identifier for which playlists are being fetched.
|
|
71
|
-
* @param {number} [params.limit=10] - The maximum number of playlists to return per page (default is 10).
|
|
72
|
-
* @param {number} [params.page=1] - The page number for pagination.
|
|
73
|
-
* @param {string} [params.sort='-created_at'] - The sorting order for the playlists (default is by created_at in descending order).
|
|
74
|
-
* @param {int|string} [params.content_id] - If content_id exists, the endpoint checks in each playlist if we have the content in the items.
|
|
75
|
-
*
|
|
76
|
-
* @returns {Promise<Object|null>} - A promise that resolves to the response from the API, containing the user playlists data.
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* fetchUserPlaylists('drumeo', { page: 1, sort: 'name', searchTerm: 'rock' })
|
|
80
|
-
* .then(playlists => console.log(playlists))
|
|
81
|
-
* .catch(error => console.error(error));
|
|
82
|
-
*/
|
|
83
|
-
export async function fetchUserPlaylists(
|
|
84
|
-
brand,
|
|
85
|
-
{ page, limit, sort, content_id } = {}
|
|
86
|
-
) {
|
|
87
|
-
const pageString = page ? `?page=${page}` : '?page=1'
|
|
88
|
-
const limitString = limit ? `&limit=${limit}` : ''
|
|
89
|
-
const sortString = sort ? `&sort=${sort}` : ''
|
|
90
|
-
const content = content_id ? `&content_id=${content_id}` : ''
|
|
91
|
-
const brandString = brand ? `&brand=${brand}` : ''
|
|
92
|
-
const url = `${BASE_PATH}/v1/user/playlists${pageString}${brandString}${limitString}${sortString}${content}`
|
|
93
|
-
return await getNavigateToForPlaylists(await fetchHandler(url), {dataField: 'data'})
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Creates a new user playlist by sending a POST request with playlist data to the API.
|
|
98
|
-
*
|
|
99
|
-
* This function calls the `/playlists/playlist` endpoint, where the server validates the incoming data and associates
|
|
100
|
-
* the new playlist with the authenticated user. The `name` field is required, while other fields are optional.
|
|
101
|
-
*
|
|
102
|
-
* @param {CreatePlaylistDTO} playlistData - An object containing data to create the playlist. The fields include:
|
|
103
|
-
* - `name` (string): The name of the new playlist (required, max 255 characters).
|
|
104
|
-
* - `description` (string): A description of the playlist (optional, max 1000 characters).
|
|
105
|
-
* - `category` (string): The category of the playlist.
|
|
106
|
-
* - `private` (boolean): Whether the playlist is private (optional, defaults to false).
|
|
107
|
-
* - `brand` (string): Brand identifier for the playlist.
|
|
108
|
-
*
|
|
109
|
-
* @returns {Promise<Playlist>} - A promise that resolves to the created playlist data if successful, or an error response if validation fails.
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* createPlaylist({ name: "My Playlist", description: "A cool playlist", private: true })
|
|
113
|
-
* .then(response => console.log(response))
|
|
114
|
-
* .catch(error => console.error('Error creating playlist:', error));
|
|
115
|
-
*/
|
|
116
|
-
export async function createPlaylist(playlistData) {
|
|
117
|
-
const url = `${BASE_PATH}/v1/user/playlists`
|
|
118
|
-
return await fetchHandler(url, 'POST', null, playlistData)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Soft deletes a playlist. Will cascade and also soft delete entries in other playlist tables (pinned, reported, liked,
|
|
123
|
-
* playlist content) and last engaged that have this playlist id
|
|
124
|
-
* @param {id} playlist - the id of the playlist you want to soft delete.
|
|
125
|
-
* @returns {Promise<any|string|null>}
|
|
126
|
-
*/
|
|
127
|
-
export async function deletePlaylist(playlist) {
|
|
128
|
-
const url = `${BASE_PATH}/v1/user/playlists/delete/${playlist}`
|
|
129
|
-
return await fetchHandler(url, 'POST', null, playlist)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Soft restores a playlist. Will cascade and also soft restore entries in other playlist tables (pinned, reported, liked,
|
|
134
|
-
* playlist content) and last engaged that have this playlist id
|
|
135
|
-
* @param {id} playlist - the id of the playlist you want to soft restore.
|
|
136
|
-
* @returns {Promise<any|string|null>}
|
|
137
|
-
*/
|
|
138
|
-
export async function undeletePlaylist(playlist) {
|
|
139
|
-
const url = `${BASE_PATH}/v1/user/playlists/undelete/${playlist}`
|
|
140
|
-
return await fetchHandler(url, 'POST', null, playlist)
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Likes a playlist for the current user.
|
|
146
|
-
*
|
|
147
|
-
* @async
|
|
148
|
-
* @function likePlaylist
|
|
149
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to like.
|
|
150
|
-
*
|
|
151
|
-
* @returns {Promise<Object>}
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
* // Like playlist with ID '123'
|
|
155
|
-
* try {
|
|
156
|
-
* const response = await likePlaylist('123');
|
|
157
|
-
* console.log('Playlist liked successfully:', response);
|
|
158
|
-
* } catch (error) {
|
|
159
|
-
* console.error('Failed to like playlist:', error);
|
|
160
|
-
* }
|
|
161
|
-
*/
|
|
162
|
-
export async function likePlaylist(playlistId) {
|
|
163
|
-
const url = `${BASE_PATH}/v1/user/playlists/like/${playlistId}`
|
|
164
|
-
return await fetchHandler(url, 'PUT')
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Unlikes a previously liked playlist.
|
|
169
|
-
* @async
|
|
170
|
-
* @function unlikePlaylist
|
|
171
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to unlike.
|
|
172
|
-
*
|
|
173
|
-
* @returns {Promise<Object>}
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* // Unlike playlist with ID '123'
|
|
178
|
-
* try {
|
|
179
|
-
* const response = await unlikePlaylist('123');
|
|
180
|
-
* console.log('Playlist unliked successfully:', response);
|
|
181
|
-
* } catch (error) {
|
|
182
|
-
* console.error('Failed to unlike playlist:', error);
|
|
183
|
-
* }
|
|
184
|
-
*/
|
|
185
|
-
export async function unlikePlaylist(playlistId) {
|
|
186
|
-
const url = `${BASE_PATH}/v1/user/playlists/like/${playlistId}`
|
|
187
|
-
return await fetchHandler(url, 'DELETE')
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Reports a playlist
|
|
192
|
-
*
|
|
193
|
-
* @async
|
|
194
|
-
* @function reportPlaylist
|
|
195
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to report.
|
|
196
|
-
*
|
|
197
|
-
* @returns {Promise<Object>}
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* // Report playlist with ID '123'
|
|
201
|
-
* try {
|
|
202
|
-
* const response = await reportPlaylist('123');
|
|
203
|
-
* console.log('Playlist reported successfully:', response);
|
|
204
|
-
* } catch (error) {
|
|
205
|
-
* console.error('Failed to report playlist:', error);
|
|
206
|
-
* }
|
|
207
|
-
*/
|
|
208
|
-
export async function reportPlaylist(playlistId) {
|
|
209
|
-
const url = `${BASE_PATH}/v1/user/playlists/report/${playlistId}`
|
|
210
|
-
return await fetchHandler(url, 'POST')
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Adds an item to one or more playlists
|
|
215
|
-
*
|
|
216
|
-
* @param {AddItemToPlaylistDTO} payload - The request payload containing necessary parameters.
|
|
217
|
-
*
|
|
218
|
-
* @returns {Promise<Object|null>} - A promise that resolves to an object with the response data, including:
|
|
219
|
-
* - `added` (Array): Playlist ids that we were success
|
|
220
|
-
* - `limit_exceeded` (Array): A list of playlists where the item limit was exceeded, if any.
|
|
221
|
-
* - `unauthorized` (Array): A list of successfully added items (empty if none).
|
|
222
|
-
*
|
|
223
|
-
* Resolves to `null` if the request fails.
|
|
224
|
-
* @throws {Error} - Throws an error if the request encounters issues during the operation.
|
|
225
|
-
*
|
|
226
|
-
* @example
|
|
227
|
-
* const payload = {
|
|
228
|
-
* content_id: 123,
|
|
229
|
-
* playlist_id: [1, 2, 3],
|
|
230
|
-
* position: 2,
|
|
231
|
-
*
|
|
232
|
-
* };
|
|
233
|
-
*
|
|
234
|
-
* addItemToPlaylist(payload)
|
|
235
|
-
* .then(response => {
|
|
236
|
-
* if (response?.success) {
|
|
237
|
-
* console.log("Item(s) added to playlist successfully");
|
|
238
|
-
* }
|
|
239
|
-
* if (response?.limit_exceeded) {
|
|
240
|
-
* console.warn("Some playlists exceeded the item limit:", response.limit_exceeded);
|
|
241
|
-
* }
|
|
242
|
-
* })
|
|
243
|
-
* .catch(error => {
|
|
244
|
-
* console.error("Error adding item to playlist:", error);
|
|
245
|
-
* });
|
|
246
|
-
*/
|
|
247
|
-
export async function addItemToPlaylist(payload) {
|
|
248
|
-
const url = `${BASE_PATH}/v1/user/playlists/items`
|
|
249
|
-
return await fetchHandler(url, 'POST', null, payload)
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Toggles a playlists public/private state
|
|
254
|
-
*
|
|
255
|
-
* @param {string|number} playlistId
|
|
256
|
-
* @param {Boolean} is_private - flag for private/public
|
|
257
|
-
|
|
258
|
-
* @returns {Promise<Playlist>} - A promise that resolves to the updated playlist data if successful, or an error response if validation fails.
|
|
259
|
-
*
|
|
260
|
-
* @example
|
|
261
|
-
* togglePlaylistPrivate(11541, true)
|
|
262
|
-
* .then(response => console.log(response))
|
|
263
|
-
* .catch(error => console.error('Error creating playlist:', error));
|
|
264
|
-
*/
|
|
265
|
-
export async function togglePlaylistPrivate(playlistId, is_private)
|
|
266
|
-
{
|
|
267
|
-
return await updatePlaylist(playlistId, {is_private})
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Updates a playlists values
|
|
273
|
-
*
|
|
274
|
-
* @param {string|number} playlistId
|
|
275
|
-
* @param {UpdatePlaylistDTO} updateData - An object containing fields to update on the playlist:
|
|
276
|
-
* - `name` (string): The name of the new playlist (required, max 255 characters).
|
|
277
|
-
* - `description` (string): A description of the playlist (optional, max 1000 characters).
|
|
278
|
-
* - `category` (string): The category of the playlist (optional).
|
|
279
|
-
* - `is_private` (boolean): Whether the playlist is private (optional, defaults to false).
|
|
280
|
-
* - `deleted_items` (array): List of playlist item IDs to delete (optional).
|
|
281
|
-
* - `item_order` (array): Updated order of playlist items (ids, not railcontent_ids) (optional).
|
|
282
|
-
*
|
|
283
|
-
* @returns {Promise<object>} - A promise that resolves to the created playlist data and lessons if successful, or an error response if validation fails.
|
|
284
|
-
*
|
|
285
|
-
* The server response includes:
|
|
286
|
-
* - `playlist`: Playlist metadata (same as fetchPlaylist)
|
|
287
|
-
* - `lessons`: Updated list of plalyist lessons (same as fetchPlaylistItems)
|
|
288
|
-
*
|
|
289
|
-
* @example
|
|
290
|
-
* updatePlaylist(661113 { name: "My Playlist", description: "A cool playlist", is_private: true, deleted_items : [2189832, 221091] })
|
|
291
|
-
* .then(response => console.log(response.playlist); console.log(response.lessons))
|
|
292
|
-
* .catch(error => console.error('Error updating playlist:', error));
|
|
293
|
-
*/
|
|
294
|
-
export async function updatePlaylist(playlistId, updateData)
|
|
295
|
-
{
|
|
296
|
-
const { name, description, category, is_private, item_order, deleted_items } = updateData;
|
|
297
|
-
let data = {
|
|
298
|
-
...name && { name },
|
|
299
|
-
...'description' in updateData && { description },
|
|
300
|
-
...'is_private' in updateData && { private: is_private || false },
|
|
301
|
-
...'category' in updateData && { category },
|
|
302
|
-
...deleted_items && { deleted_items },
|
|
303
|
-
...item_order && { item_order },
|
|
304
|
-
}
|
|
305
|
-
const url = `${BASE_PATH}/v1/user/playlists/${playlistId}`
|
|
306
|
-
return await fetchHandler(url, 'PUT', null, data);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Delete Items from playlist
|
|
311
|
-
*
|
|
312
|
-
* @async
|
|
313
|
-
* @function deleteItemsFromPlaylist
|
|
314
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to update.
|
|
315
|
-
* @param {array} deleted_items - list of playlist ids to delete (user_playlist_item_id, not the railcontent_id)
|
|
316
|
-
*
|
|
317
|
-
* @returns {Promise<Object>}
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
* // Delete items 8462221 and 8462222 from playlist 81111
|
|
321
|
-
* try {
|
|
322
|
-
* const response = await deleteItemsFromPlaylist(81111, [8462221, 8462222]);
|
|
323
|
-
* } catch (error) {
|
|
324
|
-
* console.error('Failed to delete playlist items:', error);
|
|
325
|
-
* }
|
|
326
|
-
*/
|
|
327
|
-
export async function deleteItemsFromPlaylist(playlistId, deleted_items) {
|
|
328
|
-
return await updatePlaylist(playlistId, {deleted_items})
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Restore items
|
|
333
|
-
*
|
|
334
|
-
* @async
|
|
335
|
-
* @function restoreItemFromPlaylist
|
|
336
|
-
* @param {string|number} playlistItemId - The unique identifier of the playlist ite to restore.
|
|
337
|
-
*
|
|
338
|
-
* @returns {Promise<Object>}
|
|
339
|
-
*
|
|
340
|
-
* @example
|
|
341
|
-
* // Restore item 8462221
|
|
342
|
-
* try {
|
|
343
|
-
* const response = await restoreItemFromPlaylist(8462221);
|
|
344
|
-
* } catch (error) {
|
|
345
|
-
* console.error('Failed to restore playlist item:', error);
|
|
346
|
-
* }
|
|
347
|
-
*/
|
|
348
|
-
export async function restoreItemFromPlaylist(playlistItemId) {
|
|
349
|
-
const url = `${BASE_PATH}/v1/user/playlists/items/undelete/${playlistItemId}`
|
|
350
|
-
return await fetchHandler(url, 'POST')
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Duplicates a playlist and playlist items for the provided playlistID for the authorized user
|
|
355
|
-
*
|
|
356
|
-
* @param {string|number} playlistId
|
|
357
|
-
* @param {DuplicatePlaylistDTO} playlistData - An object containing data to create the playlist. The fields include:
|
|
358
|
-
* - `name` (string): The name of the new playlist (required, max 255 characters).
|
|
359
|
-
* - `description` (string): A description of the playlist (optional, max 1000 characters).
|
|
360
|
-
* - `category` (string): The category of the playlist.
|
|
361
|
-
* - `private` (boolean): Whether the playlist is private (optional, defaults to false).
|
|
362
|
-
* - `brand` (string): Brand identifier for the playlist.
|
|
363
|
-
* - 'items' (array): List of playlist items to duplicate in updated order
|
|
364
|
-
*
|
|
365
|
-
* @returns {Promise<Playlist>}
|
|
366
|
-
* @example
|
|
367
|
-
* duplicatePlaylist(81167, { name: "My Playlist (Duplicate)", description: "A cool playlist", private: true })
|
|
368
|
-
* .then(response => console.log(response))
|
|
369
|
-
* .catch(error => console.error('Error creating playlist:', error));
|
|
370
|
-
*/
|
|
371
|
-
export async function duplicatePlaylist(playlistId, playlistData) {
|
|
372
|
-
const url = `${BASE_PATH}/v1/user/playlists/duplicate/${playlistId}`
|
|
373
|
-
return await fetchHandler(url, 'POST', null, playlistData)
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Retrieves details of a specific playlist by its ID.
|
|
378
|
-
*
|
|
379
|
-
* This function sends a GET request to the `/playlists/playlist` endpoint with a specified playlist ID.
|
|
380
|
-
* The server validates the user's access to the playlist and returns playlist details if the user is authorized.
|
|
381
|
-
*
|
|
382
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to retrieve.
|
|
383
|
-
*
|
|
384
|
-
* @returns {Promise<Object>} - A promise that resolves to the response from the API, containing:
|
|
385
|
-
* - `data` (Object): The playlist details, or an error message if access is denied or the playlist is not found.
|
|
386
|
-
*
|
|
387
|
-
* @example
|
|
388
|
-
* fetchPlaylist(12345)
|
|
389
|
-
* .then(response => console.log(response.data))
|
|
390
|
-
* .catch(error => console.error('Error fetching playlist:', error));
|
|
391
|
-
*/
|
|
392
|
-
export async function fetchPlaylist(playlistId) {
|
|
393
|
-
const url = `${BASE_PATH}/v1/user/playlists/${playlistId}`
|
|
394
|
-
return await getNavigateToForPlaylists(await fetchHandler(url))
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Retrieves items within a specified playlist by playlist ID.
|
|
399
|
-
*
|
|
400
|
-
* This function sends a GET request to the `/playlists/playlist-lessons` endpoint to fetch items in the given playlist.
|
|
401
|
-
* The server combines data from the playlist and additional metadata from Sanity to enhance item details.
|
|
402
|
-
*
|
|
403
|
-
* @param {string|number} playlistId - The unique identifier of the playlist whose items are to be fetched.
|
|
404
|
-
*
|
|
405
|
-
* @returns {Promise<Array<Object>>} - A promise that resolves to an array of playlist items
|
|
406
|
-
*
|
|
407
|
-
* @example
|
|
408
|
-
* fetchPlaylistItems(12345)
|
|
409
|
-
* .then(items => console.log(items))
|
|
410
|
-
* .catch(error => console.error('Error fetching playlist items:', error));
|
|
411
|
-
*/
|
|
412
|
-
export async function fetchPlaylistItems(playlistId) {
|
|
413
|
-
const url = `${BASE_PATH}/v1/user/playlists/items/${playlistId}`
|
|
414
|
-
return await fetchHandler(url, 'GET')
|
|
415
|
-
}
|
|
416
|
-
</code></pre>
|
|
417
|
-
</article>
|
|
418
|
-
</section>
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
</div>
|
|
426
|
-
|
|
427
|
-
<br class="clear">
|
|
428
|
-
|
|
429
|
-
<footer>
|
|
430
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Nov 28 2025 11:22:56 GMT-0800 (Pacific Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
431
|
-
</footer>
|
|
432
|
-
|
|
433
|
-
<script>prettyPrint();</script>
|
|
434
|
-
<script src="scripts/polyfill.js"></script>
|
|
435
|
-
<script src="scripts/linenumber.js"></script>
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
</body>
|
|
440
|
-
</html>
|