Skip to main content

types_sdk/
api.rs

1//! `TypesClient` trait definition.
2//!
3//! This trait defines the public API for the `types` module.
4
5use async_trait::async_trait;
6
7use crate::error::TypesError;
8
9/// Public API trait for the `types` module.
10///
11/// This trait can be consumed by other modules via `ClientHub`:
12/// ```ignore
13/// let client = hub.get::<dyn TypesClient>()?;
14/// let ready = client.is_ready().await?;
15/// ```
16///
17/// The types module is responsible for registering core GTS types
18/// that other modules depend on (e.g., `BaseModkitPluginV1`).
19#[async_trait]
20pub trait TypesClient: Send + Sync {
21    /// Check if core types have been registered.
22    ///
23    /// # Returns
24    ///
25    /// `true` if core types are registered and ready.
26    ///
27    /// # Errors
28    ///
29    /// Returns an error if the check fails.
30    async fn is_ready(&self) -> Result<bool, TypesError>;
31}