aboutsummaryrefslogtreecommitdiffstats
path: root/crates/common/src/api.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/common/src/api.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/common/src/api.rs b/crates/common/src/api.rs
new file mode 100644
index 00000000..0e34171d
--- /dev/null
+++ b/crates/common/src/api.rs
@@ -0,0 +1,22 @@
+use semver::Version;
+use serde::{Deserialize, Serialize};
+use std::borrow::Cow;
+use std::sync::LazyLock;
+
+// the usage of X- has been deprecated for quite along time, it turns out
+pub static ATUIN_HEADER_VERSION: &str = "Atuin-Version";
+pub static ATUIN_CARGO_VERSION: &str = env!("CARGO_PKG_VERSION");
+
+pub static ATUIN_VERSION: LazyLock<Version> =
+ LazyLock::new(|| Version::parse(ATUIN_CARGO_VERSION).expect("failed to parse self semver"));
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ErrorResponse<'a> {
+ pub reason: Cow<'a, str>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct IndexResponse {
+ pub homage: String,
+ pub version: String,
+}