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.779.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 [`list_stored_files_paged`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ListStoredFilesPagedError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`load_csv_preview`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum LoadCsvPreviewError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`load_file_metadata`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum LoadFileMetadataError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`load_file_preview`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum LoadFilePreviewError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`load_git_repo_file_metadata`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum LoadGitRepoFileMetadataError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`load_git_repo_file_preview`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum LoadGitRepoFilePreviewError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`load_parquet_preview`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum LoadParquetPreviewError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`load_table_row_count`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum LoadTableRowCountError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`move_s3_file`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum MoveS3FileError {
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`polars_connection_settings`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum PolarsConnectionSettingsError {
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`polars_connection_settings_v2`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum PolarsConnectionSettingsV2Error {
176    UnknownValue(serde_json::Value),
177}
178
179/// struct for typed errors of method [`s3_resource_info`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum S3ResourceInfoError {
183    UnknownValue(serde_json::Value),
184}
185
186
187pub async fn check_s3_folder_exists(configuration: &configuration::Configuration, workspace: &str, file_key: &str, marker_file: Option<&str>) -> Result<models::CheckS3FolderExists200Response, Error<CheckS3FolderExistsError>> {
188    let local_var_configuration = configuration;
189
190    let local_var_client = &local_var_configuration.client;
191
192    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/check_s3_folder_exists", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
193    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
194
195    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
196    if let Some(ref local_var_str) = marker_file {
197        local_var_req_builder = local_var_req_builder.query(&[("marker_file", &local_var_str.to_string())]);
198    }
199    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
200        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
201    }
202    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
203        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
204    };
205
206    let local_var_req = local_var_req_builder.build()?;
207    let local_var_resp = local_var_client.execute(local_var_req).await?;
208
209    let local_var_status = local_var_resp.status();
210    let local_var_content = local_var_resp.text().await?;
211
212    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
213        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
214    } else {
215        let local_var_entity: Option<CheckS3FolderExistsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
216        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
217        Err(Error::ResponseError(local_var_error))
218    }
219}
220
221pub 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>> {
222    let local_var_configuration = configuration;
223
224    let local_var_client = &local_var_configuration.client;
225
226    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/test_connection", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
227    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
228
229    if let Some(ref local_var_str) = storage {
230        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
231    }
232    if let Some(ref local_var_str) = s3_resource_path {
233        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
234    }
235    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
236        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
237    }
238    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
239        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
240    };
241
242    let local_var_req = local_var_req_builder.build()?;
243    let local_var_resp = local_var_client.execute(local_var_req).await?;
244
245    let local_var_status = local_var_resp.status();
246    let local_var_content = local_var_resp.text().await?;
247
248    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
249        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
250    } else {
251        let local_var_entity: Option<DatasetStorageTestConnectionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
252        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
253        Err(Error::ResponseError(local_var_error))
254    }
255}
256
257pub 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>> {
258    let local_var_configuration = configuration;
259
260    let local_var_client = &local_var_configuration.client;
261
262    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/delete_s3_file", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
263    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
264
265    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
266    if let Some(ref local_var_str) = storage {
267        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
268    }
269    if let Some(ref local_var_str) = s3_resource_path {
270        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
271    }
272    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
273        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
274    }
275    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
276        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
277    };
278
279    let local_var_req = local_var_req_builder.build()?;
280    let local_var_resp = local_var_client.execute(local_var_req).await?;
281
282    let local_var_status = local_var_resp.status();
283    let local_var_content = local_var_resp.text().await?;
284
285    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
286        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
287    } else {
288        let local_var_entity: Option<DeleteS3FileError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
289        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
290        Err(Error::ResponseError(local_var_error))
291    }
292}
293
294pub async fn duckdb_connection_settings(configuration: &configuration::Configuration, workspace: &str, duckdb_connection_settings_request: models::DuckdbConnectionSettingsRequest) -> Result<models::DuckdbConnectionSettings200Response, Error<DuckdbConnectionSettingsError>> {
295    let local_var_configuration = configuration;
296
297    let local_var_client = &local_var_configuration.client;
298
299    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/duckdb_connection_settings", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
300    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
301
302    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
303        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
304    }
305    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
306        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
307    };
308    local_var_req_builder = local_var_req_builder.json(&duckdb_connection_settings_request);
309
310    let local_var_req = local_var_req_builder.build()?;
311    let local_var_resp = local_var_client.execute(local_var_req).await?;
312
313    let local_var_status = local_var_resp.status();
314    let local_var_content = local_var_resp.text().await?;
315
316    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
317        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
318    } else {
319        let local_var_entity: Option<DuckdbConnectionSettingsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
320        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
321        Err(Error::ResponseError(local_var_error))
322    }
323}
324
325pub async fn duckdb_connection_settings_v2(configuration: &configuration::Configuration, workspace: &str, duckdb_connection_settings_v2_request: models::DuckdbConnectionSettingsV2Request) -> Result<models::DuckdbConnectionSettingsV2200Response, Error<DuckdbConnectionSettingsV2Error>> {
326    let local_var_configuration = configuration;
327
328    let local_var_client = &local_var_configuration.client;
329
330    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/v2/duckdb_connection_settings", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
331    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
332
333    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
334        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
335    }
336    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
337        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
338    };
339    local_var_req_builder = local_var_req_builder.json(&duckdb_connection_settings_v2_request);
340
341    let local_var_req = local_var_req_builder.build()?;
342    let local_var_resp = local_var_client.execute(local_var_req).await?;
343
344    let local_var_status = local_var_resp.status();
345    let local_var_content = local_var_resp.text().await?;
346
347    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
348        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
349    } else {
350        let local_var_entity: Option<DuckdbConnectionSettingsV2Error> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
351        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
352        Err(Error::ResponseError(local_var_error))
353    }
354}
355
356pub 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>> {
357    let local_var_configuration = configuration;
358
359    let local_var_client = &local_var_configuration.client;
360
361    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/download_s3_file", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
362    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
363
364    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
365    if let Some(ref local_var_str) = s3_resource_path {
366        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
367    }
368    if let Some(ref local_var_str) = resource_type {
369        local_var_req_builder = local_var_req_builder.query(&[("resource_type", &local_var_str.to_string())]);
370    }
371    if let Some(ref local_var_str) = storage {
372        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
373    }
374    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
375        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
376    }
377    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
378        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
379    };
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<FileDownloadError> = 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 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>> {
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/download_s3_parquet_file_as_csv", 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(&[("file_key", &file_key.to_string())]);
405    if let Some(ref local_var_str) = s3_resource_path {
406        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
407    }
408    if let Some(ref local_var_str) = resource_type {
409        local_var_req_builder = local_var_req_builder.query(&[("resource_type", &local_var_str.to_string())]);
410    }
411    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
412        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
413    }
414    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
415        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
416    };
417
418    let local_var_req = local_var_req_builder.build()?;
419    let local_var_resp = local_var_client.execute(local_var_req).await?;
420
421    let local_var_status = local_var_resp.status();
422    let local_var_content = local_var_resp.text().await?;
423
424    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
425        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
426    } else {
427        let local_var_entity: Option<FileDownloadParquetAsCsvError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
428        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
429        Err(Error::ResponseError(local_var_error))
430    }
431}
432
433pub 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>> {
434    let local_var_configuration = configuration;
435
436    let local_var_client = &local_var_configuration.client;
437
438    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/upload_s3_file", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
439    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
440
441    if let Some(ref local_var_str) = file_key {
442        local_var_req_builder = local_var_req_builder.query(&[("file_key", &local_var_str.to_string())]);
443    }
444    if let Some(ref local_var_str) = file_extension {
445        local_var_req_builder = local_var_req_builder.query(&[("file_extension", &local_var_str.to_string())]);
446    }
447    if let Some(ref local_var_str) = s3_resource_path {
448        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
449    }
450    if let Some(ref local_var_str) = resource_type {
451        local_var_req_builder = local_var_req_builder.query(&[("resource_type", &local_var_str.to_string())]);
452    }
453    if let Some(ref local_var_str) = storage {
454        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
455    }
456    if let Some(ref local_var_str) = content_type {
457        local_var_req_builder = local_var_req_builder.query(&[("content_type", &local_var_str.to_string())]);
458    }
459    if let Some(ref local_var_str) = content_disposition {
460        local_var_req_builder = local_var_req_builder.query(&[("content_disposition", &local_var_str.to_string())]);
461    }
462    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
463        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
464    }
465    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
466        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
467    };
468    local_var_req_builder = local_var_req_builder.json(&body);
469
470    let local_var_req = local_var_req_builder.build()?;
471    let local_var_resp = local_var_client.execute(local_var_req).await?;
472
473    let local_var_status = local_var_resp.status();
474    let local_var_content = local_var_resp.text().await?;
475
476    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
477        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
478    } else {
479        let local_var_entity: Option<FileUploadError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
480        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
481        Err(Error::ResponseError(local_var_error))
482    }
483}
484
485pub async fn get_storage_usage(configuration: &configuration::Configuration, workspace: &str, refresh: Option<bool>) -> Result<models::GetStorageUsage200Response, Error<GetStorageUsageError>> {
486    let local_var_configuration = configuration;
487
488    let local_var_client = &local_var_configuration.client;
489
490    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/storage_usage", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
491    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
492
493    if let Some(ref local_var_str) = refresh {
494        local_var_req_builder = local_var_req_builder.query(&[("refresh", &local_var_str.to_string())]);
495    }
496    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
497        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
498    }
499    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
500        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
501    };
502
503    let local_var_req = local_var_req_builder.build()?;
504    let local_var_resp = local_var_client.execute(local_var_req).await?;
505
506    let local_var_status = local_var_resp.status();
507    let local_var_content = local_var_resp.text().await?;
508
509    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
510        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
511    } else {
512        let local_var_entity: Option<GetStorageUsageError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
513        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
514        Err(Error::ResponseError(local_var_error))
515    }
516}
517
518pub 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>> {
519    let local_var_configuration = configuration;
520
521    let local_var_client = &local_var_configuration.client;
522
523    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));
524    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
525
526    if let Some(ref local_var_str) = file_key {
527        local_var_req_builder = local_var_req_builder.query(&[("file_key", &local_var_str.to_string())]);
528    }
529    if let Some(ref local_var_str) = file_extension {
530        local_var_req_builder = local_var_req_builder.query(&[("file_extension", &local_var_str.to_string())]);
531    }
532    if let Some(ref local_var_str) = s3_resource_path {
533        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
534    }
535    if let Some(ref local_var_str) = resource_type {
536        local_var_req_builder = local_var_req_builder.query(&[("resource_type", &local_var_str.to_string())]);
537    }
538    if let Some(ref local_var_str) = storage {
539        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
540    }
541    if let Some(ref local_var_str) = content_type {
542        local_var_req_builder = local_var_req_builder.query(&[("content_type", &local_var_str.to_string())]);
543    }
544    if let Some(ref local_var_str) = content_disposition {
545        local_var_req_builder = local_var_req_builder.query(&[("content_disposition", &local_var_str.to_string())]);
546    }
547    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
548        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
549    }
550    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
551        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
552    };
553    local_var_req_builder = local_var_req_builder.json(&body);
554
555    let local_var_req = local_var_req_builder.build()?;
556    let local_var_resp = local_var_client.execute(local_var_req).await?;
557
558    let local_var_status = local_var_resp.status();
559    let local_var_content = local_var_resp.text().await?;
560
561    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
562        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
563    } else {
564        let local_var_entity: Option<GitRepoViewerFileUploadError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
565        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
566        Err(Error::ResponseError(local_var_error))
567    }
568}
569
570pub 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>> {
571    let local_var_configuration = configuration;
572
573    let local_var_client = &local_var_configuration.client;
574
575    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/list_git_repo_files", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
576    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
577
578    local_var_req_builder = local_var_req_builder.query(&[("max_keys", &max_keys.to_string())]);
579    if let Some(ref local_var_str) = marker {
580        local_var_req_builder = local_var_req_builder.query(&[("marker", &local_var_str.to_string())]);
581    }
582    if let Some(ref local_var_str) = prefix {
583        local_var_req_builder = local_var_req_builder.query(&[("prefix", &local_var_str.to_string())]);
584    }
585    if let Some(ref local_var_str) = storage {
586        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
587    }
588    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
589        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
590    }
591    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
592        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
593    };
594
595    let local_var_req = local_var_req_builder.build()?;
596    let local_var_resp = local_var_client.execute(local_var_req).await?;
597
598    let local_var_status = local_var_resp.status();
599    let local_var_content = local_var_resp.text().await?;
600
601    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
602        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
603    } else {
604        let local_var_entity: Option<ListGitRepoFilesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
605        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
606        Err(Error::ResponseError(local_var_error))
607    }
608}
609
610pub async fn list_stored_files(configuration: &configuration::Configuration, workspace: &str, max_keys: i32, marker: Option<&str>, prefix: Option<&str>, search: Option<&str>, storage: Option<&str>, s3_resource_path: Option<&str>) -> Result<models::ListStoredFiles200Response, Error<ListStoredFilesError>> {
611    let local_var_configuration = configuration;
612
613    let local_var_client = &local_var_configuration.client;
614
615    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/list_stored_files", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
616    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
617
618    local_var_req_builder = local_var_req_builder.query(&[("max_keys", &max_keys.to_string())]);
619    if let Some(ref local_var_str) = marker {
620        local_var_req_builder = local_var_req_builder.query(&[("marker", &local_var_str.to_string())]);
621    }
622    if let Some(ref local_var_str) = prefix {
623        local_var_req_builder = local_var_req_builder.query(&[("prefix", &local_var_str.to_string())]);
624    }
625    if let Some(ref local_var_str) = search {
626        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
627    }
628    if let Some(ref local_var_str) = storage {
629        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
630    }
631    if let Some(ref local_var_str) = s3_resource_path {
632        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
633    }
634    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
635        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
636    }
637    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
638        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
639    };
640
641    let local_var_req = local_var_req_builder.build()?;
642    let local_var_resp = local_var_client.execute(local_var_req).await?;
643
644    let local_var_status = local_var_resp.status();
645    let local_var_content = local_var_resp.text().await?;
646
647    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
648        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
649    } else {
650        let local_var_entity: Option<ListStoredFilesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
651        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
652        Err(Error::ResponseError(local_var_error))
653    }
654}
655
656pub async fn list_stored_files_paged(configuration: &configuration::Configuration, workspace: &str, prefix: Option<&str>, max_keys: Option<i32>, page_token: Option<&str>, storage: Option<&str>, s3_resource_path: Option<&str>) -> Result<models::ListStoredFilesPaged200Response, Error<ListStoredFilesPagedError>> {
657    let local_var_configuration = configuration;
658
659    let local_var_client = &local_var_configuration.client;
660
661    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/list_stored_files_paged", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
662    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
663
664    if let Some(ref local_var_str) = prefix {
665        local_var_req_builder = local_var_req_builder.query(&[("prefix", &local_var_str.to_string())]);
666    }
667    if let Some(ref local_var_str) = max_keys {
668        local_var_req_builder = local_var_req_builder.query(&[("max_keys", &local_var_str.to_string())]);
669    }
670    if let Some(ref local_var_str) = page_token {
671        local_var_req_builder = local_var_req_builder.query(&[("page_token", &local_var_str.to_string())]);
672    }
673    if let Some(ref local_var_str) = storage {
674        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
675    }
676    if let Some(ref local_var_str) = s3_resource_path {
677        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &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<ListStoredFilesPagedError> = 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 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>> {
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/load_csv_preview/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
707    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
708
709    if let Some(ref local_var_str) = offset {
710        local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
711    }
712    if let Some(ref local_var_str) = limit {
713        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
714    }
715    if let Some(ref local_var_str) = sort_col {
716        local_var_req_builder = local_var_req_builder.query(&[("sort_col", &local_var_str.to_string())]);
717    }
718    if let Some(ref local_var_str) = sort_desc {
719        local_var_req_builder = local_var_req_builder.query(&[("sort_desc", &local_var_str.to_string())]);
720    }
721    if let Some(ref local_var_str) = search_col {
722        local_var_req_builder = local_var_req_builder.query(&[("search_col", &local_var_str.to_string())]);
723    }
724    if let Some(ref local_var_str) = search_term {
725        local_var_req_builder = local_var_req_builder.query(&[("search_term", &local_var_str.to_string())]);
726    }
727    if let Some(ref local_var_str) = storage {
728        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
729    }
730    if let Some(ref local_var_str) = csv_separator {
731        local_var_req_builder = local_var_req_builder.query(&[("csv_separator", &local_var_str.to_string())]);
732    }
733    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
734        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
735    }
736    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
737        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
738    };
739
740    let local_var_req = local_var_req_builder.build()?;
741    let local_var_resp = local_var_client.execute(local_var_req).await?;
742
743    let local_var_status = local_var_resp.status();
744    let local_var_content = local_var_resp.text().await?;
745
746    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
747        Ok(())
748    } else {
749        let local_var_entity: Option<LoadCsvPreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
750        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
751        Err(Error::ResponseError(local_var_error))
752    }
753}
754
755pub 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>> {
756    let local_var_configuration = configuration;
757
758    let local_var_client = &local_var_configuration.client;
759
760    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/load_file_metadata", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
761    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
762
763    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
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<LoadFileMetadataError> = 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_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>> {
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_file_preview", 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) = file_size_in_bytes {
802        local_var_req_builder = local_var_req_builder.query(&[("file_size_in_bytes", &local_var_str.to_string())]);
803    }
804    if let Some(ref local_var_str) = file_mime_type {
805        local_var_req_builder = local_var_req_builder.query(&[("file_mime_type", &local_var_str.to_string())]);
806    }
807    if let Some(ref local_var_str) = csv_separator {
808        local_var_req_builder = local_var_req_builder.query(&[("csv_separator", &local_var_str.to_string())]);
809    }
810    if let Some(ref local_var_str) = csv_has_header {
811        local_var_req_builder = local_var_req_builder.query(&[("csv_has_header", &local_var_str.to_string())]);
812    }
813    if let Some(ref local_var_str) = read_bytes_from {
814        local_var_req_builder = local_var_req_builder.query(&[("read_bytes_from", &local_var_str.to_string())]);
815    }
816    if let Some(ref local_var_str) = read_bytes_length {
817        local_var_req_builder = local_var_req_builder.query(&[("read_bytes_length", &local_var_str.to_string())]);
818    }
819    if let Some(ref local_var_str) = storage {
820        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
821    }
822    if let Some(ref local_var_str) = s3_resource_path {
823        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
824    }
825    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
826        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
827    }
828    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
829        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
830    };
831
832    let local_var_req = local_var_req_builder.build()?;
833    let local_var_resp = local_var_client.execute(local_var_req).await?;
834
835    let local_var_status = local_var_resp.status();
836    let local_var_content = local_var_resp.text().await?;
837
838    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
839        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
840    } else {
841        let local_var_entity: Option<LoadFilePreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
842        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
843        Err(Error::ResponseError(local_var_error))
844    }
845}
846
847pub async fn load_git_repo_file_metadata(configuration: &configuration::Configuration, workspace: &str, file_key: &str, storage: Option<&str>) -> Result<models::WindmillFileMetadata, Error<LoadGitRepoFileMetadataError>> {
848    let local_var_configuration = configuration;
849
850    let local_var_client = &local_var_configuration.client;
851
852    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));
853    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
854
855    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
856    if let Some(ref local_var_str) = storage {
857        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
858    }
859    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
860        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
861    }
862    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
863        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
864    };
865
866    let local_var_req = local_var_req_builder.build()?;
867    let local_var_resp = local_var_client.execute(local_var_req).await?;
868
869    let local_var_status = local_var_resp.status();
870    let local_var_content = local_var_resp.text().await?;
871
872    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
873        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
874    } else {
875        let local_var_entity: Option<LoadGitRepoFileMetadataError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
876        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
877        Err(Error::ResponseError(local_var_error))
878    }
879}
880
881pub 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>> {
882    let local_var_configuration = configuration;
883
884    let local_var_client = &local_var_configuration.client;
885
886    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));
887    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
888
889    local_var_req_builder = local_var_req_builder.query(&[("file_key", &file_key.to_string())]);
890    if let Some(ref local_var_str) = file_size_in_bytes {
891        local_var_req_builder = local_var_req_builder.query(&[("file_size_in_bytes", &local_var_str.to_string())]);
892    }
893    if let Some(ref local_var_str) = file_mime_type {
894        local_var_req_builder = local_var_req_builder.query(&[("file_mime_type", &local_var_str.to_string())]);
895    }
896    if let Some(ref local_var_str) = csv_separator {
897        local_var_req_builder = local_var_req_builder.query(&[("csv_separator", &local_var_str.to_string())]);
898    }
899    if let Some(ref local_var_str) = csv_has_header {
900        local_var_req_builder = local_var_req_builder.query(&[("csv_has_header", &local_var_str.to_string())]);
901    }
902    if let Some(ref local_var_str) = read_bytes_from {
903        local_var_req_builder = local_var_req_builder.query(&[("read_bytes_from", &local_var_str.to_string())]);
904    }
905    if let Some(ref local_var_str) = read_bytes_length {
906        local_var_req_builder = local_var_req_builder.query(&[("read_bytes_length", &local_var_str.to_string())]);
907    }
908    if let Some(ref local_var_str) = storage {
909        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
910    }
911    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
912        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
913    }
914    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
915        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
916    };
917
918    let local_var_req = local_var_req_builder.build()?;
919    let local_var_resp = local_var_client.execute(local_var_req).await?;
920
921    let local_var_status = local_var_resp.status();
922    let local_var_content = local_var_resp.text().await?;
923
924    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
925        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
926    } else {
927        let local_var_entity: Option<LoadGitRepoFilePreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
928        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
929        Err(Error::ResponseError(local_var_error))
930    }
931}
932
933pub 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>> {
934    let local_var_configuration = configuration;
935
936    let local_var_client = &local_var_configuration.client;
937
938    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));
939    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
940
941    if let Some(ref local_var_str) = offset {
942        local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
943    }
944    if let Some(ref local_var_str) = limit {
945        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
946    }
947    if let Some(ref local_var_str) = sort_col {
948        local_var_req_builder = local_var_req_builder.query(&[("sort_col", &local_var_str.to_string())]);
949    }
950    if let Some(ref local_var_str) = sort_desc {
951        local_var_req_builder = local_var_req_builder.query(&[("sort_desc", &local_var_str.to_string())]);
952    }
953    if let Some(ref local_var_str) = search_col {
954        local_var_req_builder = local_var_req_builder.query(&[("search_col", &local_var_str.to_string())]);
955    }
956    if let Some(ref local_var_str) = search_term {
957        local_var_req_builder = local_var_req_builder.query(&[("search_term", &local_var_str.to_string())]);
958    }
959    if let Some(ref local_var_str) = storage {
960        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
961    }
962    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
963        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
964    }
965    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
966        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
967    };
968
969    let local_var_req = local_var_req_builder.build()?;
970    let local_var_resp = local_var_client.execute(local_var_req).await?;
971
972    let local_var_status = local_var_resp.status();
973    let local_var_content = local_var_resp.text().await?;
974
975    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
976        Ok(())
977    } else {
978        let local_var_entity: Option<LoadParquetPreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
979        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
980        Err(Error::ResponseError(local_var_error))
981    }
982}
983
984pub 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>> {
985    let local_var_configuration = configuration;
986
987    let local_var_client = &local_var_configuration.client;
988
989    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));
990    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
991
992    if let Some(ref local_var_str) = search_col {
993        local_var_req_builder = local_var_req_builder.query(&[("search_col", &local_var_str.to_string())]);
994    }
995    if let Some(ref local_var_str) = search_term {
996        local_var_req_builder = local_var_req_builder.query(&[("search_term", &local_var_str.to_string())]);
997    }
998    if let Some(ref local_var_str) = storage {
999        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
1000    }
1001    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1002        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1003    }
1004    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1005        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1006    };
1007
1008    let local_var_req = local_var_req_builder.build()?;
1009    let local_var_resp = local_var_client.execute(local_var_req).await?;
1010
1011    let local_var_status = local_var_resp.status();
1012    let local_var_content = local_var_resp.text().await?;
1013
1014    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1015        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1016    } else {
1017        let local_var_entity: Option<LoadTableRowCountError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1018        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1019        Err(Error::ResponseError(local_var_error))
1020    }
1021}
1022
1023pub 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>> {
1024    let local_var_configuration = configuration;
1025
1026    let local_var_client = &local_var_configuration.client;
1027
1028    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/move_s3_file", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1029    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1030
1031    local_var_req_builder = local_var_req_builder.query(&[("src_file_key", &src_file_key.to_string())]);
1032    local_var_req_builder = local_var_req_builder.query(&[("dest_file_key", &dest_file_key.to_string())]);
1033    if let Some(ref local_var_str) = storage {
1034        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
1035    }
1036    if let Some(ref local_var_str) = s3_resource_path {
1037        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
1038    }
1039    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1040        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1041    }
1042    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1043        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1044    };
1045
1046    let local_var_req = local_var_req_builder.build()?;
1047    let local_var_resp = local_var_client.execute(local_var_req).await?;
1048
1049    let local_var_status = local_var_resp.status();
1050    let local_var_content = local_var_resp.text().await?;
1051
1052    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1053        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1054    } else {
1055        let local_var_entity: Option<MoveS3FileError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1056        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1057        Err(Error::ResponseError(local_var_error))
1058    }
1059}
1060
1061pub async fn polars_connection_settings(configuration: &configuration::Configuration, workspace: &str, duckdb_connection_settings_request: models::DuckdbConnectionSettingsRequest) -> Result<models::PolarsConnectionSettings200Response, Error<PolarsConnectionSettingsError>> {
1062    let local_var_configuration = configuration;
1063
1064    let local_var_client = &local_var_configuration.client;
1065
1066    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/polars_connection_settings", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1067    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1068
1069    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1070        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1071    }
1072    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1073        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1074    };
1075    local_var_req_builder = local_var_req_builder.json(&duckdb_connection_settings_request);
1076
1077    let local_var_req = local_var_req_builder.build()?;
1078    let local_var_resp = local_var_client.execute(local_var_req).await?;
1079
1080    let local_var_status = local_var_resp.status();
1081    let local_var_content = local_var_resp.text().await?;
1082
1083    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1084        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1085    } else {
1086        let local_var_entity: Option<PolarsConnectionSettingsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1087        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1088        Err(Error::ResponseError(local_var_error))
1089    }
1090}
1091
1092pub async fn polars_connection_settings_v2(configuration: &configuration::Configuration, workspace: &str, duckdb_connection_settings_v2_request: models::DuckdbConnectionSettingsV2Request) -> Result<models::PolarsConnectionSettingsV2200Response, Error<PolarsConnectionSettingsV2Error>> {
1093    let local_var_configuration = configuration;
1094
1095    let local_var_client = &local_var_configuration.client;
1096
1097    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/v2/polars_connection_settings", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1098    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1099
1100    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1101        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1102    }
1103    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1104        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1105    };
1106    local_var_req_builder = local_var_req_builder.json(&duckdb_connection_settings_v2_request);
1107
1108    let local_var_req = local_var_req_builder.build()?;
1109    let local_var_resp = local_var_client.execute(local_var_req).await?;
1110
1111    let local_var_status = local_var_resp.status();
1112    let local_var_content = local_var_resp.text().await?;
1113
1114    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1115        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1116    } else {
1117        let local_var_entity: Option<PolarsConnectionSettingsV2Error> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1118        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1119        Err(Error::ResponseError(local_var_error))
1120    }
1121}
1122
1123pub async fn s3_resource_info(configuration: &configuration::Configuration, workspace: &str, duckdb_connection_settings_v2_request: models::DuckdbConnectionSettingsV2Request) -> Result<models::S3Resource, Error<S3ResourceInfoError>> {
1124    let local_var_configuration = configuration;
1125
1126    let local_var_client = &local_var_configuration.client;
1127
1128    let local_var_uri_str = format!("{}/w/{workspace}/job_helpers/v2/s3_resource_info", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1129    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1130
1131    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1132        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1133    }
1134    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1135        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1136    };
1137    local_var_req_builder = local_var_req_builder.json(&duckdb_connection_settings_v2_request);
1138
1139    let local_var_req = local_var_req_builder.build()?;
1140    let local_var_resp = local_var_client.execute(local_var_req).await?;
1141
1142    let local_var_status = local_var_resp.status();
1143    let local_var_content = local_var_resp.text().await?;
1144
1145    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1146        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1147    } else {
1148        let local_var_entity: Option<S3ResourceInfoError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1149        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1150        Err(Error::ResponseError(local_var_error))
1151    }
1152}
1153