This is an automated email from the ASF dual-hosted git repository.

hgruszecki pushed a commit to branch refactor-binary-7-http
in repository https://gitbox.apache.org/repos/asf/iggy.git

commit 2ffc373b5c0b637a54682c0771e875e40b43fc6f
Author: Hubert Gruszecki <[email protected]>
AuthorDate: Thu Mar 26 19:53:56 2026 +0100

    refactor(server): extract shared HTTP DTOs to iggy_common
    
    SDK and server HTTP handlers each defined private copies of
    the same request/response structs (LoginUser, GetSnapshot,
    StoreConsumerOffset, etc.) with only Serialize or Deserialize.
    This duplication meant field additions required coordinated
    changes in two places.
    
    Create 7 shared DTOs in iggy_common::http with both Serialize
    and Deserialize, then delete the 11 local copies from SDK and
    server. Also delete the empty types::command module (remnant
    of the now-removed Command trait).
    
    Net -88 lines across 24 files.
---
 .../delete_consumer_offset.rs}                     | 13 +++++----
 .../get_consumer_offset.rs}                        | 16 +++++++----
 core/common/src/http/consumer_offsets/mod.rs       |  4 +++
 .../store_consumer_offset.rs}                      | 16 +++++++----
 .../mod.rs => messages/flush_unsaved_buffer.rs}    | 13 +++++----
 core/common/src/http/messages/mod.rs               |  1 +
 .../login_with_personal_access_token.rs}           | 14 ++++++----
 core/common/src/http/personal_access_tokens/mod.rs |  1 +
 .../http/{users/mod.rs => system/get_snapshot.rs}  | 15 ++++++----
 core/common/src/http/system/mod.rs                 |  2 ++
 .../src/http/users/{mod.rs => login_user.rs}       | 19 +++++++++----
 core/common/src/http/users/mod.rs                  |  1 +
 core/common/src/lib.rs                             |  2 ++
 core/common/src/types/command/mod.rs               | 17 ------------
 core/common/src/types/mod.rs                       |  1 -
 core/sdk/src/http/consumer_offsets.rs              | 23 +++-------------
 core/sdk/src/http/messages.rs                      | 10 ++-----
 core/sdk/src/http/personal_access_tokens.rs        | 10 ++-----
 core/sdk/src/http/system.rs                        | 10 ++-----
 core/sdk/src/http/users.rs                         | 13 ++-------
 core/server/src/http/consumer_offsets.rs           | 32 ++++------------------
 core/server/src/http/personal_access_tokens.rs     | 11 ++------
 core/server/src/http/system.rs                     | 15 ++--------
 core/server/src/http/users.rs                      | 11 ++------
 24 files changed, 102 insertions(+), 168 deletions(-)

diff --git a/core/common/src/http/users/mod.rs 
b/core/common/src/http/consumer_offsets/delete_consumer_offset.rs
similarity index 82%
copy from core/common/src/http/users/mod.rs
copy to core/common/src/http/consumer_offsets/delete_consumer_offset.rs
index 7d70c2720..48436f334 100644
--- a/core/common/src/http/users/mod.rs
+++ b/core/common/src/http/consumer_offsets/delete_consumer_offset.rs
@@ -16,9 +16,10 @@
  * under the License.
  */
 
-pub mod change_password;
-pub mod create_user;
-pub mod defaults;
-pub mod delete_user;
-pub mod update_permissions;
-pub mod update_user;
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct DeleteConsumerOffset {
+    #[serde(default)]
+    pub partition_id: Option<u32>,
+}
diff --git a/core/common/src/http/users/mod.rs 
b/core/common/src/http/consumer_offsets/get_consumer_offset.rs
similarity index 74%
copy from core/common/src/http/users/mod.rs
copy to core/common/src/http/consumer_offsets/get_consumer_offset.rs
index 7d70c2720..cfce212bc 100644
--- a/core/common/src/http/users/mod.rs
+++ b/core/common/src/http/consumer_offsets/get_consumer_offset.rs
@@ -16,9 +16,13 @@
  * under the License.
  */
 
