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