JavaScript is disabled, refresh for a better experience. ambee/giterated-api

ambee/giterated-api

Git repository hosting, collaboration, and discovery for the Fediverse.

Fixes!

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨46cd262

⁨src/main.rs⁩ - ⁨928⁩ bytes
Raw
1 use std::str::FromStr;
2
3 use giterated_api::DaemonConnectionPool;
4 use giterated_models::{
5 instance::Instance,
6 object_backend::ObjectBackend,
7 user::{DisplayName, User},
8 };
9
10 use color_eyre::eyre::Result;
11 use tracing::info;
12
13 #[tokio::main]
14 async fn main() -> Result<()> {
15 tracing_subscriber::fmt::init();
16 color_eyre::install()?;
17
18 let pool = DaemonConnectionPool::connect_other(
19 Instance::from_str("giterated.dev")?,
20 ("127.0.0.1:1111").parse().unwrap(),
21 )
22 .unwrap();
23
24 let mut user = pool.get_object::<User>("ambee:giterated.dev").await?;
25
26 info!("Getting display name for {}!", user);
27
28 let display_name = user.get::<DisplayName>().await?;
29
30 info!("{}'s display name is {}", user, display_name);
31
32 let repositories = user
33 .repositories(&Instance::from_str("giterated.dev").unwrap())
34 .await?;
35
36 info!("Repository: {:#?}", repositories);
37
38 Ok(())
39 }
40