-pub mod change_password;
-pub mod create_user;
-pub mod defaults;
-pub mod delete_user;
-pub mod update_permissions;
-pub mod update_user;
+use crate::Consumer;
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct GetConsumerOffset {
+    #[serde(flatten)]
+    pub consumer: Consumer,
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub partition_id: Option<u32>,
+}
diff --git a/core/common/src/http/consumer_offsets/mod.rs 
b/core/common/src/http/consumer_offsets/mod.rs
index 31bd66e6e..5001595f6 100644
--- a/core/common/src/http/consumer_offsets/mod.rs
+++ b/core/common/src/http/consumer_offsets/mod.rs
@@ -15,3 +15,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
+pub mod delete_consumer_offset;
+pub mod get_consumer_offset;
+pub mod store_consumer_offset;
diff --git a/core/common/src/http/users/mod.rs 
b/core/common/src/http/consumer_offsets/store_consumer_offset.rs
similarity index 76%
copy from core/common/src/http/users/mod.rs
copy to core/common/src/http/consumer_offsets/store_consumer_offset.rs
index 7d70c2720..c1e1a5f76 100644
--- a/core/common/src/http/users/mod.rs
+++ b/core/common/src/http/consumer_offsets/store_consumer_offset.rs
@@ -16,9 +16,13 @@
  * under the License.
  */
 
-pub mod change_password;
-pub mod create_user;
-pub mod defaults;
-pub mod delete_user;
-pub mod update_permissions;
-pub mod update_user;
+use crate::Consumer;
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct StoreConsumerOffset {
+    #[serde(flatten)]
+    pub consumer: Consumer,
+    pub partition_id: Option<u32>,
+    pub offset: u64,
+}
diff --git a/core/common/src/http/users/mod.rs 
b/core/common/src/http/messages/flush_unsaved_buffer.rs
similarity index 83%
copy from core/common/src/http/users/mod.rs
copy to core/common/src/http/messages/flush_unsaved_buffer.rs
index 7d70c2720..a0c8720e9 100644
--- a/core/common/src/http/users/mod.rs
+++ b/core/common/src/http/messages/flush_unsaved_buffer.rs
@@ -16,9 +16,10 @@
  * under the License.
  */
 
-pub mod change_password;
-pub mod create_user;
-pub mod defaults;
-pub mod delete_user;
-pub mod update_permissions;
-pub mod update_user;
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct FlushUnsavedBuffer {
+    pub partition_id: u32,
+    pub fsync: bool,
+}
diff --git a/core/common/src/http/messages/mod.rs 
b/core/common/src/http/messages/mod.rs
index ba2da6a3f..105ca06d8 100644
--- a/core/common/src/http/messages/mod.rs
+++ b/core/common/src/http/messages/mod.rs
@@ -15,5 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
+pub mod flush_unsaved_buffer;
 pub mod poll_messages;
 pub mod send_messages;
diff --git a/core/common/src/http/users/mod.rs 
b/core/common/src/http/personal_access_tokens/login_with_personal_access_token.rs
similarity index 75%
copy from core/common/src/http/users/mod.rs
copy to 
core/common/src/http/personal_access_tokens/login_with_personal_access_token.rs
index 7d70c2720..155023d4c 100644
--- a/core/common/src/http/users/mod.rs
+++ 
b/core/common/src/http/personal_access_tokens/login_with_personal_access_token.rs
@@ -16,9 +16,11 @@
  * under the License.
  */
 
