Adding code for getting contact #12
@@ -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
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user