2018-09-19 14:44:20 +02:00
|
|
|
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'
|
2018-09-19 14:44:20 +02:00
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
type ActorFetchByUrlType = 'all' | 'association-ids'
|
|
|
|
|
|
|
|
function fetchActorByUrl (url: string, fetchType: ActorFetchByUrlType): Bluebird<MActorFull | MActorAccountChannelId> {
|
2018-09-19 14:44:20 +02:00
|
|
|
if (fetchType === 'all') return ActorModel.loadByUrlAndPopulateAccountAndChannel(url)
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
if (fetchType === 'association-ids') return ActorModel.loadByUrl(url)
|
2018-09-19 14:44:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
ActorFetchByUrlType,
|
|
|
|
fetchActorByUrl
|
|
|
|
}
|