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