2020-12-08 07:30:29 -06:00
|
|
|
|
2021-05-11 04:15:29 -05:00
|
|
|
import { ActorModel } from '../models/actor/actor'
|
2020-12-08 07:30:29 -06:00
|
|
|
import { MActorAccountChannelId, MActorFull } from '../types/models'
|
2018-09-19 07:44:20 -05:00
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
type ActorFetchByUrlType = 'all' | 'association-ids'
|
|
|
|
|
2020-12-08 07:30:29 -06:00
|
|
|
function fetchActorByUrl (url: string, fetchType: ActorFetchByUrlType): Promise<MActorFull | MActorAccountChannelId> {
|
2018-09-19 07:44:20 -05:00
|
|
|
if (fetchType === 'all') return ActorModel.loadByUrlAndPopulateAccountAndChannel(url)
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
if (fetchType === 'association-ids') return ActorModel.loadByUrl(url)
|
2018-09-19 07:44:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
ActorFetchByUrlType,
|
|
|
|
fetchActorByUrl
|
|
|
|
}
|