NIM PC Cross Platform SDK
nim_robot_helper.h
Go to the documentation of this file.
1
7#ifndef _NIM_SDK_CPP_ROBOT_HELPER_H_
8#define _NIM_SDK_CPP_ROBOT_HELPER_H_
9
10#include <assert.h>
11#include <list>
12#include <string>
13#include "nim_define_include.h"
16#include "public_defines.h"
21namespace nim {
23struct NIM_SDK_CPPWRAPPER_DLL_API RobotInfo {
24public:
26 void SetAccid(const std::string& accid) { robot_info_[kNIMRobotInfoKeyAccid] = accid; }
27
29 std::string GetAccid() const { return robot_info_[kNIMRobotInfoKeyAccid].asString(); }
30
32 void SetName(const std::string& name) { robot_info_[kNIMRobotInfoKeyName] = name; }
33
35 std::string GetName() const { return robot_info_[kNIMRobotInfoKeyName].asString(); }
36
38 void SetIcon(const std::string& icon) { robot_info_[kNIMRobotInfoKeyIcon] = icon; }
39
41 std::string GetIcon() const { return robot_info_[kNIMRobotInfoKeyIcon].asString(); }
42
44 void SetIntro(const std::string& intro) { robot_info_[kNIMRobotInfoKeyIntro] = intro; }
45
47 std::string GetIntro() const { return robot_info_[kNIMRobotInfoKeyIntro].asString(); }
48
50 void SetRobotID(const std::string& id) { robot_info_[kNIMRobotInfoKeyRobotId] = id; }
51
53 std::string GetRobotID() const { return robot_info_[kNIMRobotInfoKeyRobotId].asString(); }
54
56 void SetCreateTime(const uint64_t time) { robot_info_[kNIMRobotInfoKeyCreateTime] = time; }
57
59 uint64_t GetCreateTime() const { return robot_info_[kNIMRobotInfoKeyCreateTime].asUInt64(); }
60
62 void SetUpdateTime(const uint64_t time) { robot_info_[kNIMRobotInfoKeyUpdateTime] = time; }
63
65 uint64_t GetUpdateTime() const { return robot_info_[kNIMRobotInfoKeyUpdateTime].asUInt64(); }
66
67private:
69};
70
71typedef std::list<RobotInfo> RobotInfos;
72
79NIM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfosStringToRobotInfos(const std::string& infos_json, RobotInfos& infos);
80
87NIM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfoStringToRobotInfo(const std::string& info_json, RobotInfo& info);
88
89} // namespace nim
90
91#endif //_NIM_SDK_CPP_ROBOT_HELPER_H_
Represents a JSON value.
Definition: value.h:196
namespace nim
bool ParseRobotInfoStringToRobotInfo(const std::string &info_json, RobotInfo &info)
解析机器人信息
Definition: nim_robot_helper.cpp:24
bool ParseRobotInfosStringToRobotInfos(const std::string &infos_json, RobotInfos &infos)
解析机器人信息
Definition: nim_robot_helper.cpp:10
static const char * kNIMRobotInfoKeyAccid
string 帐号
Definition: nim_chatroom_def.h:877
static const char * kNIMRobotInfoKeyRobotId
string 机器人ID
Definition: nim_chatroom_def.h:885
static const char * kNIMRobotInfoKeyIcon
string 头像
Definition: nim_chatroom_def.h:881
static const char * kNIMRobotInfoKeyIntro
string 介绍
Definition: nim_chatroom_def.h:883
static const char * kNIMRobotInfoKeyName
string 名字
Definition: nim_chatroom_def.h:879
static const char * kNIMRobotInfoKeyCreateTime
long 创建时间戳 毫秒
Definition: nim_chatroom_def.h:887
static const char * kNIMRobotInfoKeyUpdateTime
long 更新时间戳 毫秒
Definition: nim_chatroom_def.h:889
NIM 公共数据类型定义总的包含文件
JSON辅助方法
定义导出宏
NIM SDK 及 NIM ChatRoom SDK 公用头文件
机器人信息
Definition: nim_robot_helper.h:23
std::string GetRobotID() const
Definition: nim_robot_helper.h:53
void SetName(const std::string &name)
Definition: nim_robot_helper.h:32
std::string GetName() const
Definition: nim_robot_helper.h:35
void SetRobotID(const std::string &id)
Definition: nim_robot_helper.h:50
uint64_t GetCreateTime() const
Definition: nim_robot_helper.h:59
std::string GetIntro() const
Definition: nim_robot_helper.h:47
void SetAccid(const std::string &accid)
Definition: nim_robot_helper.h:26
std::string GetAccid() const
Definition: nim_robot_helper.h:29
uint64_t GetUpdateTime() const
Definition: nim_robot_helper.h:65
void SetCreateTime(const uint64_t time)
Definition: nim_robot_helper.h:56
void SetIcon(const std::string &icon)
Definition: nim_robot_helper.h:38
void SetIntro(const std::string &intro)
Definition: nim_robot_helper.h:44
std::string GetIcon() const
Definition: nim_robot_helper.h:41
void SetUpdateTime(const uint64_t time)
Definition: nim_robot_helper.h:62