1 import * as Bluebird from 'bluebird'
2 import * as Sequelize from 'sequelize'
3 import { Account as FormattedAccount, ActivityPubActor } from '../../../shared'
4 import { ServerInstance } from '../server/server-interface'
5 import { VideoChannelInstance } from '../video/video-channel-interface'
7 export namespace AccountMethods {
8 export type LoadApplication = () => Bluebird<AccountInstance>
10 export type Load = (id: number) => Bluebird<AccountInstance>
11 export type LoadByUUID = (uuid: string) => Bluebird<AccountInstance>
12 export type LoadByUrl = (url: string, transaction?: Sequelize.Transaction) => Bluebird<AccountInstance>
13 export type LoadAccountByServerAndUUID = (uuid: string, serverId: number, transaction: Sequelize.Transaction) => Bluebird<AccountInstance>
14 export type LoadLocalByName = (name: string) => Bluebird<AccountInstance>
15 export type LoadByNameAndHost = (name: string, host: string) => Bluebird<AccountInstance>
16 export type ListOwned = () => Bluebird<AccountInstance[]>
18 export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor
19 export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount
20 export type IsOwned = (this: AccountInstance) => boolean
21 export type GetFollowerSharedInboxUrls = (this: AccountInstance) => Bluebird<string[]>
22 export type GetFollowingUrl = (this: AccountInstance) => string
23 export type GetFollowersUrl = (this: AccountInstance) => string
24 export type GetPublicKeyUrl = (this: AccountInstance) => string
27 export interface AccountClass {
28 loadApplication: AccountMethods.LoadApplication
29 loadAccountByServerAndUUID: AccountMethods.LoadAccountByServerAndUUID
30 load: AccountMethods.Load
31 loadByUUID: AccountMethods.LoadByUUID
32 loadByUrl: AccountMethods.LoadByUrl
33 loadLocalByName: AccountMethods.LoadLocalByName
34 loadByNameAndHost: AccountMethods.LoadByNameAndHost
35 listOwned: AccountMethods.ListOwned
38 export interface AccountAttributes {
43 followersCount: number
44 followingCount: number
47 sharedInboxUrl: string
55 applicationId?: number
58 export interface AccountInstance extends AccountClass, AccountAttributes, Sequelize.Instance<AccountAttributes> {
59 isOwned: AccountMethods.IsOwned
60 toActivityPubObject: AccountMethods.ToActivityPubObject
61 toFormattedJSON: AccountMethods.ToFormattedJSON
62 getFollowerSharedInboxUrls: AccountMethods.GetFollowerSharedInboxUrls
63 getFollowingUrl: AccountMethods.GetFollowingUrl
64 getFollowersUrl: AccountMethods.GetFollowersUrl
65 getPublicKeyUrl: AccountMethods.GetPublicKeyUrl
71 Server: ServerInstance
72 VideoChannels: VideoChannelInstance[]
75 export interface AccountModel extends AccountClass, Sequelize.Model<AccountInstance, AccountAttributes> {}