]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/models/account/account-interface.ts
Add follow tabs
[github/Chocobozzz/PeerTube.git] / server / models / account / account-interface.ts
1 import * as Bluebird from 'bluebird'
2 import * as Sequelize from 'sequelize'
3 import { Account as FormattedAccount, ActivityPubActor } from '../../../shared'
4 import { ResultList } from '../../../shared/models/result-list.model'
5 import { PodInstance } from '../pod/pod-interface'
6 import { VideoChannelInstance } from '../video/video-channel-interface'
7
8 export namespace AccountMethods {
9 export type LoadApplication = () => Bluebird<AccountInstance>
10
11 export type Load = (id: number) => Bluebird<AccountInstance>
12 export type LoadByUUID = (uuid: string) => Bluebird<AccountInstance>
13 export type LoadByUrl = (url: string, transaction?: Sequelize.Transaction) => Bluebird<AccountInstance>
14 export type LoadAccountByPodAndUUID = (uuid: string, podId: number, transaction: Sequelize.Transaction) => Bluebird<AccountInstance>
15 export type LoadLocalByName = (name: string) => Bluebird<AccountInstance>
16 export type LoadByNameAndHost = (name: string, host: string) => Bluebird<AccountInstance>
17 export type ListOwned = () => Bluebird<AccountInstance[]>
18
19 export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor
20 export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount
21 export type IsOwned = (this: AccountInstance) => boolean
22 export type GetFollowerSharedInboxUrls = (this: AccountInstance) => Bluebird<string[]>
23 export type GetFollowingUrl = (this: AccountInstance) => string
24 export type GetFollowersUrl = (this: AccountInstance) => string
25 export type GetPublicKeyUrl = (this: AccountInstance) => string
26 }
27
28 export interface AccountClass {
29 loadApplication: AccountMethods.LoadApplication
30 loadAccountByPodAndUUID: AccountMethods.LoadAccountByPodAndUUID
31 load: AccountMethods.Load
32 loadByUUID: AccountMethods.LoadByUUID
33 loadByUrl: AccountMethods.LoadByUrl
34 loadLocalByName: AccountMethods.LoadLocalByName
35 loadByNameAndHost: AccountMethods.LoadByNameAndHost
36 listOwned: AccountMethods.ListOwned
37 }
38
39 export interface AccountAttributes {
40 name: string
41 url: string
42 publicKey: string
43 privateKey: string
44 followersCount: number
45 followingCount: number
46 inboxUrl: string
47 outboxUrl: string
48 sharedInboxUrl: string
49 followersUrl: string
50 followingUrl: string
51
52 uuid?: string
53
54 podId?: number
55 userId?: number
56 applicationId?: number
57 }
58
59 export interface AccountInstance extends AccountClass, AccountAttributes, Sequelize.Instance<AccountAttributes> {
60 isOwned: AccountMethods.IsOwned
61 toActivityPubObject: AccountMethods.ToActivityPubObject
62 toFormattedJSON: AccountMethods.ToFormattedJSON
63 getFollowerSharedInboxUrls: AccountMethods.GetFollowerSharedInboxUrls
64 getFollowingUrl: AccountMethods.GetFollowingUrl
65 getFollowersUrl: AccountMethods.GetFollowersUrl
66 getPublicKeyUrl: AccountMethods.GetPublicKeyUrl
67
68 id: number
69 createdAt: Date
70 updatedAt: Date
71
72 Pod: PodInstance
73 VideoChannels: VideoChannelInstance[]
74 }
75
76 export interface AccountModel extends AccountClass, Sequelize.Model<AccountInstance, AccountAttributes> {}