fromWorkGroupJson2 static method

ThreadZhipuAI fromWorkGroupJson2(
  1. dynamic json
)

Implementation

static ThreadZhipuAI fromWorkGroupJson2(dynamic json) {
  if (json['type'] == BytedeskConstants.THREAD_TYPE_WORKGROUP) {
    return ThreadZhipuAI(
        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 ThreadZhipuAI(
        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 ThreadZhipuAI(
        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 ThreadZhipuAI(
      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']);
}