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