std::shared_ptr DirListRequest::Body()

in sdk/src/model/DirListRequest.cc [53:95]


std::shared_ptr<std::iostream> DirListRequest::Body() const
{
    Json::Value root;
    if (!driveID_.empty()) {
        root["drive_id"] = driveID_;
    }
    if (!shareID_.empty()) {
        root["share_id"] = shareID_;
    }
    root["parent_file_id"] = parentFileID_;
    root["order_by"] = orderBy_;
    root["order_direction"] = orderDirection_;
    root["marker"] = marker_;
    root["limit"] = limit_;
    root["fields"] = fields_;

    if (!type_.empty()) {
        root["type"] = type_;
    }

    if (!category_.empty()) {
        root["category"] = category_;
    }

    if (0 != urlExpireSec_) {
        root["url_expire_sec"] = urlExpireSec_;
    }

    if (nullptr != starred_) {
        root["starred"] = *starred_;
    }

    if (nullptr != all_) {
        root["all"] = *all_;
    }

    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;
}