fromWorkGroupJson2 static method

Thread fromWorkGroupJson2(
  1. dynamic json
)

Implementation

static Thread fromWorkGroupJson2(dynamic json) {
  if (json['type'] == BytedeskConstants.THREAD_TYPE_WORKGROUP) {
    return Thread(
        tid: json['tid'],
        topic: json['topic'],
        wid: json['workGroup']['wid'],
        nickname: json['workGroup']['nickname'],
        avatar: json['workGroup']['avatar'],
        content: json['content'],
        timestamp: json['timestamp'],
        unreadCount: json['unreadCount'],
        type: json['type'],
        current: json['current'],
        client: json['client'],
        top: json['top'],
        topVisitor: json['topVisitor'],
        nodisturb: json['nodisturb'],
        nodisturbVisitor: json['nodisturbVisitor'],
        unread: json['unread'],
        unreadVisitor: json['unreadVisitor']);
  } else if (json['type'] == BytedeskConstants.THREAD_TYPE_APPOINTED) {
    return Thread(
        tid: json['tid'],
        topic: json['topic'],
        wid: json['agent']['uid'],
        nickname: json['agent']['nickname'],
        avatar: json['agent']['avatar'],
        content: json['content'],
        timestamp: json['timestamp'],
        unreadCount: json['unreadCount'],
        type: json['type'],
        current: json['current'],
        client: json['client'],
        top: json['top'],
        topVisitor: json['topVisitor'],
        nodisturb: json['nodisturb'],
        nodisturbVisitor: json['nodisturbVisitor'],
        unread: json['unread'],
        unreadVisitor: json['unreadVisitor']);
  } else if (json['type'] == BytedeskConstants.THREAD_TYPE_CHANNEL) {
    return Thread(
        tid: json['tid'],
        topic: json['topic'],
        wid: json['channel']['cid'],
        nickname: json['channel']['nickname'],
        avatar: json['channel']['avatar'],
        content: json['content'],
        timestamp: json['timestamp'],
        unreadCount: json['unreadCount'],
        type: json['type'],
        current: json['current'],
        client: json['client'],
        top: json['top'],
        topVisitor: json['topVisitor'],
        nodisturb: json['nodisturb'],
        nodisturbVisitor: json['nodisturbVisitor'],
        unread: json['unread'],
        unreadVisitor: json['unreadVisitor']);
  }
  // 其他类型
  return Thread(
      tid: json['tid'],
      topic: json['topic'],
      wid: json['admin']['uid'],
      nickname: json['admin']['nickname'],
      avatar: json['admin']['avatar'],
      content: json['content'],
      timestamp: json['timestamp'],
      unreadCount: json['unreadCount'],
      type: json['type'],
      current: json['current'],
      client: json['client'],
      top: json['top'],
      topVisitor: json['topVisitor'],
      nodisturb: json['nodisturb'],
      nodisturbVisitor: json['nodisturbVisitor'],
      unread: json['unread'],
      unreadVisitor: json['unreadVisitor']);
}