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

ambee/giterated

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

More progress :)

Amber - ⁨1⁩ year ago

parent: tbd commit: ⁨92c3f32

⁨plugins/giterated-issues/src/main.rs⁩ - ⁨1081⁩ 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::{handle::PluginHandle, new_stack::Runtime};
6 use tracing::Level;
7
8 #[tokio::main]
9 pub async fn main() {
10 tracing_subscriber::fmt()
11 .pretty()
12 .with_thread_names(true)
13 .with_max_level(Level::TRACE)
14 .init();
15
16 let handle = PluginHandle::from_dylib("giterated_issues.dll").unwrap();
17
18 let mut runtime = Runtime::new();
19
20 runtime.insert_plugin(handle);
21
22 let operation = CreateIssueRequest {
23 name: String::from("test issue"),
24 contents: String::from("hey!"),
25 author: User::from_str("amber:giterated.dev").unwrap(),
26 };
27
28 match runtime.handle_typed(
29 Repository::from_str("barson:giterated.dev/[email protected]").unwrap(),
30 operation,
31 ) {
32 Ok(success) => {
33 println!("Success in create issue: {:?}", success)
34 }
35 Err(err) => {
36 println!("Error in create issue: {:?}", err)
37 }
38 }
39 }
40