Compare commits

...
Author SHA1 Message Date
phoenix 0fde9c2edd Changed types
Release Tagging / release (pull_request) Successful in 42s
swoosh Build / Check (pull_request) Successful in 41s
swoosh Build / Test Suite (pull_request) Failing after 42s
swoosh Build / Rustfmt (pull_request) Successful in 42s
swoosh Build / Clippy (pull_request) Failing after 1m21s
swoosh Build / build (pull_request) Successful in 1m25s
2026-06-03 21:55:23 -04:00
phoenix a9fde833aa Changed type check
Release Tagging / release (pull_request) Successful in 38s
swoosh Build / Test Suite (pull_request) Failing after 35s
swoosh Build / Check (pull_request) Successful in 1m22s
swoosh Build / Rustfmt (pull_request) Successful in 30s
swoosh Build / Clippy (pull_request) Failing after 1m18s
swoosh Build / build (pull_request) Successful in 1m12s
2026-06-03 21:37:23 -04:00
phoenix 0e68debd42 Fixing syntax issue
Release Tagging / release (pull_request) Successful in 28s
swoosh Build / Check (pull_request) Successful in 1m20s
swoosh Build / Test Suite (pull_request) Failing after 1m12s
swoosh Build / Rustfmt (pull_request) Failing after 48s
swoosh Build / build (pull_request) Successful in 1m4s
swoosh Build / Clippy (pull_request) Failing after 1m1s
2026-06-03 20:46:20 -04:00
phoenix d21d72f596 Fixed variable in workflow
swoosh Build / Check (pull_request) Successful in 34s
Release Tagging / release (pull_request) Successful in 39s
swoosh Build / Test Suite (pull_request) Successful in 34s
swoosh Build / Rustfmt (pull_request) Successful in 34s
swoosh Build / Clippy (pull_request) Successful in 33s
swoosh Build / build (pull_request) Successful in 33s
2026-06-03 20:43:32 -04:00
phoenix 29fcf41a9c Need to try this out
swoosh Build / Check (pull_request) Successful in 36s
Release Tagging / release (pull_request) Successful in 39s
swoosh Build / Rustfmt (pull_request) Successful in 30s
swoosh Build / Test Suite (pull_request) Successful in 35s
swoosh Build / build (pull_request) Successful in 32s
swoosh Build / Clippy (pull_request) Successful in 37s
2026-06-03 20:40:25 -04:00
5 changed files with 45 additions and 34 deletions
+5 -5
View File
@@ -21,7 +21,7 @@ jobs:
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key
ssh-keyscan ${{ secret.MYHOST }} >> ~/.ssh/known_hosts
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key
@@ -40,7 +40,7 @@ jobs:
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key
ssh-keyscan ${{ secret.MYHOST }} >> ~/.ssh/known_hosts
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key
@@ -60,7 +60,7 @@ jobs:
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key
ssh-keyscan ${{ secret.MYHOST }} >> ~/.ssh/known_hosts
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key
@@ -80,7 +80,7 @@ jobs:
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key
ssh-keyscan ${{ secret.MYHOST }} >> ~/.ssh/known_hosts
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key
@@ -99,7 +99,7 @@ jobs:
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender-models_deploy_key
chmod 600 ~/.ssh/textsender-models_deploy_key
ssh-keyscan ${{ secret.MYHOST }} >> ~/.ssh/known_hosts
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender-models_deploy_key
Generated
+2 -2
View File
@@ -1658,8 +1658,8 @@ dependencies = [
[[package]]
name = "textsender_models"
version = "0.3.0"
source = "git+ssh://git@git.kundeng.us/phoenix/textsender-models.git?tag=v0.3.0-20-15820d5505-111#15820d550526aea3016821c01f508d8d590292cc"
version = "0.2.5"
source = "git+ssh://git@git.kundeng.us/phoenix/textsender-models.git?tag=v0.2.5-v0.3.0-migrate-38dbcb09f7-111#38dbcb09f7c2c572f429ec382c01e14b72b1d615"
dependencies = [
"const_format",
"dotenvy",
+1 -1
View File
@@ -18,7 +18,7 @@ uuid = { version = "1.23.1", features = ["v4", "serde"] }
base64-ng = { version = "1.0.6" }
const_format = { version = "0.2.36" }
josekit = { version = "0.10.3" }
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender-models.git", tag = "v0.3.0-20-15820d5505-111" }
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender-models.git", tag = "v0.2.5-v0.3.0-migrate-38dbcb09f7-111" }
[dev-dependencies]
tempfile = { version = "3.27.0" }
+24 -21
View File
@@ -8,7 +8,7 @@ pub async fn send_mssage(
param: crate::twilio::types::Parameters,
config: &textsender_models::config::auxiliary::TwilioConfig,
) -> Result<crate::twilio::api::types::TwilioAPIMessage, std::io::Error> {
if config.account_sid.is_nil() {
if config.account_sid.is_empty() {
Err(std::io::Error::other("Account SID is empty"))
} else if config.auth_token.is_empty() {
Err(std::io::Error::other(" Auth token is empty"))
@@ -45,9 +45,7 @@ pub async fn send_mssage(
let converted = date_value.to_string();
converted
}
None => {
String::new()
}
None => String::new(),
};
if param.schedule && is_scheduleable(&Some(now), &param.schedule_at) {
params.insert("ScheduleType", "fixed");
@@ -60,7 +58,8 @@ pub async fn send_mssage(
params.insert("Body", msg.content.as_str());
let url = format!(
"https://api.twilio.com/2010-04-01/Accounts/ACefa1ef516314c9d1a68cbd657de49277/Messages.json"
"https://api.twilio.com/2010-04-01/Accounts/{}/Messages.json",
config.account_sid
);
// let client = reqwest::Client::new();
@@ -73,6 +72,14 @@ pub async fn send_mssage(
match request.send().await {
Ok(response) => {
match response
.json::<crate::twilio::api::types::TwilioAPIMessage>()
.await
{
Ok(resp) => Ok(resp),
Err(err) => Err(std::io::Error::other(err)),
}
/*
match response.text().await {
Ok(body) => {
let mut obj = crate::twilio::api::types::TwilioAPIMessage {
@@ -85,6 +92,7 @@ pub async fn send_mssage(
Err(std::io::Error::other(err))
}
}
*/
}
Err(err) => Err(std::io::Error::other(err.to_string())),
}
@@ -94,15 +102,13 @@ pub async fn send_mssage(
}
}
fn generate_auth(config: &textsender_models::config::auxiliary::TwilioConfig) -> Result<String, base64_ng::EncodeError> {
fn generate_auth(
config: &textsender_models::config::auxiliary::TwilioConfig,
) -> Result<String, base64_ng::EncodeError> {
let input = format!("{}:{}", config.account_sid, config.auth_token);
match base64_ng::encode(input.as_bytes()) {
Ok(encoded) => {
Ok(format!("Basic {encoded}"))
}
Err(err) => {
Err(err)
}
Ok(encoded) => Ok(format!("Basic {encoded}")),
Err(err) => Err(err),
}
}
/*
@@ -205,15 +211,12 @@ fn is_scheduleable(
) -> bool {
match scheduled {
Some(schedule_at) => {
let early = now.unwrap().checked_add(time::Duration::seconds(300)).unwrap();
if *schedule_at > early {
true
} else {
false
}
}
None => {
false
let early = now
.unwrap()
.checked_add(time::Duration::seconds(300))
.unwrap();
if *schedule_at > early { true } else { false }
}
None => false,
}
}
+13 -5
View File
@@ -3,20 +3,28 @@ pub struct TwilioAPIMessage {
pub account_sid: String,
pub api_version: String,
pub body: String,
// pub date_created: time::OffsetDateTime,
#[serde(with = "time::serde::rfc3339::option")]
pub date_created: Option<time::OffsetDateTime>,
#[serde(with = "time::serde::rfc3339::option")]
pub date_sent: Option<time::OffsetDateTime>,
#[serde(with = "time::serde::rfc3339::option")]
pub date_updated: Option<time::OffsetDateTime>,
pub direction: String,
// Not definite of what type this is
pub error_code: Option<String>,
#[serde(skip_serializing_if = "String::is_empty")]
pub error_code: String,
// Not definite of what type this is
pub error_message: Option<String>,
#[serde(skip_serializing_if = "String::is_empty")]
pub error_message: String,
pub from: String,
pub messaging_service_sid: String,
pub num_media: String,
pub num_segments: String,
pub price: Option<String>,
pub price_unit: Option<String>,
#[serde(skip_serializing_if = "String::is_empty")]
pub price: String,
#[serde(skip_serializing_if = "String::is_empty")]
pub price_unit: String,
#[serde(skip_serializing_if = "String::is_empty")]
pub sid: String,
pub status: String,
pub subresource_uris: SubresourceURI,