]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/video-channel/video-channel.service.ts
Add ability to list imports of a channel sync
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / video-channel / video-channel.service.ts
index 480d250fb82b257f5022ca144a1c55ef1e582c79..5e3985526a06e9cedfe53c4ca3f34dd794fa32fc 100644 (file)
@@ -3,7 +3,14 @@ import { catchError, map, tap } from 'rxjs/operators'
 import { HttpClient, HttpParams } from '@angular/common/http'
 import { Injectable } from '@angular/core'
 import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core'
-import { ActorImage, ResultList, VideoChannel as VideoChannelServer, VideoChannelCreate, VideoChannelUpdate } from '@shared/models'
+import {
+  ActorImage,
+  ResultList,
+  VideoChannel as VideoChannelServer,
+  VideoChannelCreate,
+  VideoChannelUpdate,
+  VideosImportInChannelCreate
+} from '@shared/models'
 import { environment } from '../../../../environments/environment'
 import { Account } from '../account'
 import { AccountService } from '../account/account.service'
@@ -95,4 +102,16 @@ export class VideoChannelService {
     return this.authHttp.delete(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost)
                .pipe(catchError(err => this.restExtractor.handleError(err)))
   }
+
+  importVideos (videoChannelName: string, externalChannelUrl: string, syncId?: number) {
+    const path = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/import-videos'
+
+    const body: VideosImportInChannelCreate = {
+      externalChannelUrl,
+      videoChannelSyncId: syncId
+    }
+
+    return this.authHttp.post(path, body)
+               .pipe(catchError(err => this.restExtractor.handleError(err)))
+  }
 }