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::Result;
6use crate::models::bugs::BugsResponse;
7use crate::models::crash_pings::{CrashPingStackSummary, CrashPingsSummary};
8use crate::models::{CorrelationsResponse, ProcessedCrash, SearchResponse};
9
10pub fn format_bugs(response: &BugsResponse) -> Result<String> {
11    Ok(serde_json::to_string_pretty(response)?)
12}
13
14pub fn format_crash(crash: &ProcessedCrash) -> Result<String> {
15    Ok(serde_json::to_string_pretty(crash)?)
16}
17
18pub fn format_search(response: &SearchResponse) -> Result<String> {
19    Ok(serde_json::to_string_pretty(response)?)
20}
21
22pub fn format_correlations(response: &CorrelationsResponse) -> Result<String> {
23    Ok(serde_json::to_string_pretty(response)?)
24}
25
26pub fn format_crash_pings(summary: &CrashPingsSummary) -> Result<String> {
27    Ok(serde_json::to_string_pretty(summary)?)
28}
29
30pub fn format_crash_ping_stack(summary: &CrashPingStackSummary) -> Result<String> {
31    Ok(serde_json::to_string_pretty(summary)?)
32}