vkdart

Форк
0
113 строк · 3.6 Кб
1
import 'package:vkdart/vkontakte.dart';
2

3
/// Model Market
4
///
5
/// See https://dev.vk.com/ru/reference/objects/market-item
6
class MarketAttachmentModel extends CustomAttachmentModel
7
    with AttachmentLikesMixin {
8
  // ignore: public_member_api_docs
9
  MarketAttachmentModel(super.payload) : super(attachType: 'market');
10

11
  /// Product Name.
12
  String? get title => payload['title'];
13

14
  /// Product description text.
15
  String? get description => payload['description'];
16

17
  Map<String, dynamic>? get _price => payload['price'];
18
  Map<String, dynamic>? get _dimensions => payload['dimensions'];
19
  Map<String, dynamic>? get _category => payload['category'];
20
  Map<String, dynamic>? get _rejectInfo => payload['reject_info'];
21

22
  /// the price of a product in hundredths of a currency unit.
23
  int? get priceAmount => _price?['amount'];
24

25
  /// currency identifier.
26
  int? get priceCurrencyId => _price?['currency']?['id'];
27

28
  /// currency name.
29
  String? get priceCurrencyName => _price?['currency']?['name'];
30

31
  /// the old price of a product in hundredths of a currency unit.
32
  int? get priceOldAmount => _price?['old_amount'];
33

34
  /// string representation of price.
35
  String? get priceText => _price?['text'];
36

37
  /// width in millimeters.
38
  int? get dimensionsWidth => _dimensions?['width'];
39

40
  /// height in millimeters.
41
  int? get dimensionsHeight => _dimensions?['height'];
42

43
  /// length in millimeters.
44
  int? get dimensionsLength => _dimensions?['length'];
45

46
  /// category ID.
47
  int? get categoryId => _category?['id'];
48

49
  /// name of category.
50
  String? get categoryName => _category?['name'];
51

52
  /// section identifier.
53
  int? get categorySectionId => _category?['section']?['id'];
54

55
  /// section name.
56
  String? get categorySectionName => _category?['section']?['name'];
57

58
  /// name of the reason for rejecting the goods.
59
  String? get rejectTitle => _rejectInfo?['title'];
60

61
  /// description of the reason for blocking.
62
  String? get rejectDescription => _rejectInfo?['description'];
63

64
  /// “Delete” and “Write to support” buttons.
65
  Map<String, dynamic>? get rejectButtons => _rejectInfo?['buttons'];
66

67
  /// numerical representation of moderation status.
68
  String? get rejectModerationStatus => _rejectInfo?['moderation_status'];
69

70
  /// link to moderation rules.
71
  String? get rejectLink => _rejectInfo?['info_link'];
72

73
  /// support link.
74
  String? get rejectWhiteToSupportLink => _rejectInfo?['white_to_support_link'];
75

76
  /// Weight in grams.
77
  int? get weight => payload['weight'];
78

79
  /// Product cover image URL.
80
  String? get thumbPhoto => payload['thumb_photo'];
81

82
  /// Product creation date in Unixtime format.
83
  int? get createdAt => payload['date'];
84

85
  /// Product availability status. Possible values:s
86
  /// `0` — product available.
87
  /// `1` - product removed.
88
  /// `2` - product is unavailable.
89
  int? get availability => payload['availability'];
90

91
  /// true if the item has been bookmarked by the current user.
92
  bool? get isFavorite => payload['is_favorite'];
93

94
  /// Product article, arbitrary string up to 50 characters long.
95
  String? get sku => payload['sku'];
96

97
  /// Product images.
98
  List<PhotoAttachmentModel>? get photos => (payload['photos'] as List?)
99
      ?.map((e) => PhotoAttachmentModel((e as Map).cast<String, dynamic>()))
100
      .toList();
101

102
  /// Ability to comment on a product for the current user.
103
  bool? get isCanComment => checkBoolInProperty('can_comment');
104

105
  /// Ability to repost a product for the current user.
106
  bool? get isCanRepost => checkBoolInProperty('can_repost');
107

108
  /// Link to product in external resources.
109
  String? get url => payload['url'];
110

111
  /// Text on the product button.
112
  String? get buttonTitle => payload['button_title'];
113
}
114

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.