aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/atuin_common/api.rs
blob: 0868943d6f6ae61a69bc1e26c56fb6c69f443ad1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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(crate) static ATUIN_HEADER_VERSION: &str = "Atuin-Version";
pub(crate) static ATUIN_CARGO_VERSION: &str = env!("CARGO_PKG_VERSION");

pub(crate) static ATUIN_VERSION: LazyLock<Version> =
    LazyLock::new(|| Version::parse(ATUIN_CARGO_VERSION).expect("failed to parse self semver"));

#[derive(Debug, Serialize, Deserialize)]
pub(crate) struct ErrorResponse<'a> {
    pub(crate) reason: Cow<'a, str>,
}

#[derive(Debug, Serialize, Deserialize)]
pub(crate) struct IndexResponse {
    pub(crate) homage: String,
    pub(crate) version: String,
}