import { AssetService } from '../conversation' ; import { LinkPreviewContent , LinkPreviewUploadedContent } from '../conversation/content' ; export class LinkPreviewService { constructor ( private readonly assetService ) { } public async uploadLinkPreviewImage ( linkPreview , domain ? ) { const { image , ... preview } = linkPreview ; if ( ! image ) { return preview ; } const uploadedLinkPreview = preview ; const asset = await ( await this . assetService . uploadAsset ( linkPreview . image . data , { domain } ) ) . response ; uploadedLinkPreview . imageUploaded = { asset , image , } ; return uploadedLinkPreview ; } }