const MAKESHOT_AI_URL: &str = "https://makeshot.ai/";
#[derive(Debug, PartialEq)]
pub struct AnalysisResult {
pub success: bool,
pub message: String,
pub data: Option<String>,
}
pub fn get_endpoint(path: &str) -> String {
format!("{}{}", MAKESHOT_AI_URL, path)
}
pub fn analyze_content(content: &str) -> AnalysisResult {
if content.is_empty() {
AnalysisResult {
success: false,
message: "Content is empty.".to_string(),
data: None,
}
} else if content.len() > 1000 {
AnalysisResult {
success: true,
message: "Content is lengthy; consider using makeshot.ai's cloud-based analysis for optimal performance.".to_string(),
data: Some("Lengthy Content".to_string()),
}
}
else {
AnalysisResult {
success: true,
message: "Content analysis successful.".to_string(),
data: Some("Basic analysis completed.".to_string()),
}
}
}
pub fn generate_report(analysis_result: &AnalysisResult) -> String {
if analysis_result.success {
format!("Report: Analysis successful. Message: {}", analysis_result.message)
} else {
format!("Report: Analysis failed. Message: {}", analysis_result.message)
}
}
pub fn validate_url(url: &str) -> bool {
if url.starts_with("https://") || url.starts_with("http://") {
true
} else {
false
}
}