aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account-interface.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-09 17:51:58 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commite4f97babf701481b55cc10fb3448feab5f97c867 (patch)
treeaf37402a594dc5ff09f71ecb0687e8cfe4cdb471 /server/models/account/account-interface.ts
parent343ad675f2a26c15b86150a9a3552e619d5d44f4 (diff)
downloadPeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.tar.gz
PeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.tar.zst
PeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.zip
Begin activitypub
Diffstat (limited to 'server/models/account/account-interface.ts')
-rw-r--r--server/models/account/account-interface.ts74
1 files changed, 74 insertions, 0 deletions
diff --git a/server/models/account/account-interface.ts b/server/models/account/account-interface.ts
new file mode 100644
index 000000000..2ef3e2246
--- /dev/null
+++ b/server/models/account/account-interface.ts
@@ -0,0 +1,74 @@
1import * as Sequelize from 'sequelize'
2import * as Bluebird from 'bluebird'
3
4import { PodInstance } from '../pod/pod-interface'
5import { VideoChannelInstance } from '../video/video-channel-interface'
6import { ActivityPubActor } from '../../../shared'
7import { ResultList } from '../../../shared/models/result-list.model'
8
9export namespace AccountMethods {
10 export type Load = (id: number) => Bluebird<AccountInstance>
11 export type LoadByUUID = (uuid: string) => Bluebird<AccountInstance>
12 export type LoadByUrl = (url: string) => Bluebird<AccountInstance>
13 export type LoadAccountByPodAndUUID = (uuid: string, podId: number, transaction: Sequelize.Transaction) => Bluebird<AccountInstance>
14 export type LoadLocalAccountByName = (name: string) => Bluebird<AccountInstance>
15 export type ListOwned = () => Bluebird<AccountInstance[]>
16 export type ListFollowerUrlsForApi = (name: string, start: number, count: number) => Promise< ResultList<string> >
17 export type ListFollowingUrlsForApi = (name: string, start: number, count: number) => Promise< ResultList<string> >
18
19 export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor
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
25}
26
27export interface AccountClass {
28 loadAccountByPodAndUUID: AccountMethods.LoadAccountByPodAndUUID
29 load: AccountMethods.Load
30 loadByUUID: AccountMethods.LoadByUUID
31 loadByUrl: AccountMethods.LoadByUrl
32 loadLocalAccountByName: AccountMethods.LoadLocalAccountByName
33 listOwned: AccountMethods.ListOwned
34 listFollowerUrlsForApi: AccountMethods.ListFollowerUrlsForApi
35 listFollowingUrlsForApi: AccountMethods.ListFollowingUrlsForApi
36}
37
38export interface AccountAttributes {
39 name: string
40 url: string
41 publicKey: string
42 privateKey: string
43 followersCount: number
44 followingCount: number
45 inboxUrl: string
46 outboxUrl: string
47 sharedInboxUrl: string
48 followersUrl: string
49 followingUrl: string
50
51 uuid?: string
52
53 podId?: number
54 userId?: number
55 applicationId?: number
56}
57
58export interface AccountInstance extends AccountClass, AccountAttributes, Sequelize.Instance<AccountAttributes> {
59 isOwned: AccountMethods.IsOwned
60 toActivityPubObject: AccountMethods.ToActivityPubObject
61 getFollowerSharedInboxUrls: AccountMethods.GetFollowerSharedInboxUrls
62 getFollowingUrl: AccountMethods.GetFollowingUrl
63 getFollowersUrl: AccountMethods.GetFollowersUrl
64 getPublicKeyUrl: AccountMethods.GetPublicKeyUrl
65
66 id: number
67 createdAt: Date
68 updatedAt: Date
69
70 Pod: PodInstance
71 VideoChannels: VideoChannelInstance[]
72}
73
74export interface AccountModel extends AccountClass, Sequelize.Model<AccountInstance, AccountAttributes> {}