Skip to main content

socorro_cli/output/
json.rs

1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5use crate::models::crash_pings::{CrashPingStackSummary, CrashPingsSummary};
6use crate::models::{CorrelationsResponse, ProcessedCrash, SearchResponse};
7use crate::Result;
8
9pub fn format_crash(crash: &ProcessedCrash) -> Result<String> {
10    Ok(serde_json::to_string_pretty(crash)?)
11}
12
13pub fn format_search(response: &SearchResponse) -> Result<String> {
14    Ok(serde_json::to_string_pretty(response)?)
15}
16
17pub fn format_correlations(response: &CorrelationsResponse) -> Result<String> {
18    Ok(serde_json::to_string_pretty(response)?)
19}
20
21pub fn format_crash_pings(summary: &CrashPingsSummary) -> Result<String> {
22    Ok(serde_json::to_string_pretty(summary)?)
23}
24
25pub fn format_crash_ping_stack(summary: &CrashPingStackSummary) -> Result<String> {
26    Ok(serde_json::to_string_pretty(summary)?)
27}