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

ambee/giterated

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

Wow!

Amber - ⁨1⁩ year ago

parent: tbd commit: ⁨6530104

⁨plugins/giterated-issues/src/main.rs⁩ - ⁨1185⁩ bytes
Raw
1 use std::str::FromStr;
2
3 use giterated_issues::operations::CreateIssueRequest;
4 use giterated_models::{repository::Repository, user::User};
5 use giterated_plugin::abi::vtable::runtime::RuntimeHandle;
6 use giterated_runtime::{Runtime, StaticRuntimeExt};
7 use tracing::Level;
8
9 #[tokio::main]
10 pub async fn main() -> Result<(), anyhow::Error> {
11 tracing_subscriber::fmt()
12 .pretty()
13 .with_thread_names(true)
14 .with_max_level(Level::TRACE)
15 .init();
16
17 let mut runtime = Runtime::new();
18
19 runtime.load_dylib("giterated_issues.dll")?;
20
21 runtime.init();
22
23 let runtime = unsafe { RuntimeHandle::from_static() };
24
25 let operation = CreateIssueRequest {
26 name: String::from("test issue"),
27 contents: String::from("hey!"),
28 author: User::from_str("amber:giterated.dev").unwrap(),
29 };
30
31 match runtime.handle_typed(
32 Repository::from_str("barson:giterated.dev/[email protected]").unwrap(),
33 operation,
34 ) {
35 Ok(success) => {
36 println!("Success in create issue: {:?}", success)
37 }
38 Err(err) => {
39 println!("Error in create issue: {:?}", err)
40 }
41 }
42
43 Ok(())
44 }
45