File size: 725 Bytes
af8fddb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AppResult {
    pub title: String,
    pub app_id: String,
    pub url: String,
    pub icon: String,
    pub developer: String,
    pub price: String,
    pub rating: Option<f64>,
    pub store: String,
}

#[derive(Debug, Serialize)]
pub struct SearchResponse {
    pub query: String,
    pub results: Vec<AppResult>,
    pub count: usize,
}

#[derive(Debug, Deserialize)]
pub struct SearchQuery {
    pub q: String,
    #[serde(default = "default_store")]
    pub store: String,
    #[serde(default = "default_limit")]
    pub limit: usize,
}

fn default_store() -> String { "both".into() }
fn default_limit() -> usize { 25 }