aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-10 11:51:13 +0200
committerChocobozzz <me@florianbigard.com>2022-08-10 14:32:00 +0200
commita3b472a12ec6e57dbe2f650419f8064864686eab (patch)
treef36559488e34493c029b686772e986902150a647 /shared
parent0567049a9819d67070aa6d548a75a7e632a4aaa4 (diff)
downloadPeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.tar.gz
PeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.tar.zst
PeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.zip
Add ability to list imports of a channel sync
Diffstat (limited to 'shared')
-rw-r--r--shared/models/server/job.model.ts2
-rw-r--r--shared/models/videos/import/index.ts1
-rw-r--r--shared/models/videos/import/video-import.model.ts5
-rw-r--r--shared/models/videos/import/videos-import-in-channel-create.model.ts4
-rw-r--r--shared/server-commands/server/server.ts3
-rw-r--r--shared/server-commands/videos/channels-command.ts10
-rw-r--r--shared/server-commands/videos/imports-command.ts6
7 files changed, 23 insertions, 8 deletions
diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts
index ba1f83684..9c0b5ea56 100644
--- a/shared/models/server/job.model.ts
+++ b/shared/models/server/job.model.ts
@@ -236,6 +236,8 @@ export interface VideoStudioEditionPayload {
236export interface VideoChannelImportPayload { 236export interface VideoChannelImportPayload {
237 externalChannelUrl: string 237 externalChannelUrl: string
238 videoChannelId: number 238 videoChannelId: number
239
240 partOfChannelSyncId?: number
239} 241}
240 242
241export interface AfterVideoChannelImportPayload { 243export interface AfterVideoChannelImportPayload {
diff --git a/shared/models/videos/import/index.ts b/shared/models/videos/import/index.ts
index 8884ee8f2..b38a67b5f 100644
--- a/shared/models/videos/import/index.ts
+++ b/shared/models/videos/import/index.ts
@@ -1,3 +1,4 @@
1export * from './video-import-create.model' 1export * from './video-import-create.model'
2export * from './video-import-state.enum' 2export * from './video-import-state.enum'
3export * from './video-import.model' 3export * from './video-import.model'
4export * from './videos-import-in-channel-create.model'
diff --git a/shared/models/videos/import/video-import.model.ts b/shared/models/videos/import/video-import.model.ts
index 92856c70f..6aed7a91a 100644
--- a/shared/models/videos/import/video-import.model.ts
+++ b/shared/models/videos/import/video-import.model.ts
@@ -16,4 +16,9 @@ export interface VideoImport {
16 error?: string 16 error?: string
17 17
18 video?: Video & { tags: string[] } 18 video?: Video & { tags: string[] }
19
20 videoChannelSync?: {
21 id: number
22 externalChannelUrl: string
23 }
19} 24}
diff --git a/shared/models/videos/import/videos-import-in-channel-create.model.ts b/shared/models/videos/import/videos-import-in-channel-create.model.ts
new file mode 100644
index 000000000..fbfef63f8
--- /dev/null
+++ b/shared/models/videos/import/videos-import-in-channel-create.model.ts
@@ -0,0 +1,4 @@
1export interface VideosImportInChannelCreate {
2 externalChannelUrl: string
3 videoChannelSyncId?: number
4}
diff --git a/shared/server-commands/server/server.ts b/shared/server-commands/server/server.ts
index 7acbc978f..c05d16ad2 100644
--- a/shared/server-commands/server/server.ts
+++ b/shared/server-commands/server/server.ts
@@ -2,7 +2,7 @@ import { ChildProcess, fork } from 'child_process'
2import { copy } from 'fs-extra' 2import { copy } from 'fs-extra'
3import { join } from 'path' 3import { join } from 'path'
4import { parallelTests, randomInt, root } from '@shared/core-utils' 4import { parallelTests, randomInt, root } from '@shared/core-utils'
5import { Video, VideoChannel, VideoCreateResult, VideoDetails } from '@shared/models' 5import { Video, VideoChannel, VideoChannelSync, VideoCreateResult, VideoDetails } from '@shared/models'
6import { BulkCommand } from '../bulk' 6import { BulkCommand } from '../bulk'
7import { CLICommand } from '../cli' 7import { CLICommand } from '../cli'
8import { CustomPagesCommand } from '../custom-pages' 8import { CustomPagesCommand } from '../custom-pages'
@@ -80,6 +80,7 @@ export class PeerTubeServer {
80 } 80 }
81 81
82 channel?: VideoChannel 82 channel?: VideoChannel
83 videoChannelSync?: Partial<VideoChannelSync>
83 84
84 video?: Video 85 video?: Video
85 videoCreated?: VideoCreateResult 86 videoCreated?: VideoCreateResult
diff --git a/shared/server-commands/videos/channels-command.ts b/shared/server-commands/videos/channels-command.ts
index a688a120f..385d0fe73 100644
--- a/shared/server-commands/videos/channels-command.ts
+++ b/shared/server-commands/videos/channels-command.ts
@@ -6,7 +6,8 @@ import {
6 VideoChannel, 6 VideoChannel,
7 VideoChannelCreate, 7 VideoChannelCreate,
8 VideoChannelCreateResult, 8 VideoChannelCreateResult,
9 VideoChannelUpdate 9 VideoChannelUpdate,
10 VideosImportInChannelCreate
10} from '@shared/models' 11} from '@shared/models'
11import { unwrapBody } from '../requests' 12import { unwrapBody } from '../requests'
12import { AbstractCommand, OverrideCommandOptions } from '../shared' 13import { AbstractCommand, OverrideCommandOptions } from '../shared'
@@ -182,11 +183,10 @@ export class ChannelsCommand extends AbstractCommand {
182 }) 183 })
183 } 184 }
184 185
185 importVideos (options: OverrideCommandOptions & { 186 importVideos (options: OverrideCommandOptions & VideosImportInChannelCreate & {
186 channelName: string 187 channelName: string
187 externalChannelUrl: string
188 }) { 188 }) {
189 const { channelName, externalChannelUrl } = options 189 const { channelName, externalChannelUrl, videoChannelSyncId } = options
190 190
191 const path = `/api/v1/video-channels/${channelName}/import-videos` 191 const path = `/api/v1/video-channels/${channelName}/import-videos`
192 192
@@ -194,7 +194,7 @@ export class ChannelsCommand extends AbstractCommand {
194 ...options, 194 ...options,
195 195
196 path, 196 path,
197 fields: { externalChannelUrl }, 197 fields: { externalChannelUrl, videoChannelSyncId },
198 implicitToken: true, 198 implicitToken: true,
199 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 199 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
200 }) 200 })
diff --git a/shared/server-commands/videos/imports-command.ts b/shared/server-commands/videos/imports-command.ts
index c931ac481..07d810ec1 100644
--- a/shared/server-commands/videos/imports-command.ts
+++ b/shared/server-commands/videos/imports-command.ts
@@ -57,15 +57,17 @@ export class ImportsCommand extends AbstractCommand {
57 getMyVideoImports (options: OverrideCommandOptions & { 57 getMyVideoImports (options: OverrideCommandOptions & {
58 sort?: string 58 sort?: string
59 targetUrl?: string 59 targetUrl?: string
60 videoChannelSyncId?: number
61 search?: string
60 } = {}) { 62 } = {}) {
61 const { sort, targetUrl } = options 63 const { sort, targetUrl, videoChannelSyncId, search } = options
62 const path = '/api/v1/users/me/videos/imports' 64 const path = '/api/v1/users/me/videos/imports'
63 65
64 return this.getRequestBody<ResultList<VideoImport>>({ 66 return this.getRequestBody<ResultList<VideoImport>>({
65 ...options, 67 ...options,
66 68
67 path, 69 path,
68 query: { sort, targetUrl }, 70 query: { sort, targetUrl, videoChannelSyncId, search },
69 implicitToken: true, 71 implicitToken: true,
70 defaultExpectedStatus: HttpStatusCode.OK_200 72 defaultExpectedStatus: HttpStatusCode.OK_200
71 }) 73 })