PeerTube/server/helpers/actor.ts

17 lines
556 B
TypeScript
Raw Normal View History

import { ActorModel } from '../models/activitypub/actor'
2019-08-15 11:53:26 +02:00
import * as Bluebird from 'bluebird'
import { MActorFull, MActorAccountChannelId } from '../typings/models'
2019-08-15 11:53:26 +02: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 11:53:26 +02:00
if (fetchType === 'association-ids') return ActorModel.loadByUrl(url)
}
export {
ActorFetchByUrlType,
fetchActorByUrl
}