aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-08-22 15:41:49 -0700
committerBryan Newbold <bnewbold@archive.org>2020-08-22 15:41:49 -0700
commitbb552c9d0060cf49e187d1b06460a838ef19828d (patch)
treea1cb02c57a73e883a863f0520f435da207d4715f /src
parent754c2fa6b875b132ca39093678549b620e190817 (diff)
downloades-public-proxy-bb552c9d0060cf49e187d1b06460a838ef19828d.tar.gz
es-public-proxy-bb552c9d0060cf49e187d1b06460a838ef19828d.zip
start on test framework and query JSON parser
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..1ba6207
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,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>,
+}