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

ambee/giterated

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

Spinning

Amber - ⁨1⁩ year ago

parent: tbd commit: ⁨1788060

⁨plugins/giterated-issues/src/main.rs⁩ - ⁨1225⁩ 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
32 .handle_typed(
33 Repository::from_str("barson:giterated.dev/[email protected]").unwrap(),
34 operation,
35 )
36 .await
37 {
38 Ok(success) => {
39 println!("Success in create issue: {:?}", success)
40 }
41 Err(err) => {
42 println!("Error in create issue: {:?}", err)
43 }
44 }
45
46 Ok(())
47 }
48