Add ability to list imports of a channel sync

This commit is contained in:
Chocobozzz
2022-08-10 11:51:13 +02:00
parent 0567049a98
commit a3b472a12e
37 changed files with 565 additions and 179 deletions

View File

@@ -236,6 +236,8 @@ export interface VideoStudioEditionPayload {
export interface VideoChannelImportPayload {
externalChannelUrl: string
videoChannelId: number
partOfChannelSyncId?: number
}
export interface AfterVideoChannelImportPayload {

View File

@@ -1,3 +1,4 @@
export * from './video-import-create.model'
export * from './video-import-state.enum'
export * from './video-import.model'
export * from './videos-import-in-channel-create.model'

View File

@@ -16,4 +16,9 @@ export interface VideoImport {
error?: string
video?: Video & { tags: string[] }
videoChannelSync?: {
id: number
externalChannelUrl: string
}
}

View File

@@ -0,0 +1,4 @@
export interface VideosImportInChannelCreate {
externalChannelUrl: string
videoChannelSyncId?: number
}

View File

@@ -2,7 +2,7 @@ import { ChildProcess, fork } from 'child_process'
import { copy } from 'fs-extra'
import { join } from 'path'
import { parallelTests, randomInt, root } from '@shared/core-utils'
import { Video, VideoChannel, VideoCreateResult, VideoDetails } from '@shared/models'
import { Video, VideoChannel, VideoChannelSync, VideoCreateResult, VideoDetails } from '@shared/models'
import { BulkCommand } from '../bulk'
import { CLICommand } from '../cli'
import { CustomPagesCommand } from '../custom-pages'
@@ -80,6 +80,7 @@ export class PeerTubeServer {
}
channel?: VideoChannel
videoChannelSync?: Partial<VideoChannelSync>
video?: Video
videoCreated?: VideoCreateResult

View File

@@ -6,7 +6,8 @@ import {
VideoChannel,
VideoChannelCreate,
VideoChannelCreateResult,
VideoChannelUpdate
VideoChannelUpdate,
VideosImportInChannelCreate
} from '@shared/models'
import { unwrapBody } from '../requests'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
@@ -182,11 +183,10 @@ export class ChannelsCommand extends AbstractCommand {
})
}
importVideos (options: OverrideCommandOptions & {
importVideos (options: OverrideCommandOptions & VideosImportInChannelCreate & {
channelName: string
externalChannelUrl: string
}) {
const { channelName, externalChannelUrl } = options
const { channelName, externalChannelUrl, videoChannelSyncId } = options
const path = `/api/v1/video-channels/${channelName}/import-videos`
@@ -194,7 +194,7 @@ export class ChannelsCommand extends AbstractCommand {
...options,
path,
fields: { externalChannelUrl },
fields: { externalChannelUrl, videoChannelSyncId },
implicitToken: true,
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
})

View File

@@ -57,15 +57,17 @@ export class ImportsCommand extends AbstractCommand {
getMyVideoImports (options: OverrideCommandOptions & {
sort?: string
targetUrl?: string
videoChannelSyncId?: number
search?: string
} = {}) {
const { sort, targetUrl } = options
const { sort, targetUrl, videoChannelSyncId, search } = options
const path = '/api/v1/users/me/videos/imports'
return this.getRequestBody<ResultList<VideoImport>>({
...options,
path,
query: { sort, targetUrl },
query: { sort, targetUrl, videoChannelSyncId, search },
implicitToken: true,
defaultExpectedStatus: HttpStatusCode.OK_200
})