use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiResponseBody<T> {
pub was_successful: bool,
pub data: Option<T>,
pub message: Option<String>,
}
impl ApiResponseBody<Value> {
pub fn into_json_body(self) -> String {
json!({
"wasSuccessful": self.was_successful,
"data": self.data,
"message": self.message,
})
.to_string()
}
}