This commit is contained in:
parent
e6cdcd74a1
commit
a080c9ff86
@ -63,31 +63,6 @@ namespace repertory {
|
|||||||
sia_provider::sia_provider(app_config &config, i_http_comm &comm)
|
sia_provider::sia_provider(app_config &config, i_http_comm &comm)
|
||||||
: base_provider(config, comm) {}
|
: base_provider(config, comm) {}
|
||||||
|
|
||||||
auto sia_provider::create_directory_key(const std::string &api_path) const
|
|
||||||
-> api_error {
|
|
||||||
auto parent_api_path = utils::path::get_parent_api_path(api_path);
|
|
||||||
|
|
||||||
json object_list{};
|
|
||||||
if (not get_object_list(parent_api_path, object_list)) {
|
|
||||||
return api_error::error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (not object_list.contains("objects")) {
|
|
||||||
return api_error::error;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto &list = object_list.at("objects");
|
|
||||||
if (std::ranges::find_if(list, [&api_path](auto &&entry) -> bool {
|
|
||||||
return entry.at("key").template get<std::string>() == api_path + '/';
|
|
||||||
}) == list.end()) {
|
|
||||||
return api_error::item_not_found;
|
|
||||||
}
|
|
||||||
|
|
||||||
api_meta_map meta;
|
|
||||||
return const_cast<sia_provider *>(this)->create_directory_impl(api_path,
|
|
||||||
meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto sia_provider::check_version(std::string &required_version,
|
auto sia_provider::check_version(std::string &required_version,
|
||||||
std::string &returned_version) const -> bool {
|
std::string &returned_version) const -> bool {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
@ -174,6 +149,31 @@ auto sia_provider::create_directory_impl(const std::string &api_path,
|
|||||||
return api_error::success;
|
return api_error::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto sia_provider::create_directory_key(const std::string &api_path) const
|
||||||
|
-> api_error {
|
||||||
|
auto parent_api_path = utils::path::get_parent_api_path(api_path);
|
||||||
|
|
||||||
|
json object_list{};
|
||||||
|
if (not get_object_list(parent_api_path, object_list)) {
|
||||||
|
return api_error::comm_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not object_list.contains("objects")) {
|
||||||
|
return api_error::item_not_found;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto &list = object_list.at("objects");
|
||||||
|
if (std::ranges::find_if(list, [&api_path](auto &&entry) -> bool {
|
||||||
|
return entry.at("key").template get<std::string>() == api_path + '/';
|
||||||
|
}) == list.end()) {
|
||||||
|
return api_error::item_not_found;
|
||||||
|
}
|
||||||
|
|
||||||
|
api_meta_map meta;
|
||||||
|
return const_cast<sia_provider *>(this)->create_directory_impl(api_path,
|
||||||
|
meta);
|
||||||
|
}
|
||||||
|
|
||||||
auto sia_provider::get_directory_item_count(const std::string &api_path) const
|
auto sia_provider::get_directory_item_count(const std::string &api_path) const
|
||||||
-> std::uint64_t {
|
-> std::uint64_t {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user