aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
blob: 1ba620732bc9706c34b7ad442b550206427274a2 (plain)
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
34
35

use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct ApiRequest {
    pub method: String,
    pub path_and_query: String,
    pub body: Option<ApiBody>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct ApiBody {
    pub query: Option<ApiQuery>,
    pub from: Option<u32>,
    pub size: Option<u32>,
    pub sort: Option<String>, // XXX
    pub slice: Option<String>, // XXX
}

#[derive(Serialize, Deserialize, Debug)]
pub enum ApiQuery {
    #[serde(rename = "match")]
    Match(MatchQuery),
}

#[derive(Serialize, Deserialize, Debug)]
pub struct MatchQuery {
    message: QueryField,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct QueryField{
    query: String,
    fuzziness: Option<String>,
}