1
import 'package:vkdart/util.dart';
2
import 'package:vkdart/vkontakte.dart';
6
/// See https://dev.vk.com/ru/reference/objects/comment
7
class WallReplyAttachmentModel extends CustomAttachmentModel {
8
// ignore: public_member_api_docs
9
WallReplyAttachmentModel(super.payload) : super(attachType: 'wall_reply');
12
int get id => payload['id'] ?? payload['cid'];
14
/// The ID of the comment author.
15
int get fromId => payload['from_id'];
17
/// The date the comment was created in Unixtime format.
18
int get createdAt => payload['date'];
20
/// The text of the comment.
21
String? get text => payload['text'];
23
/// is the commentator a VK Donut subscriber.
24
bool? get isDon => payload['donut']?['is_don'];
26
/// a stub for users who have not subscribed to VK Donut.
27
String? get donutPlacholder => payload['donut']?['placeholder'];
29
/// The ID of the user or community to whom the current comment was left in response (if applicable).
30
bool? get isReplyToUser => checkBoolInProperty('reply_to_user');
32
/// The ID of the comment that the current one was left in response to (if applicable).
33
bool? get isReplyToComment => checkBoolInProperty('reply_to_comment');
35
/// Media commentary attachments (photos, links, etc.).
36
/// See https://dev.vk.com/ru/reference/objects/comment#attachments
37
List<AttachmentModel> get attachments =>
38
transformAttachments((payload['attachments'] as List?)
39
?.map((e) => (e as Map).cast<String, dynamic>())
43
/// An array of IDs of parent comments.
44
List<int>? get parentsStack => payload['parents_stack'];
46
/// the number of comments in the thread.
47
int? get threadCount => payload['thread']?['count'];
49
/// an array of objects for comments on a record (only for the wall.getComments method).
50
List<WallReplyAttachmentModel>? get threadItems => payload['thread']?['items']
51
?.map((e) => WallReplyAttachmentModel((e as Map).cast<String, dynamic>()))
54
/// can the current user leave comments in this thread.
55
bool? get isThreadCanPost => payload['thread']?['can_post'];
57
/// do I need to display the reply button in the branch
58
bool? get isThreadShowReplyButton => payload['thread']?['show_reply_button'];
60
/// can communities leave comments in the thread?
61
bool? get isThreadGroupsCanPost => payload['thread']?['groups_can_post'];