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.810.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 [`discard_hub_project_update`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DiscardHubProjectUpdateError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`get_hub_project_by_source`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetHubProjectBySourceError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_hub_project_export`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetHubProjectExportError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`list_hub_projects`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum ListHubProjectsError {
43    Status400(),
44    UnknownValue(serde_json::Value),
45}
46
47/// struct for typed errors of method [`publish_hub_app`]
48#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum PublishHubAppError {
51    UnknownValue(serde_json::Value),
52}
53
54/// struct for typed errors of method [`publish_hub_draft`]
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum PublishHubDraftError {
58    UnknownValue(serde_json::Value),
59}
60
61/// struct for typed errors of method [`publish_hub_flow`]
62#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum PublishHubFlowError {
65    UnknownValue(serde_json::Value),
66}
67
68/// struct for typed errors of method [`publish_hub_flow_recording`]
69#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum PublishHubFlowRecordingError {
72    UnknownValue(serde_json::Value),
73}
74
75/// struct for typed errors of method [`publish_hub_migrations`]
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum PublishHubMigrationsError {
79    UnknownValue(serde_json::Value),
80}
81
82/// struct for typed errors of method [`publish_hub_pipeline_recording`]
83#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum PublishHubPipelineRecordingError {
86    UnknownValue(serde_json::Value),
87}
88
89/// struct for typed errors of method [`publish_hub_project_logo`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum PublishHubProjectLogoError {
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`publish_hub_raw_app`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum PublishHubRawAppError {
100    UnknownValue(serde_json::Value),
101}
102
103/// struct for typed errors of method [`publish_hub_raw_app_recording`]
104#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum PublishHubRawAppRecordingError {
107    UnknownValue(serde_json::Value),
108}
109
110/// struct for typed errors of method [`publish_hub_resource_type`]
111#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum PublishHubResourceTypeError {
114    UnknownValue(serde_json::Value),
115}
116
117/// struct for typed errors of method [`publish_hub_resources`]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum PublishHubResourcesError {
121    UnknownValue(serde_json::Value),
122}
123
124/// struct for typed errors of method [`publish_hub_script`]
125#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum PublishHubScriptError {
128    UnknownValue(serde_json::Value),
129}
130
131/// struct for typed errors of method [`publish_hub_script_recording`]
132#[derive(Debug, Clone, Serialize, Deserialize)]
133#[serde(untagged)]
134pub enum PublishHubScriptRecordingError {
135    UnknownValue(serde_json::Value),
136}
137
138/// struct for typed errors of method [`publish_hub_triggers`]
139#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum PublishHubTriggersError {
142    UnknownValue(serde_json::Value),
143}
144
145/// struct for typed errors of method [`submit_hub_project`]
146#[derive(Debug, Clone, Serialize, Deserialize)]
147#[serde(untagged)]
148pub enum SubmitHubProjectError {
149    UnknownValue(serde_json::Value),
150}
151
152/// struct for typed errors of method [`withdraw_hub_project`]
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum WithdrawHubProjectError {
156    UnknownValue(serde_json::Value),
157}
158
159
160/// 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. The published project is left untouched. 
161pub async fn discard_hub_project_update(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str) -> Result<String, Error<DiscardHubProjectUpdateError>> {
162    let local_var_configuration = configuration;
163
164    let local_var_client = &local_var_configuration.client;
165
166    let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/discard_update", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
167    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
168
169    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
170    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
171        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
172    }
173    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
174        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
175    };
176
177    let local_var_req = local_var_req_builder.build()?;
178    let local_var_resp = local_var_client.execute(local_var_req).await?;
179
180    let local_var_status = local_var_resp.status();
181    let local_var_content = local_var_resp.text().await?;
182
183    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
184        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
185    } else {
186        let local_var_entity: Option<DiscardHubProjectUpdateError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
187        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
188        Err(Error::ResponseError(local_var_error))
189    }
190}
191
192/// 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. 
193pub async fn get_hub_project_by_source(configuration: &configuration::Configuration, workspace: &str, folder: &str) -> Result<String, Error<GetHubProjectBySourceError>> {
194    let local_var_configuration = configuration;
195
196    let local_var_client = &local_var_configuration.client;
197
198    let local_var_uri_str = format!("{}/w/{workspace}/hub/project", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
199    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
200
201    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
202    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
203        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
204    }
205    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
206        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
207    };
208
209    let local_var_req = local_var_req_builder.build()?;
210    let local_var_resp = local_var_client.execute(local_var_req).await?;
211
212    let local_var_status = local_var_resp.status();
213    let local_var_content = local_var_resp.text().await?;
214
215    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
216        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
217    } else {
218        let local_var_entity: Option<GetHubProjectBySourceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
219        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
220        Err(Error::ResponseError(local_var_error))
221    }
222}
223
224/// 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. 
225pub async fn get_hub_project_export(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: Option<&str>) -> Result<String, Error<GetHubProjectExportError>> {
226    let local_var_configuration = configuration;
227
228    let local_var_client = &local_var_configuration.client;
229
230    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));
231    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
232
233    if let Some(ref local_var_str) = folder {
234        local_var_req_builder = local_var_req_builder.query(&[("folder", &local_var_str.to_string())]);
235    }
236    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
237        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
238    }
239    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
240        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
241    };
242
243    let local_var_req = local_var_req_builder.build()?;
244    let local_var_resp = local_var_client.execute(local_var_req).await?;
245
246    let local_var_status = local_var_resp.status();
247    let local_var_content = local_var_resp.text().await?;
248
249    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
250        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
251    } else {
252        let local_var_entity: Option<GetHubProjectExportError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
253        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
254        Err(Error::ResponseError(local_var_error))
255    }
256}
257
258/// Forwards to the configured Hub's public project catalogue and returns its status code and raw response body. Readable by any workspace member: the listing is not workspace-scoped, and it is proxied only because the Hub's listing endpoint sends no CORS header. Refused with 400 when the instance has the Hub disabled, in which case no outbound request is made. 
259pub async fn list_hub_projects(configuration: &configuration::Configuration, workspace: &str) -> Result<String, Error<ListHubProjectsError>> {
260    let local_var_configuration = configuration;
261
262    let local_var_client = &local_var_configuration.client;
263
264    let local_var_uri_str = format!("{}/w/{workspace}/hub/projects", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
265    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
266
267    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
268        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
269    }
270    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
271        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
272    };
273
274    let local_var_req = local_var_req_builder.build()?;
275    let local_var_resp = local_var_client.execute(local_var_req).await?;
276
277    let local_var_status = local_var_resp.status();
278    let local_var_content = local_var_resp.text().await?;
279
280    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
281        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
282    } else {
283        let local_var_entity: Option<ListHubProjectsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
284        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
285        Err(Error::ResponseError(local_var_error))
286    }
287}
288
289/// 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. 
290pub async fn publish_hub_app(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_app_body: models::PublishAppBody) -> Result<String, Error<PublishHubAppError>> {
291    let local_var_configuration = configuration;
292
293    let local_var_client = &local_var_configuration.client;
294
295    let local_var_uri_str = format!("{}/w/{workspace}/hub/apps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
296    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
297
298    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
299    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
300        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
301    }
302    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
303        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
304    };
305    local_var_req_builder = local_var_req_builder.json(&publish_app_body);
306
307    let local_var_req = local_var_req_builder.build()?;
308    let local_var_resp = local_var_client.execute(local_var_req).await?;
309
310    let local_var_status = local_var_resp.status();
311    let local_var_content = local_var_resp.text().await?;
312
313    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
314        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
315    } else {
316        let local_var_entity: Option<PublishHubAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
317        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
318        Err(Error::ResponseError(local_var_error))
319    }
320}
321
322/// 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. 
323pub async fn publish_hub_draft(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_draft_body: models::PublishDraftBody) -> Result<String, Error<PublishHubDraftError>> {
324    let local_var_configuration = configuration;
325
326    let local_var_client = &local_var_configuration.client;
327
328    let local_var_uri_str = format!("{}/w/{workspace}/hub/publish_draft", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
329    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
330
331    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
332    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
333        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
334    }
335    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
336        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
337    };
338    local_var_req_builder = local_var_req_builder.json(&publish_draft_body);
339
340    let local_var_req = local_var_req_builder.build()?;
341    let local_var_resp = local_var_client.execute(local_var_req).await?;
342
343    let local_var_status = local_var_resp.status();
344    let local_var_content = local_var_resp.text().await?;
345
346    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
347        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
348    } else {
349        let local_var_entity: Option<PublishHubDraftError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
350        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
351        Err(Error::ResponseError(local_var_error))
352    }
353}
354
355/// 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. 
356pub async fn publish_hub_flow(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_flow_body: models::PublishFlowBody) -> Result<String, Error<PublishHubFlowError>> {
357    let local_var_configuration = configuration;
358
359    let local_var_client = &local_var_configuration.client;
360
361    let local_var_uri_str = format!("{}/w/{workspace}/hub/flows", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
362    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
363
364    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
365    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
366        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
367    }
368    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
369        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
370    };
371    local_var_req_builder = local_var_req_builder.json(&publish_flow_body);
372
373    let local_var_req = local_var_req_builder.build()?;
374    let local_var_resp = local_var_client.execute(local_var_req).await?;
375
376    let local_var_status = local_var_resp.status();
377    let local_var_content = local_var_resp.text().await?;
378
379    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
380        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
381    } else {
382        let local_var_entity: Option<PublishHubFlowError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
383        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
384        Err(Error::ResponseError(local_var_error))
385    }
386}
387
388/// 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. 
389pub async fn publish_hub_flow_recording(configuration: &configuration::Configuration, workspace: &str, flow_id: i64, folder: &str, recording_body: models::RecordingBody) -> Result<String, Error<PublishHubFlowRecordingError>> {
390    let local_var_configuration = configuration;
391
392    let local_var_client = &local_var_configuration.client;
393
394    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);
395    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
396
397    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
398    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
399        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
400    }
401    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
402        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
403    };
404    local_var_req_builder = local_var_req_builder.json(&recording_body);
405
406    let local_var_req = local_var_req_builder.build()?;
407    let local_var_resp = local_var_client.execute(local_var_req).await?;
408
409    let local_var_status = local_var_resp.status();
410    let local_var_content = local_var_resp.text().await?;
411
412    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
413        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
414    } else {
415        let local_var_entity: Option<PublishHubFlowRecordingError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
416        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
417        Err(Error::ResponseError(local_var_error))
418    }
419}
420
421/// 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. 
422pub async fn publish_hub_migrations(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_migrations_body: models::PublishMigrationsBody) -> Result<String, Error<PublishHubMigrationsError>> {
423    let local_var_configuration = configuration;
424
425    let local_var_client = &local_var_configuration.client;
426
427    let local_var_uri_str = format!("{}/w/{workspace}/hub/migrations", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
428    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
429
430    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
431    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
432        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
433    }
434    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
435        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
436    };
437    local_var_req_builder = local_var_req_builder.json(&publish_migrations_body);
438
439    let local_var_req = local_var_req_builder.build()?;
440    let local_var_resp = local_var_client.execute(local_var_req).await?;
441
442    let local_var_status = local_var_resp.status();
443    let local_var_content = local_var_resp.text().await?;
444
445    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
446        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
447    } else {
448        let local_var_entity: Option<PublishHubMigrationsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
449        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
450        Err(Error::ResponseError(local_var_error))
451    }
452}
453
454/// 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. 
455pub async fn publish_hub_pipeline_recording(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str, pipeline_recording_body: models::PipelineRecordingBody) -> Result<String, Error<PublishHubPipelineRecordingError>> {
456    let local_var_configuration = configuration;
457
458    let local_var_client = &local_var_configuration.client;
459
460    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));
461    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
462
463    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
464    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
465        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
466    }
467    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
468        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
469    };
470    local_var_req_builder = local_var_req_builder.json(&pipeline_recording_body);
471
472    let local_var_req = local_var_req_builder.build()?;
473    let local_var_resp = local_var_client.execute(local_var_req).await?;
474
475    let local_var_status = local_var_resp.status();
476    let local_var_content = local_var_resp.text().await?;
477
478    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
479        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
480    } else {
481        let local_var_entity: Option<PublishHubPipelineRecordingError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
482        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
483        Err(Error::ResponseError(local_var_error))
484    }
485}
486
487/// Requires the caller to be a workspace admin. Sets the project's custom logo (base64 png/svg, decoded size max 512KB) or clears it when `logo` is null; the `logo` field itself is required so an empty body cannot clear the logo by accident. Forwards the request to the configured Hub scoped to the `{workspace}:{folder}` source and returns the Hub's status code and raw response body. 
488pub async fn publish_hub_project_logo(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str, project_logo_body: models::ProjectLogoBody) -> Result<String, Error<PublishHubProjectLogoError>> {
489    let local_var_configuration = configuration;
490
491    let local_var_client = &local_var_configuration.client;
492
493    let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/logo", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
494    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
495
496    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
497    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
498        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
499    }
500    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
501        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
502    };
503    local_var_req_builder = local_var_req_builder.json(&project_logo_body);
504
505    let local_var_req = local_var_req_builder.build()?;
506    let local_var_resp = local_var_client.execute(local_var_req).await?;
507
508    let local_var_status = local_var_resp.status();
509    let local_var_content = local_var_resp.text().await?;
510
511    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
512        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
513    } else {
514        let local_var_entity: Option<PublishHubProjectLogoError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
515        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
516        Err(Error::ResponseError(local_var_error))
517    }
518}
519
520/// 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. 
521pub async fn publish_hub_raw_app(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_raw_app_body: models::PublishRawAppBody) -> Result<String, Error<PublishHubRawAppError>> {
522    let local_var_configuration = configuration;
523
524    let local_var_client = &local_var_configuration.client;
525
526    let local_var_uri_str = format!("{}/w/{workspace}/hub/raw_apps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
527    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
528
529    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
530    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
531        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
532    }
533    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
534        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
535    };
536    local_var_req_builder = local_var_req_builder.json(&publish_raw_app_body);
537
538    let local_var_req = local_var_req_builder.build()?;
539    let local_var_resp = local_var_client.execute(local_var_req).await?;
540
541    let local_var_status = local_var_resp.status();
542    let local_var_content = local_var_resp.text().await?;
543
544    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
545        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
546    } else {
547        let local_var_entity: Option<PublishHubRawAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
548        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
549        Err(Error::ResponseError(local_var_error))
550    }
551}
552
553/// 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. 
554pub async fn publish_hub_raw_app_recording(configuration: &configuration::Configuration, workspace: &str, id: i64, folder: &str, recording_body: models::RecordingBody) -> Result<String, Error<PublishHubRawAppRecordingError>> {
555    let local_var_configuration = configuration;
556
557    let local_var_client = &local_var_configuration.client;
558
559    let local_var_uri_str = format!("{}/w/{workspace}/hub/raw_apps/{id}/recording", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=id);
560    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
561
562    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
563    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
564        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
565    }
566    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
567        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
568    };
569    local_var_req_builder = local_var_req_builder.json(&recording_body);
570
571    let local_var_req = local_var_req_builder.build()?;
572    let local_var_resp = local_var_client.execute(local_var_req).await?;
573
574    let local_var_status = local_var_resp.status();
575    let local_var_content = local_var_resp.text().await?;
576
577    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
578        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
579    } else {
580        let local_var_entity: Option<PublishHubRawAppRecordingError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
581        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
582        Err(Error::ResponseError(local_var_error))
583    }
584}
585
586/// 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. 
587pub async fn publish_hub_resource_type(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_resource_type_body: models::PublishResourceTypeBody) -> Result<String, Error<PublishHubResourceTypeError>> {
588    let local_var_configuration = configuration;
589
590    let local_var_client = &local_var_configuration.client;
591
592    let local_var_uri_str = format!("{}/w/{workspace}/hub/resource_types", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
593    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
594
595    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
596    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
597        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
598    }
599    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
600        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
601    };
602    local_var_req_builder = local_var_req_builder.json(&publish_resource_type_body);
603
604    let local_var_req = local_var_req_builder.build()?;
605    let local_var_resp = local_var_client.execute(local_var_req).await?;
606
607    let local_var_status = local_var_resp.status();
608    let local_var_content = local_var_resp.text().await?;
609
610    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
611        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
612    } else {
613        let local_var_entity: Option<PublishHubResourceTypeError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
614        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
615        Err(Error::ResponseError(local_var_error))
616    }
617}
618
619/// 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. 
620pub async fn publish_hub_resources(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_resources_body: models::PublishResourcesBody) -> Result<String, Error<PublishHubResourcesError>> {
621    let local_var_configuration = configuration;
622
623    let local_var_client = &local_var_configuration.client;
624
625    let local_var_uri_str = format!("{}/w/{workspace}/hub/resources", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
626    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
627
628    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
629    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
630        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
631    }
632    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
633        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
634    };
635    local_var_req_builder = local_var_req_builder.json(&publish_resources_body);
636
637    let local_var_req = local_var_req_builder.build()?;
638    let local_var_resp = local_var_client.execute(local_var_req).await?;
639
640    let local_var_status = local_var_resp.status();
641    let local_var_content = local_var_resp.text().await?;
642
643    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
644        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
645    } else {
646        let local_var_entity: Option<PublishHubResourcesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
647        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
648        Err(Error::ResponseError(local_var_error))
649    }
650}
651
652/// 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. 
653pub async fn publish_hub_script(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_script_body: models::PublishScriptBody) -> Result<String, Error<PublishHubScriptError>> {
654    let local_var_configuration = configuration;
655
656    let local_var_client = &local_var_configuration.client;
657
658    let local_var_uri_str = format!("{}/w/{workspace}/hub/scripts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
659    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
660
661    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
662    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
663        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
664    }
665    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
666        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
667    };
668    local_var_req_builder = local_var_req_builder.json(&publish_script_body);
669
670    let local_var_req = local_var_req_builder.build()?;
671    let local_var_resp = local_var_client.execute(local_var_req).await?;
672
673    let local_var_status = local_var_resp.status();
674    let local_var_content = local_var_resp.text().await?;
675
676    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
677        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
678    } else {
679        let local_var_entity: Option<PublishHubScriptError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
680        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
681        Err(Error::ResponseError(local_var_error))
682    }
683}
684
685/// 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. 
686pub async fn publish_hub_script_recording(configuration: &configuration::Configuration, workspace: &str, ask_id: i64, folder: &str, recording_body: models::RecordingBody) -> Result<String, Error<PublishHubScriptRecordingError>> {
687    let local_var_configuration = configuration;
688
689    let local_var_client = &local_var_configuration.client;
690
691    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);
692    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
693
694    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
695    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
696        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
697    }
698    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
699        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
700    };
701    local_var_req_builder = local_var_req_builder.json(&recording_body);
702
703    let local_var_req = local_var_req_builder.build()?;
704    let local_var_resp = local_var_client.execute(local_var_req).await?;
705
706    let local_var_status = local_var_resp.status();
707    let local_var_content = local_var_resp.text().await?;
708
709    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
710        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
711    } else {
712        let local_var_entity: Option<PublishHubScriptRecordingError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
713        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
714        Err(Error::ResponseError(local_var_error))
715    }
716}
717
718/// 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. 
719pub async fn publish_hub_triggers(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_triggers_body: models::PublishTriggersBody) -> Result<String, Error<PublishHubTriggersError>> {
720    let local_var_configuration = configuration;
721
722    let local_var_client = &local_var_configuration.client;
723
724    let local_var_uri_str = format!("{}/w/{workspace}/hub/triggers", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
725    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
726
727    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
728    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
729        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
730    }
731    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
732        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
733    };
734    local_var_req_builder = local_var_req_builder.json(&publish_triggers_body);
735
736    let local_var_req = local_var_req_builder.build()?;
737    let local_var_resp = local_var_client.execute(local_var_req).await?;
738
739    let local_var_status = local_var_resp.status();
740    let local_var_content = local_var_resp.text().await?;
741
742    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
743        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
744    } else {
745        let local_var_entity: Option<PublishHubTriggersError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
746        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
747        Err(Error::ResponseError(local_var_error))
748    }
749}
750
751/// 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. 
752pub async fn submit_hub_project(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str) -> Result<String, Error<SubmitHubProjectError>> {
753    let local_var_configuration = configuration;
754
755    let local_var_client = &local_var_configuration.client;
756
757    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));
758    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
759
760    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
761    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
762        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
763    }
764    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
765        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
766    };
767
768    let local_var_req = local_var_req_builder.build()?;
769    let local_var_resp = local_var_client.execute(local_var_req).await?;
770
771    let local_var_status = local_var_resp.status();
772    let local_var_content = local_var_resp.text().await?;
773
774    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
775        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
776    } else {
777        let local_var_entity: Option<SubmitHubProjectError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
778        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
779        Err(Error::ResponseError(local_var_error))
780    }
781}
782
783/// 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. Everything pushed for the submission is kept, so it can be fixed and submitted again. 
784pub async fn withdraw_hub_project(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str) -> Result<String, Error<WithdrawHubProjectError>> {
785    let local_var_configuration = configuration;
786
787    let local_var_client = &local_var_configuration.client;
788
789    let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/withdraw", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
790    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
791
792    local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
793    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
794        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
795    }
796    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
797        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
798    };
799
800    let local_var_req = local_var_req_builder.build()?;
801    let local_var_resp = local_var_client.execute(local_var_req).await?;
802
803    let local_var_status = local_var_resp.status();
804    let local_var_content = local_var_resp.text().await?;
805
806    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
807        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
808    } else {
809        let local_var_entity: Option<WithdrawHubProjectError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
810        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
811        Err(Error::ResponseError(local_var_error))
812    }
813}
814