-pub mod change_password;
-pub mod create_user;
-pub mod defaults;
-pub mod delete_user;
-pub mod update_permissions;
-pub mod update_user;
+use secrecy::SecretString;
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct LoginWithPersonalAccessToken {
+    #[serde(serialize_with = "crate::utils::serde_secret::serialize_secret")]
+    pub token: SecretString,
+}
diff --git a/core/common/src/http/personal_access_tokens/mod.rs 
b/core/common/src/http/personal_access_tokens/mod.rs
index e9513d5a3..c70fca451 100644
--- a/core/common/src/http/personal_access_tokens/mod.rs
+++ b/core/common/src/http/personal_access_tokens/mod.rs
@@ -18,3 +18,4 @@
 
 pub mod create_personal_access_token;
 pub mod delete_personal_access_token;
+pub mod login_with_personal_access_token;
diff --git a/core/common/src/http/users/mod.rs 
b/core/common/src/http/system/get_snapshot.rs
similarity index 75%
copy from core/common/src/http/users/mod.rs
copy to core/common/src/http/system/get_snapshot.rs
index 7d70c2720..684c48e77 100644
--- a/core/common/src/http/users/mod.rs
+++ b/core/common/src/http/system/get_snapshot.rs
@@ -16,9 +16,12 @@
  * under the License.
  */
 
-pub mod change_password;
-pub mod create_user;
-pub mod defaults;
-pub mod delete_user;
-pub mod update_permissions;
-pub mod update_user;
+use crate::SnapshotCompression;
+use crate::SystemSnapshotType;
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct GetSnapshot {
+    pub compression: SnapshotCompression,
+    pub snapshot_types: Vec<SystemSnapshotType>,
+}
diff --git a/core/common/src/http/system/mod.rs 
b/core/common/src/http/system/mod.rs
index 31bd66e6e..58dcaf4e1 100644
--- a/core/common/src/http/system/mod.rs
+++ b/core/common/src/http/system/mod.rs
@@ -15,3 +15,5 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
+pub mod get_snapshot;
diff --git a/core/common/src/http/users/mod.rs 
b/core/common/src/http/users/login_user.rs
similarity index 68%
copy from core/common/src/http/users/mod.rs
copy to core/common/src/http/users/login_user.rs
index 7d70c2720..ae0757407 100644
--- a/core/common/src/http/users/mod.rs
+++ b/core/common/src/http/users/login_user.rs
@@ -16,9 +16,16 @@
  * under the License.
  */
 
-pub mod change_password;
-pub mod create_user;
-pub mod defaults;
-pub mod delete_user;
-pub mod update_permissions;
-pub mod update_user;
+use secrecy::SecretString;
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct LoginUser {
+    pub username: String,
+    #[serde(serialize_with = "crate::utils::serde_secret::serialize_secret")]
+    pub password: SecretString,
+    #[serde(default)]
+    pub version: Option<String>,
+    #[serde(default)]
+    pub context: Option<String>,
+}
diff --git a/core/common/src/http/users/mod.rs 
b/core/common/src/http/users/mod.rs
index 7d70c2720..52e4c7aaa 100644
--- a/core/common/src/http/users/mod.rs
+++ b/core/common/src/http/users/mod.rs
@@ -20,5 +20,6 @@ pub mod change_password;
 pub mod create_user;
 pub mod defaults;
 pub mod delete_user;
+pub mod login_user;
 pub mod update_permissions;
 pub mod update_user;
diff --git a/core/common/src/lib.rs b/core/common/src/lib.rs
index 6cdd1f821..044caec0f 100644
--- a/core/common/src/lib.rs
+++ b/core/common/src/lib.rs
@@ -40,11 +40,13 @@ pub use certificates::generate_self_signed_certificate;
 pub use chrono::{DateTime, Duration as ChronoDuration, Utc};
 pub use deduplication::MessageDeduplicator;
 pub use http::consumer_groups::*;
+pub use http::consumer_offsets::*;
 pub use http::messages::*;
 pub use http::partitions::*;
 pub use http::personal_access_tokens::*;
 pub use http::segments::*;
 pub use http::streams::*;
