NIM SDK API  9.0.0
nim_nos_helper.h
Go to the documentation of this file.
1 
7 #ifndef _NIM_SDK_CPP_NOS_HELPER_H_
8 #define _NIM_SDK_CPP_NOS_HELPER_H_
9 
10 #include <functional>
11 #include <list>
12 #include <map>
13 #include <string>
14 #include "nim_define_include.h"
20 namespace nim {
21 
23 struct NIM_SDK_CPPWRAPPER_DLL_API InitNosConfigParam {
31  void AddTag(const std::string& tag, int32_t survival_time) {
32  tag_list_[tag] = ((survival_time == 0) ? (0) : (survival_time > kMINSURVIVALTIME ? survival_time : kMINSURVIVALTIME));
33  }
38  void RemoveTag(const std::string& tag) { tag_list_.erase(tag); }
42  std::map<std::string, int32_t> GetTagList() const { return tag_list_; }
47  void SetGetExtension(const std::string& json_extension) { json_extension_ = json_extension; }
51  std::string GetExtension() const { return json_extension_; }
52 
53  static const int32_t kMINSURVIVALTIME;
55 private:
56  std::map<std::string, int32_t> tag_list_;
57  std::string json_extension_;
58 };
59 
61 struct NIM_SDK_CPPWRAPPER_DLL_API InitNosResult {
62  NIMNosInitConfigResultType result_;
63  std::list<std::string> success_req_tags_;
64  std::map<std::string, int> failure_req_tags_;
65  std::list<std::string> ignore_req_tags_;
66  void FromJsonString(const std::string& json_data);
67 };
68 
70 struct NIM_SDK_CPPWRAPPER_DLL_API UploadMediaResult {
71  std::string url_;
72  std::string res_id_;
73  std::string call_id_;
77 };
78 
80 struct NIM_SDK_CPPWRAPPER_DLL_API DownloadMediaResult {
81  std::string file_path_;
82  std::string call_id_;
83  std::string res_id_;
87 };
88 
90 struct NIM_SDK_CPPWRAPPER_DLL_API ProgressData {
91  std::string res_id_;
95 };
96 
104 NIM_SDK_CPPWRAPPER_DLL_API bool ParseUploadResult(const std::string& url, const std::string& json, UploadMediaResult& res);
105 
115 NIM_SDK_CPPWRAPPER_DLL_API bool ParseDownloadResult(const std::string& file_path,
116  const std::string& call_id,
117  const std::string& res_id,
118  DownloadMediaResult& res);
119 
126 NIM_SDK_CPPWRAPPER_DLL_API bool ParseProgressData(const std::string& json, ProgressData& res);
127 
128 } // namespace nim
129 
130 #endif //_NIM_SDK_CPP_NOS_HELPER_H_
nim::InitNosResult::ignore_req_tags_
std::list< std::string > ignore_req_tags_
Definition: nim_nos_helper.h:65
nim::InitNosConfigParam::GetExtension
std::string GetExtension() const
Definition: nim_nos_helper.h:51
nim::DownloadMediaResult::call_id_
std::string call_id_
Definition: nim_nos_helper.h:82
nim::UploadMediaResult::res_id_
std::string res_id_
Definition: nim_nos_helper.h:72
nim::InitNosResult::result_
NIMNosInitConfigResultType result_
Definition: nim_nos_helper.h:62
nim::ParseDownloadResult
NIM_SDK_CPPWRAPPER_DLL_API bool ParseDownloadResult(const std::string &file_path, const std::string &call_id, const std::string &res_id, DownloadMediaResult &res)
解析NOS上传过程数据
nim::DownloadMediaResult
下载完成的结果
Definition: nim_nos_helper.h:80
nim::InitNosResult
初始化结果
Definition: nim_nos_helper.h:61
nim::DownloadMediaResult::file_path_
std::string file_path_
Definition: nim_nos_helper.h:81
nim::InitNosConfigParam::GetTagList
std::map< std::string, int32_t > GetTagList() const
Definition: nim_nos_helper.h:42
nim::UploadMediaResult::UploadMediaResult
UploadMediaResult()
Definition: nim_nos_helper.h:76
nim::UploadMediaResult::url_
std::string url_
Definition: nim_nos_helper.h:71
nim::UploadMediaResult::call_id_
std::string call_id_
Definition: nim_nos_helper.h:73
nim::DownloadMediaResult::res_id_
std::string res_id_
Definition: nim_nos_helper.h:83
nim::InitNosConfigParam::InitNosConfigParam
InitNosConfigParam()
Definition: nim_nos_helper.h:25
nim::ProgressData::ProgressData
ProgressData()
Definition: nim_nos_helper.h:94
nim::ParseUploadResult
NIM_SDK_CPPWRAPPER_DLL_API bool ParseUploadResult(const std::string &url, const std::string &json, UploadMediaResult &res)
解析NOS上传结果
nim::InitNosConfigParam::AddTag
void AddTag(const std::string &tag, int32_t survival_time)
Definition: nim_nos_helper.h:31
nim::InitNosConfigParam::kMINSURVIVALTIME
static const int32_t kMINSURVIVALTIME
Definition: nim_nos_helper.h:53
nim
namespace nim
nim::UploadMediaResult
上传完成的结果
Definition: nim_nos_helper.h:70
nim::ParseProgressData
NIM_SDK_CPPWRAPPER_DLL_API bool ParseProgressData(const std::string &json, ProgressData &res)
解析NOS上传过程数据
nim::ProgressData
传输过程中的数据
Definition: nim_nos_helper.h:90
nim::InitNosConfigParam
初始化nos参数
Definition: nim_nos_helper.h:23
nim::InitNosResult::failure_req_tags_
std::map< std::string, int > failure_req_tags_
Definition: nim_nos_helper.h:64
nim::InitNosConfigParam::SetGetExtension
void SetGetExtension(const std::string &json_extension)
Definition: nim_nos_helper.h:47
nim::InitNosResult::success_req_tags_
std::list< std::string > success_req_tags_
Definition: nim_nos_helper.h:63
nim::ProgressData::res_id_
std::string res_id_
Definition: nim_nos_helper.h:91
nim::InitNosConfigParam::RemoveTag
void RemoveTag(const std::string &tag)
Definition: nim_nos_helper.h:38
nim::DownloadMediaResult::DownloadMediaResult
DownloadMediaResult()
Definition: nim_nos_helper.h:86
nim_sdk_cpp_wrapper.h
定义导出宏