use dlopen2::wrapper::Container; use giterated_models::{ instance::Instance, object::{GiteratedObject, ObjectRequest}, operation::GiteratedOperation, settings::{GetSetting, Setting}, user::{DisplayName, User}, value::GetValue, }; use giterated_plugin::{handle::PluginHandle, new_stack::Runtime, GiteratedPluginApi}; use tracing::{info, Level}; fn main() { tracing_subscriber::fmt() .pretty() .with_thread_names(true) .with_max_level(Level::TRACE) .init(); let mut handle = PluginHandle::from_dylib("example_plugin_dylib.dll").unwrap(); let mut runtime = Runtime::default(); runtime.insert_plugin(handle); let object_request = ObjectRequest(String::from("foobar")); match runtime.handle( Instance::object_name(), ObjectRequest::operation_name(), "meow", &serde_json::to_vec(&object_request).unwrap(), ) { Ok(success) => info!("handler call success!"), Err(_) => info!("handler call error"), } match runtime.handle( User::object_name(), >::operation_name(), "amber:giterated.dev", &serde_json::to_vec(&GetValue { value_name: String::from("display_name"), }) .unwrap(), ) { Ok(success) => info!("get_value handler call success!"), Err(_) => info!("get_value handler call error"), } match runtime.handle( User::object_name(), >::operation_name(), "amber:giterated.dev", &serde_json::to_vec(&GetSetting { setting_name: DisplayName::name().to_string(), }) .unwrap(), ) { Ok(success) => info!("get_setting handler call success!"), Err(_) => info!("get_setting handler call error"), } }