+pub use http::system::*;
 pub use http::topics::*;
 pub use http::users::*;
 pub use sender::{
diff --git a/core/common/src/types/command/mod.rs 
b/core/common/src/types/command/mod.rs
deleted file mode 100644
index 31bd66e6e..000000000
--- a/core/common/src/types/command/mod.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
diff --git a/core/common/src/types/mod.rs b/core/common/src/types/mod.rs
index 06ab6914a..3e7321a80 100644
--- a/core/common/src/types/mod.rs
+++ b/core/common/src/types/mod.rs
@@ -19,7 +19,6 @@ pub(crate) mod args;
 pub(crate) mod client;
 pub(crate) mod client_state;
 pub(crate) mod cluster;
-pub(crate) mod command;
 pub(crate) mod compression;
 pub(crate) mod configuration;
 pub(crate) mod consumer;
diff --git a/core/sdk/src/http/consumer_offsets.rs 
b/core/sdk/src/http/consumer_offsets.rs
index 4c3a07012..fe7435506 100644
--- a/core/sdk/src/http/consumer_offsets.rs
+++ b/core/sdk/src/http/consumer_offsets.rs
@@ -22,24 +22,9 @@ use crate::prelude::Identifier;
 use crate::prelude::IggyError;
 use async_trait::async_trait;
 use iggy_common::ConsumerOffsetClient;
+use iggy_common::get_consumer_offset::GetConsumerOffset;
+use iggy_common::store_consumer_offset::StoreConsumerOffset;
 use iggy_common::{Consumer, ConsumerOffsetInfo};
-use serde::Serialize;
-
-#[derive(Serialize)]
-struct StoreOffsetRequest {
-    #[serde(flatten)]
-    consumer: Consumer,
-    partition_id: Option<u32>,
-    offset: u64,
-}
-
-#[derive(Serialize)]
-struct GetOffsetQuery {
-    #[serde(flatten)]
-    consumer: Consumer,
-    #[serde(skip_serializing_if = "Option::is_none")]
-    partition_id: Option<u32>,
-}
 
 #[async_trait]
 impl ConsumerOffsetClient for HttpClient {
@@ -53,7 +38,7 @@ impl ConsumerOffsetClient for HttpClient {
     ) -> Result<(), IggyError> {
         self.put(
             &get_path(&stream_id.as_cow_str(), &topic_id.as_cow_str()),
-            &StoreOffsetRequest {
+            &StoreConsumerOffset {
                 consumer: consumer.clone(),
                 partition_id,
                 offset,
@@ -73,7 +58,7 @@ impl ConsumerOffsetClient for HttpClient {
         let response = self
             .get_with_query(
                 &get_path(&stream_id.as_cow_str(), &topic_id.as_cow_str()),
-                &GetOffsetQuery {
+                &GetConsumerOffset {
                     consumer: consumer.clone(),
                     partition_id,
                 },
diff --git a/core/sdk/src/http/messages.rs b/core/sdk/src/http/messages.rs
index 581a04160..50153f004 100644
--- a/core/sdk/src/http/messages.rs
+++ b/core/sdk/src/http/messages.rs
@@ -25,13 +25,7 @@ use crate::prelude::{
 use async_trait::async_trait;
 use iggy_common::IggyMessagesBatch;
 use iggy_common::MessageClient;
-use serde::Serialize;
-
-#[derive(Serialize)]
-struct FlushUnsavedBufferQuery {
-    partition_id: u32,
-    fsync: bool,
-}
+use iggy_common::flush_unsaved_buffer::FlushUnsavedBuffer;
 
 #[async_trait]
 impl MessageClient for HttpClient {
@@ -103,7 +97,7 @@ impl MessageClient for HttpClient {
                     partition_id,
                     fsync,
                 ),
-                &FlushUnsavedBufferQuery {
+                &FlushUnsavedBuffer {
                     partition_id,
                     fsync,
                 },
diff --git a/core/sdk/src/http/personal_access_tokens.rs 
b/core/sdk/src/http/personal_access_tokens.rs
index fd53224e7..902f0baf4 100644
--- a/core/sdk/src/http/personal_access_tokens.rs
+++ b/core/sdk/src/http/personal_access_tokens.rs
@@ -24,15 +24,9 @@ use iggy_common::IdentityInfo;
 use iggy_common::PersonalAccessTokenClient;
 use iggy_common::PersonalAccessTokenExpiry;
 use iggy_common::create_personal_access_token::CreatePersonalAccessToken;
+use 
iggy_common::login_with_personal_access_token::LoginWithPersonalAccessToken;
 use iggy_common::{PersonalAccessTokenInfo, RawPersonalAccessToken};
 use secrecy::SecretString;
-use serde::Serialize;
-
-#[derive(Serialize)]
-struct LoginWithPatRequest {
-    #[serde(serialize_with = "iggy_common::serde_secret::serialize_secret")]
-    token: SecretString,
-}
 
 const PATH: &str = "/personal-access-tokens";
 
@@ -80,7 +74,7 @@ impl PersonalAccessTokenClient for HttpClient {
         let response = self
             .post(
                 &format!("{PATH}/login"),
-                &LoginWithPatRequest {
+                &LoginWithPersonalAccessToken {
                     token: SecretString::from(token),
                 },
             )
diff --git a/core/sdk/src/http/system.rs b/core/sdk/src/http/system.rs
index 8f1724d70..295925c7a 100644
--- a/core/sdk/src/http/system.rs
+++ b/core/sdk/src/http/system.rs
@@ -23,15 +23,9 @@ use async_trait::async_trait;
 use iggy_common::Snapshot;
 use iggy_common::Stats;
 use iggy_common::SystemClient;
+use iggy_common::get_snapshot::GetSnapshot;
 use iggy_common::{ClientInfo, ClientInfoDetails};
 use iggy_common::{SnapshotCompression, SystemSnapshotType};
-use serde::Serialize;
-
-#[derive(Serialize)]
-struct GetSnapshotRequest {
-    compression: SnapshotCompression,
-    snapshot_types: Vec<SystemSnapshotType>,
-}
 
 const PING: &str = "/ping";
 const CLIENTS: &str = "/clients";
@@ -96,7 +90,7 @@ impl SystemClient for HttpClient {
         let response = self
             .post(
                 SNAPSHOT,
-                &GetSnapshotRequest {
+                &GetSnapshot {
                     compression,
                     snapshot_types,
                 },
diff --git a/core/sdk/src/http/users.rs b/core/sdk/src/http/users.rs
index 29f7215c1..08ad3b504 100644
--- a/core/sdk/src/http/users.rs
+++ b/core/sdk/src/http/users.rs
@@ -23,20 +23,11 @@ use async_trait::async_trait;
 use iggy_common::UserClient;
 use iggy_common::change_password::ChangePassword;
 use iggy_common::create_user::CreateUser;
+use iggy_common::login_user::LoginUser;
 use iggy_common::update_permissions::UpdatePermissions;
 use iggy_common::update_user::UpdateUser;
 use iggy_common::{IdentityInfo, Permissions, UserInfo, UserInfoDetails, 
UserStatus};
 use secrecy::SecretString;
-use serde::Serialize;
-
-#[derive(Serialize)]
-struct LoginUserRequest {
-    username: String,
-    #[serde(serialize_with = "iggy_common::serde_secret::serialize_secret")]
-    password: SecretString,
-    version: Option<String>,
-    context: Option<String>,
-}
 
 const PATH: &str = "/users";
 
@@ -155,7 +146,7 @@ impl UserClient for HttpClient {
         let response = self
             .post(
                 &format!("{PATH}/login"),
-                &LoginUserRequest {
+                &LoginUser {
                     username: username.to_string(),
                     password: SecretString::from(password),
                     version: Some(env!("CARGO_PKG_VERSION").to_string()),
diff --git a/core/server/src/http/consumer_offsets.rs 
b/core/server/src/http/consumer_offsets.rs
index 0101d979b..9564b6614 100644
--- a/core/server/src/http/consumer_offsets.rs
+++ b/core/server/src/http/consumer_offsets.rs
@@ -30,31 +30,11 @@ use iggy_common::Consumer;
 use iggy_common::ConsumerOffsetInfo;
 use iggy_common::Identifier;
 use iggy_common::IggyError;
-use serde::Deserialize;
+use iggy_common::delete_consumer_offset::DeleteConsumerOffset;
+use iggy_common::get_consumer_offset::GetConsumerOffset;
+use iggy_common::store_consumer_offset::StoreConsumerOffset;
 use std::sync::Arc;
 
-#[derive(Debug, Deserialize)]
-struct GetConsumerOffsetQuery {
-    #[serde(flatten)]
-    consumer: Consumer,
-    #[serde(default)]
-    partition_id: Option<u32>,
-}
-
-#[derive(Debug, Deserialize)]
-struct StoreConsumerOffsetBody {
-    #[serde(flatten)]
-    consumer: Consumer,
-    partition_id: Option<u32>,
-    offset: u64,
-}
-
-#[derive(Debug, Deserialize)]
-struct DeleteConsumerOffsetQuery {
-    #[serde(default)]
-    partition_id: Option<u32>,
-}
-
 pub fn router(state: Arc<AppState>) -> Router {
     Router::new()
         .route(
@@ -73,7 +53,7 @@ async fn get_consumer_offset(
     State(state): State<Arc<AppState>>,
     Extension(identity): Extension<Identity>,
     Path((stream_id, topic_id)): Path<(String, String)>,
-    query: Query<GetConsumerOffsetQuery>,
+    query: Query<GetConsumerOffset>,
 ) -> Result<Json<ConsumerOffsetInfo>, CustomError> {
     let stream_id = Identifier::from_str_value(&stream_id)?;
     let topic_id = Identifier::from_str_value(&topic_id)?;
@@ -111,7 +91,7 @@ async fn store_consumer_offset(
     State(state): State<Arc<AppState>>,
     Extension(identity): Extension<Identity>,
     Path((stream_id, topic_id)): Path<(String, String)>,
-    Json(body): Json<StoreConsumerOffsetBody>,
+    Json(body): Json<StoreConsumerOffset>,
 ) -> Result<StatusCode, CustomError> {
     let stream_id = Identifier::from_str_value(&stream_id)?;
     let topic_id = Identifier::from_str_value(&topic_id)?;
@@ -142,7 +122,7 @@ async fn delete_consumer_offset(
     State(state): State<Arc<AppState>>,
     Extension(identity): Extension<Identity>,
     Path((stream_id, topic_id, consumer_id)): Path<(String, String, String)>,
-    query: Query<DeleteConsumerOffsetQuery>,
+    query: Query<DeleteConsumerOffset>,
 ) -> Result<StatusCode, CustomError> {
     let stream_id_ident = Identifier::from_str_value(&stream_id)?;
     let topic_id_ident = Identifier::from_str_value(&topic_id)?;
diff --git a/core/server/src/http/personal_access_tokens.rs 
b/core/server/src/http/personal_access_tokens.rs
index 927a761b6..dfd4870f0 100644
--- a/core/server/src/http/personal_access_tokens.rs
+++ b/core/server/src/http/personal_access_tokens.rs
@@ -38,17 +38,12 @@ use iggy_common::IdentityInfo;
 use iggy_common::PersonalAccessTokenInfo;
 use iggy_common::Validatable;
 use iggy_common::create_personal_access_token::CreatePersonalAccessToken;
+use 
iggy_common::login_with_personal_access_token::LoginWithPersonalAccessToken;
 use iggy_common::{IggyError, RawPersonalAccessToken};
-use secrecy::{ExposeSecret, SecretString};
-use serde::Deserialize;
+use secrecy::ExposeSecret;
 use std::sync::Arc;
 use tracing::instrument;
 
-#[derive(Debug, Deserialize)]
-struct LoginWithPatBody {
-    pub token: SecretString,
-}
-
 pub fn router(state: Arc<AppState>) -> Router {
     Router::new()
         .route(
@@ -140,7 +135,7 @@ async fn delete_personal_access_token(
 #[instrument(skip_all, name = "trace_login_with_personal_access_token")]
 async fn login_with_personal_access_token(
     State(state): State<Arc<AppState>>,
-    Json(command): Json<LoginWithPatBody>,
+    Json(command): Json<LoginWithPersonalAccessToken>,
 ) -> Result<Json<IdentityInfo>, CustomError> {
     let user = state
         .shard
diff --git a/core/server/src/http/system.rs b/core/server/src/http/system.rs
index e5021266a..e1a229f9a 100644
--- a/core/server/src/http/system.rs
+++ b/core/server/src/http/system.rs
@@ -32,21 +32,12 @@ use bytes::Bytes;
 use chrono::Local;
 use err_trail::ErrContext;
 use iggy_common::Stats;
-use iggy_common::{
-    ClientInfo, ClientInfoDetails, ClusterMetadata, IggyError, 
SnapshotCompression,
-    SystemSnapshotType,
-};
+use iggy_common::get_snapshot::GetSnapshot;
+use iggy_common::{ClientInfo, ClientInfoDetails, ClusterMetadata, IggyError, 
SystemSnapshotType};
 use send_wrapper::SendWrapper;
-use serde::Deserialize;
 use std::sync::Arc;
 use tracing::error;
 
-#[derive(Debug, Deserialize)]
-struct GetSnapshotBody {
-    pub snapshot_types: Vec<SystemSnapshotType>,
-    pub compression: SnapshotCompression,
-}
-
 const NAME: &str = "Iggy API";
 const PONG: &str = "pong";
 
@@ -138,7 +129,7 @@ async fn get_clients(
 async fn get_snapshot(
     State(state): State<Arc<AppState>>,
     Extension(_identity): Extension<Identity>,
-    Json(command): Json<GetSnapshotBody>,
+    Json(command): Json<GetSnapshot>,
 ) -> Result<impl IntoResponse, CustomError> {
     if command.snapshot_types.contains(&SystemSnapshotType::All) && 
command.snapshot_types.len() > 1
     {
diff --git a/core/server/src/http/users.rs b/core/server/src/http/users.rs
index cb6020674..4dcc7f73d 100644
--- a/core/server/src/http/users.rs
+++ b/core/server/src/http/users.rs
@@ -45,19 +45,14 @@ use iggy_binary_protocol::requests::users::{
 use iggy_common::Identifier;
 use iggy_common::IdentityInfo;
 use iggy_common::Validatable;
+use iggy_common::login_user::LoginUser;
 use iggy_common::{IggyError, UserInfo, UserInfoDetails};
-use secrecy::{ExposeSecret, SecretString};
+use secrecy::ExposeSecret;
 use send_wrapper::SendWrapper;
 use serde::Deserialize;
 use std::sync::Arc;
 use tracing::instrument;
 
-#[derive(Debug, Deserialize)]
-struct LoginUserBody {
-    pub username: String,
-    pub password: SecretString,
-}
-
 pub fn router(state: Arc<AppState>) -> Router {
     Router::new()
         .route("/users", get(get_users).post(create_user))
@@ -262,7 +257,7 @@ async fn delete_user(
 #[instrument(skip_all, name = "trace_login_user")]
 async fn login_user(
     State(state): State<Arc<AppState>>,
-    Json(command): Json<LoginUserBody>,
+    Json(command): Json<LoginUser>,
 ) -> Result<Json<IdentityInfo>, CustomError> {
     let user = state
         .shard

Reply via email to