68 std::string json = R
"({"error":{"code":")" + error.code + R"(","message":")" +
69 error.message + R"("})";
80 std::string_view message) {
81 return std::string(R
"({"error":{"code":")") + std::string(code) +
82 R"(","message":")" + std::string(message) + R"("}})";
90[[nodiscard]]
inline std::string
92 return std::string(R
"({"status":"success","message":")") +
93 std::string(message) + R"("})";
103 result.reserve(s.size() + 10);
std::string to_json(const api_error &error)
Create JSON error response body.
std::string make_error_json(std::string_view code, std::string_view message)
Create JSON error response body with details.
std::string json_escape(std::string_view s)
Escape a string for JSON.
http_status
Common HTTP status codes.
std::string make_success_json(std::string_view message="OK")
Create success response with optional message.
Standard API error structure.