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