use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BrowsableResponse {
pub data: serde_json::Value,
pub metadata: ResponseMetadata,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ResponseMetadata {
pub status: u16,
pub method: String,
pub path: String,
pub headers: HashMap<String, String>,
}
impl BrowsableResponse {
pub fn new(data: serde_json::Value, metadata: ResponseMetadata) -> Self {
Self { data, metadata }
}
pub fn success(data: serde_json::Value, method: String, path: String) -> Self {
Self {
data,
metadata: ResponseMetadata {
status: 200,
method,
path,
headers: HashMap::new(),
},
}
}
}