Adding code for getting contact #12

Merged
phoenix merged 3 commits from get_contact into v0.3.0 2026-06-25 21:40:03 -04:00
2 changed files with 4 additions and 9 deletions
Showing only changes of commit 95dbe2bf82 - Show all commits
+3 -8
View File
@@ -7,11 +7,9 @@ impl Contact {
pub async fn get(
&self,
contact_id: &uuid::Uuid,
) -> Result<Vec<textsender_models::contact::Contact>, std::io::Error>
{
) -> Result<Vec<textsender_models::contact::Contact>, std::io::Error> {
let client = reqwest::Client::new();
let endpoint =
format!("api/v1/contact?id={contact_id}");
let endpoint = format!("api/v1/contact?id={contact_id}");
let api_url = format!("{}/{endpoint}", self.app.api_url);
println!("Url: {api_url:?}");
@@ -43,9 +41,7 @@ async fn parse_response(
if lrs.is_empty() {
Err(std::io::Error::other("Error response is empty"))
} else {
let mut events: Vec<
textsender_models::contact::Contact,
> = Vec::new();
let mut events: Vec<textsender_models::contact::Contact> = Vec::new();
for event in lrs.iter() {
let ll: textsender_models::contact::Contact =
@@ -66,4 +62,3 @@ async fn parse_response(
Err(err) => Err(std::io::Error::other(err.to_string())),
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ impl Service {
let contacts = super::contact::Contact {
app: self.app.clone(),
token: self.token.clone()
token: self.token.clone(),
};
let events = events.unwrap_or_default();
for event in events {