| #ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_AUTHZ_JSON_UTILS_H_ |
| #define THIRD_PARTY_MILOTIC_EXTERNAL_CC_AUTHZ_JSON_UTILS_H_ |
| |
| #include <cstddef> |
| #include <cstdint> |
| #include <optional> |
| #include <string> |
| #include <string_view> |
| |
| #include "nlohmann/json.hpp" |
| |
| namespace milotic::authz { |
| |
| const std::string* GetValueAsStringFromArray( |
| const nlohmann::json::array_t& array, std::size_t index); |
| const std::string* GetValueAsString(const nlohmann::json& root, |
| std::string_view key); |
| const std::string* GetValueAsString( |
| const nlohmann::json& root, const nlohmann::json::json_pointer& pointer); |
| const nlohmann::json* GetValueAsJson(const nlohmann::json& root, |
| std::string_view key); |
| const nlohmann::json::array_t* GetValueAsArray(const nlohmann::json& root, |
| std::string_view key); |
| const double* GetValueAsDouble(const nlohmann::json& root, |
| std::string_view key); |
| const int64_t* GetValueAsInt(const nlohmann::json& root, std::string_view key); |
| const uint64_t* GetValueAsUint(const nlohmann::json& root, |
| std::string_view key); |
| const bool* GetValueAsBool(const nlohmann::json& root, std::string_view key); |
| |
| std::optional<uint64_t> GetValueAsUintFromStringOrInteger( |
| const nlohmann::json& root, std::string_view key); |
| std::optional<double> GetValueAsDoubleFromFloatOrInteger( |
| const nlohmann::json& root, std::string_view key); |
| } // namespace milotic::authz |
| |
| #endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_AUTHZ_JSON_UTILS_H_ |