musora-content-services 2.3.26 → 2.5.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/.coderabbit.yaml +0 -0
- package/.editorconfig +0 -0
- package/.github/pull_request_template.md +0 -0
- package/.github/workflows/node.js.yml +0 -0
- package/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/.yarnrc.yml +1 -0
- package/CHANGELOG.md +19 -0
- package/README.md +0 -0
- package/babel.config.cjs +0 -0
- package/docs/Content-Organization.html +0 -0
- package/docs/ContentOrganization.html +2 -2
- package/docs/Gamification.html +2 -2
- package/docs/UserManagement.html +0 -0
- package/docs/UserManagementSystem.html +26 -2
- package/docs/api_types.js.html +2 -2
- package/docs/config.js.html +2 -2
- package/docs/content-org_content-org.js.html +2 -2
- package/docs/content-org_playlists-types.js.html +6 -6
- package/docs/content-org_playlists.js.html +220 -18
- package/docs/content.js.html +26 -11
- 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 -0
- 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 -0
- 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/gamification_awards.js.html +2 -2
- package/docs/gamification_gamification.js.html +2 -2
- package/docs/gamification_types.js.html +2 -2
- package/docs/global.html +14 -23
- package/docs/global.html#User +0 -0
- package/docs/index.html +2 -2
- package/docs/module-Awards.html +2 -2
- package/docs/module-Config.html +2 -2
- package/docs/module-Content-Services-V2.html +10 -9
- package/docs/module-Content-Services.html +763 -0
- package/docs/module-Interests.html +1066 -0
- package/docs/module-Permissions.html +2 -2
- package/docs/module-Playlists.html +1738 -157
- package/docs/module-Railcontent-Services.html +823 -3862
- package/docs/module-Sanity-Services.html +33 -33
- package/docs/module-Session-Management.html +0 -0
- package/docs/module-Sessions.html +2 -2
- package/docs/module-User-Activity.html +405 -32
- package/docs/module-User-Management.html +0 -0
- package/docs/module-User-Permissions.html +0 -0
- package/docs/module-UserManagement.html +2 -2
- package/docs/railcontent.js.html +65 -464
- package/docs/sanity.js.html +7 -5
- package/docs/scripts/collapse.js +0 -0
- package/docs/scripts/commonNav.js +0 -0
- package/docs/scripts/linenumber.js +0 -0
- package/docs/scripts/nav.js +0 -0
- package/docs/scripts/polyfill.js +0 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
- package/docs/scripts/prettify/lang-css.js +0 -0
- package/docs/scripts/prettify/prettify.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/styles/jsdoc.css +0 -0
- package/docs/styles/prettify.css +0 -0
- package/docs/types.js.html +0 -0
- package/docs/userActivity.js.html +177 -45
- package/docs/user_interests.js.html +150 -0
- package/docs/user_management.js.html +2 -2
- package/docs/user_permissions.js.html +2 -2
- package/docs/user_sessions.js.html +2 -2
- package/docs/user_types.js.html +2 -2
- package/docs/user_user-management-system.js.html +3 -2
- package/docs/user_user-management.js.html +0 -0
- package/jest.config.js +0 -0
- package/jsdoc.json +0 -0
- package/link_mcs.sh +0 -0
- package/package.json +1 -1
- package/src/contentMetaData.js +29 -5
- package/src/contentTypeConfig.js +3 -2
- package/src/index.d.ts +17 -0
- package/src/index.js +17 -0
- package/src/infrastructure/http/HttpClient.ts +120 -0
- package/src/infrastructure/http/executors/FetchRequestExecutor.ts +45 -0
- package/src/infrastructure/http/index.ts +13 -0
- package/src/infrastructure/http/interfaces/HeaderProvider.ts +3 -0
- package/src/infrastructure/http/interfaces/HttpError.ts +7 -0
- package/src/infrastructure/http/interfaces/NetworkError.ts +6 -0
- package/src/infrastructure/http/interfaces/RequestExecutor.ts +5 -0
- package/src/infrastructure/http/interfaces/RequestOptions.ts +5 -0
- package/src/infrastructure/http/providers/DefaultHeaderProvider.ts +18 -0
- package/src/services/content-org/playlists.js +0 -0
- package/src/services/content.js +24 -9
- package/src/services/contentAggregator.js +18 -10
- package/src/services/railcontent.js +28 -0
- package/src/services/recommendations.js +21 -25
- package/src/services/user/interests.js +78 -0
- package/src/services/user/user-management-system.js +1 -0
- package/src/services/userActivity.js +23 -0
- package/test/HttpClient.test.js +257 -0
- package/test/contentLikes.test.js +0 -0
- package/test/contentProgress.test.js +0 -0
- package/test/dataContext.test.js +0 -0
- package/test/forum.test.js +0 -0
- package/test/imageSRCBuilder.test.js +0 -0
- package/test/imageSRCVerify.test.js +0 -0
- package/test/initializeTests.js +0 -0
- package/test/lib/lastUpdated.test.js +0 -0
- package/test/live/contentProgressLive.test.js +0 -0
- package/test/live/railcontentLive.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/mockData/mockData_fetchByRailContentIds_one_content.json +0 -0
- package/test/mockData/mockData_user_practices.json +0 -0
- package/test/streakMessage.test.js +0 -0
- package/test/user/permissions.test.js +0 -0
- package/test/userActivity.test.js +0 -0
- package/tools/generate-index.cjs +0 -0
package/docs/railcontent.js.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Awards.html">Awards</a><ul class='methods'><li data-type='method'><a href="module-Awards.html#.fetchAwardsForUser">fetchAwardsForUser</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#.getNewAndUpcoming">getNewAndUpcoming</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-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#.fetchUserPlaylists">fetchUserPlaylists</a></li></ul></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#.countAssignmentsAndLessons">countAssignmentsAndLessons</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#.deletePlaylist">deletePlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deletePlaylistItem">deletePlaylistItem</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deletePlaylistLike">deletePlaylistLike</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.duplicatePlaylist">duplicatePlaylist</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#.fetchChallengeIndexMetadata">fetchChallengeIndexMetadata</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeLessonData">fetchChallengeLessonData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeMetadata">fetchChallengeMetadata</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeUserActiveChallenges">fetchChallengeUserActiveChallenges</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#.fetchCompletedChallenges">fetchCompletedChallenges</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#.fetchOwnedChallenges">fetchOwnedChallenges</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchPinnedPlaylists">fetchPinnedPlaylists</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchPlaylist">fetchPlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchPlaylistItem">fetchPlaylistItem</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchPlaylistItems">fetchPlaylistItems</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#.fetchUserChallengeProgress">fetchUserChallengeProgress</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#.likePlaylist">likePlaylist</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#.pinPlaylist">pinPlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesCommunityNotification">postChallengesCommunityNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesEnroll">postChallengesEnroll</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesEnrollmentNotification">postChallengesEnrollmentNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesHideCompletedBanner">postChallengesHideCompletedBanner</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesLeave">postChallengesLeave</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesSetStartDate">postChallengesSetStartDate</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesSoloNotification">postChallengesSoloNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesUnlock">postChallengesUnlock</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#.reportPlaylist">reportPlaylist</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#.unpinPlaylist">unpinPlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.updatePlaylist">updatePlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.updatePlaylistItem">updatePlaylistItem</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#.fetchArtistLessons">fetchArtistLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</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#.fetchCoachLessons">fetchCoachLessons</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#.fetchGenreLessons">fetchGenreLessons</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#.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#.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#.fetchParentForDownload">fetchParentForDownload</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#.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#.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#~getNextAndPreviousQuarterDates">getNextAndPreviousQuarterDates</a></li><li data-type='method'><a href="module-Sanity-Services.html#~getQueryFromPage">getQueryFromPage</a></li><li data-type='method'><a href="module-Sanity-Services.html#~handleCustomFetchAll">handleCustomFetchAll</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-User-Activity.html">User-Activity</a><ul class='methods'><li data-type='method'><a href="module-User-Activity.html#.createPracticeNotes">createPracticeNotes</a></li><li data-type='method'><a href="module-User-Activity.html#.deletePracticeSession">deletePracticeSession</a></li><li data-type='method'><a href="module-User-Activity.html#.getPracticeNotes">getPracticeNotes</a></li><li data-type='method'><a href="module-User-Activity.html#.getPracticeSessions">getPracticeSessions</a></li><li data-type='method'><a href="module-User-Activity.html#.getRecentActivity">getRecentActivity</a></li><li data-type='method'><a href="module-User-Activity.html#.getUserMonthlyStats">getUserMonthlyStats</a></li><li data-type='method'><a href="module-User-Activity.html#.getUserWeeklyStats">getUserWeeklyStats</a></li><li data-type='method'><a href="module-User-Activity.html#.recordUserPractice">recordUserPractice</a></li><li data-type='method'><a href="module-User-Activity.html#.removeUserPractice">removeUserPractice</a></li><li data-type='method'><a href="module-User-Activity.html#.restorePracticeSession">restorePracticeSession</a></li><li data-type='method'><a href="module-User-Activity.html#.restoreUserPractice">restoreUserPractice</a></li><li data-type='method'><a href="module-User-Activity.html#.updatePracticeNotes">updatePracticeNotes</a></li><li data-type='method'><a href="module-User-Activity.html#.updateUserPractice">updateUserPractice</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#.unblockUser">unblockUser</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="ContentOrganization.html">ContentOrganization</a></li><li><a href="Gamification.html">Gamification</a></li><li><a href="UserManagementSystem.html">UserManagementSystem</a></li></ul><h3><a href="global.html">Global</a></h3>
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Awards.html">Awards</a><ul class='methods'><li data-type='method'><a href="module-Awards.html#.fetchAwardsForUser">fetchAwardsForUser</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#.getNewAndUpcoming">getNewAndUpcoming</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-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-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#.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#.updatePlaylist">updatePlaylist</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#~togglePlaylistPrivate">togglePlaylistPrivate</a></li><li data-type='method'><a href="module-Playlists.html#~unlikePlaylist">unlikePlaylist</a></li></ul></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#.fetchChallengeIndexMetadata">fetchChallengeIndexMetadata</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeLessonData">fetchChallengeLessonData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeMetadata">fetchChallengeMetadata</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeUserActiveChallenges">fetchChallengeUserActiveChallenges</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#.fetchCompletedChallenges">fetchCompletedChallenges</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#.fetchOwnedChallenges">fetchOwnedChallenges</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#.fetchUserChallengeProgress">fetchUserChallengeProgress</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#.postChallengesCommunityNotification">postChallengesCommunityNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesEnroll">postChallengesEnroll</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesEnrollmentNotification">postChallengesEnrollmentNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesHideCompletedBanner">postChallengesHideCompletedBanner</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesLeave">postChallengesLeave</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesSetStartDate">postChallengesSetStartDate</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesSoloNotification">postChallengesSoloNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesUnlock">postChallengesUnlock</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#.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#.fetchArtistLessons">fetchArtistLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</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#.fetchCoachLessons">fetchCoachLessons</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#.fetchGenreLessons">fetchGenreLessons</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#.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#.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#.fetchParentForDownload">fetchParentForDownload</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#.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#.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#~getNextAndPreviousQuarterDates">getNextAndPreviousQuarterDates</a></li><li data-type='method'><a href="module-Sanity-Services.html#~getQueryFromPage">getQueryFromPage</a></li><li data-type='method'><a href="module-Sanity-Services.html#~handleCustomFetchAll">handleCustomFetchAll</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-User-Activity.html">User-Activity</a><ul class='methods'><li data-type='method'><a href="module-User-Activity.html#.calculateLongestStreaks">calculateLongestStreaks</a></li><li data-type='method'><a href="module-User-Activity.html#.createPracticeNotes">createPracticeNotes</a></li><li data-type='method'><a href="module-User-Activity.html#.deletePracticeSession">deletePracticeSession</a></li><li data-type='method'><a href="module-User-Activity.html#.getPracticeNotes">getPracticeNotes</a></li><li data-type='method'><a href="module-User-Activity.html#.getPracticeSessions">getPracticeSessions</a></li><li data-type='method'><a href="module-User-Activity.html#.getRecentActivity">getRecentActivity</a></li><li data-type='method'><a href="module-User-Activity.html#.getUserMonthlyStats">getUserMonthlyStats</a></li><li data-type='method'><a href="module-User-Activity.html#.getUserWeeklyStats">getUserWeeklyStats</a></li><li data-type='method'><a href="module-User-Activity.html#.recordUserPractice">recordUserPractice</a></li><li data-type='method'><a href="module-User-Activity.html#.removeUserPractice">removeUserPractice</a></li><li data-type='method'><a href="module-User-Activity.html#.restorePracticeSession">restorePracticeSession</a></li><li data-type='method'><a href="module-User-Activity.html#.restoreUserPractice">restoreUserPractice</a></li><li data-type='method'><a href="module-User-Activity.html#.updatePracticeNotes">updatePracticeNotes</a></li><li data-type='method'><a href="module-User-Activity.html#.updateUserPractice">updateUserPractice</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#.unblockUser">unblockUser</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="ContentOrganization.html">ContentOrganization</a></li><li><a href="Gamification.html">Gamification</a></li><li><a href="UserManagementSystem.html">UserManagementSystem</a></li></ul><h3><a href="global.html">Global</a></h3>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -337,10 +337,19 @@ async function patchDataHandler(url, data) {
|
|
|
337
337
|
return fetchHandler(url, 'patch', null, data)
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
+
async function putDataHandler(url, data) {
|
|
341
|
+
return fetchHandler(url, 'put', null, data)
|
|
342
|
+
}
|
|
343
|
+
|
|
340
344
|
async function deleteDataHandler(url, data) {
|
|
341
345
|
return fetchHandler(url, 'delete')
|
|
342
346
|
}
|
|
343
347
|
|
|
348
|
+
export async function fetchLikeCount(contendId){
|
|
349
|
+
const url = `/api/content/v1/content/like_count/${contendId}`
|
|
350
|
+
return await fetchDataHandler(url)
|
|
351
|
+
}
|
|
352
|
+
|
|
344
353
|
export async function fetchUserLikes(currentVersion) {
|
|
345
354
|
let url = `/api/content/v1/user/likes`
|
|
346
355
|
return fetchDataHandler(url, currentVersion)
|
|
@@ -606,313 +615,6 @@ export async function postChallengesHideCompletedBanner(contentId) {
|
|
|
606
615
|
return await fetchHandler(url, 'post')
|
|
607
616
|
}
|
|
608
617
|
|
|
609
|
-
/**
|
|
610
|
-
* Duplicates an existing playlist by sending a POST request to the API.
|
|
611
|
-
*
|
|
612
|
-
* This function calls the `/playlists/duplicate` endpoint, where the server replicates the specified playlist,
|
|
613
|
-
* including its items. Optionally, new `name`, `description`, `category`, or `thumbnail_url` parameters can be provided
|
|
614
|
-
* to customize the duplicated playlist. If a new name is not provided, the server appends " (Duplicate)" to the original name.
|
|
615
|
-
*
|
|
616
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to be duplicated.
|
|
617
|
-
* @param {Object} [playlistData] - Optional data to customize the duplicated playlist.
|
|
618
|
-
* @param {string} [playlistData.name] - New name for the duplicated playlist (default is original name + " (Duplicate)").
|
|
619
|
-
* @param {string} [playlistData.description] - New description for the duplicated playlist (defaults to original description).
|
|
620
|
-
* @param {string} [playlistData.category] - New category for the duplicated playlist (defaults to original category).
|
|
621
|
-
* @param {string} [playlistData.thumbnail_url] - New URL for the duplicated playlist thumbnail (defaults to original thumbnail).
|
|
622
|
-
*
|
|
623
|
-
* @returns {Promise<Object>} - A promise that resolves to the duplicated playlist data, or rejects with an error if the duplication fails.
|
|
624
|
-
*
|
|
625
|
-
* The duplicated playlist contains:
|
|
626
|
-
* - `name` (string): Name of the new playlist.
|
|
627
|
-
* - `description` (string|null): Description of the duplicated playlist.
|
|
628
|
-
* - `category` (string|null): Category of the duplicated playlist.
|
|
629
|
-
* - `thumbnail_url` (string|null): URL of the playlist thumbnail.
|
|
630
|
-
* - `items` (Array): A list of items (e.g., songs, tracks) copied from the original playlist.
|
|
631
|
-
*
|
|
632
|
-
* @example
|
|
633
|
-
* duplicatePlaylist(12345, { name: "My New Playlist" })
|
|
634
|
-
* .then(duplicatedPlaylist => console.log(duplicatedPlaylist))
|
|
635
|
-
* .catch(error => console.error('Error duplicating playlist:', error));
|
|
636
|
-
*/
|
|
637
|
-
export async function duplicatePlaylist(playlistId, playlistData) {
|
|
638
|
-
let url = `/playlists/duplicate/${playlistId}`
|
|
639
|
-
return await fetchHandler(url, 'post', null, playlistData)
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
/**
|
|
643
|
-
* Deletes a user’s playlist along with all associated items by sending a DELETE request to the API.
|
|
644
|
-
*
|
|
645
|
-
* This function calls the `/playlists/playlist` endpoint, where the server verifies the user’s ownership of the specified playlist.
|
|
646
|
-
* If the user is authorized, it deletes both the playlist and its associated items.
|
|
647
|
-
*
|
|
648
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to be deleted.
|
|
649
|
-
*
|
|
650
|
-
* @returns {Promise<Object>} - A promise that resolves to an object containing:
|
|
651
|
-
* - `success` (boolean): Indicates if the deletion was successful (`true` for success).
|
|
652
|
-
* - `message` (string): Success confirmation message (e.g., "Playlist and associated items deleted successfully").
|
|
653
|
-
*
|
|
654
|
-
* If the user is unauthorized or the playlist does not exist, the promise rejects with an error.
|
|
655
|
-
*
|
|
656
|
-
* @example
|
|
657
|
-
* deletePlaylist(12345)
|
|
658
|
-
* .then(response => {
|
|
659
|
-
* if (response.success) {
|
|
660
|
-
* console.log(response.message);
|
|
661
|
-
* }
|
|
662
|
-
* })
|
|
663
|
-
* .catch(error => console.error('Error deleting playlist:', error));
|
|
664
|
-
*/
|
|
665
|
-
export async function deletePlaylist(playlistId) {
|
|
666
|
-
let url = `/playlists/playlist/${playlistId}`
|
|
667
|
-
return await fetchHandler(url, 'delete')
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
/**
|
|
671
|
-
* Updates a user’s playlist by sending a PUT request with updated data to the API.
|
|
672
|
-
*
|
|
673
|
-
* This function calls the `/playlists/playlist/{playlistId}` endpoint, where the server validates the incoming data
|
|
674
|
-
* and verifies that the authenticated user is the playlist owner. If authorized, it updates the playlist details with the provided data.
|
|
675
|
-
*
|
|
676
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to be updated.
|
|
677
|
-
* @param {Object} updatedData - An object containing the playlist data to update. The possible fields include:
|
|
678
|
-
* - `name` (string): The new name of the playlist (max 255 characters).
|
|
679
|
-
* - `description` (string): A new description for the playlist (max 1000 characters).
|
|
680
|
-
* - `category` (string): The updated category of the playlist (max 255 characters).
|
|
681
|
-
* - `private` (boolean): Whether the playlist is private.
|
|
682
|
-
* - `thumbnail_url` (string): The URL of the playlist thumbnail.
|
|
683
|
-
*
|
|
684
|
-
* @returns {Promise<Object>} - A promise that resolves to an object containing:
|
|
685
|
-
* - `success` (boolean): Indicates if the update was successful (`true` for success).
|
|
686
|
-
* - `message` (string): Success confirmation message if the update is successful.
|
|
687
|
-
* - Other fields containing the updated playlist data.
|
|
688
|
-
*
|
|
689
|
-
* If the user is unauthorized or the data validation fails, the promise rejects with an error.
|
|
690
|
-
*
|
|
691
|
-
* @example
|
|
692
|
-
* updatePlaylist(12345, { name: "My New Playlist Name", description: "Updated description" })
|
|
693
|
-
* .then(response => {
|
|
694
|
-
* if (response.success) {
|
|
695
|
-
* console.log(response.message);
|
|
696
|
-
* }
|
|
697
|
-
* })
|
|
698
|
-
* .catch(error => console.error('Error updating playlist:', error));
|
|
699
|
-
*/
|
|
700
|
-
export async function updatePlaylist(playlistId, updatedData) {
|
|
701
|
-
const url = `/playlists/playlist/${playlistId}`
|
|
702
|
-
return await fetchHandler(url, 'PUT', null, updatedData)
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
/**
|
|
706
|
-
* Sends a request to "like" a playlist on behalf of the authenticated user.
|
|
707
|
-
*
|
|
708
|
-
* This function calls the `/playlists/playlist/like` endpoint, where the server validates the `playlist_id` and checks
|
|
709
|
-
* if the authenticated user has already liked the playlist. If not, it creates a new "like" entry associated with the playlist.
|
|
710
|
-
*
|
|
711
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to be liked.
|
|
712
|
-
*
|
|
713
|
-
* @returns {Promise<Object>} - A promise that resolves with the response from the API. The response contains:
|
|
714
|
-
* - `success` (boolean): Indicates if the like action was successful (`true` for success).
|
|
715
|
-
* - `message` (string): A success message if the playlist is liked successfully, or a notification if it was already liked.
|
|
716
|
-
* - `like` (Object|null): Details of the created "like" entry if the playlist is newly liked, or null if it was already liked.
|
|
717
|
-
*
|
|
718
|
-
* The `like` object in the response includes:
|
|
719
|
-
* - `playlist_id`: The ID of the liked playlist.
|
|
720
|
-
* - `user_id`: The ID of the user who liked the playlist.
|
|
721
|
-
* - `brand`: The brand associated with the like.
|
|
722
|
-
* - `created_at`: Timestamp of when the like was created.
|
|
723
|
-
*
|
|
724
|
-
* @example
|
|
725
|
-
* likePlaylist(12345)
|
|
726
|
-
* .then(response => {
|
|
727
|
-
* if (response.success) {
|
|
728
|
-
* console.log(response.message);
|
|
729
|
-
* }
|
|
730
|
-
* })
|
|
731
|
-
* .catch(error => console.error('Error liking playlist:', error));
|
|
732
|
-
*/
|
|
733
|
-
export async function likePlaylist(playlistId) {
|
|
734
|
-
const url = `/playlists/like`
|
|
735
|
-
const payload = { playlist_id: playlistId }
|
|
736
|
-
return await fetchHandler(url, 'PUT', null, payload)
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
/**
|
|
740
|
-
* Removes a "like" from a playlist for the authenticated user.
|
|
741
|
-
*
|
|
742
|
-
* This function sends a DELETE request to the `/playlists/like` endpoint, where the server validates the `playlist_id`
|
|
743
|
-
* and checks if a like by the authenticated user already exists for the specified playlist. If so, it deletes the like.
|
|
744
|
-
*
|
|
745
|
-
* @param {string|number} playlistId - The unique identifier of the playlist whose like is to be removed.
|
|
746
|
-
*
|
|
747
|
-
* @returns {Promise<Object>} - A promise that resolves with the response from the API. The response contains:
|
|
748
|
-
* - `success` (boolean): Indicates if the removal was successful (`true` for success).
|
|
749
|
-
* - `message` (string): A success message if the playlist like is removed successfully or a notification if the playlist was not previously liked.
|
|
750
|
-
*
|
|
751
|
-
* @example
|
|
752
|
-
* deletePlaylistLike(12345)
|
|
753
|
-
* .then(response => {
|
|
754
|
-
* if (response.success) {
|
|
755
|
-
* console.log(response.message);
|
|
756
|
-
* }
|
|
757
|
-
* })
|
|
758
|
-
* .catch(error => console.error('Error removing playlist like:', error));
|
|
759
|
-
*/
|
|
760
|
-
export async function deletePlaylistLike(playlistId) {
|
|
761
|
-
const url = `/playlists/like`
|
|
762
|
-
const payload = { playlist_id: playlistId }
|
|
763
|
-
return await fetchHandler(url, 'DELETE', null, payload)
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
/**
|
|
767
|
-
* Retrieves details of a specific playlist by its ID.
|
|
768
|
-
*
|
|
769
|
-
* This function sends a GET request to the `/playlists/playlist` endpoint with a specified playlist ID.
|
|
770
|
-
* The server validates the user's access to the playlist and returns playlist details if the user is authorized.
|
|
771
|
-
*
|
|
772
|
-
* @param {string|number} playlistId - The unique identifier of the playlist to retrieve.
|
|
773
|
-
*
|
|
774
|
-
* @returns {Promise<Object>} - A promise that resolves to the response from the API, containing:
|
|
775
|
-
* - `data` (Object): The playlist details, or an error message if access is denied or the playlist is not found.
|
|
776
|
-
*
|
|
777
|
-
* @example
|
|
778
|
-
* fetchPlaylist(12345)
|
|
779
|
-
* .then(response => console.log(response.data))
|
|
780
|
-
* .catch(error => console.error('Error fetching playlist:', error));
|
|
781
|
-
*/
|
|
782
|
-
export async function fetchPlaylist(playlistId) {
|
|
783
|
-
const url = `/playlists/playlist/${playlistId}`
|
|
784
|
-
return await fetchHandler(url, 'GET')
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* Retrieves items within a specified playlist by playlist ID.
|
|
789
|
-
*
|
|
790
|
-
* This function sends a GET request to the `/playlists/playlist-lessons` endpoint to fetch items in the given playlist.
|
|
791
|
-
* The server combines data from the playlist and additional metadata from Sanity to enhance item details.
|
|
792
|
-
*
|
|
793
|
-
* @param {string|number} playlistId - The unique identifier of the playlist whose items are to be fetched.
|
|
794
|
-
*
|
|
795
|
-
* @returns {Promise<Array<Object>>} - A promise that resolves to an array of playlist items
|
|
796
|
-
*
|
|
797
|
-
* @example
|
|
798
|
-
* fetchPlaylistItems(12345)
|
|
799
|
-
* .then(items => console.log(items))
|
|
800
|
-
* .catch(error => console.error('Error fetching playlist items:', error));
|
|
801
|
-
*/
|
|
802
|
-
export async function fetchPlaylistItems(playlistId, { sort } = {}) {
|
|
803
|
-
const sortString = sort ? `&sort=${sort}` : ''
|
|
804
|
-
const url = `/playlists/playlist-lessons?playlist_id=${playlistId}${sortString}`
|
|
805
|
-
return await fetchHandler(url, 'GET')
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
/**
|
|
809
|
-
* Updates a playlist item with the provided data.
|
|
810
|
-
*
|
|
811
|
-
* @param {Object} updatedData - The data to update the playlist item with.
|
|
812
|
-
* @param {number} updatedData.user_playlist_item_id - The ID of the playlist item to update.
|
|
813
|
-
* @param {number} [updatedData.start_second] - (Optional) The start time in seconds for the item.
|
|
814
|
-
* @param {number} [updatedData.end_second] - (Optional) The end time in seconds for the item.
|
|
815
|
-
* @param {string} [updatedData.playlist_item_name] - (Optional) The new name for the playlist item.
|
|
816
|
-
* @param {number} [updatedData.position] - (Optional) The new position for the playlist item within the playlist.
|
|
817
|
-
* @returns {Promise<Object|null>} - A promise that resolves to an object containing:
|
|
818
|
-
* - `success` (boolean): Indicates if the update was successful (`true` for success).
|
|
819
|
-
* - `data` (Object): The updated playlist item data.
|
|
820
|
-
*
|
|
821
|
-
* Resolves to `null` if the request fails.
|
|
822
|
-
* @throws {Error} - Throws an error if the request fails.
|
|
823
|
-
*
|
|
824
|
-
* @example
|
|
825
|
-
* const updatedData = {
|
|
826
|
-
* user_playlist_item_id: 123,
|
|
827
|
-
* start_second: 30,
|
|
828
|
-
* end_second: 120,
|
|
829
|
-
* playlist_item_name: "Updated Playlist Item Name",
|
|
830
|
-
* position: 2
|
|
831
|
-
* };
|
|
832
|
-
*
|
|
833
|
-
* updatePlaylistItem(updatedData)
|
|
834
|
-
* .then(response => {
|
|
835
|
-
* if (response.success) {
|
|
836
|
-
* console.log("Playlist item updated successfully:", response.data);
|
|
837
|
-
* }
|
|
838
|
-
* })
|
|
839
|
-
* .catch(error => {
|
|
840
|
-
* console.error("Error updating playlist item:", error);
|
|
841
|
-
* });
|
|
842
|
-
*/
|
|
843
|
-
export async function updatePlaylistItem(updatedData) {
|
|
844
|
-
const url = `/playlists/item`
|
|
845
|
-
return await fetchHandler(url, 'POST', null, updatedData)
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* Deletes a playlist item and repositions other items in the playlist if necessary.
|
|
850
|
-
*
|
|
851
|
-
* @param {Object} payload - The data required to delete the playlist item.
|
|
852
|
-
* @param {number} payload.user_playlist_item_id - The ID of the playlist item to delete.
|
|
853
|
-
* @returns {Promise<Object|null>} - A promise that resolves to an object containing:
|
|
854
|
-
* - `success` (boolean): Indicates if the deletion was successful (`true` for success).
|
|
855
|
-
* - `message` (string): A success message if the item is deleted successfully.
|
|
856
|
-
* - `error` (string): An error message if the deletion fails.
|
|
857
|
-
*
|
|
858
|
-
* Resolves to `null` if the request fails.
|
|
859
|
-
* @throws {Error} - Throws an error if the request fails.
|
|
860
|
-
*
|
|
861
|
-
* @example
|
|
862
|
-
* const payload = {
|
|
863
|
-
* user_playlist_item_id: 123
|
|
864
|
-
* };
|
|
865
|
-
*
|
|
866
|
-
* deletePlaylistItem(payload)
|
|
867
|
-
* .then(response => {
|
|
868
|
-
* if (response.success) {
|
|
869
|
-
* console.log("Playlist item deleted successfully:", response.message);
|
|
870
|
-
* } else {
|
|
871
|
-
* console.error("Error:", response.error);
|
|
872
|
-
* }
|
|
873
|
-
* })
|
|
874
|
-
* .catch(error => {
|
|
875
|
-
* console.error("Error deleting playlist item:", error);
|
|
876
|
-
* });
|
|
877
|
-
*/
|
|
878
|
-
export async function deletePlaylistItem(payload) {
|
|
879
|
-
const url = `/playlists/item`
|
|
880
|
-
return await fetchHandler(url, 'DELETE', null, payload)
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
* Fetches detailed data for a specific playlist item, including associated Sanity and Assignment information if available.
|
|
885
|
-
*
|
|
886
|
-
* @param {Object} payload - The request payload containing necessary parameters.
|
|
887
|
-
* @param {number} payload.user_playlist_item_id - The unique ID of the playlist item to fetch.
|
|
888
|
-
* @returns {Promise<Object|null>} - A promise that resolves to an object with the fetched playlist item data, including:
|
|
889
|
-
* - `success` (boolean): Indicates if the data retrieval was successful (`true` on success).
|
|
890
|
-
* - `data` (Object): Contains the detailed playlist item data enriched with Sanity and Assignment details, if available.
|
|
891
|
-
*
|
|
892
|
-
* Resolves to `null` if the request fails.
|
|
893
|
-
* @throws {Error} - Throws an error if the request encounters issues during retrieval.
|
|
894
|
-
*
|
|
895
|
-
* @example
|
|
896
|
-
* const payload = { user_playlist_item_id: 123 };
|
|
897
|
-
*
|
|
898
|
-
* fetchPlaylistItem(payload)
|
|
899
|
-
* .then(response => {
|
|
900
|
-
* if (response?.success) {
|
|
901
|
-
* console.log("Fetched playlist item data:", response.data);
|
|
902
|
-
* } else {
|
|
903
|
-
* console.log("Failed to fetch playlist item data.");
|
|
904
|
-
* }
|
|
905
|
-
* })
|
|
906
|
-
* .catch(error => {
|
|
907
|
-
* console.error("Error fetching playlist item:", error);
|
|
908
|
-
* });
|
|
909
|
-
*/
|
|
910
|
-
export async function fetchPlaylistItem(payload) {
|
|
911
|
-
const playlistItemId = payload.user_playlist_item_id
|
|
912
|
-
const url = `/playlists/item/${playlistItemId}`
|
|
913
|
-
return await fetchHandler(url)
|
|
914
|
-
}
|
|
915
|
-
|
|
916
618
|
export async function postContentComplete(contentId) {
|
|
917
619
|
let url = `/api/content/v1/user/progress/complete/${contentId}`
|
|
918
620
|
return postDataHandler(url)
|
|
@@ -923,150 +625,6 @@ export async function postContentReset(contentId) {
|
|
|
923
625
|
return postDataHandler(url)
|
|
924
626
|
}
|
|
925
627
|
|
|
926
|
-
/**
|
|
927
|
-
* Retrieves the count of lessons and assignments associated with a specific content ID.
|
|
928
|
-
*
|
|
929
|
-
* @param {number} contentId - The ID of the content for which to count lessons and assignments.
|
|
930
|
-
*
|
|
931
|
-
* @returns {Promise<Object|null>} - A promise that resolves to an object containing the counts:
|
|
932
|
-
* - `lessons_count` (number): The number of lessons associated with the content.
|
|
933
|
-
* - `soundslice_assignments_count` (number): The number of Soundslice assignments associated with the content.
|
|
934
|
-
*
|
|
935
|
-
* @example
|
|
936
|
-
* const contentId = 123;
|
|
937
|
-
*
|
|
938
|
-
* countAssignmentsAndLessons(contentId)
|
|
939
|
-
* .then(response => {
|
|
940
|
-
* if (response) {
|
|
941
|
-
* console.log("Lessons count:", response.lessons_count);
|
|
942
|
-
* console.log("Soundslice assignments count:", response.soundslice_assignments_count);
|
|
943
|
-
* } else {
|
|
944
|
-
* console.log("Failed to retrieve counts.");
|
|
945
|
-
* }
|
|
946
|
-
* })
|
|
947
|
-
* .catch(error => {
|
|
948
|
-
* console.error("Error fetching assignments and lessons count:", error);
|
|
949
|
-
* });
|
|
950
|
-
*/
|
|
951
|
-
export async function countAssignmentsAndLessons(contentId) {
|
|
952
|
-
const url = `/playlists/count-lessons-and-assignments/${contentId}`
|
|
953
|
-
return await fetchHandler(url)
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
/**
|
|
957
|
-
* Pins a playlist to the user's playlist menu.
|
|
958
|
-
*
|
|
959
|
-
* @param {number} playlistId - The ID of the playlist to pin.
|
|
960
|
-
* @returns {Promise<Object>} - A promise that resolves to an object containing:
|
|
961
|
-
* - `success` (boolean): Indicates if the pinning operation was successful (`true` for success).
|
|
962
|
-
* - `message` (string): A success message if the playlist was pinned successfully.
|
|
963
|
-
* - `error` (string): An error message if the pinning operation fails.
|
|
964
|
-
*
|
|
965
|
-
* Resolves to an error message if the request fails.
|
|
966
|
-
* @throws {Error} - Throws an error if the request fails.
|
|
967
|
-
*
|
|
968
|
-
* @example
|
|
969
|
-
* const playlistId = 123;
|
|
970
|
-
*
|
|
971
|
-
* pinPlaylist(playlistId)
|
|
972
|
-
* .then(response => {
|
|
973
|
-
* if (response.success) {
|
|
974
|
-
* console.log("Playlist pinned successfully:", response.message);
|
|
975
|
-
* } else {
|
|
976
|
-
* console.error("Error:", response.error);
|
|
977
|
-
* }
|
|
978
|
-
* })
|
|
979
|
-
* .catch(error => {
|
|
980
|
-
* console.error("Error pinning playlist:", error);
|
|
981
|
-
* });
|
|
982
|
-
*/
|
|
983
|
-
export async function pinPlaylist(playlistId) {
|
|
984
|
-
const url = `/playlists/pin/${playlistId}`
|
|
985
|
-
return await fetchHandler(url, 'PUT')
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
/**
|
|
989
|
-
* Unpins a playlist
|
|
990
|
-
*
|
|
991
|
-
* @param {number} playlistId - The ID of the playlist to unpin.
|
|
992
|
-
* @returns {Promise<Object>} - A promise that resolves to an object containing:
|
|
993
|
-
* - `success` (boolean): Indicates if the unpinning operation was successful (`true` for success).
|
|
994
|
-
* - `message` (string): A success message if the playlist was unpinned successfully.
|
|
995
|
-
* - `error` (string): An error message if the unpinning operation fails.
|
|
996
|
-
*
|
|
997
|
-
* Resolves to an error message if the request fails.
|
|
998
|
-
* @throws {Error} - Throws an error if the request fails.
|
|
999
|
-
*
|
|
1000
|
-
* @example
|
|
1001
|
-
* const playlistId = 123;
|
|
1002
|
-
*
|
|
1003
|
-
* unpinPlaylist(playlistId)
|
|
1004
|
-
* .then(response => {
|
|
1005
|
-
* if (response.success) {
|
|
1006
|
-
* console.log("Playlist unpinned successfully:", response.message);
|
|
1007
|
-
* } else {
|
|
1008
|
-
* console.error("Error:", response.error);
|
|
1009
|
-
* }
|
|
1010
|
-
* })
|
|
1011
|
-
* .catch(error => {
|
|
1012
|
-
* console.error("Error unpinning playlist:", error);
|
|
1013
|
-
* });
|
|
1014
|
-
*/
|
|
1015
|
-
export async function unpinPlaylist(playlistId) {
|
|
1016
|
-
const url = `/playlists/unpin/${playlistId}`
|
|
1017
|
-
return await fetchHandler(url, 'PUT')
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
/**
|
|
1021
|
-
* Fetches the list of pinned playlists for the authenticated user.
|
|
1022
|
-
*
|
|
1023
|
-
* @param {string} brand - The brand associated with the playlists to fetch.
|
|
1024
|
-
* @returns {Promise<Object>} - A promise that resolves to an object containing:
|
|
1025
|
-
* - `success` (boolean): Indicates if the fetching operation was successful (`true` for success).
|
|
1026
|
-
* - `data` (Array): An array of pinned playlists.
|
|
1027
|
-
* - `error` (string): An error message if the fetching operation fails.
|
|
1028
|
-
*
|
|
1029
|
-
* Resolves to an error message if the request fails.
|
|
1030
|
-
* @throws {Error} - Throws an error if the request fails.
|
|
1031
|
-
*
|
|
1032
|
-
* @example
|
|
1033
|
-
* const brand = "drumeo";
|
|
1034
|
-
*
|
|
1035
|
-
* fetchPinnedPlaylists(brand)
|
|
1036
|
-
* .then(response => {
|
|
1037
|
-
* if (response.success) {
|
|
1038
|
-
* console.log("Pinned playlists:", response.data);
|
|
1039
|
-
* } else {
|
|
1040
|
-
* console.error("Error:", response.error);
|
|
1041
|
-
* }
|
|
1042
|
-
* })
|
|
1043
|
-
* .catch(error => {
|
|
1044
|
-
* console.error("Error fetching pinned playlists:", error);
|
|
1045
|
-
* });
|
|
1046
|
-
*/
|
|
1047
|
-
export async function fetchPinnedPlaylists(brand) {
|
|
1048
|
-
const url = `/playlists/my-pinned-playlists?brand=${brand}`
|
|
1049
|
-
return await fetchHandler(url, 'GET')
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
/**
|
|
1053
|
-
* Report playlist endpoint
|
|
1054
|
-
*
|
|
1055
|
-
* @param playlistId
|
|
1056
|
-
* @param issue
|
|
1057
|
-
* @returns {Promise<any|null>}
|
|
1058
|
-
*/
|
|
1059
|
-
export async function reportPlaylist(playlistId, { issue } = {}) {
|
|
1060
|
-
const issueString = issue ? `?issue=${issue}` : ''
|
|
1061
|
-
const url = `/playlists/report/${playlistId}${issueString}`
|
|
1062
|
-
return await fetchHandler(url, 'PUT')
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
export async function playback(playlistId) {
|
|
1066
|
-
const url = `/playlists/play/${playlistId}`
|
|
1067
|
-
return await fetchHandler(url, 'GET')
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
628
|
/**
|
|
1071
629
|
* Set a user's StudentView Flag
|
|
1072
630
|
*
|
|
@@ -1219,11 +777,27 @@ export async function editComment(commentId, comment) {
|
|
|
1219
777
|
const data = {
|
|
1220
778
|
comment: comment,
|
|
1221
779
|
}
|
|
1222
|
-
return await
|
|
780
|
+
return await putDataHandler(url, data)
|
|
1223
781
|
}
|
|
1224
782
|
|
|
1225
|
-
|
|
1226
|
-
|
|
783
|
+
/**
|
|
784
|
+
* @param {int} commentId
|
|
785
|
+
* @param {string} issue
|
|
786
|
+
* @returns {Promise<*|null>}
|
|
787
|
+
*/
|
|
788
|
+
export async function reportComment(commentId, issue) {
|
|
789
|
+
const url = `/api/content/v1/comments/${commentId}/report`
|
|
790
|
+
const data = {
|
|
791
|
+
issue: issue,
|
|
792
|
+
}
|
|
793
|
+
return await postDataHandler(url, data)
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
export async function fetchUserPractices({ currentVersion, userId } = {}) {
|
|
797
|
+
const params = new URLSearchParams();
|
|
798
|
+
if (userId) params.append('user_id', userId);
|
|
799
|
+
const query = params.toString() ? `?${params.toString()}` : '';
|
|
800
|
+
const url = `/api/user/practices/v1/practices${query}`;
|
|
1227
801
|
const response = await fetchDataHandler(url, currentVersion);
|
|
1228
802
|
const { data, version } = response;
|
|
1229
803
|
const userPractices = data;
|
|
@@ -1265,18 +839,17 @@ export async function logUserPractice(practiceDetails) {
|
|
|
1265
839
|
const url = `/api/user/practices/v1/practices`
|
|
1266
840
|
return await fetchHandler(url, 'POST', null, practiceDetails)
|
|
1267
841
|
}
|
|
1268
|
-
export async function fetchUserPracticeMeta(practiceIds) {
|
|
842
|
+
export async function fetchUserPracticeMeta(practiceIds, userId = null) {
|
|
1269
843
|
if (practiceIds.length == 0) {
|
|
1270
844
|
return []
|
|
1271
845
|
}
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
})
|
|
846
|
+
const params = new URLSearchParams();
|
|
847
|
+
practiceIds.forEach(id => params.append('practice_ids[]', id));
|
|
848
|
+
|
|
849
|
+
if (userId !== null) {
|
|
850
|
+
params.append('user_id', userId);
|
|
1278
851
|
}
|
|
1279
|
-
const url = `/api/user/practices/v1/practices
|
|
852
|
+
const url = `/api/user/practices/v1/practices?${params.toString()}`
|
|
1280
853
|
return await fetchHandler(url, 'GET', null)
|
|
1281
854
|
}
|
|
1282
855
|
|
|
@@ -1295,6 +868,34 @@ export async function fetchUserPracticeNotes(date) {
|
|
|
1295
868
|
return await fetchHandler(url, 'GET', null)
|
|
1296
869
|
}
|
|
1297
870
|
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Get the id and slug of last interacted child. Only valid for certain content types
|
|
874
|
+
*
|
|
875
|
+
* @async
|
|
876
|
+
* @function fetchLastInteractedChild
|
|
877
|
+
* @param {array} content_ids - Content ids of to get the last interacted child of
|
|
878
|
+
*
|
|
879
|
+
*
|
|
880
|
+
* @returns {Promise<Object>} - keyed object per valid content ids with the child
|
|
881
|
+
*
|
|
882
|
+
* @example
|
|
883
|
+
* try {
|
|
884
|
+
* const response = await fetchLastInteractedChild([191369, 410427]);
|
|
885
|
+
* console.log('child id', response[191369].content_id)
|
|
886
|
+
* console.log('child slug', response[191369].slug)
|
|
887
|
+
* } catch (error) {
|
|
888
|
+
* console.error('Failed to get children', error);
|
|
889
|
+
* }
|
|
890
|
+
*/
|
|
891
|
+
export async function fetchLastInteractedChild(content_ids) {
|
|
892
|
+
const params = new URLSearchParams();
|
|
893
|
+
content_ids.forEach(id => params.append('content_ids[]', id));
|
|
894
|
+
const url = `/api/content/v1/user/last_interacted_child?${params.toString()}`
|
|
895
|
+
return await fetchHandler(url, 'GET', null)
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
|
|
1298
899
|
function fetchAbsolute(url, params) {
|
|
1299
900
|
if (globalConfig.sessionConfig.authToken) {
|
|
1300
901
|
params.headers['Authorization'] = `Bearer ${globalConfig.sessionConfig.authToken}`
|
|
@@ -1331,7 +932,7 @@ export async function fetchHandler(url, method = 'get', dataVersion = null, body
|
|
|
1331
932
|
<br class="clear">
|
|
1332
933
|
|
|
1333
934
|
<footer>
|
|
1334
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
935
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed May 14 2025 19:23:31 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
1335
936
|
</footer>
|
|
1336
937
|
|
|
1337
938
|
<script>prettyPrint();</script>
|