pub struct APCore {
pub config: Config,
/* private fields */
}Expand description
Main entry point for interacting with the APCore system.
Fields§
§config: ConfigImplementations§
Source§impl APCore
impl APCore
Sourcepub fn with_options(
registry: Option<Registry>,
executor: Option<Executor>,
config: Option<Config>,
metrics_collector: Option<MetricsCollector>,
) -> APCore
pub fn with_options( registry: Option<Registry>, executor: Option<Executor>, config: Option<Config>, metrics_collector: Option<MetricsCollector>, ) -> APCore
Create a new APCore client with all optional parameters.
If both executor and registry are provided, the executor takes precedence
and the registry is ignored (the executor already contains its own registry).
Sourcepub fn with_config(config: Config) -> APCore
pub fn with_config(config: Config) -> APCore
Create a new APCore client with the given configuration.
Sourcepub async fn call(
&self,
module_id: &str,
inputs: Value,
ctx: Option<&Context<Value>>,
version_hint: Option<&str>,
) -> Result<Value, ModuleError>
pub async fn call( &self, module_id: &str, inputs: Value, ctx: Option<&Context<Value>>, version_hint: Option<&str>, ) -> Result<Value, ModuleError>
Call (execute) a module by ID with the given inputs.
Sourcepub async fn call_async(
&self,
module_id: &str,
inputs: Value,
ctx: Option<&Context<Value>>,
version_hint: Option<&str>,
) -> Result<Value, ModuleError>
pub async fn call_async( &self, module_id: &str, inputs: Value, ctx: Option<&Context<Value>>, version_hint: Option<&str>, ) -> Result<Value, ModuleError>
Alias for call() — provided for spec compatibility.
Sourcepub async fn validate(
&self,
module_id: &str,
inputs: &Value,
) -> Result<(), ModuleError>
pub async fn validate( &self, module_id: &str, inputs: &Value, ) -> Result<(), ModuleError>
Validate module inputs without executing.
Sourcepub fn register(
&mut self,
module_id: &str,
module: Box<dyn Module>,
) -> Result<(), ModuleError>
pub fn register( &mut self, module_id: &str, module: Box<dyn Module>, ) -> Result<(), ModuleError>
Register a module with the given module_id.
Sourcepub async fn discover(&mut self) -> Result<usize, ModuleError>
pub async fn discover(&mut self) -> Result<usize, ModuleError>
Trigger module discovery.
Sourcepub fn list_modules(
&self,
tags: Option<&[String]>,
prefix: Option<&str>,
) -> Vec<String>
pub fn list_modules( &self, tags: Option<&[String]>, prefix: Option<&str>, ) -> Vec<String>
List all registered modules, optionally filtered by tags and/or prefix.
Sourcepub fn use_middleware(&mut self, middleware: Box<dyn Middleware>)
pub fn use_middleware(&mut self, middleware: Box<dyn Middleware>)
Add a middleware to the execution pipeline.
Sourcepub fn remove_middleware(&mut self, name: &str) -> bool
pub fn remove_middleware(&mut self, name: &str) -> bool
Remove a middleware by name (legacy alias).
Sourcepub fn disable(
&mut self,
_module_id: &str,
_reason: Option<&str>,
) -> Result<(), ModuleError>
pub fn disable( &mut self, _module_id: &str, _reason: Option<&str>, ) -> Result<(), ModuleError>
Disable a module with an optional reason.
Sourcepub fn enable(
&mut self,
_module_id: &str,
_reason: Option<&str>,
) -> Result<(), ModuleError>
pub fn enable( &mut self, _module_id: &str, _reason: Option<&str>, ) -> Result<(), ModuleError>
Re-enable a previously disabled module.
Sourcepub fn on(
&mut self,
_event_type: &str,
subscriber: Box<dyn EventSubscriber>,
) -> String
pub fn on( &mut self, _event_type: &str, subscriber: Box<dyn EventSubscriber>, ) -> String
Subscribe to an event type. Returns the subscriber ID.
Lazily initializes the event emitter on first use.
Sourcepub fn events(&self) -> Option<&EventEmitter>
pub fn events(&self) -> Option<&EventEmitter>
Get the event emitter, if configured.
Sourcepub async fn reload(&mut self) -> Result<(), ModuleError>
pub async fn reload(&mut self) -> Result<(), ModuleError>
Reload modules from the configured modules path.
Sourcepub async fn shutdown(&mut self) -> Result<(), ModuleError>
pub async fn shutdown(&mut self) -> Result<(), ModuleError>
Shut down the client and release resources.
Sourcepub async fn stream(
&self,
module_id: &str,
inputs: Value,
ctx: Option<&Context<Value>>,
version_hint: Option<&str>,
) -> Result<Vec<Value>, ModuleError>
pub async fn stream( &self, module_id: &str, inputs: Value, ctx: Option<&Context<Value>>, version_hint: Option<&str>, ) -> Result<Vec<Value>, ModuleError>
Stream execution of a module.
Sourcepub fn use_before(&mut self, middleware: Box<dyn BeforeMiddleware>)
pub fn use_before(&mut self, middleware: Box<dyn BeforeMiddleware>)
Add a before callback middleware.
Sourcepub fn use_after(&mut self, middleware: Box<dyn AfterMiddleware>)
pub fn use_after(&mut self, middleware: Box<dyn AfterMiddleware>)
Add an after callback middleware.