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

ambee/giterated-api

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

Fixes schmixes

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨92ff417

⁨src/main.rs⁩ - ⁨710⁩ 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 #[tokio::main]
11 async fn main() -> Result<(), anyhow::Error> {
12 tracing_subscriber::fmt::init();
13 let pool = DaemonConnectionPool::connect_other(
14 Instance::from_str("giterated.dev")?,
15 ("127.0.0.1:1111").parse().unwrap(),
16 )
17 .unwrap();
18
19 let mut user = pool.get_object::<User>("ambee:giterated.dev").await?;
20
21 let _display_name = user.get::<DisplayName>().await?;
22
23 let _repositories = user
24 .repositories(&Instance::from_str("giterated.dev").unwrap())
25 .await?;
26
27 Ok(())
28 }
29