actor.ts 556 B

12345678910111213141516
  1. import { ActorModel } from '../models/activitypub/actor'
  2. import * as Bluebird from 'bluebird'
  3. import { MActorFull, MActorAccountChannelId } from '../typings/models'
  4. type ActorFetchByUrlType = 'all' | 'association-ids'
  5. function fetchActorByUrl (url: string, fetchType: ActorFetchByUrlType): Bluebird<MActorFull | MActorAccountChannelId> {
  6. if (fetchType === 'all') return ActorModel.loadByUrlAndPopulateAccountAndChannel(url)
  7. if (fetchType === 'association-ids') return ActorModel.loadByUrl(url)
  8. }
  9. export {
  10. ActorFetchByUrlType,
  11. fetchActorByUrl
  12. }