From 96402420c13b45fc7e8a4c36e76e4e0d5ffe5cff Mon Sep 17 00:00:00 2001 From: Vincent Stuyck Date: Sun, 11 Jan 2026 22:33:03 +0100 Subject: [PATCH] add bones for change activations --- src/api/activations.rs | 44 ++++++++++++++++++++++++++++++++++++++++++ src/api/mod.rs | 1 + src/api/tags.rs | 5 ++--- src/client.rs | 14 ++++++++++---- 4 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 src/api/activations.rs diff --git a/src/api/activations.rs b/src/api/activations.rs new file mode 100644 index 0000000..625ba25 --- /dev/null +++ b/src/api/activations.rs @@ -0,0 +1,44 @@ +use serde::{Deserialize, Serialize}; + +use crate::{ApiClient, Client, Result}; + + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(JsonSchema))] +pub struct ChangeActivation; + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(JsonSchema))] +pub struct PendingChange; + +impl From<&Client> for ApiClient { + fn from(value: &Client) -> Self { + Self::new(value) + } +} + +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(JsonSchema))] +pub struct ActivateChangeRequest { + redirect: bool, + sites: Vec, + force_foreign_changes: bool +} + +impl ApiClient { + pub async fn activate(&self) -> Result<()> { + todo!() + } + pub async fn await_activation(&self, activation_id: &str) -> Result<()> { + todo!() + } + pub async fn read_current_activations(&self) -> Result> { + todo!() + } + pub async fn bulk_read_pending_changes(&self) -> Result> { + todo!() + } + pub async fn read_activation_status(&self, activation_id: &str) -> Result { + todo!() + } +} diff --git a/src/api/mod.rs b/src/api/mod.rs index 231f33b..26860bc 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1,3 +1,4 @@ +pub mod activations; pub mod folders; pub mod hosts; pub mod groups; diff --git a/src/api/tags.rs b/src/api/tags.rs index 20b59ea..4fcdc76 100644 --- a/src/api/tags.rs +++ b/src/api/tags.rs @@ -125,11 +125,11 @@ impl TagUpdateRequest { #[cfg_attr(feature = "schemars", derive(JsonSchema))] pub struct TagDeleteQuery { repair: bool, - mode: TagDeleteMode + mode: Option } impl TagDeleteQuery { - pub fn new(repair: bool, mode: TagDeleteMode) -> Self { + pub fn new(repair: bool, mode: Option) -> Self { Self { repair, mode } } } @@ -140,7 +140,6 @@ pub enum TagDeleteMode { Abort, #[default] Delete, Remove, - Null } impl DomainExtension for TagGroup { diff --git a/src/client.rs b/src/client.rs index 5bcb946..ec86295 100644 --- a/src/client.rs +++ b/src/client.rs @@ -433,20 +433,26 @@ impl Display for BulkAction { } } -pub struct ApiClient { +pub struct ApiClient { pub(crate) inner: Arc, _marker: PhantomData, } -impl From<&Client> for ApiClient { - fn from(value: &Client) -> Self { +impl ApiClient { + pub(crate) fn new(inner: &Client) -> Self { Self { - inner: value.0.clone(), + inner: inner.0.clone(), _marker: Default::default(), } } } +impl From<&Client> for ApiClient { + fn from(value: &Client) -> Self { + Self::new(value) + } +} + impl ApiClient { pub async fn create( &self,