+
+ const body = this.buildImportVideoObject(video)
+ body.targetUrl = targetUrl
+
+ const data = objectToFormData(body)
+ return this.authHttp.post<VideoImport>(url, data)
+ .pipe(catchError(res => this.restExtractor.handleError(res)))
+ }
+
+ importVideoTorrent (target: string | Blob, video: VideoUpdate): Observable<VideoImport> {
+ const url = VideoImportService.BASE_VIDEO_IMPORT_URL
+ const body: VideoImportCreate = this.buildImportVideoObject(video)
+
+ if (typeof target === 'string') body.magnetUri = target
+ else body.torrentfile = target
+
+ const data = objectToFormData(body)
+ return this.authHttp.post<VideoImport>(url, data)
+ .pipe(catchError(res => this.restExtractor.handleError(res)))
+ }
+
+ getMyVideoImports (pagination: RestPagination, sort: SortMeta): Observable<ResultList<VideoImport>> {
+ let params = new HttpParams()
+ params = this.restService.addRestGetParams(params, pagination, sort)
+
+ return this.authHttp
+ .get<ResultList<VideoImport>>(UserService.BASE_USERS_URL + '/me/videos/imports', { params })
+ .pipe(
+ switchMap(res => this.extractVideoImports(res)),
+ map(res => this.restExtractor.convertResultListDateToHuman(res)),
+ catchError(err => this.restExtractor.handleError(err))
+ )
+ }
+
+ private buildImportVideoObject (video: VideoUpdate): VideoImportCreate {