Add outbox
[oweals/peertube.git] / server / models / account / account-follow-interface.ts
1 import * as Bluebird from 'bluebird'
2 import * as Sequelize from 'sequelize'
3 import { AccountFollow, FollowState } from '../../../shared/models/accounts/follow.model'
4 import { ResultList } from '../../../shared/models/result-list.model'
5 import { AccountInstance } from './account-interface'
6
7 export namespace AccountFollowMethods {
8   export type LoadByAccountAndTarget = (accountId: number, targetAccountId: number) => Bluebird<AccountFollowInstance>
9
10   export type ListFollowingForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountFollowInstance>>
11   export type ListFollowersForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountFollowInstance>>
12
13   export type ListAcceptedFollowerUrlsForApi = (accountId: number[], start?: number, count?: number) => Promise< ResultList<string> >
14   export type ListAcceptedFollowingUrlsForApi = (accountId: number[], start?: number, count?: number) => Promise< ResultList<string> >
15   export type ListAcceptedFollowerSharedInboxUrls = (accountId: number[]) => Promise< ResultList<string> >
16   export type ToFormattedJSON = (this: AccountFollowInstance) => AccountFollow
17 }
18
19 export interface AccountFollowClass {
20   loadByAccountAndTarget: AccountFollowMethods.LoadByAccountAndTarget
21   listFollowersForApi: AccountFollowMethods.ListFollowersForApi
22   listFollowingForApi: AccountFollowMethods.ListFollowingForApi
23
24   listAcceptedFollowerUrlsForApi: AccountFollowMethods.ListAcceptedFollowerUrlsForApi
25   listAcceptedFollowingUrlsForApi: AccountFollowMethods.ListAcceptedFollowingUrlsForApi
26   listAcceptedFollowerSharedInboxUrls: AccountFollowMethods.ListAcceptedFollowerSharedInboxUrls
27 }
28
29 export interface AccountFollowAttributes {
30   accountId: number
31   targetAccountId: number
32   state: FollowState
33 }
34
35 export interface AccountFollowInstance extends AccountFollowClass, AccountFollowAttributes, Sequelize.Instance<AccountFollowAttributes> {
36   id: number
37   createdAt: Date
38   updatedAt: Date
39
40   AccountFollower?: AccountInstance
41   AccountFollowing?: AccountInstance
42
43   toFormattedJSON: AccountFollowMethods.ToFormattedJSON
44 }
45
46 export interface AccountFollowModel extends AccountFollowClass, Sequelize.Model<AccountFollowInstance, AccountFollowAttributes> {}