From eeb46dc84d34c5ea5f43ed8b7b0b60854e204d59 Mon Sep 17 00:00:00 2001 From: phoenix Date: Thu, 4 Jun 2026 21:05:11 -0400 Subject: [PATCH] Added function to convert response to a json value --- src/twilio/api/mod.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/twilio/api/mod.rs b/src/twilio/api/mod.rs index 86d589d..fe0e99b 100644 --- a/src/twilio/api/mod.rs +++ b/src/twilio/api/mod.rs @@ -1,5 +1,27 @@ pub mod types; +pub async fn popp(response: reqwest::Response) -> serde_json::Value { + match response.json().await { + Ok(json_body) => { + json_body + /* + let res = jsonBody.as_str(); + match serde_json::from_str(res) { + Ok(converted) => { + converted + } + Err(_err) => { + serde_json::Value::Null + } + } + */ + } + Err(_err) => { + serde_json::Value::Null + } + } +} + pub async fn send_mssage( msg: &textsender_models::message::Message, contact: &textsender_models::contact::Contact,