UNPKG

vk-io

Version:

Modern VK API SDK for Node.js

129 lines (128 loc) 3.28 kB
import { Attachment, AttachmentFactoryOptions } from './attachment'; import { IPhotoAttachmentPayload, PhotoAttachment } from './photo'; import { AttachmentType } from '../../utils/constants'; export interface IMarketAttachmentPayload { id: number; owner_id: number; access_key?: string; title?: string; description?: string; price?: { amount: string; currency: { id: number; name: string; }; old_amount?: string; text: string; }; dimensions?: { width: number; height: number; length: number; }; weight?: number; category?: { id: number; name: string; section: { id: number; name: string; }; }; thumb_photo?: string; date?: number; availability?: 0 | 1 | 2; is_favorite?: number; photos?: IPhotoAttachmentPayload[]; can_comment?: number; can_repost?: number; likes?: { user_likes: number; count: number; }; url?: string; button_title?: string; } export type MarketAttachmentOptions = AttachmentFactoryOptions<IMarketAttachmentPayload>; export declare class MarketAttachment extends Attachment<IMarketAttachmentPayload, AttachmentType.MARKET | 'market'> { photos?: PhotoAttachment[]; /** * Constructor */ constructor(options: MarketAttachmentOptions); /** * Load attachment payload */ loadAttachmentPayload(): Promise<void>; /** * Checks is bookmarked current user */ get isFavorited(): boolean | undefined; /** * Checks is can comment for current user */ get canComment(): boolean | undefined; /** * Checks is can repost for current user */ get canRepost(): boolean | undefined; /** * Returns product title */ get title(): string | undefined; /** * Returns product description */ get description(): string | undefined; /** * Returns product price */ get price(): IMarketAttachmentPayload['price'] | undefined; /** * Returns product dimensions */ get dimensions(): IMarketAttachmentPayload['dimensions'] | undefined; /** * Returns product dimensions */ get weight(): number | undefined; /** * Returns product category */ get category(): IMarketAttachmentPayload['category'] | undefined; /** * Returns product thumbnail url */ get thumbnailUrl(): string | undefined; /** * Returns the date when this product was created */ get createdAt(): number | undefined; /** * Returns product availability * * **0** - the product is available * * **1** - the item has been deleted * * **2** - the product is not available */ get availability(): IMarketAttachmentPayload['availability'] | undefined; /** * Returns product likes */ get likes(): IMarketAttachmentPayload['likes'] | undefined; /** * Returns product url */ get url(): string | undefined; /** * Returns product button title */ get buttonTitle(): string | undefined; /** * Applies the payload */ private applyPayload; }