aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video/video.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/video/video.service.ts')
-rw-r--r--client/src/app/shared/video/video.service.ts23
1 files changed, 12 insertions, 11 deletions
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 871bc9e46..d1af13c93 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -41,7 +41,7 @@ export interface VideosProvider {
41 filter?: VideoFilter, 41 filter?: VideoFilter,
42 categoryOneOf?: number, 42 categoryOneOf?: number,
43 languageOneOf?: string[] 43 languageOneOf?: string[]
44 }): Observable<{ videos: Video[], totalVideos: number }> 44 }): Observable<ResultList<Video>>
45} 45}
46 46
47@Injectable() 47@Injectable()
@@ -65,11 +65,11 @@ export class VideoService implements VideosProvider {
65 return VideoService.BASE_VIDEO_URL + uuid + '/watching' 65 return VideoService.BASE_VIDEO_URL + uuid + '/watching'
66 } 66 }
67 67
68 getVideo (uuid: string): Observable<VideoDetails> { 68 getVideo (options: { videoId: string }): Observable<VideoDetails> {
69 return this.serverService.localeObservable 69 return this.serverService.localeObservable
70 .pipe( 70 .pipe(
71 switchMap(translations => { 71 switchMap(translations => {
72 return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + uuid) 72 return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + options.videoId)
73 .pipe(map(videoHash => ({ videoHash, translations }))) 73 .pipe(map(videoHash => ({ videoHash, translations })))
74 }), 74 }),
75 map(({ videoHash, translations }) => new VideoDetails(videoHash, translations)), 75 map(({ videoHash, translations }) => new VideoDetails(videoHash, translations)),
@@ -123,7 +123,7 @@ export class VideoService implements VideosProvider {
123 .pipe(catchError(err => this.restExtractor.handleError(err))) 123 .pipe(catchError(err => this.restExtractor.handleError(err)))
124 } 124 }
125 125
126 getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField): Observable<{ videos: Video[], totalVideos: number }> { 126 getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField): Observable<ResultList<Video>> {
127 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 127 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
128 128
129 let params = new HttpParams() 129 let params = new HttpParams()
@@ -141,7 +141,7 @@ export class VideoService implements VideosProvider {
141 account: Account, 141 account: Account,
142 videoPagination: ComponentPagination, 142 videoPagination: ComponentPagination,
143 sort: VideoSortField 143 sort: VideoSortField
144 ): Observable<{ videos: Video[], totalVideos: number }> { 144 ): Observable<ResultList<Video>> {
145 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 145 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
146 146
147 let params = new HttpParams() 147 let params = new HttpParams()
@@ -159,7 +159,7 @@ export class VideoService implements VideosProvider {
159 videoChannel: VideoChannel, 159 videoChannel: VideoChannel,
160 videoPagination: ComponentPagination, 160 videoPagination: ComponentPagination,
161 sort: VideoSortField 161 sort: VideoSortField
162 ): Observable<{ videos: Video[], totalVideos: number }> { 162 ): Observable<ResultList<Video>> {
163 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 163 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
164 164
165 let params = new HttpParams() 165 let params = new HttpParams()
@@ -176,7 +176,7 @@ export class VideoService implements VideosProvider {
176 getPlaylistVideos ( 176 getPlaylistVideos (
177 videoPlaylistId: number | string, 177 videoPlaylistId: number | string,
178 videoPagination: ComponentPagination 178 videoPagination: ComponentPagination
179 ): Observable<{ videos: Video[], totalVideos: number }> { 179 ): Observable<ResultList<Video>> {
180 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 180 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
181 181
182 let params = new HttpParams() 182 let params = new HttpParams()
@@ -190,10 +190,11 @@ export class VideoService implements VideosProvider {
190 ) 190 )
191 } 191 }
192 192
193 getUserSubscriptionVideos ( 193 getUserSubscriptionVideos (parameters: {
194 videoPagination: ComponentPagination, 194 videoPagination: ComponentPagination,
195 sort: VideoSortField 195 sort: VideoSortField
196 ): Observable<{ videos: Video[], totalVideos: number }> { 196 }): Observable<ResultList<Video>> {
197 const { videoPagination, sort } = parameters
197 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 198 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
198 199
199 let params = new HttpParams() 200 let params = new HttpParams()
@@ -213,7 +214,7 @@ export class VideoService implements VideosProvider {
213 filter?: VideoFilter, 214 filter?: VideoFilter,
214 categoryOneOf?: number, 215 categoryOneOf?: number,
215 languageOneOf?: string[] 216 languageOneOf?: string[]
216 }): Observable<{ videos: Video[], totalVideos: number }> { 217 }): Observable<ResultList<Video>> {
217 const { videoPagination, sort, filter, categoryOneOf, languageOneOf } = parameters 218 const { videoPagination, sort, filter, categoryOneOf, languageOneOf } = parameters
218 219
219 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 220 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
@@ -344,7 +345,7 @@ export class VideoService implements VideosProvider {
344 videos.push(new Video(videoJson, translations)) 345 videos.push(new Video(videoJson, translations))
345 } 346 }
346 347
347 return { videos, totalVideos } 348 return { total: totalVideos, data: videos }
348 }) 349 })
349 ) 350 )
350 } 351 }