Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d959162b43
|
||
|
|
4adbfdf712
|
||
|
|
3d1720e020
|
+4
-15
@@ -32,17 +32,11 @@ pub async fn send_mssage(
|
|||||||
|
|
||||||
let mut params = std::collections::HashMap::new();
|
let mut params = std::collections::HashMap::new();
|
||||||
params.insert("To", contact.phone_number.as_str());
|
params.insert("To", contact.phone_number.as_str());
|
||||||
// params.insert("StatusCallback", "http://OjQozHznkhNTTR.vpnrM1zdXFuiQ");
|
|
||||||
// params.insert("MaxPrice", "1");
|
|
||||||
params.insert("ProvideFeedback", "true");
|
params.insert("ProvideFeedback", "true");
|
||||||
// params.insert("Attempt", "5");
|
|
||||||
// params.insert("ValidityPeriod", "1537");
|
|
||||||
params.insert("ForceDelivery", "false");
|
params.insert("ForceDelivery", "false");
|
||||||
params.insert("ContentRetention", "retain");
|
params.insert("ContentRetention", "retain");
|
||||||
params.insert("AddressRetention", "obfuscate");
|
params.insert("AddressRetention", "obfuscate");
|
||||||
params.insert("SmartEncoded", "true");
|
params.insert("SmartEncoded", "true");
|
||||||
// params.insert("PersistentAction", "string");
|
|
||||||
// params.insert("PersistentAction", "string");
|
|
||||||
params.insert("ShortenUrls", "true");
|
params.insert("ShortenUrls", "true");
|
||||||
let date = match param.schedule_at {
|
let date = match param.schedule_at {
|
||||||
Some(date_value) => date_value.to_string(),
|
Some(date_value) => date_value.to_string(),
|
||||||
@@ -66,7 +60,7 @@ pub async fn send_mssage(
|
|||||||
let request = client.post(url).headers(headers).form(¶ms);
|
let request = client.post(url).headers(headers).form(¶ms);
|
||||||
match request.send().await {
|
match request.send().await {
|
||||||
Ok(response) => match response.status() {
|
Ok(response) => match response.status() {
|
||||||
reqwest::StatusCode::OK => Ok(response),
|
reqwest::StatusCode::CREATED => Ok(response),
|
||||||
status => Err(std::io::Error::other(format!(
|
status => Err(std::io::Error::other(format!(
|
||||||
"Unaccounted status: {status:?}"
|
"Unaccounted status: {status:?}"
|
||||||
))),
|
))),
|
||||||
@@ -104,15 +98,10 @@ fn generate_auth(
|
|||||||
params.insert("ShortenUrls", "true");
|
params.insert("ShortenUrls", "true");
|
||||||
params.insert("SendAsMms", "true");
|
params.insert("SendAsMms", "true");
|
||||||
params.insert("RiskCheck", "enable");
|
params.insert("RiskCheck", "enable");
|
||||||
|
|
||||||
let response = request.send().await?;
|
|
||||||
let body = response.text().await?;
|
|
||||||
println!("{}", body);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const DEFAULT_SCHEDULING_SECONDS: i64 = 300;
|
||||||
|
|
||||||
fn is_scheduleable(
|
fn is_scheduleable(
|
||||||
now: &Option<time::OffsetDateTime>,
|
now: &Option<time::OffsetDateTime>,
|
||||||
scheduled: &Option<time::OffsetDateTime>,
|
scheduled: &Option<time::OffsetDateTime>,
|
||||||
@@ -121,7 +110,7 @@ fn is_scheduleable(
|
|||||||
Some(schedule_at) => {
|
Some(schedule_at) => {
|
||||||
let early = now
|
let early = now
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.checked_add(time::Duration::seconds(300))
|
.checked_add(time::Duration::seconds(DEFAULT_SCHEDULING_SECONDS))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
*schedule_at > early
|
*schedule_at > early
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user