Skip to main content

windmill_api/apis/
hub_publish_api.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.768.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`get_hub_project_by_source`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetHubProjectBySourceError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`get_hub_project_export`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetHubProjectExportError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`publish_hub_app`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum PublishHubAppError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`publish_hub_draft`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum PublishHubDraftError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`publish_hub_flow`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum PublishHubFlowError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`publish_hub_flow_recording`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum PublishHubFlowRecordingError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`publish_hub_migrations`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum PublishHubMigrationsError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`publish_hub_pipeline_recording`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum PublishHubPipelineRecordingError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`publish_hub_raw_app`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum PublishHubRawAppError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`publish_hub_raw_app_embed`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum PublishHubRawAppEmbedError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`publish_hub_resource_type`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum PublishHubResourceTypeError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`publish_hub_resources`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum PublishHubResourcesError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`publish_hub_script`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum PublishHubScriptError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`publish_hub_script_recording`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum PublishHubScriptRecordingError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`publish_hub_triggers`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum PublishHubTriggersError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`submit_hub_project`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum SubmitHubProjectError {
127    UnknownValue(serde_json::Value),
128}
129
130
131/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
132pub async fn get_hub_project_by_source(configuration: &configuration::Configuration, workspace: &str, folder: &str) -> Result<String, Error<GetHubProjectBySourceError>> {
133    let local_var_configuration = configuration;
134
135    let local_var_client = &local_var_configuration.client;
136
137    let local_var_uri_str = format!("{}/w/{workspace}/hub/project", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
138    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
139
140    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
141    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
142        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
143    }
144    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
145        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
146    };
147
148    let local_var_req = local_var_req_builder.build()?;
149    let local_var_resp = local_var_client.execute(local_var_req).await?;
150
151    let local_var_status = local_var_resp.status();
152    let local_var_content = local_var_resp.text().await?;
153
154    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
155        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
156    } else {
157        let local_var_entity: Option<GetHubProjectBySourceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
158        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
159        Err(Error::ResponseError(local_var_error))
160    }
161}
162
163/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub and returns the Hub's status code and raw response body. The folder scope is only needed to re-export the caller's own draft; approved projects are public, so it is optional here. 
164pub async fn get_hub_project_export(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: Option<&str>) -> Result<String, Error<GetHubProjectExportError>> {
165    let local_var_configuration = configuration;
166
167    let local_var_client = &local_var_configuration.client;
168
169    let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/export", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
170    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
171
172    if let Some(ref local_var_str) = folder {
173        local_var_req_builder = local_var_req_builder.query(&[("folder", &local_var_str.to_string())]);
174    }
175    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
176        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
177    }
178    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
179        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
180    };
181
182    let local_var_req = local_var_req_builder.build()?;
183    let local_var_resp = local_var_client.execute(local_var_req).await?;
184
185    let local_var_status = local_var_resp.status();
186    let local_var_content = local_var_resp.text().await?;
187
188    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
189        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
190    } else {
191        let local_var_entity: Option<GetHubProjectExportError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
192        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
193        Err(Error::ResponseError(local_var_error))
194    }
195}
196
197/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
198pub async fn publish_hub_app(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_app_body: models::PublishAppBody) -> Result<String, Error<PublishHubAppError>> {
199    let local_var_configuration = configuration;
200
201    let local_var_client = &local_var_configuration.client;
202
203    let local_var_uri_str = format!("{}/w/{workspace}/hub/apps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
204    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
205
206    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
207    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
208        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
209    }
210    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
211        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
212    };
213    local_var_req_builder = local_var_req_builder.json(&publish_app_body);
214
215    let local_var_req = local_var_req_builder.build()?;
216    let local_var_resp = local_var_client.execute(local_var_req).await?;
217
218    let local_var_status = local_var_resp.status();
219    let local_var_content = local_var_resp.text().await?;
220
221    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
222        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
223    } else {
224        let local_var_entity: Option<PublishHubAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
225        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
226        Err(Error::ResponseError(local_var_error))
227    }
228}
229
230/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
231pub async fn publish_hub_draft(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_draft_body: models::PublishDraftBody) -> Result<String, Error<PublishHubDraftError>> {
232    let local_var_configuration = configuration;
233
234    let local_var_client = &local_var_configuration.client;
235
236    let local_var_uri_str = format!("{}/w/{workspace}/hub/publish_draft", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
237    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
238
239    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
240    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
241        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
242    }
243    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
244        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
245    };
246    local_var_req_builder = local_var_req_builder.json(&publish_draft_body);
247
248    let local_var_req = local_var_req_builder.build()?;
249    let local_var_resp = local_var_client.execute(local_var_req).await?;
250
251    let local_var_status = local_var_resp.status();
252    let local_var_content = local_var_resp.text().await?;
253
254    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
255        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
256    } else {
257        let local_var_entity: Option<PublishHubDraftError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
258        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
259        Err(Error::ResponseError(local_var_error))
260    }
261}
262
263/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
264pub async fn publish_hub_flow(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_flow_body: models::PublishFlowBody) -> Result<String, Error<PublishHubFlowError>> {
265    let local_var_configuration = configuration;
266
267    let local_var_client = &local_var_configuration.client;
268
269    let local_var_uri_str = format!("{}/w/{workspace}/hub/flows", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
270    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
271
272    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
273    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
274        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
275    }
276    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
277        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
278    };
279    local_var_req_builder = local_var_req_builder.json(&publish_flow_body);
280
281    let local_var_req = local_var_req_builder.build()?;
282    let local_var_resp = local_var_client.execute(local_var_req).await?;
283
284    let local_var_status = local_var_resp.status();
285    let local_var_content = local_var_resp.text().await?;
286
287    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
288        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
289    } else {
290        let local_var_entity: Option<PublishHubFlowError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
291        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
292        Err(Error::ResponseError(local_var_error))
293    }
294}
295
296/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
297pub async fn publish_hub_flow_recording(configuration: &configuration::Configuration, workspace: &str, flow_id: i64, folder: &str, recording_body: models::RecordingBody) -> Result<String, Error<PublishHubFlowRecordingError>> {
298    let local_var_configuration = configuration;
299
300    let local_var_client = &local_var_configuration.client;
301
302    let local_var_uri_str = format!("{}/w/{workspace}/hub/flows/{flow_id}/recording", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), flow_id=flow_id);
303    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
304
305    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
306    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
307        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
308    }
309    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
310        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
311    };
312    local_var_req_builder = local_var_req_builder.json(&recording_body);
313
314    let local_var_req = local_var_req_builder.build()?;
315    let local_var_resp = local_var_client.execute(local_var_req).await?;
316
317    let local_var_status = local_var_resp.status();
318    let local_var_content = local_var_resp.text().await?;
319
320    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
321        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
322    } else {
323        let local_var_entity: Option<PublishHubFlowRecordingError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
324        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
325        Err(Error::ResponseError(local_var_error))
326    }
327}
328
329/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
330pub async fn publish_hub_migrations(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_migrations_body: models::PublishMigrationsBody) -> Result<String, Error<PublishHubMigrationsError>> {
331    let local_var_configuration = configuration;
332
333    let local_var_client = &local_var_configuration.client;
334
335    let local_var_uri_str = format!("{}/w/{workspace}/hub/migrations", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
336    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
337
338    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
339    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
340        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
341    }
342    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
343        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
344    };
345    local_var_req_builder = local_var_req_builder.json(&publish_migrations_body);
346
347    let local_var_req = local_var_req_builder.build()?;
348    let local_var_resp = local_var_client.execute(local_var_req).await?;
349
350    let local_var_status = local_var_resp.status();
351    let local_var_content = local_var_resp.text().await?;
352
353    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
354        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
355    } else {
356        let local_var_entity: Option<PublishHubMigrationsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
357        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
358        Err(Error::ResponseError(local_var_error))
359    }
360}
361
362/// Requires the caller to be a workspace admin. A data-pipeline recording is scoped to the whole project (a folder cascade), not a single item. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
363pub async fn publish_hub_pipeline_recording(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str, pipeline_recording_body: models::PipelineRecordingBody) -> Result<String, Error<PublishHubPipelineRecordingError>> {
364    let local_var_configuration = configuration;
365
366    let local_var_client = &local_var_configuration.client;
367
368    let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/pipeline_recording", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
369    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
370
371    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
372    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
373        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
374    }
375    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
376        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
377    };
378    local_var_req_builder = local_var_req_builder.json(&pipeline_recording_body);
379
380    let local_var_req = local_var_req_builder.build()?;
381    let local_var_resp = local_var_client.execute(local_var_req).await?;
382
383    let local_var_status = local_var_resp.status();
384    let local_var_content = local_var_resp.text().await?;
385
386    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
387        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
388    } else {
389        let local_var_entity: Option<PublishHubPipelineRecordingError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
390        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
391        Err(Error::ResponseError(local_var_error))
392    }
393}
394
395/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
396pub async fn publish_hub_raw_app(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_raw_app_body: models::PublishRawAppBody) -> Result<String, Error<PublishHubRawAppError>> {
397    let local_var_configuration = configuration;
398
399    let local_var_client = &local_var_configuration.client;
400
401    let local_var_uri_str = format!("{}/w/{workspace}/hub/raw_apps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
402    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
403
404    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
405    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
406        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
407    }
408    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
409        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
410    };
411    local_var_req_builder = local_var_req_builder.json(&publish_raw_app_body);
412
413    let local_var_req = local_var_req_builder.build()?;
414    let local_var_resp = local_var_client.execute(local_var_req).await?;
415
416    let local_var_status = local_var_resp.status();
417    let local_var_content = local_var_resp.text().await?;
418
419    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
420        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
421    } else {
422        let local_var_entity: Option<PublishHubRawAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
423        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
424        Err(Error::ResponseError(local_var_error))
425    }
426}
427
428/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
429pub async fn publish_hub_raw_app_embed(configuration: &configuration::Configuration, workspace: &str, id: i64, folder: &str, raw_app_embed_body: models::RawAppEmbedBody) -> Result<String, Error<PublishHubRawAppEmbedError>> {
430    let local_var_configuration = configuration;
431
432    let local_var_client = &local_var_configuration.client;
433
434    let local_var_uri_str = format!("{}/w/{workspace}/hub/raw_apps/{id}/embed", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=id);
435    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
436
437    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
438    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
439        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
440    }
441    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
442        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
443    };
444    local_var_req_builder = local_var_req_builder.json(&raw_app_embed_body);
445
446    let local_var_req = local_var_req_builder.build()?;
447    let local_var_resp = local_var_client.execute(local_var_req).await?;
448
449    let local_var_status = local_var_resp.status();
450    let local_var_content = local_var_resp.text().await?;
451
452    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
453        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
454    } else {
455        let local_var_entity: Option<PublishHubRawAppEmbedError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
456        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
457        Err(Error::ResponseError(local_var_error))
458    }
459}
460
461/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
462pub async fn publish_hub_resource_type(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_resource_type_body: models::PublishResourceTypeBody) -> Result<String, Error<PublishHubResourceTypeError>> {
463    let local_var_configuration = configuration;
464
465    let local_var_client = &local_var_configuration.client;
466
467    let local_var_uri_str = format!("{}/w/{workspace}/hub/resource_types", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
468    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
469
470    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
471    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
472        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
473    }
474    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
475        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
476    };
477    local_var_req_builder = local_var_req_builder.json(&publish_resource_type_body);
478
479    let local_var_req = local_var_req_builder.build()?;
480    let local_var_resp = local_var_client.execute(local_var_req).await?;
481
482    let local_var_status = local_var_resp.status();
483    let local_var_content = local_var_resp.text().await?;
484
485    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
486        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
487    } else {
488        let local_var_entity: Option<PublishHubResourceTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
489        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
490        Err(Error::ResponseError(local_var_error))
491    }
492}
493
494/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
495pub async fn publish_hub_resources(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_resources_body: models::PublishResourcesBody) -> Result<String, Error<PublishHubResourcesError>> {
496    let local_var_configuration = configuration;
497
498    let local_var_client = &local_var_configuration.client;
499
500    let local_var_uri_str = format!("{}/w/{workspace}/hub/resources", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
501    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
502
503    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
504    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
505        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
506    }
507    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
508        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
509    };
510    local_var_req_builder = local_var_req_builder.json(&publish_resources_body);
511
512    let local_var_req = local_var_req_builder.build()?;
513    let local_var_resp = local_var_client.execute(local_var_req).await?;
514
515    let local_var_status = local_var_resp.status();
516    let local_var_content = local_var_resp.text().await?;
517
518    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
519        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
520    } else {
521        let local_var_entity: Option<PublishHubResourcesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
522        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
523        Err(Error::ResponseError(local_var_error))
524    }
525}
526
527/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
528pub async fn publish_hub_script(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_script_body: models::PublishScriptBody) -> Result<String, Error<PublishHubScriptError>> {
529    let local_var_configuration = configuration;
530
531    let local_var_client = &local_var_configuration.client;
532
533    let local_var_uri_str = format!("{}/w/{workspace}/hub/scripts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
534    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
535
536    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
537    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
538        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
539    }
540    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
541        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
542    };
543    local_var_req_builder = local_var_req_builder.json(&publish_script_body);
544
545    let local_var_req = local_var_req_builder.build()?;
546    let local_var_resp = local_var_client.execute(local_var_req).await?;
547
548    let local_var_status = local_var_resp.status();
549    let local_var_content = local_var_resp.text().await?;
550
551    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
552        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
553    } else {
554        let local_var_entity: Option<PublishHubScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
555        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
556        Err(Error::ResponseError(local_var_error))
557    }
558}
559
560/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
561pub async fn publish_hub_script_recording(configuration: &configuration::Configuration, workspace: &str, ask_id: i64, folder: &str, recording_body: models::RecordingBody) -> Result<String, Error<PublishHubScriptRecordingError>> {
562    let local_var_configuration = configuration;
563
564    let local_var_client = &local_var_configuration.client;
565
566    let local_var_uri_str = format!("{}/w/{workspace}/hub/scripts/{ask_id}/recording", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), ask_id=ask_id);
567    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
568
569    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
570    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
571        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
572    }
573    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
574        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
575    };
576    local_var_req_builder = local_var_req_builder.json(&recording_body);
577
578    let local_var_req = local_var_req_builder.build()?;
579    let local_var_resp = local_var_client.execute(local_var_req).await?;
580
581    let local_var_status = local_var_resp.status();
582    let local_var_content = local_var_resp.text().await?;
583
584    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
585        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
586    } else {
587        let local_var_entity: Option<PublishHubScriptRecordingError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
588        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
589        Err(Error::ResponseError(local_var_error))
590    }
591}
592
593/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
594pub async fn publish_hub_triggers(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_triggers_body: models::PublishTriggersBody) -> Result<String, Error<PublishHubTriggersError>> {
595    let local_var_configuration = configuration;
596
597    let local_var_client = &local_var_configuration.client;
598
599    let local_var_uri_str = format!("{}/w/{workspace}/hub/triggers", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
600    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
601
602    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
603    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
604        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
605    }
606    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
607        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
608    };
609    local_var_req_builder = local_var_req_builder.json(&publish_triggers_body);
610
611    let local_var_req = local_var_req_builder.build()?;
612    let local_var_resp = local_var_client.execute(local_var_req).await?;
613
614    let local_var_status = local_var_resp.status();
615    let local_var_content = local_var_resp.text().await?;
616
617    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
618        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
619    } else {
620        let local_var_entity: Option<PublishHubTriggersError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
621        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
622        Err(Error::ResponseError(local_var_error))
623    }
624}
625
626/// Requires the caller to be a workspace admin. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
627pub async fn submit_hub_project(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str) -> Result<String, Error<SubmitHubProjectError>> {
628    let local_var_configuration = configuration;
629
630    let local_var_client = &local_var_configuration.client;
631
632    let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/submit", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
633    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
634
635    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
636    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
637        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
638    }
639    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
640        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
641    };
642
643    let local_var_req = local_var_req_builder.build()?;
644    let local_var_resp = local_var_client.execute(local_var_req).await?;
645
646    let local_var_status = local_var_resp.status();
647    let local_var_content = local_var_resp.text().await?;
648
649    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
650        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
651    } else {
652        let local_var_entity: Option<SubmitHubProjectError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
653        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
654        Err(Error::ResponseError(local_var_error))
655    }
656}
657