Refactor: Separated "Other Videos" section into a dedicated component/service (#969)
[oweals/peertube.git] / client / src / app / shared / video / video.service.ts
index 558db95431119c5e4a69daf5242bbeec07d31b47..5c0674e583763c5d13c30ed550cccdb5317f2f55 100644 (file)
@@ -23,8 +23,17 @@ import { ServerService } from '@app/core'
 import { UserSubscriptionService } from '@app/shared/user-subscription'
 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
 
+export interface VideosProvider {
+  getVideos (
+    videoPagination: ComponentPagination,
+    sort: VideoSortField,
+    filter?: VideoFilter,
+    categoryOneOf?: number
+  ): Observable<{ videos: Video[], totalVideos: number }>
+}
+
 @Injectable()
-export class VideoService {
+export class VideoService implements VideosProvider {
   static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/'
   static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.'
 
@@ -51,14 +60,6 @@ export class VideoService {
                )
   }
 
-  viewVideo (uuid: string): Observable<boolean> {
-    return this.authHttp.post(this.getVideoViewUrl(uuid), {})
-               .pipe(
-                 map(this.restExtractor.extractDataBool),
-                 catchError(err => this.restExtractor.handleError(err))
-               )
-  }
-
   updateVideo (video: VideoEdit) {
     const language = video.language || null
     const licence = video.licence || null