Skip to content

Instantly share code, notes, and snippets.

Created Apr 16, 2020
What would you like to do?
use futures::future::join_all;
use futures::StreamExt;
use reqwest::Client;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
struct ProjectsItem {
hash_id: String,
type ProjectsData = Vec<ProjectsItem>;
#[derive(Serialize, Deserialize, Debug)]
struct ProjectsResponse {
data: ProjectsData,
#[derive(Serialize, Deserialize, Debug)]
struct ProjectAsset {
image_url: String,
type ProjectAssets = Vec<ProjectAsset>;
#[derive(Serialize, Deserialize, Debug)]
struct ProjectResponse {
assets: ProjectAssets,
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let username = "anniehexample";
let projects_url = format!(
let client = Client::new();
let project_list = client
println!("{:#?}", project_list);
let project_requests = project_list
.map(|project| {
let url = format!(
let project_responses = join_all(project_requests)
.map(|response| response.json::<ProjectResponse>());
let projects = join_all(project_responses).await;
println!("{:#?}", projects);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment