Compare commits

..
Author SHA1 Message Date
phoenix 720f3d8f75 Adding function to load twilio config
textsender_models PR / Rustfmt (pull_request) Successful in 1m2s
textsender_models PR / Check (pull_request) Successful in 1m10s
textsender_models PR / Clippy (pull_request) Successful in 1m25s
Release Tagging / release (pull_request) Successful in 37s
2026-06-21 17:57:02 -04:00
phoenix 7e5bc016b1 Making field optional
textsender_models PR / Rustfmt (pull_request) Successful in 54s
textsender_models PR / Clippy (pull_request) Successful in 1m13s
Release Tagging / release (pull_request) Successful in 27s
textsender_models PR / Check (pull_request) Successful in 1m54s
2026-06-20 16:33:13 -04:00
phoenix 384dd41690 bump: textsender_models
textsender_models PR / Check (pull_request) Successful in 1m32s
textsender_models PR / Clippy (pull_request) Successful in 1m31s
textsender_models PR / Rustfmt (pull_request) Successful in 47s
Release Tagging / release (pull_request) Successful in 33s
2026-06-20 12:55:02 -04:00
phoenix f246676203 Changed type of response field to serde_json::Value 2026-06-20 12:54:55 -04:00
5 changed files with 32 additions and 4 deletions
Generated
+1 -1
View File
@@ -1656,7 +1656,7 @@ dependencies = [
[[package]]
name = "textsender_models"
version = "0.4.2"
version = "0.4.3"
dependencies = [
"const_format",
"dotenvy",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "textsender_models"
version = "0.4.2"
version = "0.4.3"
edition = "2024"
rust-version = "1.96"
description = "Models used for the textsender project"
+23
View File
@@ -19,3 +19,26 @@ impl TwilioConfig {
println!("Number: {:?}", self.phone_number);
}
}
// TODO: Remove the async at a later point
pub async fn load_config() -> Result<TwilioConfig, std::io::Error> {
let auth_sid_var = crate::envy::environment::get_env("TWILIO_AUTH_SID").await;
let service_sid_var = crate::envy::environment::get_env("TWILIO_SERVICE_SID").await;
let auth_token_var = crate::envy::environment::get_env("TWILIO_AUTH_TOKEN").await;
let phone_number_var = crate::envy::environment::get_env("TWILIO_PHONE_NUMBER").await;
if auth_sid_var.value.is_empty()
|| service_sid_var.value.is_empty()
|| auth_token_var.value.is_empty()
|| phone_number_var.value.is_empty()
{
Err(std::io::Error::other("Config not set"))
} else {
Ok(TwilioConfig {
service_sid: service_sid_var.value,
auth_token: auth_token_var.value,
account_sid: auth_sid_var.value,
phone_number: phone_number_var.value,
})
}
}
+2
View File
@@ -1,3 +1,5 @@
// TODO: Functions does not need to be async
pub async fn get_db_url() -> crate::envy::EnvVar {
dotenvy::dotenv().ok();
let key = crate::envy::keys::DB_URL;
+5 -2
View File
@@ -1,4 +1,6 @@
/// Message status - Instant
pub const MESSAGE_EVENT_RESPONSE_STATUS_INSTANT: &str = "INSTANT";
/// Message status - Scheduled
pub const MESSAGE_EVENT_RESPONSE_STATUS_SCHEDULED: &str = "SCHEDULED";
#[derive(
@@ -6,9 +8,10 @@ pub const MESSAGE_EVENT_RESPONSE_STATUS_SCHEDULED: &str = "SCHEDULED";
)]
pub struct MessageEventResponse {
pub id: uuid::Uuid,
pub scheduled_message_event_id: uuid::Uuid,
#[serde(skip_serializing_if = "crate::init::is_uuid_nil")]
pub scheduled_message_event_id: Option<uuid::Uuid>,
/// Stores a json response of the sent message
pub response: String,
pub response: serde_json::Value,
pub user_id: uuid::Uuid,
pub contact_id: uuid::Uuid,
pub message_id: uuid::Uuid,