aboutsummaryrefslogtreecommitdiffstats
path: root/crates/common/src/api.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-09 22:00:59 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-09 22:00:59 +0200
commit620cf8fa33835c1ce1e56b1028ff6e2a6fbe0f39 (patch)
treee97e54ff112c8e3fa9f88335bfd1275420a4d69f /crates/common/src/api.rs
parentchore: Separate daemon, client, server, and lib into crates (diff)
downloadatuin-620cf8fa33835c1ce1e56b1028ff6e2a6fbe0f39.zip
chore: Add more things
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,
+}