* @brief Pack an inner CommandResponse into a step record for steps[] arrays. */
| 61 | * @brief Pack an inner CommandResponse into a step record for steps[] arrays. |
| 62 | */ |
| 63 | static QJsonObject toStep(const QString& label, const API::CommandResponse& r) |
| 64 | { |
| 65 | QJsonObject step; |
| 66 | step[QStringLiteral("step")] = label; |
| 67 | step[QStringLiteral("success")] = r.success; |
| 68 | if (r.success) { |
| 69 | if (!r.result.isEmpty()) |
| 70 | step[QStringLiteral("result")] = r.result; |
| 71 | } else { |
| 72 | QJsonObject err; |
| 73 | err[QStringLiteral("code")] = r.errorCode; |
| 74 | err[QStringLiteral("message")] = r.errorMessage; |
| 75 | if (!r.errorData.isEmpty()) |
| 76 | err[QStringLiteral("data")] = r.errorData; |
| 77 | |
| 78 | step[QStringLiteral("error")] = err; |
| 79 | } |
| 80 | return step; |
| 81 | } |
| 82 | |
| 83 | //-------------------------------------------------------------------------------------------------- |
| 84 | // assistant.snapshot: pass-through to project.snapshot |
no test coverage detected