diff --git a/src/api.rs b/src/api.rs index aea673a..1c8afec 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1176,12 +1176,20 @@ where // Deprecated Features // - pub async fn list_deprecated_features(&self) -> Result { + pub async fn list_all_deprecated_features(&self) -> Result { let response = self.http_get("deprecated-features", None, None).await?; let response = response.json().await?; Ok(response) } + pub async fn list_deprecated_features_in_use(&self) -> Result { + let response = self + .http_get("deprecated-features/used", None, None) + .await?; + let response = response.json().await?; + Ok(response) + } + // // Implementation // diff --git a/src/blocking_api.rs b/src/blocking_api.rs index a53af69..0dd5aeb 100644 --- a/src/blocking_api.rs +++ b/src/blocking_api.rs @@ -1033,12 +1033,18 @@ where // Deprecated Features // - pub fn list_deprecated_features(&self) -> Result { + pub fn list_all_deprecated_features(&self) -> Result { let response = self.http_get("deprecated-features", None, None)?; let response = response.json()?; Ok(response) } + pub fn list_deprecated_features_in_use(&self) -> Result { + let response = self.http_get("deprecated-features/used", None, None)?; + let response = response.json()?; + Ok(response) + } + // // OAuth 2 Configuration // diff --git a/src/responses.rs b/src/responses.rs index feae3a9..3fb5b1b 100644 --- a/src/responses.rs +++ b/src/responses.rs @@ -994,6 +994,8 @@ pub struct DeprecatedFeature { #[serde(rename = "desc")] pub description: String, pub deprecation_phase: DeprecationPhase, + pub doc_url: String, + pub provided_by: String, } impl Display for DeprecatedFeature { diff --git a/tests/deprecated_feature_tests.rs b/tests/deprecated_feature_tests.rs index 7bb4ecf..d617dda 100644 --- a/tests/deprecated_feature_tests.rs +++ b/tests/deprecated_feature_tests.rs @@ -11,8 +11,8 @@ // 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. -use rabbitmq_http_client::blocking_api::Client; use rabbitmq_http_client::responses::DeprecationPhase; +use rabbitmq_http_client::{blocking_api::Client, commons::QueueType, requests::QueueParams}; mod test_helpers; use crate::test_helpers::{endpoint, PASSWORD, USERNAME}; @@ -21,7 +21,7 @@ use crate::test_helpers::{endpoint, PASSWORD, USERNAME}; fn test_list_all_deprecated_features() { let endpoint = endpoint(); let rc = Client::new(&endpoint, USERNAME, PASSWORD); - let result = rc.list_deprecated_features(); + let result = rc.list_all_deprecated_features(); assert!(result.is_ok()); let vec = result.unwrap(); @@ -30,3 +30,26 @@ fn test_list_all_deprecated_features() { .into_iter() .any(|df| df.deprecation_phase == DeprecationPhase::PermittedByDefault)); } + +#[test] +fn test_list_deprecated_features_in_use() { + let endpoint = endpoint(); + let rc = Client::new(&endpoint, USERNAME, PASSWORD); + let vh = "/"; + let q = "test_list_deprecated_features_in_use"; + + rc.delete_queue(vh, q, true).unwrap(); + + let params = QueueParams::new(&q, QueueType::Classic, false, false, None); + rc.declare_queue(vh, ¶ms).unwrap(); + + let result2 = rc.list_deprecated_features_in_use(); + assert!(result2.is_ok()); + let vec = result2.unwrap(); + assert!(vec + .0 + .into_iter() + .any(|df| df.deprecation_phase == DeprecationPhase::PermittedByDefault)); + + rc.delete_queue(vh, q, true).unwrap(); +}