NIM 跨平台 C++ SDK
载入中...
搜索中...
未找到
nim_cpp_nos.h
浏览该文件的文档.
1
7#ifndef _NIM_SDK_CPP_NOS_H_
8#define _NIM_SDK_CPP_NOS_H_
9
10#include <functional>
11#include <string>
12#include "nim_cpp_talk.h"
19namespace nim {
20
25public:
27 typedef std::function<void(const InitNosResult&)> InitNosResultCallback;
28
29 typedef std::function<void(NIMResCode res_code, const std::string& file_path, const std::string& call_id, const std::string& res_id)>
33 typedef std::function<void(NIMResCode res_code, const std::string& url)> UploadMediaCallback;
35 typedef std::function<void(int64_t completed_size, int64_t file_size)> ProgressCallback;
36
38 typedef std::function<void(NIMResCode res_code, const DownloadMediaResult& result)> DownloadMediaExCallback;
40 typedef std::function<void(NIMResCode res_code, const UploadMediaResult& result)> UploadMediaExCallback;
42 typedef std::function<void(const std::string& url, std::string& token)> CustomTokenCallback;
44 typedef std::function<void(int64_t completed_size, int64_t file_size, const ProgressData& result)> ProgressExCallback;
45
47 typedef std::function<void(int64_t speed)> SpeedCallback;
49 typedef std::function<void(int64_t actual_size, int64_t speed)> TransferInfoCallback;
50
52 typedef std::function<void(NIMResCode res_code, const std::string& origin_url)> SafeURLToOriginURLCallback;
53
60 static void InitConfig(const InitNosConfigParam& param, const InitNosResultCallback& cb);
61
67 static void RegDownloadCb(const DownloadMediaCallback& cb);
68
74 static void RegUploadCb(const UploadMediaExCallback& cb);
75
81 static void RegCustomCustomTokenCb(const CustomTokenCallback& cb);
82
94 static bool FetchMedia(const IMMessage& msg, const DownloadMediaCallback& callback_result, const ProgressCallback& callback_progress);
95
115 static bool FetchMediaEx(const IMMessage& msg,
116 const std::string& json_extension,
117 const DownloadMediaCallback& callback_result,
118 const ProgressCallback& callback_progress,
119 const SpeedCallback& callback_speed = SpeedCallback(),
120 const TransferInfoCallback& callback_transfer = TransferInfoCallback());
121
128 static bool StopFetchMedia(const IMMessage& msg);
129
142 static bool UploadResource(const std::string& local_file,
143 const UploadMediaCallback& callback_result,
144 const ProgressCallback& callback_progress = ProgressCallback());
145
160 static bool UploadResource2(const std::string& local_file,
161 const std::string& tag,
162 const UploadMediaCallback& callback_result,
163 const ProgressCallback& callback_progress = ProgressCallback());
164
185 static bool UploadResourceEx(const std::string& local_file,
186 const std::string& json_extension,
187 const UploadMediaExCallback& callback_result,
188 const ProgressExCallback& callback_progress = ProgressExCallback(),
189 const SpeedCallback& callback_speed = SpeedCallback(),
190 const TransferInfoCallback& callback_transfer = TransferInfoCallback());
191
214 static bool UploadResourceEx2(const std::string& local_file,
215 const std::string& tag,
216 const std::string& json_extension,
217 const UploadMediaExCallback& callback_result,
218 const ProgressExCallback& callback_progress = ProgressExCallback(),
219 const SpeedCallback& callback_speed = SpeedCallback(),
220 const TransferInfoCallback& callback_transfer = TransferInfoCallback());
221
230 static bool StopUploadResourceEx(const std::string& task_id, const std::string& json_extension = "");
231
244 static bool DownloadResource(const std::string& nos_url,
245 const DownloadMediaCallback& callback_result,
246 const ProgressCallback& callback_progress = ProgressCallback());
247
268 static bool DownloadResourceEx(const std::string& nos_url,
269 const std::string& json_extension,
270 const DownloadMediaExCallback& callback_result,
271 const ProgressExCallback& callback_progress = ProgressExCallback(),
272 const SpeedCallback& callback_speed = SpeedCallback(),
273 const TransferInfoCallback& callback_transfer = TransferInfoCallback());
274
283 static bool StopDownloadResourceEx(const std::string& task_id, const std::string& json_extension = "");
284
294 static void SafeURLToOriginURL(const std::string& safe_url, const SafeURLToOriginURLCallback& cb, const std::string& json_extension = "");
295
300 static void UnregNosCb();
306 static void SetSupportQuickTrans(bool bquick);
307};
308
309} // namespace nim
310
311#endif //_NIM_SDK_CPP_NOS_H_
NIM SDK提供的NOS云存储服务接口
Definition nim_cpp_nos.h:24
std::function< void(const InitNosResult &) InitNosResultCallback)
初始化结果回调模板
Definition nim_cpp_nos.h:27
std::function< void(NIMResCode res_code, const UploadMediaResult &result) UploadMediaExCallback)
扩展上传回调模板
Definition nim_cpp_nos.h:40
std::function< void(const std::string &url, std::string &token) CustomTokenCallback)
自定义token回调模板
Definition nim_cpp_nos.h:42
std::function< void(int64_t actual_size, int64_t speed)> TransferInfoCallback
最终传输信息回调模板
Definition nim_cpp_nos.h:49
std::function< void(NIMResCode res_code, const std::string &origin_url) SafeURLToOriginURLCallback)
根据安全链接(短链)取得源链接
Definition nim_cpp_nos.h:52
std::function< void(int64_t completed_size, int64_t file_size, const ProgressData &result) ProgressExCallback)
扩展过程回调模板
Definition nim_cpp_nos.h:44
std::function< void(int64_t speed)> SpeedCallback
速度回调模板
Definition nim_cpp_nos.h:47
std::function< void(NIMResCode res_code, const DownloadMediaResult &result) DownloadMediaExCallback)
扩展下载回调模板
Definition nim_cpp_nos.h:38
std::function< void(NIMResCode res_code, const std::string &file_path, const std::string &call_id, const std::string &res_id) DownloadMediaCallback)
下载回调模板
Definition nim_cpp_nos.h:31
std::function< void(NIMResCode res_code, const std::string &url) UploadMediaCallback)
上传回调模板
Definition nim_cpp_nos.h:33
std::function< void(int64_t completed_size, int64_t file_size)> ProgressCallback
过程回调模板
Definition nim_cpp_nos.h:35
namespace nim
单聊与群聊
NOS数据结构定义
定义导出宏
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition nim_sdk_cpp_wrapper.h:38
NIMResCode
Definition public_defines.h:21
下载完成的结果
Definition nim_nos_helper.h:88
Definition nim_talk_helper.h:339
初始化nos参数
Definition nim_nos_helper.h:23
初始化结果
Definition nim_nos_helper.h:62
传输过程中的数据
Definition nim_nos_helper.h:101
上传完成的结果
Definition nim_nos_helper.h:75