Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70f5261b49
|
||
|
|
0fde9c2edd
|
@@ -7,7 +7,7 @@ pub async fn send_mssage(
|
|||||||
contact: &textsender_models::contact::Contact,
|
contact: &textsender_models::contact::Contact,
|
||||||
param: crate::twilio::types::Parameters,
|
param: crate::twilio::types::Parameters,
|
||||||
config: &textsender_models::config::auxiliary::TwilioConfig,
|
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() {
|
if config.account_sid.is_empty() {
|
||||||
Err(std::io::Error::other("Account SID is empty"))
|
Err(std::io::Error::other("Account SID is empty"))
|
||||||
} else if config.auth_token.is_empty() {
|
} else if config.auth_token.is_empty() {
|
||||||
@@ -72,6 +72,8 @@ pub async fn send_mssage(
|
|||||||
|
|
||||||
match request.send().await {
|
match request.send().await {
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
|
Ok(response)
|
||||||
|
/*
|
||||||
match response
|
match response
|
||||||
.json::<crate::twilio::api::types::TwilioAPIMessage>()
|
.json::<crate::twilio::api::types::TwilioAPIMessage>()
|
||||||
.await
|
.await
|
||||||
@@ -79,7 +81,6 @@ pub async fn send_mssage(
|
|||||||
Ok(resp) => Ok(resp),
|
Ok(resp) => Ok(resp),
|
||||||
Err(err) => Err(std::io::Error::other(err)),
|
Err(err) => Err(std::io::Error::other(err)),
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
match response.text().await {
|
match response.text().await {
|
||||||
Ok(body) => {
|
Ok(body) => {
|
||||||
let mut obj = crate::twilio::api::types::TwilioAPIMessage {
|
let mut obj = crate::twilio::api::types::TwilioAPIMessage {
|
||||||
|
|||||||
@@ -3,20 +3,28 @@ pub struct TwilioAPIMessage {
|
|||||||
pub account_sid: String,
|
pub account_sid: String,
|
||||||
pub api_version: String,
|
pub api_version: String,
|
||||||
pub body: 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>,
|
pub date_sent: Option<time::OffsetDateTime>,
|
||||||
|
#[serde(with = "time::serde::rfc3339::option")]
|
||||||
pub date_updated: Option<time::OffsetDateTime>,
|
pub date_updated: Option<time::OffsetDateTime>,
|
||||||
pub direction: String,
|
pub direction: String,
|
||||||
// Not definite of what type this is
|
// 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
|
// 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 from: String,
|
||||||
pub messaging_service_sid: String,
|
pub messaging_service_sid: String,
|
||||||
pub num_media: String,
|
pub num_media: String,
|
||||||
pub num_segments: String,
|
pub num_segments: String,
|
||||||
pub price: Option<String>,
|
#[serde(skip_serializing_if = "String::is_empty")]
|
||||||
pub price_unit: Option<String>,
|
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 sid: String,
|
||||||
pub status: String,
|
pub status: String,
|
||||||
pub subresource_uris: SubresourceURI,
|
pub subresource_uris: SubresourceURI,
|
||||||
|
|||||||
Reference in New Issue
Block a user