use std::{str::FromStr, time::Instant}; use giterated_api::{daemon_backend::NetworkOperationState, DaemonConnectionPool}; use giterated_models::{ authenticated::{InstanceAuthenticator, UserAuthenticator}, instance::Instance, object_backend::ObjectBackend, repository::{AccessList, Description, Repository}, settings::AnySetting, user::{Bio, DisplayName, User}, }; use color_eyre::eyre::Result; use tokio::{fs::File, io::AsyncReadExt}; use tracing::info; #[tokio::main] async fn main() -> Result<()> { tracing_subscriber::fmt::init(); color_eyre::install()?; let start = Instant::now(); let pool = DaemonConnectionPool::connect_other( Instance::from_str("giterated.dev")?, ("127.0.0.1:1111").parse().unwrap(), ) .unwrap(); let mut operation_state = NetworkOperationState::new(); let mut user = pool .get_object::("test:giterated.dev", &operation_state) .await?; let bio = user.get::(&operation_state).await?; info!("Bio: {}", bio); let repositories = user .repositories(&Instance::from_str("giterated.dev")?, &operation_state) .await?; let repository = repositories.first().unwrap(); let mut repository = pool .get_object::(&repository.repository.to_string(), &operation_state) .await?; info!( "Repository description: {}", repository.get::(&operation_state).await? ); info!( "User Bio Setting: {}", user.get_setting::(&operation_state).await? ); Ok(()) }