Reads a long JSON value with the given name from a parent JSON value.
| 254 | |
| 255 | /// Reads a long JSON value with the given name from a parent JSON value. |
| 256 | Status GetInt64Value(const Json::Value& parent, const char* name, |
| 257 | int64* result) { |
| 258 | Json::Value result_value; |
| 259 | TF_RETURN_IF_ERROR(GetValue(parent, name, &result_value)); |
| 260 | if (result_value.isNumeric()) { |
| 261 | *result = result_value.asInt64(); |
| 262 | return Status::OK(); |
| 263 | } |
| 264 | if (result_value.isString() && |
| 265 | strings::safe_strto64(result_value.asCString(), result)) { |
| 266 | return Status::OK(); |
| 267 | } |
| 268 | return errors::Internal( |
| 269 | "The field '", name, |
| 270 | "' in the JSON response was expected to be a number."); |
| 271 | } |
| 272 | |
| 273 | /// Reads a boolean JSON value with the given name from a parent JSON value. |
| 274 | Status GetBoolValue(const Json::Value& parent, const char* name, bool* result) { |
no test coverage detected