in sdk/src/model/FileCreateRequest.cc [42:85]
std::shared_ptr<std::iostream> FileCreateRequest::Body() const
{
Json::Value root;
root["drive_id"] = driveID_;
root["parent_file_id"] = parentFileID_;
root["name"] = name_;
root["check_name_mode"] = checkNameMode_;
root["size"] = size_;
root["type"] = type_;
root["hidden"] = hidden_;
if (!fileID_.empty()) {
root["file_id"] = fileID_;
}
if (!preHash_.empty()) {
root["pre_hash"] = preHash_;
}
if (!contentHash_.empty()) {
root["content_hash_name"] = "sha1";
root["content_hash"] = contentHash_;
}
int index = 0;
for (const PartInfoReq& part : partInfoReqList_) {
root["part_info_list"][index]["part_number"] = part.PartNumber();
root["part_info_list"][index]["part_size"] = part.PartSize();
root["part_info_list"][index]["from"] = part.From();
root["part_info_list"][index]["to"] = part.To();
index++;
}
index = 0;
for (const UserTag& userTag : userTags_) {
root["user_tags"][index]["key"] = userTag.Key();
root["user_tags"][index]["value"] = userTag.Value();
index++;
}
Json::StreamWriterBuilder builder;
builder.settings_["indentation"] = "";
std::shared_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
auto content = std::make_shared<std::stringstream>();
writer->write(root, content.get());
return content;
}