PeerTube/server/models/account/account-interface.ts

76 lines
2.9 KiB
TypeScript
Raw Normal View History

2017-11-09 10:51:58 -06:00
import * as Bluebird from 'bluebird'
2017-11-13 10:39:41 -06:00
import * as Sequelize from 'sequelize'
import { Account as FormattedAccount, ActivityPubActor } from '../../../shared'
2017-11-15 04:00:25 -06:00
import { ServerInstance } from '../server/server-interface'
2017-11-09 10:51:58 -06:00
import { VideoChannelInstance } from '../video/video-channel-interface'
export namespace AccountMethods {
2017-11-13 10:39:41 -06:00
export type LoadApplication = () => Bluebird<AccountInstance>
2017-11-09 10:51:58 -06:00
export type Load = (id: number) => Bluebird<AccountInstance>
export type LoadByUUID = (uuid: string) => Bluebird<AccountInstance>
2017-11-13 11:48:28 -06:00
export type LoadByUrl = (url: string, transaction?: Sequelize.Transaction) => Bluebird<AccountInstance>
2017-11-15 04:00:25 -06:00
export type LoadAccountByServerAndUUID = (uuid: string, serverId: number, transaction: Sequelize.Transaction) => Bluebird<AccountInstance>
2017-11-14 10:31:26 -06:00
export type LoadLocalByName = (name: string) => Bluebird<AccountInstance>
export type LoadByNameAndHost = (name: string, host: string) => Bluebird<AccountInstance>
2017-11-09 10:51:58 -06:00
export type ListOwned = () => Bluebird<AccountInstance[]>
export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor
2017-11-13 10:39:41 -06:00
export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount
2017-11-09 10:51:58 -06:00
export type IsOwned = (this: AccountInstance) => boolean
export type GetFollowerSharedInboxUrls = (this: AccountInstance) => Bluebird<string[]>
export type GetFollowingUrl = (this: AccountInstance) => string
export type GetFollowersUrl = (this: AccountInstance) => string
export type GetPublicKeyUrl = (this: AccountInstance) => string
}
export interface AccountClass {
2017-11-13 10:39:41 -06:00
loadApplication: AccountMethods.LoadApplication
2017-11-15 04:00:25 -06:00
loadAccountByServerAndUUID: AccountMethods.LoadAccountByServerAndUUID
2017-11-09 10:51:58 -06:00
load: AccountMethods.Load
loadByUUID: AccountMethods.LoadByUUID
loadByUrl: AccountMethods.LoadByUrl
2017-11-14 10:31:26 -06:00
loadLocalByName: AccountMethods.LoadLocalByName
loadByNameAndHost: AccountMethods.LoadByNameAndHost
2017-11-09 10:51:58 -06:00
listOwned: AccountMethods.ListOwned
}
export interface AccountAttributes {
name: string
url: string
publicKey: string
privateKey: string
followersCount: number
followingCount: number
inboxUrl: string
outboxUrl: string
sharedInboxUrl: string
followersUrl: string
followingUrl: string
uuid?: string
2017-11-15 04:00:25 -06:00
serverId?: number
2017-11-09 10:51:58 -06:00
userId?: number
applicationId?: number
}
export interface AccountInstance extends AccountClass, AccountAttributes, Sequelize.Instance<AccountAttributes> {
isOwned: AccountMethods.IsOwned
toActivityPubObject: AccountMethods.ToActivityPubObject
2017-11-13 10:39:41 -06:00
toFormattedJSON: AccountMethods.ToFormattedJSON
2017-11-09 10:51:58 -06:00
getFollowerSharedInboxUrls: AccountMethods.GetFollowerSharedInboxUrls
getFollowingUrl: AccountMethods.GetFollowingUrl
getFollowersUrl: AccountMethods.GetFollowersUrl
getPublicKeyUrl: AccountMethods.GetPublicKeyUrl
id: number
createdAt: Date
updatedAt: Date
2017-11-15 04:00:25 -06:00
Server: ServerInstance
2017-11-09 10:51:58 -06:00
VideoChannels: VideoChannelInstance[]
}
export interface AccountModel extends AccountClass, Sequelize.Model<AccountInstance, AccountAttributes> {}