Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d5e10857d
|
||
|
|
70f5261b49
|
||
|
|
0fde9c2edd
|
@@ -7,7 +7,7 @@ pub async fn send_mssage(
|
||||
contact: &textsender_models::contact::Contact,
|
||||
param: crate::twilio::types::Parameters,
|
||||
config: &textsender_models::config::auxiliary::TwilioConfig,
|
||||
) -> Result<crate::twilio::api::types::TwilioAPIMessage, std::io::Error> {
|
||||
) -> Result<reqwest::Response, std::io::Error> {
|
||||
if config.account_sid.is_empty() {
|
||||
Err(std::io::Error::other("Account SID is empty"))
|
||||
} else if config.auth_token.is_empty() {
|
||||
@@ -72,6 +72,8 @@ pub async fn send_mssage(
|
||||
|
||||
match request.send().await {
|
||||
Ok(response) => {
|
||||
Ok(response)
|
||||
/*
|
||||
match response
|
||||
.json::<crate::twilio::api::types::TwilioAPIMessage>()
|
||||
.await
|
||||
@@ -79,7 +81,6 @@ pub async fn send_mssage(
|
||||
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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
// Things needed to send a message
|
||||
// Contact - Receipient to send to (textsender-models)
|
||||
// Message - The content to sent (textsender-models)
|
||||
// Parameters - Controls flow of sending message
|
||||
// Config - Contains info needed to send message (textsender-models)
|
||||
/// Parameters - Controls flow of sending message
|
||||
pub struct Parameters {
|
||||
pub schedule: bool,
|
||||
pub schedule_at: Option<time::OffsetDateTime>,
|
||||
|
||||
Reference in New Issue
Block a user