Skip to content

Commit

Permalink
Swap MessageList for Vec<GetMessage> here
Browse files Browse the repository at this point in the history
as it is easier for callers to deal with.
  • Loading branch information
michaelklishin committed Jan 19, 2025
1 parent d7603bb commit fb06993
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::error::Error;
use crate::error::Error::{ClientErrorResponse, NotFound, ServerErrorResponse};
use crate::responses::{
DeprecatedFeatureList, FeatureFlag, FeatureFlagList, FeatureFlagStability, FeatureFlagState,
MessageList, OAuthConfiguration,
GetMessage, OAuthConfiguration,
};
use crate::{
commons::{BindingDestinationType, SupportedProtocol, UserLimitTarget, VirtualHostLimitTarget},
Expand Down Expand Up @@ -1302,8 +1302,8 @@ where
queue: &str,
count: u32,
ack_mode: &str,
) -> Result<MessageList> {
let body = serde_json::json!({
) -> Result<Vec<GetMessage>> {
let body = json!({
"count": count,
"ackmode": ack_mode,
"encoding": "auto"
Expand Down
6 changes: 3 additions & 3 deletions src/blocking_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::error::Error;
use crate::error::Error::{ClientErrorResponse, NotFound, ServerErrorResponse};
use crate::responses::{
DeprecatedFeatureList, FeatureFlag, FeatureFlagList, FeatureFlagStability, FeatureFlagState,
MessageList, OAuthConfiguration,
GetMessage, OAuthConfiguration,
};
use crate::{
commons::{BindingDestinationType, SupportedProtocol, UserLimitTarget, VirtualHostLimitTarget},
Expand Down Expand Up @@ -1148,8 +1148,8 @@ where
queue: &str,
count: u32,
ack_mode: &str,
) -> Result<MessageList> {
let body = serde_json::json!({
) -> Result<Vec<GetMessage>> {
let body = json!({
"count": count,
"ackmode": ack_mode,
"encoding": "auto"
Expand Down
9 changes: 4 additions & 5 deletions tests/async_message_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// 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::responses::MessageList;
use rabbitmq_http_client::{
api::Client,
requests::{self, QueueParams},
Expand Down Expand Up @@ -61,7 +60,7 @@ async fn test_async_publish_and_get() {
let msg_list = result5.unwrap();
assert_eq!(
msg_list,
MessageList(vec![GetMessage {
vec![GetMessage {
payload_bytes: 11,
redelivered: false,
exchange: "".to_owned(),
Expand All @@ -70,7 +69,7 @@ async fn test_async_publish_and_get() {
properties: MessageProperties::default(),
payload: "rust test 1".to_owned(),
payload_encoding: "string".to_owned()
}])
}]
);

let result7 = rc.get_messages(vhost, queue, 1, "ack_requeue_false").await;
Expand All @@ -80,7 +79,7 @@ async fn test_async_publish_and_get() {
let msg_list2 = result7.unwrap();
assert_eq!(
msg_list2,
MessageList(vec![GetMessage {
vec![GetMessage {
payload_bytes: 11,
redelivered: false,
exchange: "".to_owned(),
Expand All @@ -89,7 +88,7 @@ async fn test_async_publish_and_get() {
properties: props,
payload: "rust test 2".to_owned(),
payload_encoding: "string".to_owned()
}])
}]
);

rc.delete_queue(vhost, queue, false).await.unwrap();
Expand Down
9 changes: 4 additions & 5 deletions tests/blocking_message_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// 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::responses::MessageList;
use rabbitmq_http_client::{
blocking_api::Client,
requests::{self, QueueParams},
Expand Down Expand Up @@ -57,7 +56,7 @@ fn test_publish_and_get() {
let msg_list = result5.unwrap();
assert_eq!(
msg_list,
MessageList(vec![GetMessage {
vec![GetMessage {
payload_bytes: 11,
redelivered: false,
exchange: "".to_owned(),
Expand All @@ -66,7 +65,7 @@ fn test_publish_and_get() {
properties: MessageProperties::default(),
payload: "rust test 1".to_owned(),
payload_encoding: "string".to_owned()
}])
}]
);

let result7 = rc.get_messages(vhost, queue, 1, "ack_requeue_false");
Expand All @@ -76,7 +75,7 @@ fn test_publish_and_get() {
let msg_list2 = result7.unwrap();
assert_eq!(
msg_list2,
MessageList(vec![GetMessage {
vec![GetMessage {
payload_bytes: 11,
redelivered: false,
exchange: "".to_owned(),
Expand All @@ -85,7 +84,7 @@ fn test_publish_and_get() {
properties: props,
payload: "rust test 2".to_owned(),
payload_encoding: "string".to_owned()
}])
}]
);

rc.delete_queue(vhost, queue, false).unwrap();
Expand Down

0 comments on commit fb06993

Please sign in to comment.