aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/utils
diff options
context:
space:
mode:
Diffstat (limited to 'shared/utils')
-rw-r--r--shared/utils/index.ts3
-rw-r--r--shared/utils/videos/video-playlists.ts30
2 files changed, 18 insertions, 15 deletions
diff --git a/shared/utils/index.ts b/shared/utils/index.ts
index 156901372..c09565d95 100644
--- a/shared/utils/index.ts
+++ b/shared/utils/index.ts
@@ -13,12 +13,13 @@ export * from './requests/requests'
13export * from './requests/check-api-params' 13export * from './requests/check-api-params'
14export * from './server/servers' 14export * from './server/servers'
15export * from './videos/services' 15export * from './videos/services'
16export * from './videos/video-playlists'
16export * from './users/users' 17export * from './users/users'
17export * from './videos/video-abuses' 18export * from './videos/video-abuses'
18export * from './videos/video-blacklist' 19export * from './videos/video-blacklist'
19export * from './videos/video-channels' 20export * from './videos/video-channels'
20export * from './videos/video-comments' 21export * from './videos/video-comments'
21export * from './videos/video-playlists' 22export * from './videos/video-streaming-playlists'
22export * from './videos/videos' 23export * from './videos/videos'
23export * from './videos/video-change-ownership' 24export * from './videos/video-change-ownership'
24export * from './feeds/feeds' 25export * from './feeds/feeds'
diff --git a/shared/utils/videos/video-playlists.ts b/shared/utils/videos/video-playlists.ts
index 5186d9c4f..21285688a 100644
--- a/shared/utils/videos/video-playlists.ts
+++ b/shared/utils/videos/video-playlists.ts
@@ -31,7 +31,7 @@ function getVideoPlaylist (url: string, playlistId: number | string, statusCodeE
31 }) 31 })
32} 32}
33 33
34function deleteVideoPlaylist (url: string, token: string, playlistId: number | string, statusCodeExpected = 200) { 34function deleteVideoPlaylist (url: string, token: string, playlistId: number | string, statusCodeExpected = 204) {
35 const path = '/api/v1/video-playlists/' + playlistId 35 const path = '/api/v1/video-playlists/' + playlistId
36 36
37 return makeDeleteRequest({ 37 return makeDeleteRequest({
@@ -46,7 +46,7 @@ function createVideoPlaylist (options: {
46 url: string, 46 url: string,
47 token: string, 47 token: string,
48 playlistAttrs: VideoPlaylistCreate, 48 playlistAttrs: VideoPlaylistCreate,
49 expectedStatus: number 49 expectedStatus?: number
50}) { 50}) {
51 const path = '/api/v1/video-playlists/' 51 const path = '/api/v1/video-playlists/'
52 52
@@ -63,7 +63,7 @@ function createVideoPlaylist (options: {
63 token: options.token, 63 token: options.token,
64 fields, 64 fields,
65 attaches, 65 attaches,
66 statusCodeExpected: options.expectedStatus 66 statusCodeExpected: options.expectedStatus || 200
67 }) 67 })
68} 68}
69 69
@@ -71,9 +71,10 @@ function updateVideoPlaylist (options: {
71 url: string, 71 url: string,
72 token: string, 72 token: string,
73 playlistAttrs: VideoPlaylistUpdate, 73 playlistAttrs: VideoPlaylistUpdate,
74 expectedStatus: number 74 playlistId: number | string,
75 expectedStatus?: number
75}) { 76}) {
76 const path = '/api/v1/video-playlists/' 77 const path = '/api/v1/video-playlists/' + options.playlistId
77 78
78 const fields = omit(options.playlistAttrs, 'thumbnailfile') 79 const fields = omit(options.playlistAttrs, 'thumbnailfile')
79 80
@@ -88,7 +89,7 @@ function updateVideoPlaylist (options: {
88 token: options.token, 89 token: options.token,
89 fields, 90 fields,
90 attaches, 91 attaches,
91 statusCodeExpected: options.expectedStatus 92 statusCodeExpected: options.expectedStatus || 204
92 }) 93 })
93} 94}
94 95
@@ -97,7 +98,7 @@ function addVideoInPlaylist (options: {
97 token: string, 98 token: string,
98 playlistId: number | string, 99 playlistId: number | string,
99 elementAttrs: VideoPlaylistElementCreate 100 elementAttrs: VideoPlaylistElementCreate
100 expectedStatus: number 101 expectedStatus?: number
101}) { 102}) {
102 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos' 103 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos'
103 104
@@ -106,7 +107,7 @@ function addVideoInPlaylist (options: {
106 path, 107 path,
107 token: options.token, 108 token: options.token,
108 fields: options.elementAttrs, 109 fields: options.elementAttrs,
109 statusCodeExpected: options.expectedStatus 110 statusCodeExpected: options.expectedStatus || 200
110 }) 111 })
111} 112}
112 113
@@ -116,7 +117,7 @@ function updateVideoPlaylistElement (options: {
116 playlistId: number | string, 117 playlistId: number | string,
117 videoId: number | string, 118 videoId: number | string,
118 elementAttrs: VideoPlaylistElementUpdate, 119 elementAttrs: VideoPlaylistElementUpdate,
119 expectedStatus: number 120 expectedStatus?: number
120}) { 121}) {
121 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.videoId 122 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.videoId
122 123
@@ -125,7 +126,7 @@ function updateVideoPlaylistElement (options: {
125 path, 126 path,
126 token: options.token, 127 token: options.token,
127 fields: options.elementAttrs, 128 fields: options.elementAttrs,
128 statusCodeExpected: options.expectedStatus 129 statusCodeExpected: options.expectedStatus || 204
129 }) 130 })
130} 131}
131 132
@@ -142,7 +143,7 @@ function removeVideoFromPlaylist (options: {
142 url: options.url, 143 url: options.url,
143 path, 144 path,
144 token: options.token, 145 token: options.token,
145 statusCodeExpected: options.expectedStatus 146 statusCodeExpected: options.expectedStatus || 204
146 }) 147 })
147} 148}
148 149
@@ -152,14 +153,14 @@ function reorderVideosPlaylist (options: {
152 playlistId: number | string, 153 playlistId: number | string,
153 elementAttrs: { 154 elementAttrs: {
154 startPosition: number, 155 startPosition: number,
155 insertAfter: number, 156 insertAfterPosition: number,
156 reorderLength?: number 157 reorderLength?: number
157 }, 158 },
158 expectedStatus: number 159 expectedStatus: number
159}) { 160}) {
160 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos' 161 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/reorder'
161 162
162 return makePutBodyRequest({ 163 return makePostBodyRequest({
163 url: options.url, 164 url: options.url,
164 path, 165 path,
165 token: options.token, 166 token: options.token,
@@ -179,6 +180,7 @@ export {
179 deleteVideoPlaylist, 180 deleteVideoPlaylist,
180 181
181 addVideoInPlaylist, 182 addVideoInPlaylist,
183 updateVideoPlaylistElement,
182 removeVideoFromPlaylist, 184 removeVideoFromPlaylist,
183 185
184 reorderVideosPlaylist 186 reorderVideosPlaylist