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 LoadLocalByName = (name: string) => Bluebird<AccountInstance>
14 export type LoadByNameAndHost = (name: string, host: string) => Bluebird<AccountInstance>
15 export type ListByFollowersUrls = (followerUrls: string[], transaction?: Sequelize.Transaction) => Bluebird<AccountInstance[]>
17 export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor
18 export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount
19 export type IsOwned = (this: AccountInstance) => boolean
20 export type GetFollowerSharedInboxUrls = (this: AccountInstance) => Bluebird<string[]>
21 export type GetFollowingUrl = (this: AccountInstance) => string
22 export type GetFollowersUrl = (this: AccountInstance) => string
23 export type GetPublicKeyUrl = (this: AccountInstance) => string
26 export interface AccountClass {
27 loadApplication: AccountMethods.LoadApplication
28 load: AccountMethods.Load
29 loadByUUID: AccountMethods.LoadByUUID
30 loadByUrl: AccountMethods.LoadByUrl
31 loadLocalByName: AccountMethods.LoadLocalByName
32 loadByNameAndHost: AccountMethods.LoadByNameAndHost
33 listByFollowersUrls: AccountMethods.ListByFollowersUrls
36 export interface AccountAttributes {
41 followersCount: number
42 followingCount: number
45 sharedInboxUrl: string
53 applicationId?: number
56 export interface AccountInstance extends AccountClass, AccountAttributes, Sequelize.Instance<AccountAttributes> {
57 isOwned: AccountMethods.IsOwned
58 toActivityPubObject: AccountMethods.ToActivityPubObject
59 toFormattedJSON: AccountMethods.ToFormattedJSON
60 getFollowerSharedInboxUrls: AccountMethods.GetFollowerSharedInboxUrls
61 getFollowingUrl: AccountMethods.GetFollowingUrl
62 getFollowersUrl: AccountMethods.GetFollowersUrl
63 getPublicKeyUrl: AccountMethods.GetPublicKeyUrl
69 Server: ServerInstance
70 VideoChannels: VideoChannelInstance[]
73 export interface AccountModel extends AccountClass, Sequelize.Model<AccountInstance, AccountAttributes> {}