Skip to main content

orvanta_api/apis/
helpers_api.rs

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