fromJsonThreadWorkGroupV2 static method

Message fromJsonThreadWorkGroupV2(
  1. dynamic json
)

Implementation

static Message fromJsonThreadWorkGroupV2(dynamic json) {
  //
  List<Category> categoriesList = [];
  if (json['type'] == BytedeskConstants.MESSAGE_TYPE_ROBOT_V2) {
    categoriesList = json['categories'] == null
        ? []
        : (json['categories'] as List<dynamic>)
            .map((item) => Category.fromJson(item))
            .toList();
  }
  //
  return Message(
      mid: json['mid'],
      // topic: json['thread']['topic'],
      content: json['content'],
      imageUrl: json['imageUrl'],
      voiceUrl: json['voiceUrl'],
      fileUrl: json['fileUrl'],
      videoUrl: json['videoOrShortUrl'],
      nickname: json['user']['nickname'],
      avatar: json['user']['avatar'],
      type: json['type'],
      timestamp: json['createdAt'],
      status: 'stored',
      isSend: 0,
      currentUid: SpUtil.getString(BytedeskConstants.uid),
      client: json['client'],
      thread: Thread.fromVisitorJson(json['thread']),
      user: User.fromJson(json['user']),
      categories: categoriesList,
      categoriesJson: json['categories'].toString());
}