UNPKG

plxnner

Version:

An elegant open-source planner for Instagram

41 lines (33 loc) 1.12 kB
import UserProfile from "../../user/userProfile.class" import { removeUndefinedFromObject } from "../../../utils/utilsObject" import { usePlatformStructure } from "../../../composables/composablePlatformStructure"; export default class InstagramUserProfile extends UserProfile implements IInstagramUserProfile { public user: IInstagramUser public structure: IPlatformStructureUserProfile constructor(user: IInstagramUser) { super(user) this.user = user this.structure = { ...usePlatformStructure(this.user.platform).user.profile } } get publicProfile() { return `https://instagram.com/${this.user.profile.username}` } public async export(): Promise<IRawUserProfile> { let avatar = undefined if (this.avatar) { avatar = await this.avatar.export() } return removeUndefinedFromObject({ username: this.username, name: this.name, verified: this.verified, followers_count: this.followers_count, follows_count: this.follows_count, website: this.website?.href, biography: this.biography, avatar, }) } }