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

ambee/giterated-api

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

begin new protocol refactor

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨2091700

⁨src/main.rs⁩ - ⁨653⁩ bytes
Raw
1 use std::str::FromStr;
2
3 use giterated_api::DaemonConnectionPool;
4 use giterated_models::{
5 model::{instance::Instance, user::User},
6 operation::ObjectBackend,
7 values::user::DisplayName,
8 };
9
10 #[tokio::main]
11 async fn main() -> Result<(), anyhow::Error> {
12 tracing_subscriber::fmt::init();
13 let pool = DaemonConnectionPool::connect(Instance::from_str("giterated.dev")?).unwrap();
14
15 let mut user = pool.get_object::<User>("ambee:giterated.dev").await?;
16
17 let display_name = user.get::<DisplayName>().await?;
18
19 let repositories = user
20 .repositories(&Instance::from_str("giterated.dev").unwrap())
21 .await?;
22
23 Ok(())
24 }
25