]>
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' |
72c7248b C |
9 | |
10 | export namespace VideoChannelMethods { | |
11 | export type ToFormattedJSON = (this: VideoChannelInstance) => FormattedVideoChannel | |
e4f97bab | 12 | export type ToActivityPubObject = (this: VideoChannelInstance) => VideoChannelObject |
72c7248b C |
13 | export type IsOwned = (this: VideoChannelInstance) => boolean |
14 | ||
e4f97bab | 15 | export type CountByAccount = (accountId: number) => Promise<number> |
72c7248b | 16 | export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<VideoChannelInstance> > |
e4f97bab C |
17 | export type LoadByIdAndAccount = (id: number, accountId: number) => Promise<VideoChannelInstance> |
18 | export type ListByAccount = (accountId: number) => Promise< ResultList<VideoChannelInstance> > | |
19 | export type LoadAndPopulateAccount = (id: number) => Promise<VideoChannelInstance> | |
20 | export type LoadByUUIDAndPopulateAccount = (uuid: string) => Promise<VideoChannelInstance> | |
72c7248b | 21 | export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> |
60862425 | 22 | export type LoadByHostAndUUID = (uuid: string, serverHost: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> |
e4f97bab | 23 | export type LoadAndPopulateAccountAndVideos = (id: number) => Promise<VideoChannelInstance> |
0d0e8dd0 C |
24 | export type LoadByUrl = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> |
25 | export type LoadByUUIDOrUrl = (uuid: string, url: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | |
72c7248b C |
26 | } |
27 | ||
28 | export interface VideoChannelClass { | |
e4f97bab | 29 | countByAccount: VideoChannelMethods.CountByAccount |
72c7248b | 30 | listForApi: VideoChannelMethods.ListForApi |
e4f97bab | 31 | listByAccount: VideoChannelMethods.ListByAccount |
e4f97bab | 32 | loadByIdAndAccount: VideoChannelMethods.LoadByIdAndAccount |
e4f97bab C |
33 | loadAndPopulateAccount: VideoChannelMethods.LoadAndPopulateAccount |
34 | loadByUUIDAndPopulateAccount: VideoChannelMethods.LoadByUUIDAndPopulateAccount | |
35 | loadAndPopulateAccountAndVideos: VideoChannelMethods.LoadAndPopulateAccountAndVideos | |
0d0e8dd0 C |
36 | loadByUrl: VideoChannelMethods.LoadByUrl |
37 | loadByUUIDOrUrl: VideoChannelMethods.LoadByUUIDOrUrl | |
72c7248b C |
38 | } |
39 | ||
40 | export interface VideoChannelAttributes { | |
41 | id?: number | |
42 | uuid?: string | |
43 | name: string | |
44 | description: string | |
45 | remote: boolean | |
0d0e8dd0 | 46 | url?: string |
72c7248b | 47 | |
e4f97bab | 48 | Account?: AccountInstance |
72c7248b C |
49 | Videos?: VideoInstance[] |
50 | } | |
51 | ||
52 | export interface VideoChannelInstance extends VideoChannelClass, VideoChannelAttributes, Sequelize.Instance<VideoChannelAttributes> { | |
53 | id: number | |
54 | createdAt: Date | |
55 | updatedAt: Date | |
56 | ||
57 | isOwned: VideoChannelMethods.IsOwned | |
58 | toFormattedJSON: VideoChannelMethods.ToFormattedJSON | |
e4f97bab | 59 | toActivityPubObject: VideoChannelMethods.ToActivityPubObject |
72c7248b C |
60 | } |
61 | ||
62 | export interface VideoChannelModel extends VideoChannelClass, Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> {} |