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

17 lines
511 B
TypeScript
Raw Normal View History

2020-12-08 08:30:29 -05:00
2021-05-11 05:15:29 -04:00
import { ActorModel } from '../models/actor/actor'
2020-12-08 08:30:29 -05:00
import { MActorAccountChannelId, MActorFull } from '../types/models'
2019-08-15 05:53:26 -04:00
type ActorFetchByUrlType = 'all' | 'association-ids'
2020-12-08 08:30:29 -05:00
function fetchActorByUrl (url: string, fetchType: ActorFetchByUrlType): Promise<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
}