]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/helpers/actor.ts
Merge branch 'release/2.2.0' into develop
[github/Chocobozzz/PeerTube.git] / server / helpers / actor.ts
CommitLineData
e587e0ec 1import { ActorModel } from '../models/activitypub/actor'
453e83ea
C
2import * as Bluebird from 'bluebird'
3import { MActorFull, MActorAccountChannelId } from '../typings/models'
e587e0ec 4
453e83ea
C
5type ActorFetchByUrlType = 'all' | 'association-ids'
6
7function fetchActorByUrl (url: string, fetchType: ActorFetchByUrlType): Bluebird<MActorFull | MActorAccountChannelId> {
e587e0ec
C
8 if (fetchType === 'all') return ActorModel.loadByUrlAndPopulateAccountAndChannel(url)
9
453e83ea 10 if (fetchType === 'association-ids') return ActorModel.loadByUrl(url)
e587e0ec
C
11}
12
13export {
14 ActorFetchByUrlType,
15 fetchActorByUrl
16}