use contentful_management::ContentfulClient; use tokio; #[tokio::main] async fn main() { let access_token = "your_access_token"; let space_id = "your_space_id"; let environment_id = "your_environment_id"; let client = ContentfulClient::new(access_token); // Fetch a single entry by ID match client .entry .get(&space_id, &environment_id, "entry_id") .await { Ok(entry) => { println!("Single Entry: {:?}", entry); } Err(e) => { eprintln!("Error: {}", e); } } // Fetch a single entry with references by ID, including up to 2 levels of references match client .entry .get_with_references(&space_id, &environment_id, "entry_id", Some(2)) .await { Ok(entry) => { println!("Single Entry with References: {:?}", entry); } Err(e) => { eprintln!("Error: {}", e); } } // Fetch all published entries match client.entry.get_published(&space_id, &environment_id).await { Ok(entries) => { println!("Published Entries:"); for entry in entries { println!("{:?}", entry); } } Err(e) => { eprintln!("Error: {}", e); } } // Fetch many entries, optionally filtering by content type match client .entry .get_many(&space_id, &environment_id, Some("content_type_id")) .await { Ok(entries) => { println!("Entries of Specific Content Type:"); for entry in entries { println!("{:?}", entry); } } Err(e) => { eprintln!("Error: {}", e); } } // Fetch a single space by ID match client.space.get(space_id).await { Ok(space) => { println!("Single Space: {:?}", space); } Err(e) => { eprintln!("Error: {}", e); } } // Fetch all spaces match client.space.get_many().await { Ok(spaces) => { println!("All Spaces:"); for space in spaces { println!("{:?}", space); } } Err(e) => { eprintln!("Error: {}", e); } } // Fetch a single environment by ID match client.environment.get(&space_id, environment_id).await { Ok(environment) => { println!("Single Environment: {:?}", environment); } Err(e) => { eprintln!("Error: {}", e); } } // Fetch all environments for the current space match client.environment.get_many(&space_id).await { Ok(environments) => { println!("All Environments:"); for environment in environments { println!("{:?}", environment); } } Err(e) => { eprintln!("Error: {}", e); } } // Fetch all environment aliases match client.environment.get_aliases(&space_id).await { Ok(aliases) => { println!("All Environment Aliases:"); for alias in aliases { println!("{:?}", alias); } } Err(e) => { eprintln!("Error: {}", e); } } // Fetch a single environment alias by ID match client.environment.get_alias(&space_id, "alias_id").await { Ok(alias) => { println!("Single Environment Alias: {:?}", alias); } Err(e) => { eprintln!("Error: {}", e); } } // Fetch a single asset by ID match client .asset .get(&space_id, &environment_id, "asset_id") .await { Ok(asset) => { println!("Single Asset: {:?}", asset); } Err(e) => { eprintln!("Error: {}", e); } } // Fetch all assets match client.asset.get_many(&space_id, &environment_id).await { Ok(assets) => { println!("All Assets:"); for asset in assets { println!("{:?}", asset); } } Err(e) => { eprintln!("Error: {}", e); } } // Fetch a single content type by ID match client .content_type .get(&space_id, &environment_id, "content_type_id") .await { Ok(content_type) => { println!("Single Content Type: {:?}", content_type); } Err(e) => { eprintln!("Error: {}", e); } } // Fetch all content types match client .content_type .get_many(&space_id, &environment_id) .await { Ok(content_types) => { println!("All Content Types:"); for content_type in content_types { println!("{:?}", content_type); } } Err(e) => { eprintln!("Error: {}", e); } } // Fetch all tags match client.tag.get_many(&space_id, &environment_id).await { Ok(tags) => { println!("All Tags:"); for tag in tags { println!("{:?}", tag); } } Err(e) => { eprintln!("Error: {}", e); } } // Create a new tag match client .tag .create(&space_id, &environment_id, "new_tag_id", "New Tag Name") .await { Ok(new_tag) => { println!("Created Tag:"); println!("{:?}", new_tag); } Err(e) => { eprintln!("Error: {}", e); } } // Delete a tag match client .tag .delete(&space_id, &environment_id, "new_tag_id") .await { Ok(_) => { println!("Tag deleted successfully"); } Err(e) => { eprintln!("Error: {}", e); } } }