use std::str::FromStr; use giterated_issues::operations::CreateIssueRequest; use giterated_models::{repository::Repository, user::User}; use giterated_plugin::abi::vtable::runtime::RuntimeHandle; use giterated_runtime::{Runtime, StaticRuntimeExt}; use tracing::Level; #[tokio::main] pub async fn main() -> Result<(), anyhow::Error> { tracing_subscriber::fmt() .pretty() .with_thread_names(true) .with_max_level(Level::TRACE) .init(); let mut runtime = Runtime::new(); runtime.load_dylib("giterated_issues.dll")?; runtime.init(); let runtime = unsafe { RuntimeHandle::from_static() }; let operation = CreateIssueRequest { name: String::from("test issue"), contents: String::from("hey!"), author: User::from_str("amber:giterated.dev").unwrap(), }; match runtime.handle_typed( Repository::from_str("barson:giterated.dev/foo@giterated.dev").unwrap(), operation, ) { Ok(success) => { println!("Success in create issue: {:?}", success) } Err(err) => { println!("Error in create issue: {:?}", err) } } Ok(()) }