uarp_sdk/generated/api/
playground.rs1#![allow(unused_imports, clippy::too_many_arguments)]
6
7use reqwest::Method;
8use serde::{Deserialize, Serialize};
9
10use crate::client::{Client, Request, NO_BODY, NO_QUERY};
11use crate::error::Result;
12use crate::generated::models;
13use crate::multipart::{field_text, FilePart};
14use crate::util::encode_path;
15
16#[derive(Debug, Clone)]
18pub struct PlaygroundApi {
19 pub(crate) client: Client,
20}
21
22impl Client {
23 pub fn playground(&self) -> PlaygroundApi {
25 PlaygroundApi { client: self.clone() }
26 }
27}
28
29impl PlaygroundApi {
30 pub async fn get_playground_canvas(&self, agent_id: &str) -> Result<models::PlaygroundAgentState> {
34 self.client
35 .request_json(Request {
36 method: Method::GET,
37 path: format!("/api/v1/playground/agents/{}", encode_path(agent_id)),
38 query: NO_QUERY,
39 body: NO_BODY,
40 headers: Vec::new(),
41 idempotent: false,
42 })
43 .await
44 }
45
46 pub async fn list_playground_templates(&self) -> Result<models::ListPlaygroundTemplatesResponse> {
50 self.client
51 .request_json(Request {
52 method: Method::GET,
53 path: "/api/v1/playground/templates".to_string(),
54 query: NO_QUERY,
55 body: NO_BODY,
56 headers: Vec::new(),
57 idempotent: false,
58 })
59 .await
60 }
61
62 pub async fn run(&self, agent_id: &str, body: &serde_json::Map<String, serde_json::Value>) -> Result<models::Run> {
68 self.client
69 .request_json(Request {
70 method: Method::POST,
71 path: format!("/api/v1/playground/agents/{}/run", encode_path(agent_id)),
72 query: NO_QUERY,
73 body: Some(body),
74 headers: Vec::new(),
75 idempotent: true,
76 })
77 .await
78 }
79
80 pub async fn save_playground_canvas(&self, agent_id: &str, body: &serde_json::Map<String, serde_json::Value>) -> Result<models::PlaygroundAgentState> {
84 self.client
85 .request_json(Request {
86 method: Method::PUT,
87 path: format!("/api/v1/playground/agents/{}", encode_path(agent_id)),
88 query: NO_QUERY,
89 body: Some(body),
90 headers: Vec::new(),
91 idempotent: true,
92 })
93 .await
94 }
95}