openapp_sdk_core/resources/
scripting.rs1use std::sync::Arc;
4
5use reqwest::Method;
6
7use super::JsonValue;
8use crate::{
9 error::SdkError,
10 transport::{RequestSpec, Transport},
11};
12
13#[derive(Debug, Clone)]
14pub struct ScriptingClient {
15 transport: Arc<Transport>,
16}
17
18impl ScriptingClient {
19 pub(crate) fn new(transport: Arc<Transport>) -> Self {
20 Self { transport }
21 }
22
23 pub async fn execute(&self, body: &JsonValue) -> Result<JsonValue, SdkError> {
25 self.transport
26 .request_json::<JsonValue, JsonValue>(RequestSpec {
27 method: Method::POST,
28 path: "/scripting/execute",
29 body: Some(body),
30 ..Default::default()
31 })
32 .await
33 }
34}