Skip to main content

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.770.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 [`check_s3_folder_exists`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CheckS3FolderExistsError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`dataset_storage_test_connection`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DatasetStorageTestConnectionError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`delete_s3_file`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DeleteS3FileError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`duckdb_connection_settings`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DuckdbConnectionSettingsError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`duckdb_connection_settings_v2`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum DuckdbConnectionSettingsV2Error {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`file_download`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum FileDownloadError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`file_download_parquet_as_csv`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum FileDownloadParquetAsCsvError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`file_upload`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum FileUploadError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_storage_usage`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetStorageUsageError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`git_repo_viewer_file_upload`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GitRepoViewerFileUploadError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`list_git_repo_files`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ListGitRepoFilesError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`list_stored_files`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum ListStoredFilesError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`load_csv_preview`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum LoadCsvPreviewError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`load_file_metadata`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum LoadFileMetadataError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`load_file_preview`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum LoadFilePreviewError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`load_git_repo_file_metadata`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum LoadGitRepoFileMetadataError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`load_git_repo_file_preview`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum LoadGitRepoFilePreviewError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`load_parquet_preview`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum LoadParquetPreviewError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`load_table_row_count`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum LoadTableRowCountError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`move_s3_file`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum MoveS3FileError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`polars_connection_settings`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum PolarsConnectionSettingsError {
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`polars_connection_settings_v2`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum PolarsConnectionSettingsV2Error {
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`s3_resource_info`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum S3ResourceInfoError {
176    UnknownValue(serde_json::Value),
177}
178
179
180pub async fn check_s3_folder_exists(configuration: &configuration::Configuration, workspace: &str, file_key: &str, marker_file: Option<&str>) -> Result<models::CheckS3FolderExists200Response, Error<CheckS3FolderExistsError>> {
181    let local_var_configuration = configuration;
182
183    let local_var_client = &local_var_configuration.client;
184
185    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/check_s3_folder_exists", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
186    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
187
188    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
189    if let Some(ref local_var_str) = marker_file {
190        local_var_req_builder = local_var_req_builder.query(&[("marker_file", &local_var_str.to_string())]);
191    }
192    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
193        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
194    }
195    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
196        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
197    };
198
199    let local_var_req = local_var_req_builder.build()?;
200    let local_var_resp = local_var_client.execute(local_var_req).await?;
201
202    let local_var_status = local_var_resp.status();
203    let local_var_content = local_var_resp.text().await?;
204
205    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
206        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
207    } else {
208        let local_var_entity: Option<CheckS3FolderExistsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
209        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
210        Err(Error::ResponseError(local_var_error))
211    }
212}
213
214pub async fn dataset_storage_test_connection(configuration: &configuration::Configuration, workspace: &str, storage: Option<&str>, s3_resource_path: Option<&str>) -> Result<serde_json::Value, Error<DatasetStorageTestConnectionError>> {
215    let local_var_configuration = configuration;
216
217    let local_var_client = &local_var_configuration.client;
218
219    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/test_connection", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
220    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
221
222    if let Some(ref local_var_str) = storage {
223        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
224    }
225    if let Some(ref local_var_str) = s3_resource_path {
226        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &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<DatasetStorageTestConnectionError> = 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
250pub async fn delete_s3_file(configuration: &configuration::Configuration, workspace: &str, file_key: &str, storage: Option<&str>, s3_resource_path: Option<&str>) -> Result<serde_json::Value, Error<DeleteS3FileError>> {
251    let local_var_configuration = configuration;
252
253    let local_var_client = &local_var_configuration.client;
254
255    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/delete_s3_file", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
256    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
257
258    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
259    if let Some(ref local_var_str) = storage {
260        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
261    }
262    if let Some(ref local_var_str) = s3_resource_path {
263        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
264    }
265    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
266        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
267    }
268    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
269        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
270    };
271
272    let local_var_req = local_var_req_builder.build()?;
273    let local_var_resp = local_var_client.execute(local_var_req).await?;
274
275    let local_var_status = local_var_resp.status();
276    let local_var_content = local_var_resp.text().await?;
277
278    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
279        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
280    } else {
281        let local_var_entity: Option<DeleteS3FileError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
282        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
283        Err(Error::ResponseError(local_var_error))
284    }
285}
286
287pub async fn duckdb_connection_settings(configuration: &configuration::Configuration, workspace: &str, duckdb_connection_settings_request: models::DuckdbConnectionSettingsRequest) -> Result<models::DuckdbConnectionSettings200Response, Error<DuckdbConnectionSettingsError>> {
288    let local_var_configuration = configuration;
289
290    let local_var_client = &local_var_configuration.client;
291
292    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/duckdb_connection_settings", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
293    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
294
295    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
296        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
297    }
298    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
299        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
300    };
301    local_var_req_builder = local_var_req_builder.json(&duckdb_connection_settings_request);
302
303    let local_var_req = local_var_req_builder.build()?;
304    let local_var_resp = local_var_client.execute(local_var_req).await?;
305
306    let local_var_status = local_var_resp.status();
307    let local_var_content = local_var_resp.text().await?;
308
309    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
310        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
311    } else {
312        let local_var_entity: Option<DuckdbConnectionSettingsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
313        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
314        Err(Error::ResponseError(local_var_error))
315    }
316}
317
318pub async fn duckdb_connection_settings_v2(configuration: &configuration::Configuration, workspace: &str, duckdb_connection_settings_v2_request: models::DuckdbConnectionSettingsV2Request) -> Result<models::DuckdbConnectionSettingsV2200Response, Error<DuckdbConnectionSettingsV2Error>> {
319    let local_var_configuration = configuration;
320
321    let local_var_client = &local_var_configuration.client;
322
323    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/v2/duckdb_connection_settings", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
324    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
325
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(&duckdb_connection_settings_v2_request);
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<DuckdbConnectionSettingsV2Error> = 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
349pub 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>> {
350    let local_var_configuration = configuration;
351
352    let local_var_client = &local_var_configuration.client;
353
354    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/download_s3_file", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
355    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
356
357    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
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_user_agent) = local_var_configuration.user_agent {
368        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
369    }
370    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
371        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
372    };
373
374    let local_var_req = local_var_req_builder.build()?;
375    let local_var_resp = local_var_client.execute(local_var_req).await?;
376
377    let local_var_status = local_var_resp.status();
378    let local_var_content = local_var_resp.text().await?;
379
380    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
381        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
382    } else {
383        let local_var_entity: Option<FileDownloadError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
384        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
385        Err(Error::ResponseError(local_var_error))
386    }
387}
388
389pub 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>> {
390    let local_var_configuration = configuration;
391
392    let local_var_client = &local_var_configuration.client;
393
394    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/download_s3_parquet_file_as_csv", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
395    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
396
397    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
398    if let Some(ref local_var_str) = s3_resource_path {
399        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
400    }
401    if let Some(ref local_var_str) = resource_type {
402        local_var_req_builder = local_var_req_builder.query(&[("resource_type", &local_var_str.to_string())]);
403    }
404    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
405        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
406    }
407    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
408        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
409    };
410
411    let local_var_req = local_var_req_builder.build()?;
412    let local_var_resp = local_var_client.execute(local_var_req).await?;
413
414    let local_var_status = local_var_resp.status();
415    let local_var_content = local_var_resp.text().await?;
416
417    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
418        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
419    } else {
420        let local_var_entity: Option<FileDownloadParquetAsCsvError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
421        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
422        Err(Error::ResponseError(local_var_error))
423    }
424}
425
426pub 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>> {
427    let local_var_configuration = configuration;
428
429    let local_var_client = &local_var_configuration.client;
430
431    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/upload_s3_file", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
432    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
433
434    if let Some(ref local_var_str) = file_key {
435        local_var_req_builder = local_var_req_builder.query(&[("file_key", &local_var_str.to_string())]);
436    }
437    if let Some(ref local_var_str) = file_extension {
438        local_var_req_builder = local_var_req_builder.query(&[("file_extension", &local_var_str.to_string())]);
439    }
440    if let Some(ref local_var_str) = s3_resource_path {
441        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
442    }
443    if let Some(ref local_var_str) = resource_type {
444        local_var_req_builder = local_var_req_builder.query(&[("resource_type", &local_var_str.to_string())]);
445    }
446    if let Some(ref local_var_str) = storage {
447        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
448    }
449    if let Some(ref local_var_str) = content_type {
450        local_var_req_builder = local_var_req_builder.query(&[("content_type", &local_var_str.to_string())]);
451    }
452    if let Some(ref local_var_str) = content_disposition {
453        local_var_req_builder = local_var_req_builder.query(&[("content_disposition", &local_var_str.to_string())]);
454    }
455    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
456        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
457    }
458    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
459        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
460    };
461    local_var_req_builder = local_var_req_builder.json(&body);
462
463    let local_var_req = local_var_req_builder.build()?;
464    let local_var_resp = local_var_client.execute(local_var_req).await?;
465
466    let local_var_status = local_var_resp.status();
467    let local_var_content = local_var_resp.text().await?;
468
469    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
470        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
471    } else {
472        let local_var_entity: Option<FileUploadError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
473        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
474        Err(Error::ResponseError(local_var_error))
475    }
476}
477
478pub async fn get_storage_usage(configuration: &configuration::Configuration, workspace: &str, refresh: Option<bool>) -> Result<models::GetStorageUsage200Response, Error<GetStorageUsageError>> {
479    let local_var_configuration = configuration;
480
481    let local_var_client = &local_var_configuration.client;
482
483    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/storage_usage", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
484    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
485
486    if let Some(ref local_var_str) = refresh {
487        local_var_req_builder = local_var_req_builder.query(&[("refresh", &local_var_str.to_string())]);
488    }
489    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
490        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
491    }
492    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
493        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
494    };
495
496    let local_var_req = local_var_req_builder.build()?;
497    let local_var_resp = local_var_client.execute(local_var_req).await?;
498
499    let local_var_status = local_var_resp.status();
500    let local_var_content = local_var_resp.text().await?;
501
502    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
503        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
504    } else {
505        let local_var_entity: Option<GetStorageUsageError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
506        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
507        Err(Error::ResponseError(local_var_error))
508    }
509}
510
511pub async fn git_repo_viewer_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<GitRepoViewerFileUploadError>> {
512    let local_var_configuration = configuration;
513
514    let local_var_client = &local_var_configuration.client;
515
516    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/upload_git_repo_file_to_instance_storage", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
517    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
518
519    if let Some(ref local_var_str) = file_key {
520        local_var_req_builder = local_var_req_builder.query(&[("file_key", &local_var_str.to_string())]);
521    }
522    if let Some(ref local_var_str) = file_extension {
523        local_var_req_builder = local_var_req_builder.query(&[("file_extension", &local_var_str.to_string())]);
524    }
525    if let Some(ref local_var_str) = s3_resource_path {
526        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
527    }
528    if let Some(ref local_var_str) = resource_type {
529        local_var_req_builder = local_var_req_builder.query(&[("resource_type", &local_var_str.to_string())]);
530    }
531    if let Some(ref local_var_str) = storage {
532        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
533    }
534    if let Some(ref local_var_str) = content_type {
535        local_var_req_builder = local_var_req_builder.query(&[("content_type", &local_var_str.to_string())]);
536    }
537    if let Some(ref local_var_str) = content_disposition {
538        local_var_req_builder = local_var_req_builder.query(&[("content_disposition", &local_var_str.to_string())]);
539    }
540    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
541        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
542    }
543    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
544        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
545    };
546    local_var_req_builder = local_var_req_builder.json(&body);
547
548    let local_var_req = local_var_req_builder.build()?;
549    let local_var_resp = local_var_client.execute(local_var_req).await?;
550
551    let local_var_status = local_var_resp.status();
552    let local_var_content = local_var_resp.text().await?;
553
554    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
555        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
556    } else {
557        let local_var_entity: Option<GitRepoViewerFileUploadError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
558        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
559        Err(Error::ResponseError(local_var_error))
560    }
561}
562
563pub async fn list_git_repo_files(configuration: &configuration::Configuration, workspace: &str, max_keys: i32, marker: Option<&str>, prefix: Option<&str>, storage: Option<&str>) -> Result<models::ListStoredFiles200Response, Error<ListGitRepoFilesError>> {
564    let local_var_configuration = configuration;
565
566    let local_var_client = &local_var_configuration.client;
567
568    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/list_git_repo_files", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
569    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
570
571    local_var_req_builder = local_var_req_builder.query(&[("max_keys", &max_keys.to_string())]);
572    if let Some(ref local_var_str) = marker {
573        local_var_req_builder = local_var_req_builder.query(&[("marker", &local_var_str.to_string())]);
574    }
575    if let Some(ref local_var_str) = prefix {
576        local_var_req_builder = local_var_req_builder.query(&[("prefix", &local_var_str.to_string())]);
577    }
578    if let Some(ref local_var_str) = storage {
579        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
580    }
581    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
582        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
583    }
584    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
585        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
586    };
587
588    let local_var_req = local_var_req_builder.build()?;
589    let local_var_resp = local_var_client.execute(local_var_req).await?;
590
591    let local_var_status = local_var_resp.status();
592    let local_var_content = local_var_resp.text().await?;
593
594    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
595        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
596    } else {
597        let local_var_entity: Option<ListGitRepoFilesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
598        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
599        Err(Error::ResponseError(local_var_error))
600    }
601}
602
603pub async fn list_stored_files(configuration: &configuration::Configuration, workspace: &str, max_keys: i32, marker: Option<&str>, prefix: Option<&str>, storage: Option<&str>, s3_resource_path: Option<&str>) -> Result<models::ListStoredFiles200Response, Error<ListStoredFilesError>> {
604    let local_var_configuration = configuration;
605
606    let local_var_client = &local_var_configuration.client;
607
608    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/list_stored_files", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
609    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
610
611    local_var_req_builder = local_var_req_builder.query(&[("max_keys", &max_keys.to_string())]);
612    if let Some(ref local_var_str) = marker {
613        local_var_req_builder = local_var_req_builder.query(&[("marker", &local_var_str.to_string())]);
614    }
615    if let Some(ref local_var_str) = prefix {
616        local_var_req_builder = local_var_req_builder.query(&[("prefix", &local_var_str.to_string())]);
617    }
618    if let Some(ref local_var_str) = storage {
619        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
620    }
621    if let Some(ref local_var_str) = s3_resource_path {
622        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
623    }
624    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
625        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
626    }
627    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
628        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
629    };
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<ListStoredFilesError> = 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
646pub 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<(), Error<LoadCsvPreviewError>> {
647    let local_var_configuration = configuration;
648
649    let local_var_client = &local_var_configuration.client;
650
651    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));
652    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
653
654    if let Some(ref local_var_str) = offset {
655        local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
656    }
657    if let Some(ref local_var_str) = limit {
658        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
659    }
660    if let Some(ref local_var_str) = sort_col {
661        local_var_req_builder = local_var_req_builder.query(&[("sort_col", &local_var_str.to_string())]);
662    }
663    if let Some(ref local_var_str) = sort_desc {
664        local_var_req_builder = local_var_req_builder.query(&[("sort_desc", &local_var_str.to_string())]);
665    }
666    if let Some(ref local_var_str) = search_col {
667        local_var_req_builder = local_var_req_builder.query(&[("search_col", &local_var_str.to_string())]);
668    }
669    if let Some(ref local_var_str) = search_term {
670        local_var_req_builder = local_var_req_builder.query(&[("search_term", &local_var_str.to_string())]);
671    }
672    if let Some(ref local_var_str) = storage {
673        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
674    }
675    if let Some(ref local_var_str) = csv_separator {
676        local_var_req_builder = local_var_req_builder.query(&[("csv_separator", &local_var_str.to_string())]);
677    }
678    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
679        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
680    }
681    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
682        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
683    };
684
685    let local_var_req = local_var_req_builder.build()?;
686    let local_var_resp = local_var_client.execute(local_var_req).await?;
687
688    let local_var_status = local_var_resp.status();
689    let local_var_content = local_var_resp.text().await?;
690
691    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
692        Ok(())
693    } else {
694        let local_var_entity: Option<LoadCsvPreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
695        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
696        Err(Error::ResponseError(local_var_error))
697    }
698}
699
700pub async fn load_file_metadata(configuration: &configuration::Configuration, workspace: &str, file_key: &str, storage: Option<&str>, s3_resource_path: Option<&str>) -> Result<models::WindmillFileMetadata, Error<LoadFileMetadataError>> {
701    let local_var_configuration = configuration;
702
703    let local_var_client = &local_var_configuration.client;
704
705    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/load_file_metadata", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
706    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
707
708    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
709    if let Some(ref local_var_str) = storage {
710        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
711    }
712    if let Some(ref local_var_str) = s3_resource_path {
713        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
714    }
715    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
716        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
717    }
718    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
719        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
720    };
721
722    let local_var_req = local_var_req_builder.build()?;
723    let local_var_resp = local_var_client.execute(local_var_req).await?;
724
725    let local_var_status = local_var_resp.status();
726    let local_var_content = local_var_resp.text().await?;
727
728    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
729        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
730    } else {
731        let local_var_entity: Option<LoadFileMetadataError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
732        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
733        Err(Error::ResponseError(local_var_error))
734    }
735}
736
737pub 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>, s3_resource_path: Option<&str>) -> Result<models::WindmillFilePreview, Error<LoadFilePreviewError>> {
738    let local_var_configuration = configuration;
739
740    let local_var_client = &local_var_configuration.client;
741
742    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/load_file_preview", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
743    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
744
745    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
746    if let Some(ref local_var_str) = file_size_in_bytes {
747        local_var_req_builder = local_var_req_builder.query(&[("file_size_in_bytes", &local_var_str.to_string())]);
748    }
749    if let Some(ref local_var_str) = file_mime_type {
750        local_var_req_builder = local_var_req_builder.query(&[("file_mime_type", &local_var_str.to_string())]);
751    }
752    if let Some(ref local_var_str) = csv_separator {
753        local_var_req_builder = local_var_req_builder.query(&[("csv_separator", &local_var_str.to_string())]);
754    }
755    if let Some(ref local_var_str) = csv_has_header {
756        local_var_req_builder = local_var_req_builder.query(&[("csv_has_header", &local_var_str.to_string())]);
757    }
758    if let Some(ref local_var_str) = read_bytes_from {
759        local_var_req_builder = local_var_req_builder.query(&[("read_bytes_from", &local_var_str.to_string())]);
760    }
761    if let Some(ref local_var_str) = read_bytes_length {
762        local_var_req_builder = local_var_req_builder.query(&[("read_bytes_length", &local_var_str.to_string())]);
763    }
764    if let Some(ref local_var_str) = storage {
765        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
766    }
767    if let Some(ref local_var_str) = s3_resource_path {
768        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
769    }
770    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
771        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
772    }
773    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
774        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
775    };
776
777    let local_var_req = local_var_req_builder.build()?;
778    let local_var_resp = local_var_client.execute(local_var_req).await?;
779
780    let local_var_status = local_var_resp.status();
781    let local_var_content = local_var_resp.text().await?;
782
783    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
784        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
785    } else {
786        let local_var_entity: Option<LoadFilePreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
787        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
788        Err(Error::ResponseError(local_var_error))
789    }
790}
791
792pub async fn load_git_repo_file_metadata(configuration: &configuration::Configuration, workspace: &str, file_key: &str, storage: Option<&str>) -> Result<models::WindmillFileMetadata, Error<LoadGitRepoFileMetadataError>> {
793    let local_var_configuration = configuration;
794
795    let local_var_client = &local_var_configuration.client;
796
797    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/load_git_repo_file_metadata", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
798    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
799
800    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
801    if let Some(ref local_var_str) = storage {
802        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
803    }
804    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
805        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
806    }
807    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
808        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
809    };
810
811    let local_var_req = local_var_req_builder.build()?;
812    let local_var_resp = local_var_client.execute(local_var_req).await?;
813
814    let local_var_status = local_var_resp.status();
815    let local_var_content = local_var_resp.text().await?;
816
817    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
818        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
819    } else {
820        let local_var_entity: Option<LoadGitRepoFileMetadataError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
821        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
822        Err(Error::ResponseError(local_var_error))
823    }
824}
825
826pub async fn load_git_repo_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<LoadGitRepoFilePreviewError>> {
827    let local_var_configuration = configuration;
828
829    let local_var_client = &local_var_configuration.client;
830
831    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/load_git_repo_file_preview", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
832    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
833
834    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
835    if let Some(ref local_var_str) = file_size_in_bytes {
836        local_var_req_builder = local_var_req_builder.query(&[("file_size_in_bytes", &local_var_str.to_string())]);
837    }
838    if let Some(ref local_var_str) = file_mime_type {
839        local_var_req_builder = local_var_req_builder.query(&[("file_mime_type", &local_var_str.to_string())]);
840    }
841    if let Some(ref local_var_str) = csv_separator {
842        local_var_req_builder = local_var_req_builder.query(&[("csv_separator", &local_var_str.to_string())]);
843    }
844    if let Some(ref local_var_str) = csv_has_header {
845        local_var_req_builder = local_var_req_builder.query(&[("csv_has_header", &local_var_str.to_string())]);
846    }
847    if let Some(ref local_var_str) = read_bytes_from {
848        local_var_req_builder = local_var_req_builder.query(&[("read_bytes_from", &local_var_str.to_string())]);
849    }
850    if let Some(ref local_var_str) = read_bytes_length {
851        local_var_req_builder = local_var_req_builder.query(&[("read_bytes_length", &local_var_str.to_string())]);
852    }
853    if let Some(ref local_var_str) = storage {
854        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
855    }
856    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
857        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
858    }
859    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
860        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
861    };
862
863    let local_var_req = local_var_req_builder.build()?;
864    let local_var_resp = local_var_client.execute(local_var_req).await?;
865
866    let local_var_status = local_var_resp.status();
867    let local_var_content = local_var_resp.text().await?;
868
869    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
870        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
871    } else {
872        let local_var_entity: Option<LoadGitRepoFilePreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
873        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
874        Err(Error::ResponseError(local_var_error))
875    }
876}
877
878pub 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<(), Error<LoadParquetPreviewError>> {
879    let local_var_configuration = configuration;
880
881    let local_var_client = &local_var_configuration.client;
882
883    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));
884    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
885
886    if let Some(ref local_var_str) = offset {
887        local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
888    }
889    if let Some(ref local_var_str) = limit {
890        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
891    }
892    if let Some(ref local_var_str) = sort_col {
893        local_var_req_builder = local_var_req_builder.query(&[("sort_col", &local_var_str.to_string())]);
894    }
895    if let Some(ref local_var_str) = sort_desc {
896        local_var_req_builder = local_var_req_builder.query(&[("sort_desc", &local_var_str.to_string())]);
897    }
898    if let Some(ref local_var_str) = search_col {
899        local_var_req_builder = local_var_req_builder.query(&[("search_col", &local_var_str.to_string())]);
900    }
901    if let Some(ref local_var_str) = search_term {
902        local_var_req_builder = local_var_req_builder.query(&[("search_term", &local_var_str.to_string())]);
903    }
904    if let Some(ref local_var_str) = storage {
905        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
906    }
907    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
908        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
909    }
910    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
911        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
912    };
913
914    let local_var_req = local_var_req_builder.build()?;
915    let local_var_resp = local_var_client.execute(local_var_req).await?;
916
917    let local_var_status = local_var_resp.status();
918    let local_var_content = local_var_resp.text().await?;
919
920    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
921        Ok(())
922    } else {
923        let local_var_entity: Option<LoadParquetPreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
924        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
925        Err(Error::ResponseError(local_var_error))
926    }
927}
928
929pub 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::AppLoadTableCount200Response, Error<LoadTableRowCountError>> {
930    let local_var_configuration = configuration;
931
932    let local_var_client = &local_var_configuration.client;
933
934    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));
935    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
936
937    if let Some(ref local_var_str) = search_col {
938        local_var_req_builder = local_var_req_builder.query(&[("search_col", &local_var_str.to_string())]);
939    }
940    if let Some(ref local_var_str) = search_term {
941        local_var_req_builder = local_var_req_builder.query(&[("search_term", &local_var_str.to_string())]);
942    }
943    if let Some(ref local_var_str) = storage {
944        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
945    }
946    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
947        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
948    }
949    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
950        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
951    };
952
953    let local_var_req = local_var_req_builder.build()?;
954    let local_var_resp = local_var_client.execute(local_var_req).await?;
955
956    let local_var_status = local_var_resp.status();
957    let local_var_content = local_var_resp.text().await?;
958
959    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
960        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
961    } else {
962        let local_var_entity: Option<LoadTableRowCountError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
963        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
964        Err(Error::ResponseError(local_var_error))
965    }
966}
967
968pub async fn move_s3_file(configuration: &configuration::Configuration, workspace: &str, src_file_key: &str, dest_file_key: &str, storage: Option<&str>, s3_resource_path: Option<&str>) -> Result<serde_json::Value, Error<MoveS3FileError>> {
969    let local_var_configuration = configuration;
970
971    let local_var_client = &local_var_configuration.client;
972
973    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/move_s3_file", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
974    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
975
976    local_var_req_builder = local_var_req_builder.query(&[("src_file_key", &src_file_key.to_string())]);
977    local_var_req_builder = local_var_req_builder.query(&[("dest_file_key", &dest_file_key.to_string())]);
978    if let Some(ref local_var_str) = storage {
979        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
980    }
981    if let Some(ref local_var_str) = s3_resource_path {
982        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
983    }
984    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
985        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
986    }
987    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
988        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
989    };
990
991    let local_var_req = local_var_req_builder.build()?;
992    let local_var_resp = local_var_client.execute(local_var_req).await?;
993
994    let local_var_status = local_var_resp.status();
995    let local_var_content = local_var_resp.text().await?;
996
997    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
998        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
999    } else {
1000        let local_var_entity: Option<MoveS3FileError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1001        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1002        Err(Error::ResponseError(local_var_error))
1003    }
1004}
1005
1006pub async fn polars_connection_settings(configuration: &configuration::Configuration, workspace: &str, duckdb_connection_settings_request: models::DuckdbConnectionSettingsRequest) -> Result<models::PolarsConnectionSettings200Response, Error<PolarsConnectionSettingsError>> {
1007    let local_var_configuration = configuration;
1008
1009    let local_var_client = &local_var_configuration.client;
1010
1011    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/polars_connection_settings", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1012    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1013
1014    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1015        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1016    }
1017    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1018        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1019    };
1020    local_var_req_builder = local_var_req_builder.json(&duckdb_connection_settings_request);
1021
1022    let local_var_req = local_var_req_builder.build()?;
1023    let local_var_resp = local_var_client.execute(local_var_req).await?;
1024
1025    let local_var_status = local_var_resp.status();
1026    let local_var_content = local_var_resp.text().await?;
1027
1028    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1029        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1030    } else {
1031        let local_var_entity: Option<PolarsConnectionSettingsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1032        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1033        Err(Error::ResponseError(local_var_error))
1034    }
1035}
1036
1037pub async fn polars_connection_settings_v2(configuration: &configuration::Configuration, workspace: &str, duckdb_connection_settings_v2_request: models::DuckdbConnectionSettingsV2Request) -> Result<models::PolarsConnectionSettingsV2200Response, Error<PolarsConnectionSettingsV2Error>> {
1038    let local_var_configuration = configuration;
1039
1040    let local_var_client = &local_var_configuration.client;
1041
1042    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/v2/polars_connection_settings", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1043    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1044
1045    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1046        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1047    }
1048    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1049        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1050    };
1051    local_var_req_builder = local_var_req_builder.json(&duckdb_connection_settings_v2_request);
1052
1053    let local_var_req = local_var_req_builder.build()?;
1054    let local_var_resp = local_var_client.execute(local_var_req).await?;
1055
1056    let local_var_status = local_var_resp.status();
1057    let local_var_content = local_var_resp.text().await?;
1058
1059    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1060        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1061    } else {
1062        let local_var_entity: Option<PolarsConnectionSettingsV2Error> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1063        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1064        Err(Error::ResponseError(local_var_error))
1065    }
1066}
1067
1068pub async fn s3_resource_info(configuration: &configuration::Configuration, workspace: &str, duckdb_connection_settings_v2_request: models::DuckdbConnectionSettingsV2Request) -> Result<models::S3Resource, Error<S3ResourceInfoError>> {
1069    let local_var_configuration = configuration;
1070
1071    let local_var_client = &local_var_configuration.client;
1072
1073    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/v2/s3_resource_info", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1074    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1075
1076    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1077        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1078    }
1079    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1080        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1081    };
1082    local_var_req_builder = local_var_req_builder.json(&duckdb_connection_settings_v2_request);
1083
1084    let local_var_req = local_var_req_builder.build()?;
1085    let local_var_resp = local_var_client.execute(local_var_req).await?;
1086
1087    let local_var_status = local_var_resp.status();
1088    let local_var_content = local_var_resp.text().await?;
1089
1090    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1091        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1092    } else {
1093        let local_var_entity: Option<S3ResourceInfoError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1094        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1095        Err(Error::ResponseError(local_var_error))
1096    }
1097}
1098