1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum StorageAggregateError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum StorageClearError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum StorageDeleteError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum StorageDeleteIndexError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum StorageDetailError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum StorageExecuteFunctionError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum StorageExportError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum StorageImportError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum StorageIndexesError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum StorageListError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum StoragePostError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum StoragePostIndexError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum StoragePutError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum StorageRemoveError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum StorageStatsError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum StorageTablesError {
127 UnknownValue(serde_json::Value),
128}
129
130
131pub async fn storage_aggregate(configuration: &configuration::Configuration, table: &str, app_key: &str, pipeline: Option<&str>) -> Result<models::ObjectListApiResponse, Error<StorageAggregateError>> {
133 let p_table = table;
135 let p_app_key = app_key;
136 let p_pipeline = pipeline;
137
138 let uri_str = format!("{}/Storage/{appKey}/{table}/Aggregate", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
139 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
140
141 if let Some(ref param_value) = p_pipeline {
142 req_builder = req_builder.query(&[("pipeline", ¶m_value.to_string())]);
143 }
144 if let Some(ref user_agent) = configuration.user_agent {
145 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
146 }
147 if let Some(ref token) = configuration.bearer_access_token {
148 req_builder = req_builder.bearer_auth(token.to_owned());
149 };
150
151 let req = req_builder.build()?;
152 let resp = configuration.client.execute(req).await?;
153
154 let status = resp.status();
155 let content_type = resp
156 .headers()
157 .get("content-type")
158 .and_then(|v| v.to_str().ok())
159 .unwrap_or("application/octet-stream");
160 let content_type = super::ContentType::from(content_type);
161
162 if !status.is_client_error() && !status.is_server_error() {
163 let content = resp.text().await?;
164 match content_type {
165 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
166 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ObjectListApiResponse`"))),
167 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ObjectListApiResponse`")))),
168 }
169 } else {
170 let content = resp.text().await?;
171 let entity: Option<StorageAggregateError> = serde_json::from_str(&content).ok();
172 Err(Error::ResponseError(ResponseContent { status, content, entity }))
173 }
174}
175
176pub async fn storage_clear(configuration: &configuration::Configuration, table: &str, app_key: &str, filter: Option<&str>) -> Result<models::Int64ApiResponse, Error<StorageClearError>> {
178 let p_table = table;
180 let p_app_key = app_key;
181 let p_filter = filter;
182
183 let uri_str = format!("{}/Storage/{appKey}/{table}/Clear", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
184 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
185
186 if let Some(ref param_value) = p_filter {
187 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
188 }
189 if let Some(ref user_agent) = configuration.user_agent {
190 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
191 }
192 if let Some(ref token) = configuration.bearer_access_token {
193 req_builder = req_builder.bearer_auth(token.to_owned());
194 };
195
196 let req = req_builder.build()?;
197 let resp = configuration.client.execute(req).await?;
198
199 let status = resp.status();
200 let content_type = resp
201 .headers()
202 .get("content-type")
203 .and_then(|v| v.to_str().ok())
204 .unwrap_or("application/octet-stream");
205 let content_type = super::ContentType::from(content_type);
206
207 if !status.is_client_error() && !status.is_server_error() {
208 let content = resp.text().await?;
209 match content_type {
210 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
211 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Int64ApiResponse`"))),
212 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Int64ApiResponse`")))),
213 }
214 } else {
215 let content = resp.text().await?;
216 let entity: Option<StorageClearError> = serde_json::from_str(&content).ok();
217 Err(Error::ResponseError(ResponseContent { status, content, entity }))
218 }
219}
220
221pub async fn storage_delete(configuration: &configuration::Configuration, table: &str, id: &str, app_key: &str) -> Result<models::BooleanApiResponse, Error<StorageDeleteError>> {
223 let p_table = table;
225 let p_id = id;
226 let p_app_key = app_key;
227
228 let uri_str = format!("{}/Storage/{appKey}/{table}/{id}", configuration.base_path, table=crate::apis::urlencode(p_table), id=crate::apis::urlencode(p_id), appKey=crate::apis::urlencode(p_app_key));
229 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
230
231 if let Some(ref user_agent) = configuration.user_agent {
232 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
233 }
234 if let Some(ref token) = configuration.bearer_access_token {
235 req_builder = req_builder.bearer_auth(token.to_owned());
236 };
237
238 let req = req_builder.build()?;
239 let resp = configuration.client.execute(req).await?;
240
241 let status = resp.status();
242 let content_type = resp
243 .headers()
244 .get("content-type")
245 .and_then(|v| v.to_str().ok())
246 .unwrap_or("application/octet-stream");
247 let content_type = super::ContentType::from(content_type);
248
249 if !status.is_client_error() && !status.is_server_error() {
250 let content = resp.text().await?;
251 match content_type {
252 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
253 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BooleanApiResponse`"))),
254 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BooleanApiResponse`")))),
255 }
256 } else {
257 let content = resp.text().await?;
258 let entity: Option<StorageDeleteError> = serde_json::from_str(&content).ok();
259 Err(Error::ResponseError(ResponseContent { status, content, entity }))
260 }
261}
262
263pub async fn storage_delete_index(configuration: &configuration::Configuration, table: &str, app_key: &str, index_name: Option<&str>) -> Result<models::BooleanApiResponse, Error<StorageDeleteIndexError>> {
265 let p_table = table;
267 let p_app_key = app_key;
268 let p_index_name = index_name;
269
270 let uri_str = format!("{}/Storage/{appKey}/{table}/indexes", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
271 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
272
273 if let Some(ref param_value) = p_index_name {
274 req_builder = req_builder.query(&[("indexName", ¶m_value.to_string())]);
275 }
276 if let Some(ref user_agent) = configuration.user_agent {
277 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
278 }
279 if let Some(ref token) = configuration.bearer_access_token {
280 req_builder = req_builder.bearer_auth(token.to_owned());
281 };
282
283 let req = req_builder.build()?;
284 let resp = configuration.client.execute(req).await?;
285
286 let status = resp.status();
287 let content_type = resp
288 .headers()
289 .get("content-type")
290 .and_then(|v| v.to_str().ok())
291 .unwrap_or("application/octet-stream");
292 let content_type = super::ContentType::from(content_type);
293
294 if !status.is_client_error() && !status.is_server_error() {
295 let content = resp.text().await?;
296 match content_type {
297 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
298 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BooleanApiResponse`"))),
299 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BooleanApiResponse`")))),
300 }
301 } else {
302 let content = resp.text().await?;
303 let entity: Option<StorageDeleteIndexError> = serde_json::from_str(&content).ok();
304 Err(Error::ResponseError(ResponseContent { status, content, entity }))
305 }
306}
307
308pub async fn storage_detail(configuration: &configuration::Configuration, table: &str, id: &str, app_key: &str, project: Option<&str>) -> Result<models::ObjectApiResponse, Error<StorageDetailError>> {
310 let p_table = table;
312 let p_id = id;
313 let p_app_key = app_key;
314 let p_project = project;
315
316 let uri_str = format!("{}/Storage/{appKey}/{table}/{id}", configuration.base_path, table=crate::apis::urlencode(p_table), id=crate::apis::urlencode(p_id), appKey=crate::apis::urlencode(p_app_key));
317 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
318
319 if let Some(ref param_value) = p_project {
320 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
321 }
322 if let Some(ref user_agent) = configuration.user_agent {
323 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
324 }
325 if let Some(ref token) = configuration.bearer_access_token {
326 req_builder = req_builder.bearer_auth(token.to_owned());
327 };
328
329 let req = req_builder.build()?;
330 let resp = configuration.client.execute(req).await?;
331
332 let status = resp.status();
333 let content_type = resp
334 .headers()
335 .get("content-type")
336 .and_then(|v| v.to_str().ok())
337 .unwrap_or("application/octet-stream");
338 let content_type = super::ContentType::from(content_type);
339
340 if !status.is_client_error() && !status.is_server_error() {
341 let content = resp.text().await?;
342 match content_type {
343 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
344 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ObjectApiResponse`"))),
345 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ObjectApiResponse`")))),
346 }
347 } else {
348 let content = resp.text().await?;
349 let entity: Option<StorageDetailError> = serde_json::from_str(&content).ok();
350 Err(Error::ResponseError(ResponseContent { status, content, entity }))
351 }
352}
353
354pub async fn storage_execute_function(configuration: &configuration::Configuration, nonce: &str, timestamp: i64, signature: &str, app_key: &str, execute_function_request: Option<models::ExecuteFunctionRequest>) -> Result<models::ObjectApiResponse, Error<StorageExecuteFunctionError>> {
356 let p_nonce = nonce;
358 let p_timestamp = timestamp;
359 let p_signature = signature;
360 let p_app_key = app_key;
361 let p_execute_function_request = execute_function_request;
362
363 let uri_str = format!("{}/Storage/{appKey}/ExecuteFunction", configuration.base_path, appKey=crate::apis::urlencode(p_app_key));
364 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
365
366 req_builder = req_builder.query(&[("nonce", &p_nonce.to_string())]);
367 req_builder = req_builder.query(&[("timestamp", &p_timestamp.to_string())]);
368 req_builder = req_builder.query(&[("signature", &p_signature.to_string())]);
369 if let Some(ref user_agent) = configuration.user_agent {
370 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
371 }
372 if let Some(ref token) = configuration.bearer_access_token {
373 req_builder = req_builder.bearer_auth(token.to_owned());
374 };
375 req_builder = req_builder.json(&p_execute_function_request);
376
377 let req = req_builder.build()?;
378 let resp = configuration.client.execute(req).await?;
379
380 let status = resp.status();
381 let content_type = resp
382 .headers()
383 .get("content-type")
384 .and_then(|v| v.to_str().ok())
385 .unwrap_or("application/octet-stream");
386 let content_type = super::ContentType::from(content_type);
387
388 if !status.is_client_error() && !status.is_server_error() {
389 let content = resp.text().await?;
390 match content_type {
391 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
392 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ObjectApiResponse`"))),
393 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ObjectApiResponse`")))),
394 }
395 } else {
396 let content = resp.text().await?;
397 let entity: Option<StorageExecuteFunctionError> = serde_json::from_str(&content).ok();
398 Err(Error::ResponseError(ResponseContent { status, content, entity }))
399 }
400}
401
402pub async fn storage_export(configuration: &configuration::Configuration, table: &str, app_key: &str, filter: Option<&str>, start_time: Option<String>, end_time: Option<String>) -> Result<reqwest::Response, Error<StorageExportError>> {
404 let p_table = table;
406 let p_app_key = app_key;
407 let p_filter = filter;
408 let p_start_time = start_time;
409 let p_end_time = end_time;
410
411 let uri_str = format!("{}/Storage/{appKey}/{table}/Export", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
412 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
413
414 if let Some(ref param_value) = p_filter {
415 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
416 }
417 if let Some(ref param_value) = p_start_time {
418 req_builder = req_builder.query(&[("startTime", ¶m_value.to_string())]);
419 }
420 if let Some(ref param_value) = p_end_time {
421 req_builder = req_builder.query(&[("endTime", ¶m_value.to_string())]);
422 }
423 if let Some(ref user_agent) = configuration.user_agent {
424 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
425 }
426 if let Some(ref token) = configuration.bearer_access_token {
427 req_builder = req_builder.bearer_auth(token.to_owned());
428 };
429
430 let req = req_builder.build()?;
431 let resp = configuration.client.execute(req).await?;
432
433 let status = resp.status();
434
435 if !status.is_client_error() && !status.is_server_error() {
436 Ok(resp)
437 } else {
438 let content = resp.text().await?;
439 let entity: Option<StorageExportError> = serde_json::from_str(&content).ok();
440 Err(Error::ResponseError(ResponseContent { status, content, entity }))
441 }
442}
443
444pub async fn storage_import(configuration: &configuration::Configuration, table: &str, app_key: &str, file: Option<std::path::PathBuf>) -> Result<models::BooleanApiResponse, Error<StorageImportError>> {
446 let p_table = table;
448 let p_app_key = app_key;
449 let p_file = file;
450
451 let uri_str = format!("{}/Storage/{appKey}/{table}/Import", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
452 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
453
454 if let Some(ref user_agent) = configuration.user_agent {
455 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
456 }
457 if let Some(ref token) = configuration.bearer_access_token {
458 req_builder = req_builder.bearer_auth(token.to_owned());
459 };
460 let mut multipart_form = reqwest::multipart::Form::new();
461 req_builder = req_builder.multipart(multipart_form);
463
464 let req = req_builder.build()?;
465 let resp = configuration.client.execute(req).await?;
466
467 let status = resp.status();
468 let content_type = resp
469 .headers()
470 .get("content-type")
471 .and_then(|v| v.to_str().ok())
472 .unwrap_or("application/octet-stream");
473 let content_type = super::ContentType::from(content_type);
474
475 if !status.is_client_error() && !status.is_server_error() {
476 let content = resp.text().await?;
477 match content_type {
478 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
479 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BooleanApiResponse`"))),
480 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BooleanApiResponse`")))),
481 }
482 } else {
483 let content = resp.text().await?;
484 let entity: Option<StorageImportError> = serde_json::from_str(&content).ok();
485 Err(Error::ResponseError(ResponseContent { status, content, entity }))
486 }
487}
488
489pub async fn storage_indexes(configuration: &configuration::Configuration, table: &str, app_key: &str) -> Result<models::ObjectListApiResponse, Error<StorageIndexesError>> {
491 let p_table = table;
493 let p_app_key = app_key;
494
495 let uri_str = format!("{}/Storage/{appKey}/{table}/Indexes", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
496 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
497
498 if let Some(ref user_agent) = configuration.user_agent {
499 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
500 }
501 if let Some(ref token) = configuration.bearer_access_token {
502 req_builder = req_builder.bearer_auth(token.to_owned());
503 };
504
505 let req = req_builder.build()?;
506 let resp = configuration.client.execute(req).await?;
507
508 let status = resp.status();
509 let content_type = resp
510 .headers()
511 .get("content-type")
512 .and_then(|v| v.to_str().ok())
513 .unwrap_or("application/octet-stream");
514 let content_type = super::ContentType::from(content_type);
515
516 if !status.is_client_error() && !status.is_server_error() {
517 let content = resp.text().await?;
518 match content_type {
519 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
520 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ObjectListApiResponse`"))),
521 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ObjectListApiResponse`")))),
522 }
523 } else {
524 let content = resp.text().await?;
525 let entity: Option<StorageIndexesError> = serde_json::from_str(&content).ok();
526 Err(Error::ResponseError(ResponseContent { status, content, entity }))
527 }
528}
529
530pub async fn storage_list(configuration: &configuration::Configuration, table: &str, app_key: &str, filter: Option<&str>, project: Option<&str>, sort: Option<&str>, start_time: Option<String>, end_time: Option<String>, explain: Option<bool>, take: Option<i32>, skip: Option<i32>) -> Result<models::StorageListResultApiResponse, Error<StorageListError>> {
532 let p_table = table;
534 let p_app_key = app_key;
535 let p_filter = filter;
536 let p_project = project;
537 let p_sort = sort;
538 let p_start_time = start_time;
539 let p_end_time = end_time;
540 let p_explain = explain;
541 let p_take = take;
542 let p_skip = skip;
543
544 let uri_str = format!("{}/Storage/{appKey}/{table}", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
545 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
546
547 if let Some(ref param_value) = p_filter {
548 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
549 }
550 if let Some(ref param_value) = p_project {
551 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
552 }
553 if let Some(ref param_value) = p_sort {
554 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
555 }
556 if let Some(ref param_value) = p_start_time {
557 req_builder = req_builder.query(&[("startTime", ¶m_value.to_string())]);
558 }
559 if let Some(ref param_value) = p_end_time {
560 req_builder = req_builder.query(&[("endTime", ¶m_value.to_string())]);
561 }
562 if let Some(ref param_value) = p_explain {
563 req_builder = req_builder.query(&[("explain", ¶m_value.to_string())]);
564 }
565 if let Some(ref param_value) = p_take {
566 req_builder = req_builder.query(&[("take", ¶m_value.to_string())]);
567 }
568 if let Some(ref param_value) = p_skip {
569 req_builder = req_builder.query(&[("skip", ¶m_value.to_string())]);
570 }
571 if let Some(ref user_agent) = configuration.user_agent {
572 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
573 }
574 if let Some(ref token) = configuration.bearer_access_token {
575 req_builder = req_builder.bearer_auth(token.to_owned());
576 };
577
578 let req = req_builder.build()?;
579 let resp = configuration.client.execute(req).await?;
580
581 let status = resp.status();
582 let content_type = resp
583 .headers()
584 .get("content-type")
585 .and_then(|v| v.to_str().ok())
586 .unwrap_or("application/octet-stream");
587 let content_type = super::ContentType::from(content_type);
588
589 if !status.is_client_error() && !status.is_server_error() {
590 let content = resp.text().await?;
591 match content_type {
592 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
593 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StorageListResultApiResponse`"))),
594 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::StorageListResultApiResponse`")))),
595 }
596 } else {
597 let content = resp.text().await?;
598 let entity: Option<StorageListError> = serde_json::from_str(&content).ok();
599 Err(Error::ResponseError(ResponseContent { status, content, entity }))
600 }
601}
602
603pub async fn storage_post(configuration: &configuration::Configuration, table: &str, app_key: &str, request_body: Vec<serde_json::Value>) -> Result<models::StringApiResponse, Error<StoragePostError>> {
605 let p_table = table;
607 let p_app_key = app_key;
608 let p_request_body = request_body;
609
610 let uri_str = format!("{}/Storage/{appKey}/{table}", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
611 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
612
613 if let Some(ref user_agent) = configuration.user_agent {
614 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
615 }
616 if let Some(ref token) = configuration.bearer_access_token {
617 req_builder = req_builder.bearer_auth(token.to_owned());
618 };
619 req_builder = req_builder.json(&p_request_body);
620
621 let req = req_builder.build()?;
622 let resp = configuration.client.execute(req).await?;
623
624 let status = resp.status();
625 let content_type = resp
626 .headers()
627 .get("content-type")
628 .and_then(|v| v.to_str().ok())
629 .unwrap_or("application/octet-stream");
630 let content_type = super::ContentType::from(content_type);
631
632 if !status.is_client_error() && !status.is_server_error() {
633 let content = resp.text().await?;
634 match content_type {
635 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
636 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StringApiResponse`"))),
637 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::StringApiResponse`")))),
638 }
639 } else {
640 let content = resp.text().await?;
641 let entity: Option<StoragePostError> = serde_json::from_str(&content).ok();
642 Err(Error::ResponseError(ResponseContent { status, content, entity }))
643 }
644}
645
646pub async fn storage_post_index(configuration: &configuration::Configuration, table: &str, app_key: &str, post_index_request: Option<models::PostIndexRequest>) -> Result<models::StringApiResponse, Error<StoragePostIndexError>> {
648 let p_table = table;
650 let p_app_key = app_key;
651 let p_post_index_request = post_index_request;
652
653 let uri_str = format!("{}/Storage/{appKey}/{table}/indexes", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
654 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
655
656 if let Some(ref user_agent) = configuration.user_agent {
657 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
658 }
659 if let Some(ref token) = configuration.bearer_access_token {
660 req_builder = req_builder.bearer_auth(token.to_owned());
661 };
662 req_builder = req_builder.json(&p_post_index_request);
663
664 let req = req_builder.build()?;
665 let resp = configuration.client.execute(req).await?;
666
667 let status = resp.status();
668 let content_type = resp
669 .headers()
670 .get("content-type")
671 .and_then(|v| v.to_str().ok())
672 .unwrap_or("application/octet-stream");
673 let content_type = super::ContentType::from(content_type);
674
675 if !status.is_client_error() && !status.is_server_error() {
676 let content = resp.text().await?;
677 match content_type {
678 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
679 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StringApiResponse`"))),
680 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::StringApiResponse`")))),
681 }
682 } else {
683 let content = resp.text().await?;
684 let entity: Option<StoragePostIndexError> = serde_json::from_str(&content).ok();
685 Err(Error::ResponseError(ResponseContent { status, content, entity }))
686 }
687}
688
689pub async fn storage_put(configuration: &configuration::Configuration, table: &str, id: &str, app_key: &str, body: Option<serde_json::Value>, replace: Option<bool>) -> Result<models::BooleanApiResponse, Error<StoragePutError>> {
691 let p_table = table;
693 let p_id = id;
694 let p_app_key = app_key;
695 let p_body = body;
696 let p_replace = replace;
697
698 let uri_str = format!("{}/Storage/{appKey}/{table}/{id}", configuration.base_path, table=crate::apis::urlencode(p_table), id=crate::apis::urlencode(p_id), appKey=crate::apis::urlencode(p_app_key));
699 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
700
701 if let Some(ref param_value) = p_replace {
702 req_builder = req_builder.query(&[("replace", ¶m_value.to_string())]);
703 }
704 if let Some(ref user_agent) = configuration.user_agent {
705 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
706 }
707 if let Some(ref token) = configuration.bearer_access_token {
708 req_builder = req_builder.bearer_auth(token.to_owned());
709 };
710 req_builder = req_builder.json(&p_body);
711
712 let req = req_builder.build()?;
713 let resp = configuration.client.execute(req).await?;
714
715 let status = resp.status();
716 let content_type = resp
717 .headers()
718 .get("content-type")
719 .and_then(|v| v.to_str().ok())
720 .unwrap_or("application/octet-stream");
721 let content_type = super::ContentType::from(content_type);
722
723 if !status.is_client_error() && !status.is_server_error() {
724 let content = resp.text().await?;
725 match content_type {
726 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
727 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BooleanApiResponse`"))),
728 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BooleanApiResponse`")))),
729 }
730 } else {
731 let content = resp.text().await?;
732 let entity: Option<StoragePutError> = serde_json::from_str(&content).ok();
733 Err(Error::ResponseError(ResponseContent { status, content, entity }))
734 }
735}
736
737pub async fn storage_remove(configuration: &configuration::Configuration, table: &str, app_key: &str) -> Result<models::BooleanApiResponse, Error<StorageRemoveError>> {
739 let p_table = table;
741 let p_app_key = app_key;
742
743 let uri_str = format!("{}/Storage/{appKey}/{table}/Remove", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
744 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
745
746 if let Some(ref user_agent) = configuration.user_agent {
747 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
748 }
749 if let Some(ref token) = configuration.bearer_access_token {
750 req_builder = req_builder.bearer_auth(token.to_owned());
751 };
752
753 let req = req_builder.build()?;
754 let resp = configuration.client.execute(req).await?;
755
756 let status = resp.status();
757 let content_type = resp
758 .headers()
759 .get("content-type")
760 .and_then(|v| v.to_str().ok())
761 .unwrap_or("application/octet-stream");
762 let content_type = super::ContentType::from(content_type);
763
764 if !status.is_client_error() && !status.is_server_error() {
765 let content = resp.text().await?;
766 match content_type {
767 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
768 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BooleanApiResponse`"))),
769 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BooleanApiResponse`")))),
770 }
771 } else {
772 let content = resp.text().await?;
773 let entity: Option<StorageRemoveError> = serde_json::from_str(&content).ok();
774 Err(Error::ResponseError(ResponseContent { status, content, entity }))
775 }
776}
777
778pub async fn storage_stats(configuration: &configuration::Configuration, table: &str, app_key: &str) -> Result<models::ObjectApiResponse, Error<StorageStatsError>> {
780 let p_table = table;
782 let p_app_key = app_key;
783
784 let uri_str = format!("{}/Storage/{appKey}/{table}/Stats", configuration.base_path, table=crate::apis::urlencode(p_table), appKey=crate::apis::urlencode(p_app_key));
785 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
786
787 if let Some(ref user_agent) = configuration.user_agent {
788 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
789 }
790 if let Some(ref token) = configuration.bearer_access_token {
791 req_builder = req_builder.bearer_auth(token.to_owned());
792 };
793
794 let req = req_builder.build()?;
795 let resp = configuration.client.execute(req).await?;
796
797 let status = resp.status();
798 let content_type = resp
799 .headers()
800 .get("content-type")
801 .and_then(|v| v.to_str().ok())
802 .unwrap_or("application/octet-stream");
803 let content_type = super::ContentType::from(content_type);
804
805 if !status.is_client_error() && !status.is_server_error() {
806 let content = resp.text().await?;
807 match content_type {
808 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
809 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ObjectApiResponse`"))),
810 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ObjectApiResponse`")))),
811 }
812 } else {
813 let content = resp.text().await?;
814 let entity: Option<StorageStatsError> = serde_json::from_str(&content).ok();
815 Err(Error::ResponseError(ResponseContent { status, content, entity }))
816 }
817}
818
819pub async fn storage_tables(configuration: &configuration::Configuration, app_key: &str) -> Result<models::StringListApiResponse, Error<StorageTablesError>> {
821 let p_app_key = app_key;
823
824 let uri_str = format!("{}/Storage/{appKey}/Tables", configuration.base_path, appKey=crate::apis::urlencode(p_app_key));
825 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
826
827 if let Some(ref user_agent) = configuration.user_agent {
828 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
829 }
830 if let Some(ref token) = configuration.bearer_access_token {
831 req_builder = req_builder.bearer_auth(token.to_owned());
832 };
833
834 let req = req_builder.build()?;
835 let resp = configuration.client.execute(req).await?;
836
837 let status = resp.status();
838 let content_type = resp
839 .headers()
840 .get("content-type")
841 .and_then(|v| v.to_str().ok())
842 .unwrap_or("application/octet-stream");
843 let content_type = super::ContentType::from(content_type);
844
845 if !status.is_client_error() && !status.is_server_error() {
846 let content = resp.text().await?;
847 match content_type {
848 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
849 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StringListApiResponse`"))),
850 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::StringListApiResponse`")))),
851 }
852 } else {
853 let content = resp.text().await?;
854 let entity: Option<StorageTablesError> = serde_json::from_str(&content).ok();
855 Err(Error::ResponseError(ResponseContent { status, content, entity }))
856 }
857}
858