1
0
Fork 0
peertube/server/helpers/actor.ts

17 lines
556 B
TypeScript
Raw Normal View History

import { ActorModel } from '../models/activitypub/actor'
2019-08-15 05:53:26 -04:00
import * as Bluebird from 'bluebird'
import { MActorFull, MActorAccountChannelId } from '../typings/models'
2019-08-15 05:53:26 -04:00
type ActorFetchByUrlType = 'all' | 'association-ids'
function fetchActorByUrl (url: string, fetchType: ActorFetchByUrlType): Bluebird<MActorFull | MActorAccountChannelId> {
if (fetchType === 'all') return ActorModel.loadByUrlAndPopulateAccountAndChannel(url)
2019-08-15 05:53:26 -04:00
if (fetchType === 'association-ids') return ActorModel.loadByUrl(url)
}
export {
ActorFetchByUrlType,
fetchActorByUrl
}