#[derive(Debug, Clone)]
pub struct JournalClient<T> {
client: T,
path: String,
}
impl<T> JournalClient<T>
where
T: crate::client::Client,
{
pub fn new(client: T, parent_path: &str) -> Self {
Self {
client,
path: format!("{}{}", parent_path, "/journal"),
}
}
}
impl<T> JournalClient<T>
where
T: crate::client::Client,
{
#[doc = "Read Journal"]
#[doc = ""]
#[doc = "Permission check: perm(\"/nodes/{node}\", [\"Sys.Syslog\"])"]
pub async fn get(&self, params: GetParams) -> Result<Vec<String>, T::Error> {
let path = self.path.to_string();
let optional_vec: Option<Vec<String>> = self.client.get(&path, ¶ms).await?;
Ok(optional_vec.unwrap_or_default())
}
}
#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
pub struct GetParams {
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "End before the given Cursor. Conflicts with 'until'"]
#[doc = ""]
pub endcursor: Option<String>,
#[serde(
serialize_with = "crate::types::serialize_unsigned_int_optional",
deserialize_with = "crate::types::deserialize_unsigned_int_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Limit to the last X lines. Conflicts with a range."]
#[doc = ""]
pub lastentries: Option<u64>,
#[serde(
serialize_with = "crate::types::serialize_unsigned_int_optional",
deserialize_with = "crate::types::deserialize_unsigned_int_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Display all log since this UNIX epoch. Conflicts with 'startcursor'."]
#[doc = ""]
pub since: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Start after the given Cursor. Conflicts with 'since'"]
#[doc = ""]
pub startcursor: Option<String>,
#[serde(
serialize_with = "crate::types::serialize_unsigned_int_optional",
deserialize_with = "crate::types::deserialize_unsigned_int_optional"
)]
#[serde(skip_serializing_if = "Option::is_none", default)]
#[doc = "Display all log until this UNIX epoch. Conflicts with 'endcursor'."]
#[doc = ""]
pub until: Option<u64>,
#[serde(
flatten,
default,
skip_serializing_if = "::std::collections::HashMap::is_empty"
)]
pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
}