diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-07-10 19:43:21 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-07-10 19:43:21 +0200 |
commit | 4771e0008dd26eadbb7eaff64255a6ec914fdadb (patch) | |
tree | 4fd58f8a3f3c2d674b936c99817b4f5fb958c5d8 /shared/models/pods/remote-video | |
parent | 7a214f746bf420defbf17fa218d90d6233551bf8 (diff) | |
download | PeerTube-4771e0008dd26eadbb7eaff64255a6ec914fdadb.tar.gz PeerTube-4771e0008dd26eadbb7eaff64255a6ec914fdadb.tar.zst PeerTube-4771e0008dd26eadbb7eaff64255a6ec914fdadb.zip |
Better typescript typing for a better world
Diffstat (limited to 'shared/models/pods/remote-video')
8 files changed, 104 insertions, 0 deletions
diff --git a/shared/models/pods/remote-video/index.ts b/shared/models/pods/remote-video/index.ts new file mode 100644 index 000000000..c88116849 --- /dev/null +++ b/shared/models/pods/remote-video/index.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export * from './remote-qadu-video-request.model' | ||
2 | export * from './remote-video-event-request.model' | ||
3 | export * from './remote-video-request.model' | ||
4 | export * from './remote-video-create-request.model' | ||
5 | export * from './remote-video-update-request.model' | ||
6 | export * from './remote-video-remove-request.model' | ||
7 | export * from './remote-video-report-abuse-request.model' | ||
diff --git a/shared/models/pods/remote-video/remote-qadu-video-request.model.ts b/shared/models/pods/remote-video/remote-qadu-video-request.model.ts new file mode 100644 index 000000000..0f84e3f13 --- /dev/null +++ b/shared/models/pods/remote-video/remote-qadu-video-request.model.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | export interface RemoteQaduVideoData { | ||
2 | remoteId: string | ||
3 | views?: number | ||
4 | likes?: number | ||
5 | dislikes?: number | ||
6 | } | ||
7 | |||
8 | export interface RemoteQaduVideoRequest { | ||
9 | data: RemoteQaduVideoData | ||
10 | } | ||
diff --git a/shared/models/pods/remote-video/remote-video-create-request.model.ts b/shared/models/pods/remote-video/remote-video-create-request.model.ts new file mode 100644 index 000000000..6babb0083 --- /dev/null +++ b/shared/models/pods/remote-video/remote-video-create-request.model.ts | |||
@@ -0,0 +1,27 @@ | |||
1 | import { RemoteVideoRequest } from './remote-video-request.model' | ||
2 | |||
3 | export interface RemoteVideoCreateData { | ||
4 | remoteId: string | ||
5 | author: string | ||
6 | tags: string[] | ||
7 | name: string | ||
8 | extname: string | ||
9 | infoHash: string | ||
10 | category: number | ||
11 | licence: number | ||
12 | language: number | ||
13 | nsfw: boolean | ||
14 | description: string | ||
15 | duration: number | ||
16 | createdAt: Date | ||
17 | updatedAt: Date | ||
18 | views: number | ||
19 | likes: number | ||
20 | dislikes: number | ||
21 | thumbnailData: string | ||
22 | } | ||
23 | |||
24 | export interface RemoteVideoCreateRequest extends RemoteVideoRequest { | ||
25 | type: 'add' | ||
26 | data: RemoteVideoCreateData | ||
27 | } | ||
diff --git a/shared/models/pods/remote-video/remote-video-event-request.model.ts b/shared/models/pods/remote-video/remote-video-event-request.model.ts new file mode 100644 index 000000000..84df1ca2f --- /dev/null +++ b/shared/models/pods/remote-video/remote-video-event-request.model.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | export type RemoteVideoEventType = 'views' | 'likes' | 'dislikes' | ||
2 | |||
3 | export interface RemoteVideoEventData { | ||
4 | remoteId: string | ||
5 | eventType: RemoteVideoEventType | ||
6 | count: number | ||
7 | } | ||
8 | |||
9 | export interface RemoteVideoEventRequest { | ||
10 | data: RemoteVideoEventData | ||
11 | } | ||
diff --git a/shared/models/pods/remote-video/remote-video-remove-request.model.ts b/shared/models/pods/remote-video/remote-video-remove-request.model.ts new file mode 100644 index 000000000..95ee38661 --- /dev/null +++ b/shared/models/pods/remote-video/remote-video-remove-request.model.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | import { RemoteVideoRequest } from './remote-video-request.model' | ||
2 | |||
3 | export interface RemoteVideoRemoveData { | ||
4 | remoteId: string | ||
5 | } | ||
6 | |||
7 | export interface RemoteVideoRemoveRequest extends RemoteVideoRequest { | ||
8 | type: 'remove' | ||
9 | data: RemoteVideoRemoveData | ||
10 | } | ||
diff --git a/shared/models/pods/remote-video/remote-video-report-abuse-request.model.ts b/shared/models/pods/remote-video/remote-video-report-abuse-request.model.ts new file mode 100644 index 000000000..9059c92e0 --- /dev/null +++ b/shared/models/pods/remote-video/remote-video-report-abuse-request.model.ts | |||
@@ -0,0 +1,12 @@ | |||
1 | import { RemoteVideoRequest } from './remote-video-request.model' | ||
2 | |||
3 | export interface RemoteVideoReportAbuseData { | ||
4 | videoRemoteId: string | ||
5 | reporterUsername: string | ||
6 | reportReason: string | ||
7 | } | ||
8 | |||
9 | export interface RemoteVideoReportAbuseRequest extends RemoteVideoRequest { | ||
10 | type: 'report-abuse' | ||
11 | data: RemoteVideoReportAbuseData | ||
12 | } | ||
diff --git a/shared/models/pods/remote-video/remote-video-request.model.ts b/shared/models/pods/remote-video/remote-video-request.model.ts new file mode 100644 index 000000000..e5052a23d --- /dev/null +++ b/shared/models/pods/remote-video/remote-video-request.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface RemoteVideoRequest { | ||
2 | type: 'add' | 'update' | 'remove' | 'report-abuse' | ||
3 | data: any | ||
4 | } | ||
diff --git a/shared/models/pods/remote-video/remote-video-update-request.model.ts b/shared/models/pods/remote-video/remote-video-update-request.model.ts new file mode 100644 index 000000000..67ddbc1e4 --- /dev/null +++ b/shared/models/pods/remote-video/remote-video-update-request.model.ts | |||
@@ -0,0 +1,23 @@ | |||
1 | export interface RemoteVideoUpdateData { | ||
2 | remoteId: string | ||
3 | tags: string[] | ||
4 | name: string | ||
5 | extname: string | ||
6 | infoHash: string | ||
7 | category: number | ||
8 | licence: number | ||
9 | language: number | ||
10 | nsfw: boolean | ||
11 | description: string | ||
12 | duration: number | ||
13 | createdAt: Date | ||
14 | updatedAt: Date | ||
15 | views: number | ||
16 | likes: number | ||
17 | dislikes: number | ||
18 | } | ||
19 | |||
20 | export interface RemoteVideoUpdateRequest { | ||
21 | type: 'update' | ||
22 | data: RemoteVideoUpdateData | ||
23 | } | ||