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 AddPlatformProviderAccountError {
22 Status401(models::ApiError),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum CreateOrUpdatePlatformSecretError {
30 Status401(models::ApiError),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum DeletePlatformSecretError {
38 Status401(models::ApiError),
39 UnknownValue(serde_json::Value),
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum ExecPlatformDataError {
46 Status401(models::ApiError),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum ExportPlatformSecretsError {
54 Status401(models::ApiError),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum GeneratePlatformBackendTokenError {
62 Status401(models::ApiError),
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum GetPlatformCatalogError {
70 Status401(models::ApiError),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetPlatformManifestError {
78 Status401(models::ApiError),
79 UnknownValue(serde_json::Value),
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum ListPlatformAccountsError {
86 Status401(models::ApiError),
87 UnknownValue(serde_json::Value),
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum ListPlatformProvidersError {
94 Status401(models::ApiError),
95 UnknownValue(serde_json::Value),
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum ListPlatformSecretsError {
102 Status401(models::ApiError),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum ListPlatformTablesError {
110 Status401(models::ApiError),
111 UnknownValue(serde_json::Value),
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum ListPlatformsError {
118 Status401(models::ApiError),
119 UnknownValue(serde_json::Value),
120}
121
122#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum QueryPlatformDataError {
126 Status401(models::ApiError),
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum RunPlatformMigrationsError {
134 Status401(models::ApiError),
135 UnknownValue(serde_json::Value),
136}
137
138
139pub async fn add_platform_provider_account(configuration: &configuration::Configuration, platform_id: &str, provider: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<AddPlatformProviderAccountError>> {
140 let p_path_platform_id = platform_id;
142 let p_path_provider = provider;
143 let p_body_request_body = request_body;
144
145 let uri_str = format!("{}/v1/platforms/{platformId}/providers/{provider}/accounts", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id), provider=crate::apis::urlencode(p_path_provider));
146 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
147
148 if let Some(ref user_agent) = configuration.user_agent {
149 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
150 }
151 if let Some(ref token) = configuration.bearer_access_token {
152 req_builder = req_builder.bearer_auth(token.to_owned());
153 };
154 req_builder = req_builder.json(&p_body_request_body);
155
156 let req = req_builder.build()?;
157 let resp = configuration.client.execute(req).await?;
158
159 let status = resp.status();
160 let content_type = resp
161 .headers()
162 .get("content-type")
163 .and_then(|v| v.to_str().ok())
164 .unwrap_or("application/octet-stream");
165 let content_type = super::ContentType::from(content_type);
166
167 if !status.is_client_error() && !status.is_server_error() {
168 let content = resp.text().await?;
169 match content_type {
170 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
171 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
172 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
173 }
174 } else {
175 let content = resp.text().await?;
176 let entity: Option<AddPlatformProviderAccountError> = serde_json::from_str(&content).ok();
177 Err(Error::ResponseError(ResponseContent { status, content, entity }))
178 }
179}
180
181pub async fn create_or_update_platform_secret(configuration: &configuration::Configuration, platform_id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<CreateOrUpdatePlatformSecretError>> {
182 let p_path_platform_id = platform_id;
184 let p_body_request_body = request_body;
185
186 let uri_str = format!("{}/v1/platforms/{platformId}/secrets", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
187 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
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 req_builder = req_builder.json(&p_body_request_body);
196
197 let req = req_builder.build()?;
198 let resp = configuration.client.execute(req).await?;
199
200 let status = resp.status();
201 let content_type = resp
202 .headers()
203 .get("content-type")
204 .and_then(|v| v.to_str().ok())
205 .unwrap_or("application/octet-stream");
206 let content_type = super::ContentType::from(content_type);
207
208 if !status.is_client_error() && !status.is_server_error() {
209 let content = resp.text().await?;
210 match content_type {
211 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
212 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
213 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
214 }
215 } else {
216 let content = resp.text().await?;
217 let entity: Option<CreateOrUpdatePlatformSecretError> = serde_json::from_str(&content).ok();
218 Err(Error::ResponseError(ResponseContent { status, content, entity }))
219 }
220}
221
222pub async fn delete_platform_secret(configuration: &configuration::Configuration, platform_id: &str, name: &str) -> Result<(), Error<DeletePlatformSecretError>> {
223 let p_path_platform_id = platform_id;
225 let p_path_name = name;
226
227 let uri_str = format!("{}/v1/platforms/{platformId}/secrets/{name}", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id), name=crate::apis::urlencode(p_path_name));
228 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
229
230 if let Some(ref user_agent) = configuration.user_agent {
231 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
232 }
233 if let Some(ref token) = configuration.bearer_access_token {
234 req_builder = req_builder.bearer_auth(token.to_owned());
235 };
236
237 let req = req_builder.build()?;
238 let resp = configuration.client.execute(req).await?;
239
240 let status = resp.status();
241
242 if !status.is_client_error() && !status.is_server_error() {
243 Ok(())
244 } else {
245 let content = resp.text().await?;
246 let entity: Option<DeletePlatformSecretError> = serde_json::from_str(&content).ok();
247 Err(Error::ResponseError(ResponseContent { status, content, entity }))
248 }
249}
250
251pub async fn exec_platform_data(configuration: &configuration::Configuration, platform_id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ExecPlatformDataError>> {
252 let p_path_platform_id = platform_id;
254 let p_body_request_body = request_body;
255
256 let uri_str = format!("{}/v1/platforms/{platformId}/exec", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
257 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
258
259 if let Some(ref user_agent) = configuration.user_agent {
260 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
261 }
262 if let Some(ref token) = configuration.bearer_access_token {
263 req_builder = req_builder.bearer_auth(token.to_owned());
264 };
265 req_builder = req_builder.json(&p_body_request_body);
266
267 let req = req_builder.build()?;
268 let resp = configuration.client.execute(req).await?;
269
270 let status = resp.status();
271 let content_type = resp
272 .headers()
273 .get("content-type")
274 .and_then(|v| v.to_str().ok())
275 .unwrap_or("application/octet-stream");
276 let content_type = super::ContentType::from(content_type);
277
278 if !status.is_client_error() && !status.is_server_error() {
279 let content = resp.text().await?;
280 match content_type {
281 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
282 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
283 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
284 }
285 } else {
286 let content = resp.text().await?;
287 let entity: Option<ExecPlatformDataError> = serde_json::from_str(&content).ok();
288 Err(Error::ResponseError(ResponseContent { status, content, entity }))
289 }
290}
291
292pub async fn export_platform_secrets(configuration: &configuration::Configuration, platform_id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ExportPlatformSecretsError>> {
293 let p_path_platform_id = platform_id;
295
296 let uri_str = format!("{}/v1/platforms/{platformId}/secrets/export", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
297 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
298
299 if let Some(ref user_agent) = configuration.user_agent {
300 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
301 }
302 if let Some(ref token) = configuration.bearer_access_token {
303 req_builder = req_builder.bearer_auth(token.to_owned());
304 };
305
306 let req = req_builder.build()?;
307 let resp = configuration.client.execute(req).await?;
308
309 let status = resp.status();
310 let content_type = resp
311 .headers()
312 .get("content-type")
313 .and_then(|v| v.to_str().ok())
314 .unwrap_or("application/octet-stream");
315 let content_type = super::ContentType::from(content_type);
316
317 if !status.is_client_error() && !status.is_server_error() {
318 let content = resp.text().await?;
319 match content_type {
320 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
321 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
322 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
323 }
324 } else {
325 let content = resp.text().await?;
326 let entity: Option<ExportPlatformSecretsError> = serde_json::from_str(&content).ok();
327 Err(Error::ResponseError(ResponseContent { status, content, entity }))
328 }
329}
330
331pub async fn generate_platform_backend_token(configuration: &configuration::Configuration, platform_id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GeneratePlatformBackendTokenError>> {
332 let p_path_platform_id = platform_id;
334
335 let uri_str = format!("{}/v1/platforms/{platformId}/backend-token", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
336 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
337
338 if let Some(ref user_agent) = configuration.user_agent {
339 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
340 }
341 if let Some(ref token) = configuration.bearer_access_token {
342 req_builder = req_builder.bearer_auth(token.to_owned());
343 };
344
345 let req = req_builder.build()?;
346 let resp = configuration.client.execute(req).await?;
347
348 let status = resp.status();
349 let content_type = resp
350 .headers()
351 .get("content-type")
352 .and_then(|v| v.to_str().ok())
353 .unwrap_or("application/octet-stream");
354 let content_type = super::ContentType::from(content_type);
355
356 if !status.is_client_error() && !status.is_server_error() {
357 let content = resp.text().await?;
358 match content_type {
359 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
360 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
361 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
362 }
363 } else {
364 let content = resp.text().await?;
365 let entity: Option<GeneratePlatformBackendTokenError> = serde_json::from_str(&content).ok();
366 Err(Error::ResponseError(ResponseContent { status, content, entity }))
367 }
368}
369
370pub async fn get_platform_catalog(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetPlatformCatalogError>> {
371
372 let uri_str = format!("{}/v1/catalog/platforms", configuration.base_path);
373 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
374
375 if let Some(ref user_agent) = configuration.user_agent {
376 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
377 }
378 if let Some(ref token) = configuration.bearer_access_token {
379 req_builder = req_builder.bearer_auth(token.to_owned());
380 };
381
382 let req = req_builder.build()?;
383 let resp = configuration.client.execute(req).await?;
384
385 let status = resp.status();
386 let content_type = resp
387 .headers()
388 .get("content-type")
389 .and_then(|v| v.to_str().ok())
390 .unwrap_or("application/octet-stream");
391 let content_type = super::ContentType::from(content_type);
392
393 if !status.is_client_error() && !status.is_server_error() {
394 let content = resp.text().await?;
395 match content_type {
396 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
397 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
398 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
399 }
400 } else {
401 let content = resp.text().await?;
402 let entity: Option<GetPlatformCatalogError> = serde_json::from_str(&content).ok();
403 Err(Error::ResponseError(ResponseContent { status, content, entity }))
404 }
405}
406
407pub async fn get_platform_manifest(configuration: &configuration::Configuration, platform_id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetPlatformManifestError>> {
408 let p_path_platform_id = platform_id;
410
411 let uri_str = format!("{}/v1/platforms/{platformId}/manifest", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
412 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
413
414 if let Some(ref user_agent) = configuration.user_agent {
415 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
416 }
417 if let Some(ref token) = configuration.bearer_access_token {
418 req_builder = req_builder.bearer_auth(token.to_owned());
419 };
420
421 let req = req_builder.build()?;
422 let resp = configuration.client.execute(req).await?;
423
424 let status = resp.status();
425 let content_type = resp
426 .headers()
427 .get("content-type")
428 .and_then(|v| v.to_str().ok())
429 .unwrap_or("application/octet-stream");
430 let content_type = super::ContentType::from(content_type);
431
432 if !status.is_client_error() && !status.is_server_error() {
433 let content = resp.text().await?;
434 match content_type {
435 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
436 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
437 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
438 }
439 } else {
440 let content = resp.text().await?;
441 let entity: Option<GetPlatformManifestError> = serde_json::from_str(&content).ok();
442 Err(Error::ResponseError(ResponseContent { status, content, entity }))
443 }
444}
445
446pub async fn list_platform_accounts(configuration: &configuration::Configuration, platform_id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListPlatformAccountsError>> {
447 let p_path_platform_id = platform_id;
449
450 let uri_str = format!("{}/v1/platforms/{platformId}/accounts", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
451 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
452
453 if let Some(ref user_agent) = configuration.user_agent {
454 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
455 }
456 if let Some(ref token) = configuration.bearer_access_token {
457 req_builder = req_builder.bearer_auth(token.to_owned());
458 };
459
460 let req = req_builder.build()?;
461 let resp = configuration.client.execute(req).await?;
462
463 let status = resp.status();
464 let content_type = resp
465 .headers()
466 .get("content-type")
467 .and_then(|v| v.to_str().ok())
468 .unwrap_or("application/octet-stream");
469 let content_type = super::ContentType::from(content_type);
470
471 if !status.is_client_error() && !status.is_server_error() {
472 let content = resp.text().await?;
473 match content_type {
474 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
475 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
476 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
477 }
478 } else {
479 let content = resp.text().await?;
480 let entity: Option<ListPlatformAccountsError> = serde_json::from_str(&content).ok();
481 Err(Error::ResponseError(ResponseContent { status, content, entity }))
482 }
483}
484
485pub async fn list_platform_providers(configuration: &configuration::Configuration, platform_id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListPlatformProvidersError>> {
486 let p_path_platform_id = platform_id;
488
489 let uri_str = format!("{}/v1/platforms/{platformId}/providers", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
490 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
491
492 if let Some(ref user_agent) = configuration.user_agent {
493 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
494 }
495 if let Some(ref token) = configuration.bearer_access_token {
496 req_builder = req_builder.bearer_auth(token.to_owned());
497 };
498
499 let req = req_builder.build()?;
500 let resp = configuration.client.execute(req).await?;
501
502 let status = resp.status();
503 let content_type = resp
504 .headers()
505 .get("content-type")
506 .and_then(|v| v.to_str().ok())
507 .unwrap_or("application/octet-stream");
508 let content_type = super::ContentType::from(content_type);
509
510 if !status.is_client_error() && !status.is_server_error() {
511 let content = resp.text().await?;
512 match content_type {
513 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
514 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
515 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
516 }
517 } else {
518 let content = resp.text().await?;
519 let entity: Option<ListPlatformProvidersError> = serde_json::from_str(&content).ok();
520 Err(Error::ResponseError(ResponseContent { status, content, entity }))
521 }
522}
523
524pub async fn list_platform_secrets(configuration: &configuration::Configuration, platform_id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListPlatformSecretsError>> {
525 let p_path_platform_id = platform_id;
527
528 let uri_str = format!("{}/v1/platforms/{platformId}/secrets", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
529 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
530
531 if let Some(ref user_agent) = configuration.user_agent {
532 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
533 }
534 if let Some(ref token) = configuration.bearer_access_token {
535 req_builder = req_builder.bearer_auth(token.to_owned());
536 };
537
538 let req = req_builder.build()?;
539 let resp = configuration.client.execute(req).await?;
540
541 let status = resp.status();
542 let content_type = resp
543 .headers()
544 .get("content-type")
545 .and_then(|v| v.to_str().ok())
546 .unwrap_or("application/octet-stream");
547 let content_type = super::ContentType::from(content_type);
548
549 if !status.is_client_error() && !status.is_server_error() {
550 let content = resp.text().await?;
551 match content_type {
552 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
553 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
554 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
555 }
556 } else {
557 let content = resp.text().await?;
558 let entity: Option<ListPlatformSecretsError> = serde_json::from_str(&content).ok();
559 Err(Error::ResponseError(ResponseContent { status, content, entity }))
560 }
561}
562
563pub async fn list_platform_tables(configuration: &configuration::Configuration, platform_id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListPlatformTablesError>> {
564 let p_path_platform_id = platform_id;
566
567 let uri_str = format!("{}/v1/platforms/{platformId}/tables", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
568 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
569
570 if let Some(ref user_agent) = configuration.user_agent {
571 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
572 }
573 if let Some(ref token) = configuration.bearer_access_token {
574 req_builder = req_builder.bearer_auth(token.to_owned());
575 };
576
577 let req = req_builder.build()?;
578 let resp = configuration.client.execute(req).await?;
579
580 let status = resp.status();
581 let content_type = resp
582 .headers()
583 .get("content-type")
584 .and_then(|v| v.to_str().ok())
585 .unwrap_or("application/octet-stream");
586 let content_type = super::ContentType::from(content_type);
587
588 if !status.is_client_error() && !status.is_server_error() {
589 let content = resp.text().await?;
590 match content_type {
591 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
592 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
593 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
594 }
595 } else {
596 let content = resp.text().await?;
597 let entity: Option<ListPlatformTablesError> = serde_json::from_str(&content).ok();
598 Err(Error::ResponseError(ResponseContent { status, content, entity }))
599 }
600}
601
602pub async fn list_platforms(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListPlatformsError>> {
603
604 let uri_str = format!("{}/v1/platforms", configuration.base_path);
605 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
606
607 if let Some(ref user_agent) = configuration.user_agent {
608 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
609 }
610 if let Some(ref token) = configuration.bearer_access_token {
611 req_builder = req_builder.bearer_auth(token.to_owned());
612 };
613
614 let req = req_builder.build()?;
615 let resp = configuration.client.execute(req).await?;
616
617 let status = resp.status();
618 let content_type = resp
619 .headers()
620 .get("content-type")
621 .and_then(|v| v.to_str().ok())
622 .unwrap_or("application/octet-stream");
623 let content_type = super::ContentType::from(content_type);
624
625 if !status.is_client_error() && !status.is_server_error() {
626 let content = resp.text().await?;
627 match content_type {
628 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
629 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
630 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
631 }
632 } else {
633 let content = resp.text().await?;
634 let entity: Option<ListPlatformsError> = serde_json::from_str(&content).ok();
635 Err(Error::ResponseError(ResponseContent { status, content, entity }))
636 }
637}
638
639pub async fn query_platform_data(configuration: &configuration::Configuration, platform_id: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<QueryPlatformDataError>> {
640 let p_path_platform_id = platform_id;
642 let p_body_request_body = request_body;
643
644 let uri_str = format!("{}/v1/platforms/{platformId}/query", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
645 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
646
647 if let Some(ref user_agent) = configuration.user_agent {
648 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
649 }
650 if let Some(ref token) = configuration.bearer_access_token {
651 req_builder = req_builder.bearer_auth(token.to_owned());
652 };
653 req_builder = req_builder.json(&p_body_request_body);
654
655 let req = req_builder.build()?;
656 let resp = configuration.client.execute(req).await?;
657
658 let status = resp.status();
659 let content_type = resp
660 .headers()
661 .get("content-type")
662 .and_then(|v| v.to_str().ok())
663 .unwrap_or("application/octet-stream");
664 let content_type = super::ContentType::from(content_type);
665
666 if !status.is_client_error() && !status.is_server_error() {
667 let content = resp.text().await?;
668 match content_type {
669 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
670 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
671 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
672 }
673 } else {
674 let content = resp.text().await?;
675 let entity: Option<QueryPlatformDataError> = serde_json::from_str(&content).ok();
676 Err(Error::ResponseError(ResponseContent { status, content, entity }))
677 }
678}
679
680pub async fn run_platform_migrations(configuration: &configuration::Configuration, platform_id: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<RunPlatformMigrationsError>> {
681 let p_path_platform_id = platform_id;
683
684 let uri_str = format!("{}/v1/platforms/{platformId}/migrate", configuration.base_path, platformId=crate::apis::urlencode(p_path_platform_id));
685 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
686
687 if let Some(ref user_agent) = configuration.user_agent {
688 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
689 }
690 if let Some(ref token) = configuration.bearer_access_token {
691 req_builder = req_builder.bearer_auth(token.to_owned());
692 };
693
694 let req = req_builder.build()?;
695 let resp = configuration.client.execute(req).await?;
696
697 let status = resp.status();
698 let content_type = resp
699 .headers()
700 .get("content-type")
701 .and_then(|v| v.to_str().ok())
702 .unwrap_or("application/octet-stream");
703 let content_type = super::ContentType::from(content_type);
704
705 if !status.is_client_error() && !status.is_server_error() {
706 let content = resp.text().await?;
707 match content_type {
708 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
709 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`"))),
710 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, serde_json::Value>`")))),
711 }
712 } else {
713 let content = resp.text().await?;
714 let entity: Option<RunPlatformMigrationsError> = serde_json::from_str(&content).ok();
715 Err(Error::ResponseError(ResponseContent { status, content, entity }))
716 }
717}
718