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 LoadLocalAccountByNameAndPod = (name: string, host: string) => Bluebird<AccountInstance>
16 export type ListOwned = () => Bluebird<AccountInstance[]>
17 export type ListFollowerUrlsForApi = (id: number, start: number, count?: number) => Promise< ResultList<string> >
18 export type ListFollowingUrlsForApi = (id: number, start: number, count?: number) => Promise< ResultList<string> >
19 export type ListFollowingForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountInstance> >
20 export type ListFollowersForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountInstance> >
22 export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor
23 export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount
24 export type IsOwned = (this: AccountInstance) => boolean
25 export type GetFollowerSharedInboxUrls = (this: AccountInstance) => Bluebird<string[]>
26 export type GetFollowingUrl = (this: AccountInstance) => string
27 export type GetFollowersUrl = (this: AccountInstance) => string
28 export type GetPublicKeyUrl = (this: AccountInstance) => string
31 export interface AccountClass {
32 loadApplication: AccountMethods.LoadApplication
33 loadAccountByPodAndUUID: AccountMethods.LoadAccountByPodAndUUID
34 load: AccountMethods.Load
35 loadByUUID: AccountMethods.LoadByUUID
36 loadByUrl: AccountMethods.LoadByUrl
37 loadLocalAccountByNameAndPod: AccountMethods.LoadLocalAccountByNameAndPod
38 listOwned: AccountMethods.ListOwned
39 listFollowerUrlsForApi: AccountMethods.ListFollowerUrlsForApi
40 listFollowingUrlsForApi: AccountMethods.ListFollowingUrlsForApi
41 listFollowingForApi: AccountMethods.ListFollowingForApi
42 listFollowersForApi: AccountMethods.ListFollowersForApi
45 export interface AccountAttributes {
50 followersCount: number
51 followingCount: number
54 sharedInboxUrl: string
62 applicationId?: number
65 export interface AccountInstance extends AccountClass, AccountAttributes, Sequelize.Instance<AccountAttributes> {
66 isOwned: AccountMethods.IsOwned
67 toActivityPubObject: AccountMethods.ToActivityPubObject
68 toFormattedJSON: AccountMethods.ToFormattedJSON
69 getFollowerSharedInboxUrls: AccountMethods.GetFollowerSharedInboxUrls
70 getFollowingUrl: AccountMethods.GetFollowingUrl
71 getFollowersUrl: AccountMethods.GetFollowersUrl
72 getPublicKeyUrl: AccountMethods.GetPublicKeyUrl
79 VideoChannels: VideoChannelInstance[]
82 export interface AccountModel extends AccountClass, Sequelize.Model<AccountInstance, AccountAttributes> {}