Compare commits

..
Author SHA1 Message Date
phoenix 4dfd355bd8 Removing unused dependencies
swoosh pr / Rustfmt (pull_request) Successful in 36s
Release Tagging / release (pull_request) Successful in 51s
swoosh pr / Check (pull_request) Successful in 1m42s
swoosh pr / Clippy (pull_request) Failing after 1m45s
2026-07-03 00:40:50 -04:00
phoenix 681a7daab9 bump: textsender_models 2026-07-03 00:38:13 -04:00
phoenix c613b6011c bump: swoosh 2026-07-03 00:35:20 -04:00
phoenix 9bfb594f78 Adding new code to send message
swoosh pr / Check (pull_request) Failing after 45s
swoosh pr / Rustfmt (pull_request) Successful in 45s
Release Tagging / release (pull_request) Failing after 41s
swoosh pr / Clippy (pull_request) Failing after 2m4s
2026-07-03 00:32:19 -04:00
4 changed files with 21 additions and 23 deletions
Generated
+3 -3
View File
@@ -81,9 +81,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]] [[package]]
name = "base64-ng" name = "base64-ng"
version = "1.3.5" version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b87dbd7e45c4885ad3432a2d125ddb155c5ee87046ab23bad043dfe84fedfa2" checksum = "735259e24200bce69feb75fcb2f79f36129e54c3f3139da15880520988cd840c"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@@ -2067,7 +2067,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "swoosh" name = "swoosh"
version = "0.5.1" version = "0.5.0"
dependencies = [ dependencies = [
"base64-ng", "base64-ng",
"reqwest", "reqwest",
+2 -2
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "swoosh" name = "swoosh"
version = "0.5.1" version = "0.5.0"
edition = "2024" edition = "2024"
rust-version = "1.96" rust-version = "1.96"
description = "Library to send text messages" description = "Library to send text messages"
@@ -10,7 +10,7 @@ serde = { version = "1.0.228", features = ["derive"] }
serde_json = { version = "1.0.150" } serde_json = { version = "1.0.150" }
reqwest = { version = "0.13.4", features = ["form", "json", "blocking", "multipart", "stream"] } reqwest = { version = "0.13.4", features = ["form", "json", "blocking", "multipart", "stream"] }
time = { version = "0.3.49", features = ["formatting", "macros", "parsing", "serde"] } time = { version = "0.3.49", features = ["formatting", "macros", "parsing", "serde"] }
base64-ng = { version = "1.3.5" } base64-ng = { version = "1.0.8" }
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.0", features = ["config", "contact", "message"] } textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.0", features = ["config", "contact", "message"] }
[dev-dependencies] [dev-dependencies]
+15 -17
View File
@@ -13,13 +13,13 @@ impl SendMsg {
auth_token: &str, auth_token: &str,
phone_number: &str, phone_number: &str,
service_sid: &str, service_sid: &str,
account_sid: &str, auth_sid: &str,
) { ) {
self.config = VendorConfig { self.config = VendorConfig {
auth_token: auth_token.to_string(), auth_token: auth_token.to_string(),
phone_number: phone_number.to_string(), phone_number: phone_number.to_string(),
service_sid: service_sid.to_string(), service_sid: service_sid.to_string(),
account_sid: account_sid.to_string(), auth_sid: auth_sid.to_string(),
} }
} }
@@ -40,15 +40,15 @@ impl SendMsg {
param: &crate::twilio::types::Parameters, param: &crate::twilio::types::Parameters,
) -> Result<reqwest::Response, std::io::Error> { ) -> Result<reqwest::Response, std::io::Error> {
if self.recipient.phone_number.is_empty() { if self.recipient.phone_number.is_empty() {
Err(std::io::Error::other("Recipient not provided")) return Err(std::io::Error::other("Recipient not provided"));
} else if self.message.content.is_empty() { } else if self.message.content.is_empty() {
Err(std::io::Error::other("Message not provided")) return Err(std::io::Error::other("Message not provided"));
} else if self.config.phone_number.is_empty() } else if self.config.phone_number.is_empty()
|| self.config.service_sid.is_empty() || self.config.service_sid.is_empty()
|| self.config.auth_token.is_empty() || self.config.auth_token.is_empty()
|| self.config.account_sid.is_empty() || self.config.auth_sid.is_empty()
{ {
Err(std::io::Error::other("Config not populated")) return Err(std::io::Error::other("Config not populated"));
} else { } else {
let client = match reqwest::Client::builder().build() { let client = match reqwest::Client::builder().build() {
Ok(client) => client, Ok(client) => client,
@@ -57,16 +57,14 @@ impl SendMsg {
} }
}; };
let url = twilio::api::twilio_url(&self.config.account_sid); let url = twilio::api::twilio_url(&self.config.auth_sid);
let headers = match twilio::api::init_headers( let headers =
&self.config.account_sid, match twilio::api::init_headers(&self.config.auth_sid, &self.config.auth_token) {
&self.config.auth_token, Ok(headers) => headers,
) { Err(err) => {
Ok(headers) => headers, return Err(std::io::Error::other(err));
Err(err) => { }
return Err(std::io::Error::other(err)); };
}
};
let params = twilio::api::initial_params( let params = twilio::api::initial_params(
&self.recipient.phone_number, &self.recipient.phone_number,
&self.message.content, &self.message.content,
@@ -93,7 +91,7 @@ pub struct VendorConfig {
pub auth_token: String, pub auth_token: String,
pub phone_number: String, pub phone_number: String,
pub service_sid: String, pub service_sid: String,
pub account_sid: String, pub auth_sid: String,
} }
#[derive(Default, Debug)] #[derive(Default, Debug)]
+1 -1
View File
@@ -87,7 +87,7 @@ pub fn init_headers(
}; };
headers.insert( headers.insert(
"Authorization", "Authorization",
match format!("Basic {auth}").parse() { match auth.parse() {
Ok(auth) => auth, Ok(auth) => auth,
Err(err) => { Err(err) => {
return Err(std::io::Error::other(err)); return Err(std::io::Error::other(err));