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'
8 export namespace AccountMethods {
9 export type LoadApplication = () => Bluebird<AccountInstance>
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[]>
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
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
39 export interface AccountAttributes {
44 followersCount: number
45 followingCount: number
48 sharedInboxUrl: string
56 applicationId?: number
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
73 VideoChannels: VideoChannelInstance[]
76 export interface AccountModel extends AccountClass, Sequelize.Model<AccountInstance, AccountAttributes> {}