Add a command dumping missing date of births
This commit is contained in:
parent
bc09979a62
commit
dfac23a225
7 changed files with 47 additions and 17 deletions
1
src/utils/mod.rs
Normal file
1
src/utils/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod people;
|
19
src/utils/people.rs
Normal file
19
src/utils/people.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use crate::{types::PersonResponseDto, Client};
|
||||
use anyhow::Result;
|
||||
|
||||
pub async fn fetch_all_contacts(client: &Client) -> Result<Vec<PersonResponseDto>> {
|
||||
let mut all_people = Vec::new();
|
||||
let mut page_number = 1;
|
||||
let mut has_next_page = true;
|
||||
|
||||
while has_next_page {
|
||||
let fetched = client
|
||||
.get_all_people(Some(page_number.into()), None, Some(true))
|
||||
.await?;
|
||||
all_people.extend(fetched.people.clone());
|
||||
has_next_page = fetched.has_next_page.expect("Missing has_next_page");
|
||||
page_number += 1;
|
||||
}
|
||||
|
||||
Ok(all_people)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue