vk-io
Version:
Modern VK API SDK for Node.js
128 lines (127 loc) • 3.52 kB
TypeScript
import { Attachment, AttachmentFactoryOptions } from './attachment';
import { AttachmentType, kSerializeData } from '../../utils/constants';
import { PhotoAttachment, IPhotoAttachmentPayload } from './photo';
export interface IPollAttachmentPayload {
id: number;
owner_id: number;
access_key?: string;
anonymous?: number;
multiple?: number;
closed?: number;
is_board?: number;
can_edit?: number;
can_vote?: number;
can_report?: number;
can_share?: number;
author_id?: number;
question?: string;
created?: number;
end_date?: number;
votes?: number;
answer_ids?: number[];
friends?: number[];
answers?: {
id: number;
text: string;
votes: number;
rate: number;
}[];
background?: {
id: number;
type: 'gradient' | 'tile';
angle: number;
color: string;
width: number;
height: number;
images: IPhotoAttachmentPayload['sizes'];
points: {
position: number;
color: string;
}[];
};
photo?: IPhotoAttachmentPayload;
}
export type PollAttachmentOptions = AttachmentFactoryOptions<IPollAttachmentPayload>;
export declare class PollAttachment extends Attachment<IPollAttachmentPayload, AttachmentType.POLL | 'poll'> {
photo?: PhotoAttachment;
/**
* Constructor
*/
constructor(options: PollAttachmentOptions);
/**
* Load attachment payload
*/
loadAttachmentPayload(): Promise<void>;
/**
* Checks whether the poll is anonymous
*/
get isAnonymous(): boolean | undefined;
/**
* Checks whether the poll allows multiple choice of answers
*/
get isMultiple(): boolean | undefined;
/**
* Checks whether the poll is complete
*/
get isClosed(): boolean | undefined;
/**
* Check whether questions are attached to the discussion
*/
get isBoard(): boolean | undefined;
/**
* Check if you can edit the poll
*/
get isCanEdit(): boolean | undefined;
/**
* Check if you can vote in the survey
*/
get isCanVote(): boolean | undefined;
/**
* Check if you can complain about the poll
*/
get isCanReport(): boolean | undefined;
/**
* Check if you can share a survey
*/
get isCanShare(): boolean | undefined;
/**
* Returns the ID of the poll author
*/
get authorId(): number | undefined;
/**
* Returns the question text
*/
get question(): string | undefined;
/**
* Returns the date when this poll was created
*/
get createdAt(): number | undefined;
/**
* Returns the end date of the poll in Unixtime. 0, if the poll is unlimited
*/
get endedAt(): number | undefined;
/**
* Returns the number of votes
*/
get votes(): number | undefined;
/**
* Returns the identifiers of the response options selected by the current user
*/
get answerIds(): number[] | undefined;
/**
* Returns the identifiers of 3 friends who voted in the poll
*/
get friends(): number[] | undefined;
/**
* Returns the information about the options for the answer
*/
get answers(): IPollAttachmentPayload['answers'] | undefined;
/**
* Returns the poll snippet background
*/
get background(): IPollAttachmentPayload['background'] | undefined;
/**
* Returns the custom data
*/
[kSerializeData](): object;
}