winterbaume_iotdataplane/
wire.rs1#![allow(
6 dead_code,
7 unused_variables,
8 clippy::let_and_return,
9 clippy::single_match
10)]
11
12#[allow(unused_imports)]
13use http::header::HeaderName;
14use winterbaume_core::MockResponse;
15
16pub use super::model::*;
17
18pub fn serialize_delete_connection_response() -> MockResponse {
20 MockResponse::rest_json(200, "{}")
21}
22
23pub fn serialize_delete_thing_shadow_response(result: &DeleteThingShadowResponse) -> MockResponse {
25 let status = 200_u16;
26 let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
27 MockResponse::rest_json(status, body)
28}
29
30pub fn serialize_get_retained_message_response(
32 result: &GetRetainedMessageResponse,
33) -> MockResponse {
34 let status = 200_u16;
35 let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
36 MockResponse::rest_json(status, body)
37}
38
39pub fn serialize_get_thing_shadow_response(result: &GetThingShadowResponse) -> MockResponse {
41 let status = 200_u16;
42 let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
43 MockResponse::rest_json(status, body)
44}
45
46pub fn serialize_list_named_shadows_for_thing_response(
48 result: &ListNamedShadowsForThingResponse,
49) -> MockResponse {
50 let status = 200_u16;
51 let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
52 MockResponse::rest_json(status, body)
53}
54
55pub fn serialize_list_retained_messages_response(
57 result: &ListRetainedMessagesResponse,
58) -> MockResponse {
59 let status = 200_u16;
60 let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
61 MockResponse::rest_json(status, body)
62}
63
64pub fn serialize_publish_response() -> MockResponse {
66 MockResponse::rest_json(200, "{}")
67}
68
69pub fn serialize_update_thing_shadow_response(result: &UpdateThingShadowResponse) -> MockResponse {
71 let status = 200_u16;
72 let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
73 MockResponse::rest_json(status, body)
74}