]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/utils/videos/videos.ts
Playlist server API
[github/Chocobozzz/PeerTube.git] / shared / utils / videos / videos.ts
index 92dadfb6904ea8fb7912e2b984f7073f140fc0fd..2c09f008604556cdc226a79f37047b4f33fe9545 100644 (file)
@@ -42,7 +42,6 @@ type VideoAttributes = {
     updateAt: string
     privacy?: VideoPrivacy
   }
-  originallyPublishedAt?: string
 }
 
 function getVideoCategories (url: string) {
@@ -224,6 +223,28 @@ function getVideoChannelVideos (
   })
 }
 
+function getPlaylistVideos (
+  url: string,
+  accessToken: string,
+  playlistId: number | string,
+  start: number,
+  count: number,
+  query: { nsfw?: boolean } = {}
+) {
+  const path = '/api/v1/video-playlists/' + playlistId + '/videos'
+
+  return makeGetRequest({
+    url,
+    path,
+    query: immutableAssign(query, {
+      start,
+      count
+    }),
+    token: accessToken,
+    statusCodeExpected: 200
+  })
+}
+
 function getVideosListPagination (url: string, start: number, count: number, sort?: string) {
   const path = '/api/v1/videos'
 
@@ -351,9 +372,6 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg
   if (attributes.licence !== undefined) {
     req.field('licence', attributes.licence.toString())
   }
-  if (attributes.originallyPublishedAt !== undefined) {
-    req.field('originallyPublishedAt', attributes.originallyPublishedAt)
-  }
 
   for (let i = 0; i < attributes.tags.length; i++) {
     req.field('tags[' + i + ']', attributes.tags[i])
@@ -605,5 +623,6 @@ export {
   parseTorrentVideo,
   getLocalVideos,
   completeVideoCheck,
-  checkVideoFilesWereRemoved
+  checkVideoFilesWereRemoved,
+  getPlaylistVideos
 }