11#ifndef __NIM_QCHAT_ATTACHMENT_CPP_DEF_H__
12#define __NIM_QCHAT_ATTACHMENT_CPP_DEF_H__
30 std::string token{
""};
33 url = c_resp.
url ? c_resp.
url :
"";
38 c_resp.
url =
const_cast<char*
>(url.c_str());
39 c_resp.
token =
const_cast<char*
>(token.c_str());
49 std::string task_id{
""};
58 url = c_resp.
url ? c_resp.
url :
"";
69 std::string task_id{
""};
71 std::string file_path{
""};
89 std::string task_id{
""};
91 uint64_t total_size{0};
125 resp_holder = cb_holder(resp);
126 return resp_holder.ToCParam();
196 std::string file_path{
""};
204 auto attachment_cbs =
reinterpret_cast<UploadAttachementCallbacks*
>(resp.user_data);
205 if (attachment_cbs && attachment_cbs->completed_cb)
206 (*attachment_cbs->completed_cb)(resp);
207 delete attachment_cbs->completed_cb;
208 delete attachment_cbs->progress_cb;
209 delete attachment_cbs;
212 auto attachment_cbs =
reinterpret_cast<UploadAttachementCallbacks*
>(progress.user_data);
213 if (attachment_cbs && attachment_cbs->progress_cb)
214 (*attachment_cbs->progress_cb)(progress);
216 param.
task_id =
const_cast<char*
>(task_id.c_str());
217 param.
file_path =
const_cast<char*
>(file_path.c_str());
228 param.
task_id =
const_cast<char*
>(task_id.c_str());
252 std::string file_path{
""};
260 auto attachment_cbs =
reinterpret_cast<DownloadAttachementCallbacks*
>(resp.user_data);
261 if (attachment_cbs && attachment_cbs->completed_cb) {
262 (*attachment_cbs->completed_cb)(resp);
264 delete attachment_cbs->completed_cb;
265 delete attachment_cbs->progress_cb;
266 delete attachment_cbs;
269 auto attachment_cbs =
reinterpret_cast<DownloadAttachementCallbacks*
>(progress.user_data);
270 if (attachment_cbs && attachment_cbs->progress_cb) {
271 (*attachment_cbs->progress_cb)(progress);
275 param.
task_id =
const_cast<char*
>(task_id.c_str());
276 param.
url =
const_cast<char*
>(url.c_str());
277 param.
file_path =
const_cast<char*
>(file_path.c_str());
288 param.
task_id =
const_cast<char*
>(task_id.c_str());
std::function< void(const QChatAttachmentDownloadResp &)> AttachmentDownloadCallback
下载附件回调
Definition: nim_qchat_attachment_cpp_def.h:110
std::function< QChatAttachmentCustomTokenResp(const QChatAttachmentCustomTokenResp &)> AttachmentCustomTokenCallback
获取附件自定义token回调
Definition: nim_qchat_attachment_cpp_def.h:106
std::function< void(const QChatAttachmentUploadResp &)> AttachmentUploadCallback
上传附件回调
Definition: nim_qchat_attachment_cpp_def.h:108
std::function< void(const QChatAttachmentProgressResp &)> AttachmentProgressCallback
上传/下载附件进度回调
Definition: nim_qchat_attachment_cpp_def.h:112
@ kNIMResSuccess
Definition: nim_chatroom_res_code_def.h:18
NIMQChatDownloadResType
Definition: nim_qchat_attachment_def.h:19
@ NIMQChatDownloadResTypeSource
原文件
Definition: nim_qchat_attachment_def.h:21
Definition: nim_qchat_attachment_def.h:29
char * token
将该指针指向零结尾的token字符串的起始地址
Definition: nim_qchat_attachment_def.h:35
char * url
上传/下载的url
Definition: nim_qchat_attachment_def.h:33
Definition: nim_qchat_attachment_def.h:140
nim_qchat_attachment_progress_cb_func progress_cb
下载附件进度回调
Definition: nim_qchat_attachment_def.h:144
char * file_path
附件路径
Definition: nim_qchat_attachment_def.h:154
nim_qchat_attachment_download_cb_func cb
下载附件异步回调
Definition: nim_qchat_attachment_def.h:142
char * task_id
任务id, 为空时自动生成
Definition: nim_qchat_attachment_def.h:150
void * user_data
自定义用户数据
Definition: nim_qchat_attachment_def.h:146
char * url
附件url
Definition: nim_qchat_attachment_def.h:152
NIMQChatDownloadResType res_type
下载资源类型
Definition: nim_qchat_attachment_def.h:148
Definition: nim_qchat_attachment_def.h:51
uint32_t res_code
操作结果, 参考NIMResCode
Definition: nim_qchat_attachment_def.h:53
NIMQChatDownloadResType res_type
下载资源类型
Definition: nim_qchat_attachment_def.h:57
char * task_id
任务id, 自动下载的任务则为消息id
Definition: nim_qchat_attachment_def.h:59
char * file_path
下载后的文件路径
Definition: nim_qchat_attachment_def.h:61
Definition: nim_qchat_attachment_def.h:65
uint32_t res_code
操作结果, 参考NIMResCode
Definition: nim_qchat_attachment_def.h:67
uint64_t cur_size
当前已经上传/下载的大小
Definition: nim_qchat_attachment_def.h:75
uint64_t total_size
文件总大小
Definition: nim_qchat_attachment_def.h:73
char * task_id
下载任务id
Definition: nim_qchat_attachment_def.h:71
Definition: nim_qchat_attachment_def.h:88
nim_qchat_attachment_custom_token_cb_func cb
自定义token回调
Definition: nim_qchat_attachment_def.h:90
Definition: nim_qchat_attachment_def.h:104
nim_qchat_attachment_download_cb_func cb
下载附件全局异步回调
Definition: nim_qchat_attachment_def.h:106
Definition: nim_qchat_attachment_def.h:112
nim_qchat_attachment_progress_cb_func cb
上传/下载全局进度回调
Definition: nim_qchat_attachment_def.h:114
Definition: nim_qchat_attachment_def.h:96
nim_qchat_attachment_upload_cb_func cb
上传附件全局异步回调
Definition: nim_qchat_attachment_def.h:98
Definition: nim_qchat_attachment_def.h:158
char * task_id
任务id, 为空时自动生成
Definition: nim_qchat_attachment_def.h:160
Definition: nim_qchat_attachment_def.h:134
char * task_id
任务id, 为空时自动生成
Definition: nim_qchat_attachment_def.h:136
Definition: nim_qchat_attachment_def.h:120
nim_qchat_attachment_progress_cb_func progress_cb
上传附件进度回调
Definition: nim_qchat_attachment_def.h:124
char * file_path
附件路径
Definition: nim_qchat_attachment_def.h:130
nim_qchat_attachment_upload_cb_func cb
上传附件异步回调
Definition: nim_qchat_attachment_def.h:122
void * user_data
自定义用户数据
Definition: nim_qchat_attachment_def.h:126
char * task_id
任务id, 为空时自动生成
Definition: nim_qchat_attachment_def.h:128
Definition: nim_qchat_attachment_def.h:39
uint32_t res_code
操作结果, 参考NIMResCode
Definition: nim_qchat_attachment_def.h:41
char * task_id
任务id
Definition: nim_qchat_attachment_def.h:45
char * url
上传后的url
Definition: nim_qchat_attachment_def.h:47
Definition: nim_qchat_attachment_cpp_def.h:234
Definition: nim_qchat_attachment_cpp_def.h:26
Definition: nim_qchat_attachment_cpp_def.h:240
std::string task_id
任务id, 为空时自动生成
Definition: nim_qchat_attachment_cpp_def.h:248
Definition: nim_qchat_attachment_cpp_def.h:63
Definition: nim_qchat_attachment_cpp_def.h:84
Definition: nim_qchat_attachment_cpp_def.h:115
Definition: nim_qchat_attachment_cpp_def.h:150
Definition: nim_qchat_attachment_cpp_def.h:166
Definition: nim_qchat_attachment_cpp_def.h:133
Definition: nim_qchat_attachment_cpp_def.h:283
std::string task_id
任务id
Definition: nim_qchat_attachment_cpp_def.h:285
Definition: nim_qchat_attachment_cpp_def.h:223
std::string task_id
任务id
Definition: nim_qchat_attachment_cpp_def.h:225
Definition: nim_qchat_attachment_cpp_def.h:188
std::string task_id
任务id, 为空时自动生成
Definition: nim_qchat_attachment_cpp_def.h:194
Definition: nim_qchat_attachment_cpp_def.h:45
Definition: nim_qchat_attachment_cpp_def.h:182