X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-main%2Fvideo-channel%2Fvideo-channel.service.ts;h=5e3985526a06e9cedfe53c4ca3f34dd794fa32fc;hb=a3b472a12ec6e57dbe2f650419f8064864686eab;hp=480d250fb82b257f5022ca144a1c55ef1e582c79;hpb=28dca0a2211524bbf3ad17666c607eb6325763b8;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts index 480d250fb..5e3985526 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts @@ -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))) + } }