Got it working
This commit is contained in:
@@ -26,16 +26,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("Access token: {}", token.access_token);
|
|
||||||
|
|
||||||
let mut svc = catapult::service::core::Service {
|
let mut svc = catapult::service::core::Service {
|
||||||
app: app.clone(),
|
app: app.clone(),
|
||||||
token,
|
token,
|
||||||
};
|
};
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
// TODO: Need to update textsender_models. The token module needs updating.
|
|
||||||
// The LoginResult needs expires_in populated
|
|
||||||
if catapult::service::auth::has_token_expired(&svc.token).await {
|
if catapult::service::auth::has_token_expired(&svc.token).await {
|
||||||
match auth.get_refresh_token(&svc.token).await {
|
match auth.get_refresh_token(&svc.token).await {
|
||||||
Ok(refresh) => {
|
Ok(refresh) => {
|
||||||
|
|||||||
+2
-2
@@ -57,7 +57,7 @@ impl Service {
|
|||||||
};
|
};
|
||||||
let messages = super::message::Message {
|
let messages = super::message::Message {
|
||||||
app: self.app.clone(),
|
app: self.app.clone(),
|
||||||
token: self.token.clone()
|
token: self.token.clone(),
|
||||||
};
|
};
|
||||||
let events = events.unwrap_or_default();
|
let events = events.unwrap_or_default();
|
||||||
for event in events {
|
for event in events {
|
||||||
@@ -94,7 +94,7 @@ impl Service {
|
|||||||
2. If there is an item, get the data - Done
|
2. If there is an item, get the data - Done
|
||||||
3. Evaluate if it is schedulable - Done
|
3. Evaluate if it is schedulable - Done
|
||||||
4. Get the events and iterate each one - Done
|
4. Get the events and iterate each one - Done
|
||||||
5. Starting with the message
|
5. Starting with the message - Done
|
||||||
6. Get the contact - Done
|
6. Get the contact - Done
|
||||||
7. Send the message
|
7. Send the message
|
||||||
8. Record the message event response
|
8. Record the message event response
|
||||||
|
|||||||
@@ -62,4 +62,3 @@ async fn parse_response(
|
|||||||
Err(err) => Err(std::io::Error::other(err.to_string())),
|
Err(err) => Err(std::io::Error::other(err.to_string())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,8 +1,8 @@
|
|||||||
pub mod auth;
|
pub mod auth;
|
||||||
pub mod contact;
|
pub mod contact;
|
||||||
pub mod core;
|
pub mod core;
|
||||||
pub mod message;
|
|
||||||
pub mod event;
|
pub mod event;
|
||||||
|
pub mod message;
|
||||||
pub mod queue;
|
pub mod queue;
|
||||||
|
|
||||||
pub fn auth_header(
|
pub fn auth_header(
|
||||||
|
|||||||
Reference in New Issue
Block a user