PeerTube/server/helpers/actor.ts

17 lines
554 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'
2020-06-18 10:45:25 +02:00
import { MActorFull, MActorAccountChannelId } from '../types/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
}