Skip to main content
Glama
resolver_function.rs2.02 kB
use serde::{ Deserialize, Serialize, }; use serde_json::Value; use telemetry::prelude::*; use telemetry_utils::metric; use crate::{ ComponentView, before::BeforeFunction, request::CycloneRequestable, }; #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ResolverFunctionRequest { pub execution_id: String, pub handler: String, pub component: ResolverFunctionComponent, pub response_type: ResolverFunctionResponseType, pub code_base64: String, pub before: Vec<BeforeFunction>, } #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, Default)] #[serde(rename_all = "camelCase")] pub struct ResolverFunctionComponent { pub data: ComponentView, pub parents: Vec<ComponentView>, // TODO: add widget data here (for example select's options) } #[remain::sorted] #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, Default)] // Should be kept in sync with dal::func::backend::FuncBackendResponseType pub enum ResolverFunctionResponseType { Action, Array, Boolean, CodeGeneration, Debug, Float, Identity, Integer, Json, Management, Map, Object, Qualification, String, #[default] Unset, Void, } #[derive(Debug, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ResolverFunctionResultSuccess { pub execution_id: String, pub data: Value, pub unset: bool, pub timestamp: u64, } impl CycloneRequestable for ResolverFunctionRequest { type Response = ResolverFunctionResultSuccess; fn execution_id(&self) -> &str { &self.execution_id } fn kind(&self) -> &str { "resolverfunction" } fn websocket_path(&self) -> &str { "/execute/resolver" } fn inc_run_metric(&self) { metric!(counter.function_run.resolver = 1); } fn dec_run_metric(&self) { metric!(counter.function_run.resolver = -1); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server