UNPKG

vk-io

Version:

Modern VK API SDK for Node.js

128 lines (127 loc) 3.21 kB
import { Attachment, AttachmentFactoryOptions } from './attachment'; import { IPhotoAttachmentPayload } from './photo'; import { AttachmentType, kSerializeData } from '../../utils/constants'; export interface IDocumentAttachmentPayload { id: number; owner_id: number; access_key?: string; title?: string; size?: number; ext?: string; url?: string; date?: number; type?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; preview?: { photo?: IPhotoAttachmentPayload['sizes']; graffiti?: { src: string; width: number; height: number; }; audio_message?: { duration: number; waveform: number[]; link_ogg: string; link_mp3: string; }; }; } export type DocumentAttachmentOptions = AttachmentFactoryOptions<IDocumentAttachmentPayload>; export declare class DocumentAttachment extends Attachment<IDocumentAttachmentPayload, AttachmentType.DOCUMENT | 'doc'> { /** * Constructor */ constructor(options: DocumentAttachmentOptions); /** * Load attachment payload */ loadAttachmentPayload(): Promise<void>; /** * Checks if the document is a text */ get isText(): boolean | undefined; /** * Checks if the document is an archive */ get isArchive(): boolean | undefined; /** * Checks if the document is a gif file */ get isGif(): boolean | undefined; /** * Checks if the document is an image */ get isImage(): boolean | undefined; /** * Checks if the document is a graffiti */ get isGraffiti(): boolean | undefined; /** * Checks if the document is an audio */ get isAudio(): boolean | undefined; /** * Checks if the document is a voice */ get isVoice(): boolean | undefined; /** * Checks if the document is a video */ get isVideo(): boolean | undefined; /** * Checks if the document is a book */ get isBook(): boolean | undefined; /** * Returns the document title */ get title(): string | undefined; /** * Returns the date when this document was created */ get createdAt(): number | undefined; /** * Returns the type identifier * * **1** - text documents * * **2** - archives * * **3** - gif * * **4** - images * * **5** - audio * * **6** - video * * **7** - e-books * * **8** - unknown */ get typeId(): IDocumentAttachmentPayload['type'] | undefined; /** * Returns the size in bytes */ get size(): number | undefined; /** * Returns the extension */ get extension(): string | undefined; /** * Returns the URL of the document */ get url(): string | undefined; /** * Returns the info to preview */ get preview(): IDocumentAttachmentPayload['preview'] | undefined; /** * Checks for a property in preview */ hasPreviewProperty(name: 'photo' | 'graffiti' | 'audio_message'): boolean; /** * Returns the custom data */ [kSerializeData](): object; }