]>
Commit | Line | Data |
---|---|---|
72c7248b | 1 | import * as Promise from 'bluebird' |
39445ead | 2 | import * as Sequelize from 'sequelize' |
72c7248b | 3 | |
e4f97bab | 4 | import { ResultList } from '../../../shared' |
39445ead | 5 | import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object' |
72c7248b | 6 | import { VideoChannel as FormattedVideoChannel } from '../../../shared/models/videos/video-channel.model' |
e4f97bab | 7 | import { AccountInstance } from '../account/account-interface' |
39445ead | 8 | import { VideoInstance } from './video-interface' |
4e50b6a1 | 9 | import { VideoChannelShareInstance } from './video-channel-share-interface' |
72c7248b C |
10 | |
11 | export namespace VideoChannelMethods { | |
12 | export type ToFormattedJSON = (this: VideoChannelInstance) => FormattedVideoChannel | |
e4f97bab | 13 | export type ToActivityPubObject = (this: VideoChannelInstance) => VideoChannelObject |
72c7248b C |
14 | export type IsOwned = (this: VideoChannelInstance) => boolean |
15 | ||
e4f97bab | 16 | export type CountByAccount = (accountId: number) => Promise<number> |
72c7248b | 17 | export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<VideoChannelInstance> > |
e4f97bab C |
18 | export type LoadByIdAndAccount = (id: number, accountId: number) => Promise<VideoChannelInstance> |
19 | export type ListByAccount = (accountId: number) => Promise< ResultList<VideoChannelInstance> > | |
20 | export type LoadAndPopulateAccount = (id: number) => Promise<VideoChannelInstance> | |
21 | export type LoadByUUIDAndPopulateAccount = (uuid: string) => Promise<VideoChannelInstance> | |
72c7248b | 22 | export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> |
60862425 | 23 | export type LoadByHostAndUUID = (uuid: string, serverHost: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> |
e4f97bab | 24 | export type LoadAndPopulateAccountAndVideos = (id: number) => Promise<VideoChannelInstance> |
0d0e8dd0 C |
25 | export type LoadByUrl = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> |
26 | export type LoadByUUIDOrUrl = (uuid: string, url: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | |
72c7248b C |
27 | } |
28 | ||
29 | export interface VideoChannelClass { | |
e4f97bab | 30 | countByAccount: VideoChannelMethods.CountByAccount |
72c7248b | 31 | listForApi: VideoChannelMethods.ListForApi |
e4f97bab | 32 | listByAccount: VideoChannelMethods.ListByAccount |
e4f97bab | 33 | loadByIdAndAccount: VideoChannelMethods.LoadByIdAndAccount |
e4f97bab C |
34 | loadAndPopulateAccount: VideoChannelMethods.LoadAndPopulateAccount |
35 | loadByUUIDAndPopulateAccount: VideoChannelMethods.LoadByUUIDAndPopulateAccount | |
36 | loadAndPopulateAccountAndVideos: VideoChannelMethods.LoadAndPopulateAccountAndVideos | |
0d0e8dd0 C |
37 | loadByUrl: VideoChannelMethods.LoadByUrl |
38 | loadByUUIDOrUrl: VideoChannelMethods.LoadByUUIDOrUrl | |
72c7248b C |
39 | } |
40 | ||
41 | export interface VideoChannelAttributes { | |
42 | id?: number | |
43 | uuid?: string | |
44 | name: string | |
45 | description: string | |
46 | remote: boolean | |
0d0e8dd0 | 47 | url?: string |
72c7248b | 48 | |
e4f97bab | 49 | Account?: AccountInstance |
72c7248b | 50 | Videos?: VideoInstance[] |
4e50b6a1 | 51 | VideoChannelShares?: VideoChannelShareInstance[] |
72c7248b C |
52 | } |
53 | ||
54 | export interface VideoChannelInstance extends VideoChannelClass, VideoChannelAttributes, Sequelize.Instance<VideoChannelAttributes> { | |
55 | id: number | |
56 | createdAt: Date | |
57 | updatedAt: Date | |
58 | ||
59 | isOwned: VideoChannelMethods.IsOwned | |
60 | toFormattedJSON: VideoChannelMethods.ToFormattedJSON | |
e4f97bab | 61 | toActivityPubObject: VideoChannelMethods.ToActivityPubObject |
72c7248b C |
62 | } |
63 | ||
64 | export interface VideoChannelModel extends VideoChannelClass, Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> {} |