1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum DeleteV2IdpsIdpIdError {
20 Status400(String),
21 DefaultResponse(models::JsCantonError),
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteV2UsersUserIdError {
29 Status400(String),
30 DefaultResponse(models::JsCantonError),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum GetV2IdpsError {
38 Status400(String),
39 DefaultResponse(models::JsCantonError),
40 UnknownValue(serde_json::Value),
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum GetV2IdpsIdpIdError {
47 Status400(String),
48 DefaultResponse(models::JsCantonError),
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum GetV2InteractiveSubmissionPreferredPackageVersionError {
56 Status400(String),
57 DefaultResponse(models::JsCantonError),
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum GetV2PackagesError {
65 Status400(String),
66 DefaultResponse(models::JsCantonError),
67 UnknownValue(serde_json::Value),
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum GetV2PackagesPackageIdError {
74 Status400(String),
75 DefaultResponse(models::JsCantonError),
76 UnknownValue(serde_json::Value),
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum GetV2PackagesPackageIdStatusError {
83 Status400(String),
84 DefaultResponse(models::JsCantonError),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetV2PartiesError {
92 Status400(String),
93 DefaultResponse(models::JsCantonError),
94 UnknownValue(serde_json::Value),
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum GetV2PartiesParticipantIdError {
101 Status400(String),
102 DefaultResponse(models::JsCantonError),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum GetV2PartiesPartyError {
110 Status400(String),
111 DefaultResponse(models::JsCantonError),
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum GetV2StateConnectedSynchronizersError {
119 Status400(String),
120 DefaultResponse(models::JsCantonError),
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum GetV2StateLatestPrunedOffsetsError {
128 Status400(String),
129 DefaultResponse(models::JsCantonError),
130 UnknownValue(serde_json::Value),
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum GetV2StateLedgerEndError {
137 Status400(String),
138 DefaultResponse(models::JsCantonError),
139 UnknownValue(serde_json::Value),
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum GetV2UpdatesTransactionTreeByIdUpdateIdError {
146 Status400(String),
147 DefaultResponse(models::JsCantonError),
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GetV2UpdatesTransactionTreeByOffsetOffsetError {
155 Status400(String),
156 DefaultResponse(models::JsCantonError),
157 UnknownValue(serde_json::Value),
158}
159
160#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum GetV2UsersError {
164 Status400(String),
165 DefaultResponse(models::JsCantonError),
166 UnknownValue(serde_json::Value),
167}
168
169#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum GetV2UsersUserIdError {
173 Status400(String),
174 DefaultResponse(models::JsCantonError),
175 UnknownValue(serde_json::Value),
176}
177
178#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum GetV2UsersUserIdRightsError {
182 Status400(String),
183 DefaultResponse(models::JsCantonError),
184 UnknownValue(serde_json::Value),
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum GetV2VersionError {
191 Status400(String),
192 DefaultResponse(models::JsCantonError),
193 UnknownValue(serde_json::Value),
194}
195
196#[derive(Debug, Clone, Serialize, Deserialize)]
198#[serde(untagged)]
199pub enum PatchV2IdpsIdpIdError {
200 Status400(String),
201 DefaultResponse(models::JsCantonError),
202 UnknownValue(serde_json::Value),
203}
204
205#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum PatchV2PartiesPartyError {
209 Status400(String),
210 DefaultResponse(models::JsCantonError),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum PatchV2UsersUserIdError {
218 Status400(String),
219 DefaultResponse(models::JsCantonError),
220 UnknownValue(serde_json::Value),
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum PatchV2UsersUserIdIdentityProviderIdError {
227 Status400(String),
228 DefaultResponse(models::JsCantonError),
229 UnknownValue(serde_json::Value),
230}
231
232#[derive(Debug, Clone, Serialize, Deserialize)]
234#[serde(untagged)]
235pub enum PatchV2UsersUserIdRightsError {
236 Status400(String),
237 DefaultResponse(models::JsCantonError),
238 UnknownValue(serde_json::Value),
239}
240
241#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum PostV2CommandsAsyncSubmitError {
245 Status400(String),
246 DefaultResponse(models::JsCantonError),
247 UnknownValue(serde_json::Value),
248}
249
250#[derive(Debug, Clone, Serialize, Deserialize)]
252#[serde(untagged)]
253pub enum PostV2CommandsAsyncSubmitReassignmentError {
254 Status400(String),
255 DefaultResponse(models::JsCantonError),
256 UnknownValue(serde_json::Value),
257}
258
259#[derive(Debug, Clone, Serialize, Deserialize)]
261#[serde(untagged)]
262pub enum PostV2CommandsCompletionsError {
263 Status400(String),
264 DefaultResponse(models::JsCantonError),
265 UnknownValue(serde_json::Value),
266}
267
268#[derive(Debug, Clone, Serialize, Deserialize)]
270#[serde(untagged)]
271pub enum PostV2CommandsSubmitAndWaitError {
272 Status400(String),
273 DefaultResponse(models::JsCantonError),
274 UnknownValue(serde_json::Value),
275}
276
277#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum PostV2CommandsSubmitAndWaitForReassignmentError {
281 Status400(String),
282 DefaultResponse(models::JsCantonError),
283 UnknownValue(serde_json::Value),
284}
285
286#[derive(Debug, Clone, Serialize, Deserialize)]
288#[serde(untagged)]
289pub enum PostV2CommandsSubmitAndWaitForTransactionError {
290 Status400(String),
291 DefaultResponse(models::JsCantonError),
292 UnknownValue(serde_json::Value),
293}
294
295#[derive(Debug, Clone, Serialize, Deserialize)]
297#[serde(untagged)]
298pub enum PostV2CommandsSubmitAndWaitForTransactionTreeError {
299 Status400(String),
300 DefaultResponse(models::JsCantonError),
301 UnknownValue(serde_json::Value),
302}
303
304#[derive(Debug, Clone, Serialize, Deserialize)]
306#[serde(untagged)]
307pub enum PostV2EventsEventsByContractIdError {
308 Status400(String),
309 DefaultResponse(models::JsCantonError),
310 UnknownValue(serde_json::Value),
311}
312
313#[derive(Debug, Clone, Serialize, Deserialize)]
315#[serde(untagged)]
316pub enum PostV2IdpsError {
317 Status400(String),
318 DefaultResponse(models::JsCantonError),
319 UnknownValue(serde_json::Value),
320}
321
322#[derive(Debug, Clone, Serialize, Deserialize)]
324#[serde(untagged)]
325pub enum PostV2InteractiveSubmissionExecuteError {
326 Status400(String),
327 DefaultResponse(models::JsCantonError),
328 UnknownValue(serde_json::Value),
329}
330
331#[derive(Debug, Clone, Serialize, Deserialize)]
333#[serde(untagged)]
334pub enum PostV2InteractiveSubmissionPrepareError {
335 Status400(String),
336 DefaultResponse(models::JsCantonError),
337 UnknownValue(serde_json::Value),
338}
339
340#[derive(Debug, Clone, Serialize, Deserialize)]
342#[serde(untagged)]
343pub enum PostV2PackagesError {
344 Status400(String),
345 DefaultResponse(models::JsCantonError),
346 UnknownValue(serde_json::Value),
347}
348
349#[derive(Debug, Clone, Serialize, Deserialize)]
351#[serde(untagged)]
352pub enum PostV2PartiesError {
353 Status400(String),
354 DefaultResponse(models::JsCantonError),
355 UnknownValue(serde_json::Value),
356}
357
358#[derive(Debug, Clone, Serialize, Deserialize)]
360#[serde(untagged)]
361pub enum PostV2StateActiveContractsError {
362 Status400(String),
363 DefaultResponse(models::JsCantonError),
364 UnknownValue(serde_json::Value),
365}
366
367#[derive(Debug, Clone, Serialize, Deserialize)]
369#[serde(untagged)]
370pub enum PostV2UpdatesFlatsError {
371 Status400(String),
372 DefaultResponse(models::JsCantonError),
373 UnknownValue(serde_json::Value),
374}
375
376#[derive(Debug, Clone, Serialize, Deserialize)]
378#[serde(untagged)]
379pub enum PostV2UpdatesTransactionByIdError {
380 Status400(String),
381 DefaultResponse(models::JsCantonError),
382 UnknownValue(serde_json::Value),
383}
384
385#[derive(Debug, Clone, Serialize, Deserialize)]
387#[serde(untagged)]
388pub enum PostV2UpdatesTransactionByOffsetError {
389 Status400(String),
390 DefaultResponse(models::JsCantonError),
391 UnknownValue(serde_json::Value),
392}
393
394#[derive(Debug, Clone, Serialize, Deserialize)]
396#[serde(untagged)]
397pub enum PostV2UpdatesTreesError {
398 Status400(String),
399 DefaultResponse(models::JsCantonError),
400 UnknownValue(serde_json::Value),
401}
402
403#[derive(Debug, Clone, Serialize, Deserialize)]
405#[serde(untagged)]
406pub enum PostV2UpdatesUpdateByIdError {
407 Status400(String),
408 DefaultResponse(models::JsCantonError),
409 UnknownValue(serde_json::Value),
410}
411
412#[derive(Debug, Clone, Serialize, Deserialize)]
414#[serde(untagged)]
415pub enum PostV2UpdatesUpdateByOffsetError {
416 Status400(String),
417 DefaultResponse(models::JsCantonError),
418 UnknownValue(serde_json::Value),
419}
420
421#[derive(Debug, Clone, Serialize, Deserialize)]
423#[serde(untagged)]
424pub enum PostV2UsersError {
425 Status400(String),
426 DefaultResponse(models::JsCantonError),
427 UnknownValue(serde_json::Value),
428}
429
430#[derive(Debug, Clone, Serialize, Deserialize)]
432#[serde(untagged)]
433pub enum PostV2UsersUserIdRightsError {
434 Status400(String),
435 DefaultResponse(models::JsCantonError),
436 UnknownValue(serde_json::Value),
437}
438
439pub async fn delete_v2_idps_idp_id(
441 configuration: &configuration::Configuration,
442 idp_id: &str,
443) -> Result<serde_json::Value, Error<DeleteV2IdpsIdpIdError>> {
444 let p_idp_id = idp_id;
446
447 let uri_str = format!(
448 "{}/v2/idps/{idp_id}",
449 configuration.base_path,
450 idp_id = crate::apis::urlencode(p_idp_id)
451 );
452 let mut req_builder = configuration
453 .client
454 .request(reqwest::Method::DELETE, &uri_str);
455
456 if let Some(ref user_agent) = configuration.user_agent {
457 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
458 }
459 if let Some(ref token) = configuration.bearer_access_token {
460 req_builder = req_builder.bearer_auth(token.to_owned());
461 };
462 if let Some(ref apikey) = configuration.api_key {
463 let key = apikey.key.clone();
464 let value = match apikey.prefix {
465 Some(ref prefix) => format!("{} {}", prefix, key),
466 None => key,
467 };
468 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
469 };
470
471 let req = req_builder.build()?;
472 let resp = configuration.client.execute(req).await?;
473
474 let status = resp.status();
475 let content_type = resp
476 .headers()
477 .get("content-type")
478 .and_then(|v| v.to_str().ok())
479 .unwrap_or("application/octet-stream");
480 let content_type = super::ContentType::from(content_type);
481
482 if !status.is_client_error() && !status.is_server_error() {
483 let content = resp.text().await?;
484 match content_type {
485 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
486 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
487 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
488 }
489 } else {
490 let content = resp.text().await?;
491 let entity: Option<DeleteV2IdpsIdpIdError> = serde_json::from_str(&content).ok();
492 Err(Error::ResponseError(ResponseContent {
493 status,
494 content,
495 entity,
496 }))
497 }
498}
499
500pub async fn delete_v2_users_user_id(
502 configuration: &configuration::Configuration,
503 user_id: &str,
504) -> Result<serde_json::Value, Error<DeleteV2UsersUserIdError>> {
505 let p_user_id = user_id;
507
508 let uri_str = format!(
509 "{}/v2/users/{user_id}",
510 configuration.base_path,
511 user_id = crate::apis::urlencode(p_user_id)
512 );
513 let mut req_builder = configuration
514 .client
515 .request(reqwest::Method::DELETE, &uri_str);
516
517 if let Some(ref user_agent) = configuration.user_agent {
518 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
519 }
520 if let Some(ref token) = configuration.bearer_access_token {
521 req_builder = req_builder.bearer_auth(token.to_owned());
522 };
523 if let Some(ref apikey) = configuration.api_key {
524 let key = apikey.key.clone();
525 let value = match apikey.prefix {
526 Some(ref prefix) => format!("{} {}", prefix, key),
527 None => key,
528 };
529 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
530 };
531
532 let req = req_builder.build()?;
533 let resp = configuration.client.execute(req).await?;
534
535 let status = resp.status();
536 let content_type = resp
537 .headers()
538 .get("content-type")
539 .and_then(|v| v.to_str().ok())
540 .unwrap_or("application/octet-stream");
541 let content_type = super::ContentType::from(content_type);
542
543 if !status.is_client_error() && !status.is_server_error() {
544 let content = resp.text().await?;
545 match content_type {
546 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
547 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
548 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
549 }
550 } else {
551 let content = resp.text().await?;
552 let entity: Option<DeleteV2UsersUserIdError> = serde_json::from_str(&content).ok();
553 Err(Error::ResponseError(ResponseContent {
554 status,
555 content,
556 entity,
557 }))
558 }
559}
560
561pub async fn get_v2_idps(
563 configuration: &configuration::Configuration,
564) -> Result<models::ListIdentityProviderConfigsResponse, Error<GetV2IdpsError>> {
565 let uri_str = format!("{}/v2/idps", configuration.base_path);
566 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
567
568 if let Some(ref user_agent) = configuration.user_agent {
569 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
570 }
571 if let Some(ref token) = configuration.bearer_access_token {
572 req_builder = req_builder.bearer_auth(token.to_owned());
573 };
574 if let Some(ref apikey) = configuration.api_key {
575 let key = apikey.key.clone();
576 let value = match apikey.prefix {
577 Some(ref prefix) => format!("{} {}", prefix, key),
578 None => key,
579 };
580 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
581 };
582
583 let req = req_builder.build()?;
584 let resp = configuration.client.execute(req).await?;
585
586 let status = resp.status();
587 let content_type = resp
588 .headers()
589 .get("content-type")
590 .and_then(|v| v.to_str().ok())
591 .unwrap_or("application/octet-stream");
592 let content_type = super::ContentType::from(content_type);
593
594 if !status.is_client_error() && !status.is_server_error() {
595 let content = resp.text().await?;
596 match content_type {
597 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
598 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListIdentityProviderConfigsResponse`"))),
599 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::ListIdentityProviderConfigsResponse`")))),
600 }
601 } else {
602 let content = resp.text().await?;
603 let entity: Option<GetV2IdpsError> = serde_json::from_str(&content).ok();
604 Err(Error::ResponseError(ResponseContent {
605 status,
606 content,
607 entity,
608 }))
609 }
610}
611
612pub async fn get_v2_idps_idp_id(
614 configuration: &configuration::Configuration,
615 idp_id: &str,
616) -> Result<models::GetIdentityProviderConfigResponse, Error<GetV2IdpsIdpIdError>> {
617 let p_idp_id = idp_id;
619
620 let uri_str = format!(
621 "{}/v2/idps/{idp_id}",
622 configuration.base_path,
623 idp_id = crate::apis::urlencode(p_idp_id)
624 );
625 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
626
627 if let Some(ref user_agent) = configuration.user_agent {
628 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
629 }
630 if let Some(ref token) = configuration.bearer_access_token {
631 req_builder = req_builder.bearer_auth(token.to_owned());
632 };
633 if let Some(ref apikey) = configuration.api_key {
634 let key = apikey.key.clone();
635 let value = match apikey.prefix {
636 Some(ref prefix) => format!("{} {}", prefix, key),
637 None => key,
638 };
639 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
640 };
641
642 let req = req_builder.build()?;
643 let resp = configuration.client.execute(req).await?;
644
645 let status = resp.status();
646 let content_type = resp
647 .headers()
648 .get("content-type")
649 .and_then(|v| v.to_str().ok())
650 .unwrap_or("application/octet-stream");
651 let content_type = super::ContentType::from(content_type);
652
653 if !status.is_client_error() && !status.is_server_error() {
654 let content = resp.text().await?;
655 match content_type {
656 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
657 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetIdentityProviderConfigResponse`"))),
658 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::GetIdentityProviderConfigResponse`")))),
659 }
660 } else {
661 let content = resp.text().await?;
662 let entity: Option<GetV2IdpsIdpIdError> = serde_json::from_str(&content).ok();
663 Err(Error::ResponseError(ResponseContent {
664 status,
665 content,
666 entity,
667 }))
668 }
669}
670
671pub async fn get_v2_interactive_submission_preferred_package_version(
673 configuration: &configuration::Configuration,
674 package_name: &str,
675 parties: Option<Vec<String>>,
676 vetting_valid_at: Option<String>,
677 synchronizer_id: Option<&str>,
678) -> Result<
679 models::GetPreferredPackageVersionResponse,
680 Error<GetV2InteractiveSubmissionPreferredPackageVersionError>,
681> {
682 let p_package_name = package_name;
684 let p_parties = parties;
685 let p_vetting_valid_at = vetting_valid_at;
686 let p_synchronizer_id = synchronizer_id;
687
688 let uri_str = format!(
689 "{}/v2/interactive-submission/preferred-package-version",
690 configuration.base_path
691 );
692 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
693
694 if let Some(ref param_value) = p_parties {
695 req_builder = match "multi" {
696 "multi" => req_builder.query(
697 ¶m_value
698 .into_iter()
699 .map(|p| ("parties".to_owned(), p.to_string()))
700 .collect::<Vec<(std::string::String, std::string::String)>>(),
701 ),
702 _ => req_builder.query(&[(
703 "parties",
704 ¶m_value
705 .into_iter()
706 .map(|p| p.to_string())
707 .collect::<Vec<String>>()
708 .join(",")
709 .to_string(),
710 )]),
711 };
712 }
713 req_builder = req_builder.query(&[("package-name", &p_package_name.to_string())]);
714 if let Some(ref param_value) = p_vetting_valid_at {
715 req_builder = req_builder.query(&[("vetting_valid_at", ¶m_value.to_string())]);
716 }
717 if let Some(ref param_value) = p_synchronizer_id {
718 req_builder = req_builder.query(&[("synchronizer-id", ¶m_value.to_string())]);
719 }
720 if let Some(ref user_agent) = configuration.user_agent {
721 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
722 }
723 if let Some(ref token) = configuration.bearer_access_token {
724 req_builder = req_builder.bearer_auth(token.to_owned());
725 };
726 if let Some(ref apikey) = configuration.api_key {
727 let key = apikey.key.clone();
728 let value = match apikey.prefix {
729 Some(ref prefix) => format!("{} {}", prefix, key),
730 None => key,
731 };
732 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
733 };
734
735 let req = req_builder.build()?;
736 let resp = configuration.client.execute(req).await?;
737
738 let status = resp.status();
739 let content_type = resp
740 .headers()
741 .get("content-type")
742 .and_then(|v| v.to_str().ok())
743 .unwrap_or("application/octet-stream");
744 let content_type = super::ContentType::from(content_type);
745
746 if !status.is_client_error() && !status.is_server_error() {
747 let content = resp.text().await?;
748 match content_type {
749 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
750 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetPreferredPackageVersionResponse`"))),
751 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::GetPreferredPackageVersionResponse`")))),
752 }
753 } else {
754 let content = resp.text().await?;
755 let entity: Option<GetV2InteractiveSubmissionPreferredPackageVersionError> =
756 serde_json::from_str(&content).ok();
757 Err(Error::ResponseError(ResponseContent {
758 status,
759 content,
760 entity,
761 }))
762 }
763}
764
765pub async fn get_v2_packages(
767 configuration: &configuration::Configuration,
768) -> Result<models::ListPackagesResponse, Error<GetV2PackagesError>> {
769 let uri_str = format!("{}/v2/packages", configuration.base_path);
770 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
771
772 if let Some(ref user_agent) = configuration.user_agent {
773 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
774 }
775 if let Some(ref token) = configuration.bearer_access_token {
776 req_builder = req_builder.bearer_auth(token.to_owned());
777 };
778 if let Some(ref apikey) = configuration.api_key {
779 let key = apikey.key.clone();
780 let value = match apikey.prefix {
781 Some(ref prefix) => format!("{} {}", prefix, key),
782 None => key,
783 };
784 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
785 };
786
787 let req = req_builder.build()?;
788 let resp = configuration.client.execute(req).await?;
789
790 let status = resp.status();
791 let content_type = resp
792 .headers()
793 .get("content-type")
794 .and_then(|v| v.to_str().ok())
795 .unwrap_or("application/octet-stream");
796 let content_type = super::ContentType::from(content_type);
797
798 if !status.is_client_error() && !status.is_server_error() {
799 let content = resp.text().await?;
800 match content_type {
801 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
802 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListPackagesResponse`"))),
803 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::ListPackagesResponse`")))),
804 }
805 } else {
806 let content = resp.text().await?;
807 let entity: Option<GetV2PackagesError> = serde_json::from_str(&content).ok();
808 Err(Error::ResponseError(ResponseContent {
809 status,
810 content,
811 entity,
812 }))
813 }
814}
815
816pub async fn get_v2_packages_package_id(
818 configuration: &configuration::Configuration,
819 package_id: &str,
820) -> Result<reqwest::Response, Error<GetV2PackagesPackageIdError>> {
821 let p_package_id = package_id;
823
824 let uri_str = format!(
825 "{}/v2/packages/{package_id}",
826 configuration.base_path,
827 package_id = crate::apis::urlencode(p_package_id)
828 );
829 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
830
831 if let Some(ref user_agent) = configuration.user_agent {
832 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
833 }
834 if let Some(ref token) = configuration.bearer_access_token {
835 req_builder = req_builder.bearer_auth(token.to_owned());
836 };
837 if let Some(ref apikey) = configuration.api_key {
838 let key = apikey.key.clone();
839 let value = match apikey.prefix {
840 Some(ref prefix) => format!("{} {}", prefix, key),
841 None => key,
842 };
843 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
844 };
845
846 let req = req_builder.build()?;
847 let resp = configuration.client.execute(req).await?;
848
849 let status = resp.status();
850
851 if !status.is_client_error() && !status.is_server_error() {
852 Ok(resp)
853 } else {
854 let content = resp.text().await?;
855 let entity: Option<GetV2PackagesPackageIdError> = serde_json::from_str(&content).ok();
856 Err(Error::ResponseError(ResponseContent {
857 status,
858 content,
859 entity,
860 }))
861 }
862}
863
864pub async fn get_v2_packages_package_id_status(
866 configuration: &configuration::Configuration,
867 package_id: &str,
868) -> Result<models::GetPackageStatusResponse, Error<GetV2PackagesPackageIdStatusError>> {
869 let p_package_id = package_id;
871
872 let uri_str = format!(
873 "{}/v2/packages/{package_id}/status",
874 configuration.base_path,
875 package_id = crate::apis::urlencode(p_package_id)
876 );
877 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
878
879 if let Some(ref user_agent) = configuration.user_agent {
880 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
881 }
882 if let Some(ref token) = configuration.bearer_access_token {
883 req_builder = req_builder.bearer_auth(token.to_owned());
884 };
885 if let Some(ref apikey) = configuration.api_key {
886 let key = apikey.key.clone();
887 let value = match apikey.prefix {
888 Some(ref prefix) => format!("{} {}", prefix, key),
889 None => key,
890 };
891 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
892 };
893
894 let req = req_builder.build()?;
895 let resp = configuration.client.execute(req).await?;
896
897 let status = resp.status();
898 let content_type = resp
899 .headers()
900 .get("content-type")
901 .and_then(|v| v.to_str().ok())
902 .unwrap_or("application/octet-stream");
903 let content_type = super::ContentType::from(content_type);
904
905 if !status.is_client_error() && !status.is_server_error() {
906 let content = resp.text().await?;
907 match content_type {
908 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
909 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetPackageStatusResponse`"))),
910 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::GetPackageStatusResponse`")))),
911 }
912 } else {
913 let content = resp.text().await?;
914 let entity: Option<GetV2PackagesPackageIdStatusError> = serde_json::from_str(&content).ok();
915 Err(Error::ResponseError(ResponseContent {
916 status,
917 content,
918 entity,
919 }))
920 }
921}
922
923pub async fn get_v2_parties(
925 configuration: &configuration::Configuration,
926 page_size: Option<i32>,
927 page_token: Option<&str>,
928) -> Result<models::ListKnownPartiesResponse, Error<GetV2PartiesError>> {
929 let p_page_size = page_size;
931 let p_page_token = page_token;
932
933 let uri_str = format!("{}/v2/parties", configuration.base_path);
934 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
935
936 if let Some(ref param_value) = p_page_size {
937 req_builder = req_builder.query(&[("pageSize", ¶m_value.to_string())]);
938 }
939 if let Some(ref param_value) = p_page_token {
940 req_builder = req_builder.query(&[("pageToken", ¶m_value.to_string())]);
941 }
942 if let Some(ref user_agent) = configuration.user_agent {
943 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
944 }
945 if let Some(ref token) = configuration.bearer_access_token {
946 req_builder = req_builder.bearer_auth(token.to_owned());
947 };
948 if let Some(ref apikey) = configuration.api_key {
949 let key = apikey.key.clone();
950 let value = match apikey.prefix {
951 Some(ref prefix) => format!("{} {}", prefix, key),
952 None => key,
953 };
954 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
955 };
956
957 let req = req_builder.build()?;
958 let resp = configuration.client.execute(req).await?;
959
960 let status = resp.status();
961 let content_type = resp
962 .headers()
963 .get("content-type")
964 .and_then(|v| v.to_str().ok())
965 .unwrap_or("application/octet-stream");
966 let content_type = super::ContentType::from(content_type);
967
968 if !status.is_client_error() && !status.is_server_error() {
969 let content = resp.text().await?;
970 match content_type {
971 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
972 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListKnownPartiesResponse`"))),
973 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::ListKnownPartiesResponse`")))),
974 }
975 } else {
976 let content = resp.text().await?;
977 let entity: Option<GetV2PartiesError> = serde_json::from_str(&content).ok();
978 Err(Error::ResponseError(ResponseContent {
979 status,
980 content,
981 entity,
982 }))
983 }
984}
985
986pub async fn get_v2_parties_participant_id(
988 configuration: &configuration::Configuration,
989) -> Result<models::GetParticipantIdResponse, Error<GetV2PartiesParticipantIdError>> {
990 let uri_str = format!("{}/v2/parties/participant-id", configuration.base_path);
991 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
992
993 if let Some(ref user_agent) = configuration.user_agent {
994 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
995 }
996 if let Some(ref token) = configuration.bearer_access_token {
997 req_builder = req_builder.bearer_auth(token.to_owned());
998 };
999 if let Some(ref apikey) = configuration.api_key {
1000 let key = apikey.key.clone();
1001 let value = match apikey.prefix {
1002 Some(ref prefix) => format!("{} {}", prefix, key),
1003 None => key,
1004 };
1005 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1006 };
1007
1008 let req = req_builder.build()?;
1009 let resp = configuration.client.execute(req).await?;
1010
1011 let status = resp.status();
1012 let content_type = resp
1013 .headers()
1014 .get("content-type")
1015 .and_then(|v| v.to_str().ok())
1016 .unwrap_or("application/octet-stream");
1017 let content_type = super::ContentType::from(content_type);
1018
1019 if !status.is_client_error() && !status.is_server_error() {
1020 let content = resp.text().await?;
1021 match content_type {
1022 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1023 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetParticipantIdResponse`"))),
1024 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::GetParticipantIdResponse`")))),
1025 }
1026 } else {
1027 let content = resp.text().await?;
1028 let entity: Option<GetV2PartiesParticipantIdError> = serde_json::from_str(&content).ok();
1029 Err(Error::ResponseError(ResponseContent {
1030 status,
1031 content,
1032 entity,
1033 }))
1034 }
1035}
1036
1037pub async fn get_v2_parties_party(
1039 configuration: &configuration::Configuration,
1040 party: &str,
1041 identity_provider_id: Option<&str>,
1042 parties: Option<Vec<String>>,
1043) -> Result<models::GetPartiesResponse, Error<GetV2PartiesPartyError>> {
1044 let p_party = party;
1046 let p_identity_provider_id = identity_provider_id;
1047 let p_parties = parties;
1048
1049 let uri_str = format!(
1050 "{}/v2/parties/{party}",
1051 configuration.base_path,
1052 party = crate::apis::urlencode(p_party)
1053 );
1054 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1055
1056 if let Some(ref param_value) = p_identity_provider_id {
1057 req_builder = req_builder.query(&[("identity-provider-id", ¶m_value.to_string())]);
1058 }
1059 if let Some(ref param_value) = p_parties {
1060 req_builder = match "multi" {
1061 "multi" => req_builder.query(
1062 ¶m_value
1063 .into_iter()
1064 .map(|p| ("parties".to_owned(), p.to_string()))
1065 .collect::<Vec<(std::string::String, std::string::String)>>(),
1066 ),
1067 _ => req_builder.query(&[(
1068 "parties",
1069 ¶m_value
1070 .into_iter()
1071 .map(|p| p.to_string())
1072 .collect::<Vec<String>>()
1073 .join(",")
1074 .to_string(),
1075 )]),
1076 };
1077 }
1078 if let Some(ref user_agent) = configuration.user_agent {
1079 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1080 }
1081 if let Some(ref token) = configuration.bearer_access_token {
1082 req_builder = req_builder.bearer_auth(token.to_owned());
1083 };
1084 if let Some(ref apikey) = configuration.api_key {
1085 let key = apikey.key.clone();
1086 let value = match apikey.prefix {
1087 Some(ref prefix) => format!("{} {}", prefix, key),
1088 None => key,
1089 };
1090 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1091 };
1092
1093 let req = req_builder.build()?;
1094 let resp = configuration.client.execute(req).await?;
1095
1096 let status = resp.status();
1097 let content_type = resp
1098 .headers()
1099 .get("content-type")
1100 .and_then(|v| v.to_str().ok())
1101 .unwrap_or("application/octet-stream");
1102 let content_type = super::ContentType::from(content_type);
1103
1104 if !status.is_client_error() && !status.is_server_error() {
1105 let content = resp.text().await?;
1106 match content_type {
1107 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1108 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetPartiesResponse`"))),
1109 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::GetPartiesResponse`")))),
1110 }
1111 } else {
1112 let content = resp.text().await?;
1113 let entity: Option<GetV2PartiesPartyError> = serde_json::from_str(&content).ok();
1114 Err(Error::ResponseError(ResponseContent {
1115 status,
1116 content,
1117 entity,
1118 }))
1119 }
1120}
1121
1122pub async fn get_v2_state_connected_synchronizers(
1124 configuration: &configuration::Configuration,
1125 party: &str,
1126 participant_id: Option<&str>,
1127) -> Result<models::GetConnectedSynchronizersResponse, Error<GetV2StateConnectedSynchronizersError>>
1128{
1129 let p_party = party;
1131 let p_participant_id = participant_id;
1132
1133 let uri_str = format!(
1134 "{}/v2/state/connected-synchronizers",
1135 configuration.base_path
1136 );
1137 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1138
1139 req_builder = req_builder.query(&[("party", &p_party.to_string())]);
1140 if let Some(ref param_value) = p_participant_id {
1141 req_builder = req_builder.query(&[("participantId", ¶m_value.to_string())]);
1142 }
1143 if let Some(ref user_agent) = configuration.user_agent {
1144 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1145 }
1146 if let Some(ref token) = configuration.bearer_access_token {
1147 req_builder = req_builder.bearer_auth(token.to_owned());
1148 };
1149 if let Some(ref apikey) = configuration.api_key {
1150 let key = apikey.key.clone();
1151 let value = match apikey.prefix {
1152 Some(ref prefix) => format!("{} {}", prefix, key),
1153 None => key,
1154 };
1155 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1156 };
1157
1158 let req = req_builder.build()?;
1159 let resp = configuration.client.execute(req).await?;
1160
1161 let status = resp.status();
1162 let content_type = resp
1163 .headers()
1164 .get("content-type")
1165 .and_then(|v| v.to_str().ok())
1166 .unwrap_or("application/octet-stream");
1167 let content_type = super::ContentType::from(content_type);
1168
1169 if !status.is_client_error() && !status.is_server_error() {
1170 let content = resp.text().await?;
1171 match content_type {
1172 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1173 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetConnectedSynchronizersResponse`"))),
1174 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::GetConnectedSynchronizersResponse`")))),
1175 }
1176 } else {
1177 let content = resp.text().await?;
1178 let entity: Option<GetV2StateConnectedSynchronizersError> =
1179 serde_json::from_str(&content).ok();
1180 Err(Error::ResponseError(ResponseContent {
1181 status,
1182 content,
1183 entity,
1184 }))
1185 }
1186}
1187
1188pub async fn get_v2_state_latest_pruned_offsets(
1190 configuration: &configuration::Configuration,
1191) -> Result<models::GetLatestPrunedOffsetsResponse, Error<GetV2StateLatestPrunedOffsetsError>> {
1192 let uri_str = format!("{}/v2/state/latest-pruned-offsets", configuration.base_path);
1193 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1194
1195 if let Some(ref user_agent) = configuration.user_agent {
1196 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1197 }
1198 if let Some(ref token) = configuration.bearer_access_token {
1199 req_builder = req_builder.bearer_auth(token.to_owned());
1200 };
1201 if let Some(ref apikey) = configuration.api_key {
1202 let key = apikey.key.clone();
1203 let value = match apikey.prefix {
1204 Some(ref prefix) => format!("{} {}", prefix, key),
1205 None => key,
1206 };
1207 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1208 };
1209
1210 let req = req_builder.build()?;
1211 let resp = configuration.client.execute(req).await?;
1212
1213 let status = resp.status();
1214 let content_type = resp
1215 .headers()
1216 .get("content-type")
1217 .and_then(|v| v.to_str().ok())
1218 .unwrap_or("application/octet-stream");
1219 let content_type = super::ContentType::from(content_type);
1220
1221 if !status.is_client_error() && !status.is_server_error() {
1222 let content = resp.text().await?;
1223 match content_type {
1224 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1225 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLatestPrunedOffsetsResponse`"))),
1226 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::GetLatestPrunedOffsetsResponse`")))),
1227 }
1228 } else {
1229 let content = resp.text().await?;
1230 let entity: Option<GetV2StateLatestPrunedOffsetsError> =
1231 serde_json::from_str(&content).ok();
1232 Err(Error::ResponseError(ResponseContent {
1233 status,
1234 content,
1235 entity,
1236 }))
1237 }
1238}
1239
1240pub async fn get_v2_state_ledger_end(
1242 configuration: &configuration::Configuration,
1243) -> Result<models::GetLedgerEndResponse, Error<GetV2StateLedgerEndError>> {
1244 let uri_str = format!("{}/v2/state/ledger-end", configuration.base_path);
1245 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1246
1247 if let Some(ref user_agent) = configuration.user_agent {
1248 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1249 }
1250 if let Some(ref token) = configuration.bearer_access_token {
1251 req_builder = req_builder.bearer_auth(token.to_owned());
1252 };
1253 if let Some(ref apikey) = configuration.api_key {
1254 let key = apikey.key.clone();
1255 let value = match apikey.prefix {
1256 Some(ref prefix) => format!("{} {}", prefix, key),
1257 None => key,
1258 };
1259 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1260 };
1261
1262 let req = req_builder.build()?;
1263 let resp = configuration.client.execute(req).await?;
1264
1265 let status = resp.status();
1266 let content_type = resp
1267 .headers()
1268 .get("content-type")
1269 .and_then(|v| v.to_str().ok())
1270 .unwrap_or("application/octet-stream");
1271 let content_type = super::ContentType::from(content_type);
1272
1273 if !status.is_client_error() && !status.is_server_error() {
1274 let content = resp.text().await?;
1275 match content_type {
1276 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1277 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLedgerEndResponse`"))),
1278 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::GetLedgerEndResponse`")))),
1279 }
1280 } else {
1281 let content = resp.text().await?;
1282 let entity: Option<GetV2StateLedgerEndError> = serde_json::from_str(&content).ok();
1283 Err(Error::ResponseError(ResponseContent {
1284 status,
1285 content,
1286 entity,
1287 }))
1288 }
1289}
1290
1291pub async fn get_v2_updates_transaction_tree_by_id_update_id(
1293 configuration: &configuration::Configuration,
1294 update_id: &str,
1295 parties: Option<Vec<String>>,
1296) -> Result<models::JsGetTransactionTreeResponse, Error<GetV2UpdatesTransactionTreeByIdUpdateIdError>>
1297{
1298 let p_update_id = update_id;
1300 let p_parties = parties;
1301
1302 let uri_str = format!(
1303 "{}/v2/updates/transaction-tree-by-id/{update_id}",
1304 configuration.base_path,
1305 update_id = crate::apis::urlencode(p_update_id)
1306 );
1307 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1308
1309 if let Some(ref param_value) = p_parties {
1310 req_builder = match "multi" {
1311 "multi" => req_builder.query(
1312 ¶m_value
1313 .into_iter()
1314 .map(|p| ("parties".to_owned(), p.to_string()))
1315 .collect::<Vec<(std::string::String, std::string::String)>>(),
1316 ),
1317 _ => req_builder.query(&[(
1318 "parties",
1319 ¶m_value
1320 .into_iter()
1321 .map(|p| p.to_string())
1322 .collect::<Vec<String>>()
1323 .join(",")
1324 .to_string(),
1325 )]),
1326 };
1327 }
1328 if let Some(ref user_agent) = configuration.user_agent {
1329 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1330 }
1331 if let Some(ref token) = configuration.bearer_access_token {
1332 req_builder = req_builder.bearer_auth(token.to_owned());
1333 };
1334 if let Some(ref apikey) = configuration.api_key {
1335 let key = apikey.key.clone();
1336 let value = match apikey.prefix {
1337 Some(ref prefix) => format!("{} {}", prefix, key),
1338 None => key,
1339 };
1340 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1341 };
1342
1343 let req = req_builder.build()?;
1344 let resp = configuration.client.execute(req).await?;
1345
1346 let status = resp.status();
1347 let content_type = resp
1348 .headers()
1349 .get("content-type")
1350 .and_then(|v| v.to_str().ok())
1351 .unwrap_or("application/octet-stream");
1352 let content_type = super::ContentType::from(content_type);
1353
1354 if !status.is_client_error() && !status.is_server_error() {
1355 let content = resp.text().await?;
1356 match content_type {
1357 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1358 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsGetTransactionTreeResponse`"))),
1359 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::JsGetTransactionTreeResponse`")))),
1360 }
1361 } else {
1362 let content = resp.text().await?;
1363 let entity: Option<GetV2UpdatesTransactionTreeByIdUpdateIdError> =
1364 serde_json::from_str(&content).ok();
1365 Err(Error::ResponseError(ResponseContent {
1366 status,
1367 content,
1368 entity,
1369 }))
1370 }
1371}
1372
1373pub async fn get_v2_updates_transaction_tree_by_offset_offset(
1375 configuration: &configuration::Configuration,
1376 offset: i64,
1377 parties: Option<Vec<String>>,
1378) -> Result<
1379 models::JsGetTransactionTreeResponse,
1380 Error<GetV2UpdatesTransactionTreeByOffsetOffsetError>,
1381> {
1382 let p_offset = offset;
1384 let p_parties = parties;
1385
1386 let uri_str = format!(
1387 "{}/v2/updates/transaction-tree-by-offset/{offset}",
1388 configuration.base_path,
1389 offset = p_offset
1390 );
1391 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1392
1393 if let Some(ref param_value) = p_parties {
1394 req_builder = match "multi" {
1395 "multi" => req_builder.query(
1396 ¶m_value
1397 .into_iter()
1398 .map(|p| ("parties".to_owned(), p.to_string()))
1399 .collect::<Vec<(std::string::String, std::string::String)>>(),
1400 ),
1401 _ => req_builder.query(&[(
1402 "parties",
1403 ¶m_value
1404 .into_iter()
1405 .map(|p| p.to_string())
1406 .collect::<Vec<String>>()
1407 .join(",")
1408 .to_string(),
1409 )]),
1410 };
1411 }
1412 if let Some(ref user_agent) = configuration.user_agent {
1413 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1414 }
1415 if let Some(ref token) = configuration.bearer_access_token {
1416 req_builder = req_builder.bearer_auth(token.to_owned());
1417 };
1418 if let Some(ref apikey) = configuration.api_key {
1419 let key = apikey.key.clone();
1420 let value = match apikey.prefix {
1421 Some(ref prefix) => format!("{} {}", prefix, key),
1422 None => key,
1423 };
1424 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1425 };
1426
1427 let req = req_builder.build()?;
1428 let resp = configuration.client.execute(req).await?;
1429
1430 let status = resp.status();
1431 let content_type = resp
1432 .headers()
1433 .get("content-type")
1434 .and_then(|v| v.to_str().ok())
1435 .unwrap_or("application/octet-stream");
1436 let content_type = super::ContentType::from(content_type);
1437
1438 if !status.is_client_error() && !status.is_server_error() {
1439 let content = resp.text().await?;
1440 match content_type {
1441 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1442 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsGetTransactionTreeResponse`"))),
1443 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::JsGetTransactionTreeResponse`")))),
1444 }
1445 } else {
1446 let content = resp.text().await?;
1447 let entity: Option<GetV2UpdatesTransactionTreeByOffsetOffsetError> =
1448 serde_json::from_str(&content).ok();
1449 Err(Error::ResponseError(ResponseContent {
1450 status,
1451 content,
1452 entity,
1453 }))
1454 }
1455}
1456
1457pub async fn get_v2_users(
1459 configuration: &configuration::Configuration,
1460 page_size: Option<i32>,
1461 page_token: Option<&str>,
1462) -> Result<models::ListUsersResponse, Error<GetV2UsersError>> {
1463 let p_page_size = page_size;
1465 let p_page_token = page_token;
1466
1467 let uri_str = format!("{}/v2/users", configuration.base_path);
1468 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1469
1470 if let Some(ref param_value) = p_page_size {
1471 req_builder = req_builder.query(&[("pageSize", ¶m_value.to_string())]);
1472 }
1473 if let Some(ref param_value) = p_page_token {
1474 req_builder = req_builder.query(&[("pageToken", ¶m_value.to_string())]);
1475 }
1476 if let Some(ref user_agent) = configuration.user_agent {
1477 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1478 }
1479 if let Some(ref token) = configuration.bearer_access_token {
1480 req_builder = req_builder.bearer_auth(token.to_owned());
1481 };
1482 if let Some(ref apikey) = configuration.api_key {
1483 let key = apikey.key.clone();
1484 let value = match apikey.prefix {
1485 Some(ref prefix) => format!("{} {}", prefix, key),
1486 None => key,
1487 };
1488 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1489 };
1490
1491 let req = req_builder.build()?;
1492 let resp = configuration.client.execute(req).await?;
1493
1494 let status = resp.status();
1495 let content_type = resp
1496 .headers()
1497 .get("content-type")
1498 .and_then(|v| v.to_str().ok())
1499 .unwrap_or("application/octet-stream");
1500 let content_type = super::ContentType::from(content_type);
1501
1502 if !status.is_client_error() && !status.is_server_error() {
1503 let content = resp.text().await?;
1504 match content_type {
1505 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1506 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListUsersResponse`"))),
1507 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::ListUsersResponse`")))),
1508 }
1509 } else {
1510 let content = resp.text().await?;
1511 let entity: Option<GetV2UsersError> = serde_json::from_str(&content).ok();
1512 Err(Error::ResponseError(ResponseContent {
1513 status,
1514 content,
1515 entity,
1516 }))
1517 }
1518}
1519
1520pub async fn get_v2_users_user_id(
1522 configuration: &configuration::Configuration,
1523 user_id: &str,
1524) -> Result<models::GetUserResponse, Error<GetV2UsersUserIdError>> {
1525 let p_user_id = user_id;
1527
1528 let uri_str = format!(
1529 "{}/v2/users/{user_id}",
1530 configuration.base_path,
1531 user_id = crate::apis::urlencode(p_user_id)
1532 );
1533 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1534
1535 if let Some(ref user_agent) = configuration.user_agent {
1536 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1537 }
1538 if let Some(ref token) = configuration.bearer_access_token {
1539 req_builder = req_builder.bearer_auth(token.to_owned());
1540 };
1541 if let Some(ref apikey) = configuration.api_key {
1542 let key = apikey.key.clone();
1543 let value = match apikey.prefix {
1544 Some(ref prefix) => format!("{} {}", prefix, key),
1545 None => key,
1546 };
1547 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1548 };
1549
1550 let req = req_builder.build()?;
1551 let resp = configuration.client.execute(req).await?;
1552
1553 let status = resp.status();
1554 let content_type = resp
1555 .headers()
1556 .get("content-type")
1557 .and_then(|v| v.to_str().ok())
1558 .unwrap_or("application/octet-stream");
1559 let content_type = super::ContentType::from(content_type);
1560
1561 if !status.is_client_error() && !status.is_server_error() {
1562 let content = resp.text().await?;
1563 match content_type {
1564 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1565 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUserResponse`"))),
1566 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::GetUserResponse`")))),
1567 }
1568 } else {
1569 let content = resp.text().await?;
1570 let entity: Option<GetV2UsersUserIdError> = serde_json::from_str(&content).ok();
1571 Err(Error::ResponseError(ResponseContent {
1572 status,
1573 content,
1574 entity,
1575 }))
1576 }
1577}
1578
1579pub async fn get_v2_users_user_id_rights(
1581 configuration: &configuration::Configuration,
1582 user_id: &str,
1583) -> Result<models::ListUserRightsResponse, Error<GetV2UsersUserIdRightsError>> {
1584 let p_user_id = user_id;
1586
1587 let uri_str = format!(
1588 "{}/v2/users/{user_id}/rights",
1589 configuration.base_path,
1590 user_id = crate::apis::urlencode(p_user_id)
1591 );
1592 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1593
1594 if let Some(ref user_agent) = configuration.user_agent {
1595 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1596 }
1597 if let Some(ref token) = configuration.bearer_access_token {
1598 req_builder = req_builder.bearer_auth(token.to_owned());
1599 };
1600 if let Some(ref apikey) = configuration.api_key {
1601 let key = apikey.key.clone();
1602 let value = match apikey.prefix {
1603 Some(ref prefix) => format!("{} {}", prefix, key),
1604 None => key,
1605 };
1606 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1607 };
1608
1609 let req = req_builder.build()?;
1610 let resp = configuration.client.execute(req).await?;
1611
1612 let status = resp.status();
1613 let content_type = resp
1614 .headers()
1615 .get("content-type")
1616 .and_then(|v| v.to_str().ok())
1617 .unwrap_or("application/octet-stream");
1618 let content_type = super::ContentType::from(content_type);
1619
1620 if !status.is_client_error() && !status.is_server_error() {
1621 let content = resp.text().await?;
1622 match content_type {
1623 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1624 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListUserRightsResponse`"))),
1625 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::ListUserRightsResponse`")))),
1626 }
1627 } else {
1628 let content = resp.text().await?;
1629 let entity: Option<GetV2UsersUserIdRightsError> = serde_json::from_str(&content).ok();
1630 Err(Error::ResponseError(ResponseContent {
1631 status,
1632 content,
1633 entity,
1634 }))
1635 }
1636}
1637
1638pub async fn get_v2_version(
1640 configuration: &configuration::Configuration,
1641) -> Result<models::GetLedgerApiVersionResponse, Error<GetV2VersionError>> {
1642 let uri_str = format!("{}/v2/version", configuration.base_path);
1643 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1644
1645 if let Some(ref user_agent) = configuration.user_agent {
1646 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1647 }
1648 if let Some(ref token) = configuration.bearer_access_token {
1649 req_builder = req_builder.bearer_auth(token.to_owned());
1650 };
1651 if let Some(ref apikey) = configuration.api_key {
1652 let key = apikey.key.clone();
1653 let value = match apikey.prefix {
1654 Some(ref prefix) => format!("{} {}", prefix, key),
1655 None => key,
1656 };
1657 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1658 };
1659
1660 let req = req_builder.build()?;
1661 let resp = configuration.client.execute(req).await?;
1662
1663 let status = resp.status();
1664 let content_type = resp
1665 .headers()
1666 .get("content-type")
1667 .and_then(|v| v.to_str().ok())
1668 .unwrap_or("application/octet-stream");
1669 let content_type = super::ContentType::from(content_type);
1670
1671 if !status.is_client_error() && !status.is_server_error() {
1672 let content = resp.text().await?;
1673 match content_type {
1674 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1675 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetLedgerApiVersionResponse`"))),
1676 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::GetLedgerApiVersionResponse`")))),
1677 }
1678 } else {
1679 let content = resp.text().await?;
1680 let entity: Option<GetV2VersionError> = serde_json::from_str(&content).ok();
1681 Err(Error::ResponseError(ResponseContent {
1682 status,
1683 content,
1684 entity,
1685 }))
1686 }
1687}
1688
1689pub async fn patch_v2_idps_idp_id(
1691 configuration: &configuration::Configuration,
1692 idp_id: &str,
1693 update_identity_provider_config_request: models::UpdateIdentityProviderConfigRequest,
1694) -> Result<models::UpdateIdentityProviderConfigResponse, Error<PatchV2IdpsIdpIdError>> {
1695 let p_idp_id = idp_id;
1697 let p_update_identity_provider_config_request = update_identity_provider_config_request;
1698
1699 let uri_str = format!(
1700 "{}/v2/idps/{idp_id}",
1701 configuration.base_path,
1702 idp_id = crate::apis::urlencode(p_idp_id)
1703 );
1704 let mut req_builder = configuration
1705 .client
1706 .request(reqwest::Method::PATCH, &uri_str);
1707
1708 if let Some(ref user_agent) = configuration.user_agent {
1709 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1710 }
1711 if let Some(ref token) = configuration.bearer_access_token {
1712 req_builder = req_builder.bearer_auth(token.to_owned());
1713 };
1714 if let Some(ref apikey) = configuration.api_key {
1715 let key = apikey.key.clone();
1716 let value = match apikey.prefix {
1717 Some(ref prefix) => format!("{} {}", prefix, key),
1718 None => key,
1719 };
1720 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1721 };
1722 req_builder = req_builder.json(&p_update_identity_provider_config_request);
1723
1724 let req = req_builder.build()?;
1725 let resp = configuration.client.execute(req).await?;
1726
1727 let status = resp.status();
1728 let content_type = resp
1729 .headers()
1730 .get("content-type")
1731 .and_then(|v| v.to_str().ok())
1732 .unwrap_or("application/octet-stream");
1733 let content_type = super::ContentType::from(content_type);
1734
1735 if !status.is_client_error() && !status.is_server_error() {
1736 let content = resp.text().await?;
1737 match content_type {
1738 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1739 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateIdentityProviderConfigResponse`"))),
1740 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::UpdateIdentityProviderConfigResponse`")))),
1741 }
1742 } else {
1743 let content = resp.text().await?;
1744 let entity: Option<PatchV2IdpsIdpIdError> = serde_json::from_str(&content).ok();
1745 Err(Error::ResponseError(ResponseContent {
1746 status,
1747 content,
1748 entity,
1749 }))
1750 }
1751}
1752
1753pub async fn patch_v2_parties_party(
1755 configuration: &configuration::Configuration,
1756 party: &str,
1757 update_party_details_request: models::UpdatePartyDetailsRequest,
1758) -> Result<models::UpdatePartyDetailsResponse, Error<PatchV2PartiesPartyError>> {
1759 let p_party = party;
1761 let p_update_party_details_request = update_party_details_request;
1762
1763 let uri_str = format!(
1764 "{}/v2/parties/{party}",
1765 configuration.base_path,
1766 party = crate::apis::urlencode(p_party)
1767 );
1768 let mut req_builder = configuration
1769 .client
1770 .request(reqwest::Method::PATCH, &uri_str);
1771
1772 if let Some(ref user_agent) = configuration.user_agent {
1773 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1774 }
1775 if let Some(ref token) = configuration.bearer_access_token {
1776 req_builder = req_builder.bearer_auth(token.to_owned());
1777 };
1778 if let Some(ref apikey) = configuration.api_key {
1779 let key = apikey.key.clone();
1780 let value = match apikey.prefix {
1781 Some(ref prefix) => format!("{} {}", prefix, key),
1782 None => key,
1783 };
1784 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1785 };
1786 req_builder = req_builder.json(&p_update_party_details_request);
1787
1788 let req = req_builder.build()?;
1789 let resp = configuration.client.execute(req).await?;
1790
1791 let status = resp.status();
1792 let content_type = resp
1793 .headers()
1794 .get("content-type")
1795 .and_then(|v| v.to_str().ok())
1796 .unwrap_or("application/octet-stream");
1797 let content_type = super::ContentType::from(content_type);
1798
1799 if !status.is_client_error() && !status.is_server_error() {
1800 let content = resp.text().await?;
1801 match content_type {
1802 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1803 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdatePartyDetailsResponse`"))),
1804 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::UpdatePartyDetailsResponse`")))),
1805 }
1806 } else {
1807 let content = resp.text().await?;
1808 let entity: Option<PatchV2PartiesPartyError> = serde_json::from_str(&content).ok();
1809 Err(Error::ResponseError(ResponseContent {
1810 status,
1811 content,
1812 entity,
1813 }))
1814 }
1815}
1816
1817pub async fn patch_v2_users_user_id(
1819 configuration: &configuration::Configuration,
1820 user_id: &str,
1821 update_user_request: models::UpdateUserRequest,
1822) -> Result<models::UpdateUserResponse, Error<PatchV2UsersUserIdError>> {
1823 let p_user_id = user_id;
1825 let p_update_user_request = update_user_request;
1826
1827 let uri_str = format!(
1828 "{}/v2/users/{user_id}",
1829 configuration.base_path,
1830 user_id = crate::apis::urlencode(p_user_id)
1831 );
1832 let mut req_builder = configuration
1833 .client
1834 .request(reqwest::Method::PATCH, &uri_str);
1835
1836 if let Some(ref user_agent) = configuration.user_agent {
1837 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1838 }
1839 if let Some(ref token) = configuration.bearer_access_token {
1840 req_builder = req_builder.bearer_auth(token.to_owned());
1841 };
1842 if let Some(ref apikey) = configuration.api_key {
1843 let key = apikey.key.clone();
1844 let value = match apikey.prefix {
1845 Some(ref prefix) => format!("{} {}", prefix, key),
1846 None => key,
1847 };
1848 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1849 };
1850 req_builder = req_builder.json(&p_update_user_request);
1851
1852 let req = req_builder.build()?;
1853 let resp = configuration.client.execute(req).await?;
1854
1855 let status = resp.status();
1856 let content_type = resp
1857 .headers()
1858 .get("content-type")
1859 .and_then(|v| v.to_str().ok())
1860 .unwrap_or("application/octet-stream");
1861 let content_type = super::ContentType::from(content_type);
1862
1863 if !status.is_client_error() && !status.is_server_error() {
1864 let content = resp.text().await?;
1865 match content_type {
1866 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1867 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateUserResponse`"))),
1868 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::UpdateUserResponse`")))),
1869 }
1870 } else {
1871 let content = resp.text().await?;
1872 let entity: Option<PatchV2UsersUserIdError> = serde_json::from_str(&content).ok();
1873 Err(Error::ResponseError(ResponseContent {
1874 status,
1875 content,
1876 entity,
1877 }))
1878 }
1879}
1880
1881pub async fn patch_v2_users_user_id_identity_provider_id(
1883 configuration: &configuration::Configuration,
1884 user_id: &str,
1885 update_user_identity_provider_id_request: models::UpdateUserIdentityProviderIdRequest,
1886) -> Result<serde_json::Value, Error<PatchV2UsersUserIdIdentityProviderIdError>> {
1887 let p_user_id = user_id;
1889 let p_update_user_identity_provider_id_request = update_user_identity_provider_id_request;
1890
1891 let uri_str = format!(
1892 "{}/v2/users/{user_id}/identity-provider-id",
1893 configuration.base_path,
1894 user_id = crate::apis::urlencode(p_user_id)
1895 );
1896 let mut req_builder = configuration
1897 .client
1898 .request(reqwest::Method::PATCH, &uri_str);
1899
1900 if let Some(ref user_agent) = configuration.user_agent {
1901 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1902 }
1903 if let Some(ref token) = configuration.bearer_access_token {
1904 req_builder = req_builder.bearer_auth(token.to_owned());
1905 };
1906 if let Some(ref apikey) = configuration.api_key {
1907 let key = apikey.key.clone();
1908 let value = match apikey.prefix {
1909 Some(ref prefix) => format!("{} {}", prefix, key),
1910 None => key,
1911 };
1912 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1913 };
1914 req_builder = req_builder.json(&p_update_user_identity_provider_id_request);
1915
1916 let req = req_builder.build()?;
1917 let resp = configuration.client.execute(req).await?;
1918
1919 let status = resp.status();
1920 let content_type = resp
1921 .headers()
1922 .get("content-type")
1923 .and_then(|v| v.to_str().ok())
1924 .unwrap_or("application/octet-stream");
1925 let content_type = super::ContentType::from(content_type);
1926
1927 if !status.is_client_error() && !status.is_server_error() {
1928 let content = resp.text().await?;
1929 match content_type {
1930 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1931 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
1932 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
1933 }
1934 } else {
1935 let content = resp.text().await?;
1936 let entity: Option<PatchV2UsersUserIdIdentityProviderIdError> =
1937 serde_json::from_str(&content).ok();
1938 Err(Error::ResponseError(ResponseContent {
1939 status,
1940 content,
1941 entity,
1942 }))
1943 }
1944}
1945
1946pub async fn patch_v2_users_user_id_rights(
1948 configuration: &configuration::Configuration,
1949 user_id: &str,
1950 revoke_user_rights_request: models::RevokeUserRightsRequest,
1951) -> Result<models::RevokeUserRightsResponse, Error<PatchV2UsersUserIdRightsError>> {
1952 let p_user_id = user_id;
1954 let p_revoke_user_rights_request = revoke_user_rights_request;
1955
1956 let uri_str = format!(
1957 "{}/v2/users/{user_id}/rights",
1958 configuration.base_path,
1959 user_id = crate::apis::urlencode(p_user_id)
1960 );
1961 let mut req_builder = configuration
1962 .client
1963 .request(reqwest::Method::PATCH, &uri_str);
1964
1965 if let Some(ref user_agent) = configuration.user_agent {
1966 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1967 }
1968 if let Some(ref token) = configuration.bearer_access_token {
1969 req_builder = req_builder.bearer_auth(token.to_owned());
1970 };
1971 if let Some(ref apikey) = configuration.api_key {
1972 let key = apikey.key.clone();
1973 let value = match apikey.prefix {
1974 Some(ref prefix) => format!("{} {}", prefix, key),
1975 None => key,
1976 };
1977 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
1978 };
1979 req_builder = req_builder.json(&p_revoke_user_rights_request);
1980
1981 let req = req_builder.build()?;
1982 let resp = configuration.client.execute(req).await?;
1983
1984 let status = resp.status();
1985 let content_type = resp
1986 .headers()
1987 .get("content-type")
1988 .and_then(|v| v.to_str().ok())
1989 .unwrap_or("application/octet-stream");
1990 let content_type = super::ContentType::from(content_type);
1991
1992 if !status.is_client_error() && !status.is_server_error() {
1993 let content = resp.text().await?;
1994 match content_type {
1995 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1996 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RevokeUserRightsResponse`"))),
1997 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::RevokeUserRightsResponse`")))),
1998 }
1999 } else {
2000 let content = resp.text().await?;
2001 let entity: Option<PatchV2UsersUserIdRightsError> = serde_json::from_str(&content).ok();
2002 Err(Error::ResponseError(ResponseContent {
2003 status,
2004 content,
2005 entity,
2006 }))
2007 }
2008}
2009
2010pub async fn post_v2_commands_async_submit(
2012 configuration: &configuration::Configuration,
2013 js_commands: models::JsCommands,
2014) -> Result<serde_json::Value, Error<PostV2CommandsAsyncSubmitError>> {
2015 let p_js_commands = js_commands;
2017
2018 let uri_str = format!("{}/v2/commands/async/submit", configuration.base_path);
2019 let mut req_builder = configuration
2020 .client
2021 .request(reqwest::Method::POST, &uri_str);
2022
2023 if let Some(ref user_agent) = configuration.user_agent {
2024 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2025 }
2026 if let Some(ref token) = configuration.bearer_access_token {
2027 req_builder = req_builder.bearer_auth(token.to_owned());
2028 };
2029 if let Some(ref apikey) = configuration.api_key {
2030 let key = apikey.key.clone();
2031 let value = match apikey.prefix {
2032 Some(ref prefix) => format!("{} {}", prefix, key),
2033 None => key,
2034 };
2035 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2036 };
2037 req_builder = req_builder.json(&p_js_commands);
2038
2039 let req = req_builder.build()?;
2040 let resp = configuration.client.execute(req).await?;
2041
2042 let status = resp.status();
2043 let content_type = resp
2044 .headers()
2045 .get("content-type")
2046 .and_then(|v| v.to_str().ok())
2047 .unwrap_or("application/octet-stream");
2048 let content_type = super::ContentType::from(content_type);
2049
2050 if !status.is_client_error() && !status.is_server_error() {
2051 let content = resp.text().await?;
2052 match content_type {
2053 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2054 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
2055 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
2056 }
2057 } else {
2058 let content = resp.text().await?;
2059 let entity: Option<PostV2CommandsAsyncSubmitError> = serde_json::from_str(&content).ok();
2060 Err(Error::ResponseError(ResponseContent {
2061 status,
2062 content,
2063 entity,
2064 }))
2065 }
2066}
2067
2068pub async fn post_v2_commands_async_submit_reassignment(
2070 configuration: &configuration::Configuration,
2071 submit_reassignment_request: models::SubmitReassignmentRequest,
2072) -> Result<serde_json::Value, Error<PostV2CommandsAsyncSubmitReassignmentError>> {
2073 let p_submit_reassignment_request = submit_reassignment_request;
2075
2076 let uri_str = format!(
2077 "{}/v2/commands/async/submit-reassignment",
2078 configuration.base_path
2079 );
2080 let mut req_builder = configuration
2081 .client
2082 .request(reqwest::Method::POST, &uri_str);
2083
2084 if let Some(ref user_agent) = configuration.user_agent {
2085 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2086 }
2087 if let Some(ref token) = configuration.bearer_access_token {
2088 req_builder = req_builder.bearer_auth(token.to_owned());
2089 };
2090 if let Some(ref apikey) = configuration.api_key {
2091 let key = apikey.key.clone();
2092 let value = match apikey.prefix {
2093 Some(ref prefix) => format!("{} {}", prefix, key),
2094 None => key,
2095 };
2096 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2097 };
2098 req_builder = req_builder.json(&p_submit_reassignment_request);
2099
2100 let req = req_builder.build()?;
2101 let resp = configuration.client.execute(req).await?;
2102
2103 let status = resp.status();
2104 let content_type = resp
2105 .headers()
2106 .get("content-type")
2107 .and_then(|v| v.to_str().ok())
2108 .unwrap_or("application/octet-stream");
2109 let content_type = super::ContentType::from(content_type);
2110
2111 if !status.is_client_error() && !status.is_server_error() {
2112 let content = resp.text().await?;
2113 match content_type {
2114 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2115 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
2116 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
2117 }
2118 } else {
2119 let content = resp.text().await?;
2120 let entity: Option<PostV2CommandsAsyncSubmitReassignmentError> =
2121 serde_json::from_str(&content).ok();
2122 Err(Error::ResponseError(ResponseContent {
2123 status,
2124 content,
2125 entity,
2126 }))
2127 }
2128}
2129
2130pub async fn post_v2_commands_completions(
2132 configuration: &configuration::Configuration,
2133 completion_stream_request: models::CompletionStreamRequest,
2134 limit: Option<i64>,
2135 stream_idle_timeout_ms: Option<i64>,
2136) -> Result<Vec<models::CompletionStreamResponse>, Error<PostV2CommandsCompletionsError>> {
2137 let p_completion_stream_request = completion_stream_request;
2139 let p_limit = limit;
2140 let p_stream_idle_timeout_ms = stream_idle_timeout_ms;
2141
2142 let uri_str = format!("{}/v2/commands/completions", configuration.base_path);
2143 let mut req_builder = configuration
2144 .client
2145 .request(reqwest::Method::POST, &uri_str);
2146
2147 if let Some(ref param_value) = p_limit {
2148 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
2149 }
2150 if let Some(ref param_value) = p_stream_idle_timeout_ms {
2151 req_builder = req_builder.query(&[("stream_idle_timeout_ms", ¶m_value.to_string())]);
2152 }
2153 if let Some(ref user_agent) = configuration.user_agent {
2154 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2155 }
2156 if let Some(ref token) = configuration.bearer_access_token {
2157 req_builder = req_builder.bearer_auth(token.to_owned());
2158 };
2159 if let Some(ref apikey) = configuration.api_key {
2160 let key = apikey.key.clone();
2161 let value = match apikey.prefix {
2162 Some(ref prefix) => format!("{} {}", prefix, key),
2163 None => key,
2164 };
2165 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2166 };
2167 req_builder = req_builder.json(&p_completion_stream_request);
2168
2169 let req = req_builder.build()?;
2170 let resp = configuration.client.execute(req).await?;
2171
2172 let status = resp.status();
2173 let content_type = resp
2174 .headers()
2175 .get("content-type")
2176 .and_then(|v| v.to_str().ok())
2177 .unwrap_or("application/octet-stream");
2178 let content_type = super::ContentType::from(content_type);
2179
2180 if !status.is_client_error() && !status.is_server_error() {
2181 let content = resp.text().await?;
2182 match content_type {
2183 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2184 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::CompletionStreamResponse>`"))),
2185 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::CompletionStreamResponse>`")))),
2186 }
2187 } else {
2188 let content = resp.text().await?;
2189 let entity: Option<PostV2CommandsCompletionsError> = serde_json::from_str(&content).ok();
2190 Err(Error::ResponseError(ResponseContent {
2191 status,
2192 content,
2193 entity,
2194 }))
2195 }
2196}
2197
2198pub async fn post_v2_commands_submit_and_wait(
2200 configuration: &configuration::Configuration,
2201 js_commands: models::JsCommands,
2202) -> Result<models::SubmitAndWaitResponse, Error<PostV2CommandsSubmitAndWaitError>> {
2203 let p_js_commands = js_commands;
2205
2206 let uri_str = format!("{}/v2/commands/submit-and-wait", configuration.base_path);
2207 let mut req_builder = configuration
2208 .client
2209 .request(reqwest::Method::POST, &uri_str);
2210
2211 if let Some(ref user_agent) = configuration.user_agent {
2212 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2213 }
2214 if let Some(ref token) = configuration.bearer_access_token {
2215 req_builder = req_builder.bearer_auth(token.to_owned());
2216 };
2217 if let Some(ref apikey) = configuration.api_key {
2218 let key = apikey.key.clone();
2219 let value = match apikey.prefix {
2220 Some(ref prefix) => format!("{} {}", prefix, key),
2221 None => key,
2222 };
2223 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2224 };
2225 req_builder = req_builder.json(&p_js_commands);
2226
2227 let req = req_builder.build()?;
2228 let resp = configuration.client.execute(req).await?;
2229
2230 let status = resp.status();
2231 let content_type = resp
2232 .headers()
2233 .get("content-type")
2234 .and_then(|v| v.to_str().ok())
2235 .unwrap_or("application/octet-stream");
2236 let content_type = super::ContentType::from(content_type);
2237
2238 if !status.is_client_error() && !status.is_server_error() {
2239 let content = resp.text().await?;
2240 match content_type {
2241 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2242 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SubmitAndWaitResponse`"))),
2243 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::SubmitAndWaitResponse`")))),
2244 }
2245 } else {
2246 let content = resp.text().await?;
2247 let entity: Option<PostV2CommandsSubmitAndWaitError> = serde_json::from_str(&content).ok();
2248 Err(Error::ResponseError(ResponseContent {
2249 status,
2250 content,
2251 entity,
2252 }))
2253 }
2254}
2255
2256pub async fn post_v2_commands_submit_and_wait_for_reassignment(
2258 configuration: &configuration::Configuration,
2259 submit_and_wait_for_reassignment_request: models::SubmitAndWaitForReassignmentRequest,
2260) -> Result<
2261 models::JsSubmitAndWaitForReassignmentResponse,
2262 Error<PostV2CommandsSubmitAndWaitForReassignmentError>,
2263> {
2264 let p_submit_and_wait_for_reassignment_request = submit_and_wait_for_reassignment_request;
2266
2267 let uri_str = format!(
2268 "{}/v2/commands/submit-and-wait-for-reassignment",
2269 configuration.base_path
2270 );
2271 let mut req_builder = configuration
2272 .client
2273 .request(reqwest::Method::POST, &uri_str);
2274
2275 if let Some(ref user_agent) = configuration.user_agent {
2276 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2277 }
2278 if let Some(ref token) = configuration.bearer_access_token {
2279 req_builder = req_builder.bearer_auth(token.to_owned());
2280 };
2281 if let Some(ref apikey) = configuration.api_key {
2282 let key = apikey.key.clone();
2283 let value = match apikey.prefix {
2284 Some(ref prefix) => format!("{} {}", prefix, key),
2285 None => key,
2286 };
2287 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2288 };
2289 req_builder = req_builder.json(&p_submit_and_wait_for_reassignment_request);
2290
2291 let req = req_builder.build()?;
2292 let resp = configuration.client.execute(req).await?;
2293
2294 let status = resp.status();
2295 let content_type = resp
2296 .headers()
2297 .get("content-type")
2298 .and_then(|v| v.to_str().ok())
2299 .unwrap_or("application/octet-stream");
2300 let content_type = super::ContentType::from(content_type);
2301
2302 if !status.is_client_error() && !status.is_server_error() {
2303 let content = resp.text().await?;
2304 match content_type {
2305 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2306 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsSubmitAndWaitForReassignmentResponse`"))),
2307 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::JsSubmitAndWaitForReassignmentResponse`")))),
2308 }
2309 } else {
2310 let content = resp.text().await?;
2311 let entity: Option<PostV2CommandsSubmitAndWaitForReassignmentError> =
2312 serde_json::from_str(&content).ok();
2313 Err(Error::ResponseError(ResponseContent {
2314 status,
2315 content,
2316 entity,
2317 }))
2318 }
2319}
2320
2321pub async fn post_v2_commands_submit_and_wait_for_transaction(
2323 configuration: &configuration::Configuration,
2324 js_submit_and_wait_for_transaction_request: models::JsSubmitAndWaitForTransactionRequest,
2325) -> Result<
2326 models::JsSubmitAndWaitForTransactionResponse,
2327 Error<PostV2CommandsSubmitAndWaitForTransactionError>,
2328> {
2329 let p_js_submit_and_wait_for_transaction_request = js_submit_and_wait_for_transaction_request;
2331
2332 let uri_str = format!(
2333 "{}/v2/commands/submit-and-wait-for-transaction",
2334 configuration.base_path
2335 );
2336 let mut req_builder = configuration
2337 .client
2338 .request(reqwest::Method::POST, &uri_str);
2339
2340 if let Some(ref user_agent) = configuration.user_agent {
2341 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2342 }
2343 if let Some(ref token) = configuration.bearer_access_token {
2344 req_builder = req_builder.bearer_auth(token.to_owned());
2345 };
2346 if let Some(ref apikey) = configuration.api_key {
2347 let key = apikey.key.clone();
2348 let value = match apikey.prefix {
2349 Some(ref prefix) => format!("{} {}", prefix, key),
2350 None => key,
2351 };
2352 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2353 };
2354 req_builder = req_builder.json(&p_js_submit_and_wait_for_transaction_request);
2355
2356 let req = req_builder.build()?;
2357 let resp = configuration.client.execute(req).await?;
2358
2359 let status = resp.status();
2360 let content_type = resp
2361 .headers()
2362 .get("content-type")
2363 .and_then(|v| v.to_str().ok())
2364 .unwrap_or("application/octet-stream");
2365 let content_type = super::ContentType::from(content_type);
2366
2367 if !status.is_client_error() && !status.is_server_error() {
2368 let content = resp.text().await?;
2369 match content_type {
2370 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2371 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsSubmitAndWaitForTransactionResponse`"))),
2372 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::JsSubmitAndWaitForTransactionResponse`")))),
2373 }
2374 } else {
2375 let content = resp.text().await?;
2376 let entity: Option<PostV2CommandsSubmitAndWaitForTransactionError> =
2377 serde_json::from_str(&content).ok();
2378 Err(Error::ResponseError(ResponseContent {
2379 status,
2380 content,
2381 entity,
2382 }))
2383 }
2384}
2385
2386pub async fn post_v2_commands_submit_and_wait_for_transaction_tree(
2388 configuration: &configuration::Configuration,
2389 js_commands: models::JsCommands,
2390) -> Result<
2391 models::JsSubmitAndWaitForTransactionTreeResponse,
2392 Error<PostV2CommandsSubmitAndWaitForTransactionTreeError>,
2393> {
2394 let p_js_commands = js_commands;
2396
2397 let uri_str = format!(
2398 "{}/v2/commands/submit-and-wait-for-transaction-tree",
2399 configuration.base_path
2400 );
2401 let mut req_builder = configuration
2402 .client
2403 .request(reqwest::Method::POST, &uri_str);
2404
2405 if let Some(ref user_agent) = configuration.user_agent {
2406 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2407 }
2408 if let Some(ref token) = configuration.bearer_access_token {
2409 req_builder = req_builder.bearer_auth(token.to_owned());
2410 };
2411 if let Some(ref apikey) = configuration.api_key {
2412 let key = apikey.key.clone();
2413 let value = match apikey.prefix {
2414 Some(ref prefix) => format!("{} {}", prefix, key),
2415 None => key,
2416 };
2417 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2418 };
2419 req_builder = req_builder.json(&p_js_commands);
2420
2421 let req = req_builder.build()?;
2422 let resp = configuration.client.execute(req).await?;
2423
2424 let status = resp.status();
2425 let content_type = resp
2426 .headers()
2427 .get("content-type")
2428 .and_then(|v| v.to_str().ok())
2429 .unwrap_or("application/octet-stream");
2430 let content_type = super::ContentType::from(content_type);
2431
2432 if !status.is_client_error() && !status.is_server_error() {
2433 let content = resp.text().await?;
2434 match content_type {
2435 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2436 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsSubmitAndWaitForTransactionTreeResponse`"))),
2437 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::JsSubmitAndWaitForTransactionTreeResponse`")))),
2438 }
2439 } else {
2440 let content = resp.text().await?;
2441 let entity: Option<PostV2CommandsSubmitAndWaitForTransactionTreeError> =
2442 serde_json::from_str(&content).ok();
2443 Err(Error::ResponseError(ResponseContent {
2444 status,
2445 content,
2446 entity,
2447 }))
2448 }
2449}
2450
2451pub async fn post_v2_events_events_by_contract_id(
2453 configuration: &configuration::Configuration,
2454 get_events_by_contract_id_request: models::GetEventsByContractIdRequest,
2455) -> Result<models::JsGetEventsByContractIdResponse, Error<PostV2EventsEventsByContractIdError>> {
2456 let p_get_events_by_contract_id_request = get_events_by_contract_id_request;
2458
2459 let uri_str = format!(
2460 "{}/v2/events/events-by-contract-id",
2461 configuration.base_path
2462 );
2463 let mut req_builder = configuration
2464 .client
2465 .request(reqwest::Method::POST, &uri_str);
2466
2467 if let Some(ref user_agent) = configuration.user_agent {
2468 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2469 }
2470 if let Some(ref token) = configuration.bearer_access_token {
2471 req_builder = req_builder.bearer_auth(token.to_owned());
2472 };
2473 if let Some(ref apikey) = configuration.api_key {
2474 let key = apikey.key.clone();
2475 let value = match apikey.prefix {
2476 Some(ref prefix) => format!("{} {}", prefix, key),
2477 None => key,
2478 };
2479 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2480 };
2481 req_builder = req_builder.json(&p_get_events_by_contract_id_request);
2482
2483 let req = req_builder.build()?;
2484 let resp = configuration.client.execute(req).await?;
2485
2486 let status = resp.status();
2487 let content_type = resp
2488 .headers()
2489 .get("content-type")
2490 .and_then(|v| v.to_str().ok())
2491 .unwrap_or("application/octet-stream");
2492 let content_type = super::ContentType::from(content_type);
2493
2494 if !status.is_client_error() && !status.is_server_error() {
2495 let content = resp.text().await?;
2496 match content_type {
2497 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2498 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsGetEventsByContractIdResponse`"))),
2499 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::JsGetEventsByContractIdResponse`")))),
2500 }
2501 } else {
2502 let content = resp.text().await?;
2503 let entity: Option<PostV2EventsEventsByContractIdError> =
2504 serde_json::from_str(&content).ok();
2505 Err(Error::ResponseError(ResponseContent {
2506 status,
2507 content,
2508 entity,
2509 }))
2510 }
2511}
2512
2513pub async fn post_v2_idps(
2515 configuration: &configuration::Configuration,
2516 create_identity_provider_config_request: models::CreateIdentityProviderConfigRequest,
2517) -> Result<models::CreateIdentityProviderConfigResponse, Error<PostV2IdpsError>> {
2518 let p_create_identity_provider_config_request = create_identity_provider_config_request;
2520
2521 let uri_str = format!("{}/v2/idps", configuration.base_path);
2522 let mut req_builder = configuration
2523 .client
2524 .request(reqwest::Method::POST, &uri_str);
2525
2526 if let Some(ref user_agent) = configuration.user_agent {
2527 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2528 }
2529 if let Some(ref token) = configuration.bearer_access_token {
2530 req_builder = req_builder.bearer_auth(token.to_owned());
2531 };
2532 if let Some(ref apikey) = configuration.api_key {
2533 let key = apikey.key.clone();
2534 let value = match apikey.prefix {
2535 Some(ref prefix) => format!("{} {}", prefix, key),
2536 None => key,
2537 };
2538 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2539 };
2540 req_builder = req_builder.json(&p_create_identity_provider_config_request);
2541
2542 let req = req_builder.build()?;
2543 let resp = configuration.client.execute(req).await?;
2544
2545 let status = resp.status();
2546 let content_type = resp
2547 .headers()
2548 .get("content-type")
2549 .and_then(|v| v.to_str().ok())
2550 .unwrap_or("application/octet-stream");
2551 let content_type = super::ContentType::from(content_type);
2552
2553 if !status.is_client_error() && !status.is_server_error() {
2554 let content = resp.text().await?;
2555 match content_type {
2556 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2557 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateIdentityProviderConfigResponse`"))),
2558 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::CreateIdentityProviderConfigResponse`")))),
2559 }
2560 } else {
2561 let content = resp.text().await?;
2562 let entity: Option<PostV2IdpsError> = serde_json::from_str(&content).ok();
2563 Err(Error::ResponseError(ResponseContent {
2564 status,
2565 content,
2566 entity,
2567 }))
2568 }
2569}
2570
2571pub async fn post_v2_interactive_submission_execute(
2573 configuration: &configuration::Configuration,
2574 js_execute_submission_request: models::JsExecuteSubmissionRequest,
2575) -> Result<serde_json::Value, Error<PostV2InteractiveSubmissionExecuteError>> {
2576 let p_js_execute_submission_request = js_execute_submission_request;
2578
2579 let uri_str = format!(
2580 "{}/v2/interactive-submission/execute",
2581 configuration.base_path
2582 );
2583 let mut req_builder = configuration
2584 .client
2585 .request(reqwest::Method::POST, &uri_str);
2586
2587 if let Some(ref user_agent) = configuration.user_agent {
2588 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2589 }
2590 if let Some(ref token) = configuration.bearer_access_token {
2591 req_builder = req_builder.bearer_auth(token.to_owned());
2592 };
2593 if let Some(ref apikey) = configuration.api_key {
2594 let key = apikey.key.clone();
2595 let value = match apikey.prefix {
2596 Some(ref prefix) => format!("{} {}", prefix, key),
2597 None => key,
2598 };
2599 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2600 };
2601 req_builder = req_builder.json(&p_js_execute_submission_request);
2602
2603 let req = req_builder.build()?;
2604 let resp = configuration.client.execute(req).await?;
2605
2606 let status = resp.status();
2607 let content_type = resp
2608 .headers()
2609 .get("content-type")
2610 .and_then(|v| v.to_str().ok())
2611 .unwrap_or("application/octet-stream");
2612 let content_type = super::ContentType::from(content_type);
2613
2614 if !status.is_client_error() && !status.is_server_error() {
2615 let content = resp.text().await?;
2616 match content_type {
2617 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2618 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
2619 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
2620 }
2621 } else {
2622 let content = resp.text().await?;
2623 let entity: Option<PostV2InteractiveSubmissionExecuteError> =
2624 serde_json::from_str(&content).ok();
2625 Err(Error::ResponseError(ResponseContent {
2626 status,
2627 content,
2628 entity,
2629 }))
2630 }
2631}
2632
2633pub async fn post_v2_interactive_submission_prepare(
2635 configuration: &configuration::Configuration,
2636 js_prepare_submission_request: models::JsPrepareSubmissionRequest,
2637) -> Result<models::JsPrepareSubmissionResponse, Error<PostV2InteractiveSubmissionPrepareError>> {
2638 let p_js_prepare_submission_request = js_prepare_submission_request;
2640
2641 let uri_str = format!(
2642 "{}/v2/interactive-submission/prepare",
2643 configuration.base_path
2644 );
2645 let mut req_builder = configuration
2646 .client
2647 .request(reqwest::Method::POST, &uri_str);
2648
2649 if let Some(ref user_agent) = configuration.user_agent {
2650 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2651 }
2652 if let Some(ref token) = configuration.bearer_access_token {
2653 req_builder = req_builder.bearer_auth(token.to_owned());
2654 };
2655 if let Some(ref apikey) = configuration.api_key {
2656 let key = apikey.key.clone();
2657 let value = match apikey.prefix {
2658 Some(ref prefix) => format!("{} {}", prefix, key),
2659 None => key,
2660 };
2661 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2662 };
2663 req_builder = req_builder.json(&p_js_prepare_submission_request);
2664
2665 let req = req_builder.build()?;
2666 let resp = configuration.client.execute(req).await?;
2667
2668 let status = resp.status();
2669 let content_type = resp
2670 .headers()
2671 .get("content-type")
2672 .and_then(|v| v.to_str().ok())
2673 .unwrap_or("application/octet-stream");
2674 let content_type = super::ContentType::from(content_type);
2675
2676 if !status.is_client_error() && !status.is_server_error() {
2677 let content = resp.text().await?;
2678 match content_type {
2679 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2680 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsPrepareSubmissionResponse`"))),
2681 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::JsPrepareSubmissionResponse`")))),
2682 }
2683 } else {
2684 let content = resp.text().await?;
2685 let entity: Option<PostV2InteractiveSubmissionPrepareError> =
2686 serde_json::from_str(&content).ok();
2687 Err(Error::ResponseError(ResponseContent {
2688 status,
2689 content,
2690 entity,
2691 }))
2692 }
2693}
2694
2695pub async fn post_v2_parties(
2697 configuration: &configuration::Configuration,
2698 allocate_party_request: models::AllocatePartyRequest,
2699) -> Result<models::AllocatePartyResponse, Error<PostV2PartiesError>> {
2700 let p_allocate_party_request = allocate_party_request;
2702
2703 let uri_str = format!("{}/v2/parties", configuration.base_path);
2704 let mut req_builder = configuration
2705 .client
2706 .request(reqwest::Method::POST, &uri_str);
2707
2708 if let Some(ref user_agent) = configuration.user_agent {
2709 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2710 }
2711 if let Some(ref token) = configuration.bearer_access_token {
2712 req_builder = req_builder.bearer_auth(token.to_owned());
2713 };
2714 if let Some(ref apikey) = configuration.api_key {
2715 let key = apikey.key.clone();
2716 let value = match apikey.prefix {
2717 Some(ref prefix) => format!("{} {}", prefix, key),
2718 None => key,
2719 };
2720 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2721 };
2722 req_builder = req_builder.json(&p_allocate_party_request);
2723
2724 let req = req_builder.build()?;
2725 let resp = configuration.client.execute(req).await?;
2726
2727 let status = resp.status();
2728 let content_type = resp
2729 .headers()
2730 .get("content-type")
2731 .and_then(|v| v.to_str().ok())
2732 .unwrap_or("application/octet-stream");
2733 let content_type = super::ContentType::from(content_type);
2734
2735 if !status.is_client_error() && !status.is_server_error() {
2736 let content = resp.text().await?;
2737 match content_type {
2738 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2739 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AllocatePartyResponse`"))),
2740 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::AllocatePartyResponse`")))),
2741 }
2742 } else {
2743 let content = resp.text().await?;
2744 let entity: Option<PostV2PartiesError> = serde_json::from_str(&content).ok();
2745 Err(Error::ResponseError(ResponseContent {
2746 status,
2747 content,
2748 entity,
2749 }))
2750 }
2751}
2752
2753pub async fn post_v2_state_active_contracts(
2755 configuration: &configuration::Configuration,
2756 get_active_contracts_request: models::GetActiveContractsRequest,
2757 limit: Option<i64>,
2758 stream_idle_timeout_ms: Option<i64>,
2759) -> Result<Vec<models::JsGetActiveContractsResponse>, Error<PostV2StateActiveContractsError>> {
2760 let p_get_active_contracts_request = get_active_contracts_request;
2762 let p_limit = limit;
2763 let p_stream_idle_timeout_ms = stream_idle_timeout_ms;
2764
2765 let uri_str = format!("{}/v2/state/active-contracts", configuration.base_path);
2766 let mut req_builder = configuration
2767 .client
2768 .request(reqwest::Method::POST, &uri_str);
2769
2770 if let Some(ref param_value) = p_limit {
2771 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
2772 }
2773 if let Some(ref param_value) = p_stream_idle_timeout_ms {
2774 req_builder = req_builder.query(&[("stream_idle_timeout_ms", ¶m_value.to_string())]);
2775 }
2776 if let Some(ref user_agent) = configuration.user_agent {
2777 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2778 }
2779 if let Some(ref token) = configuration.bearer_access_token {
2780 req_builder = req_builder.bearer_auth(token.to_owned());
2781 };
2782 if let Some(ref apikey) = configuration.api_key {
2783 let key = apikey.key.clone();
2784 let value = match apikey.prefix {
2785 Some(ref prefix) => format!("{} {}", prefix, key),
2786 None => key,
2787 };
2788 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2789 };
2790 req_builder = req_builder.json(&p_get_active_contracts_request);
2791
2792 let req = req_builder.build()?;
2793 let resp = configuration.client.execute(req).await?;
2794
2795 let status = resp.status();
2796 let content_type = resp
2797 .headers()
2798 .get("content-type")
2799 .and_then(|v| v.to_str().ok())
2800 .unwrap_or("application/octet-stream");
2801 let content_type = super::ContentType::from(content_type);
2802
2803 if !status.is_client_error() && !status.is_server_error() {
2804 let content = resp.text().await?;
2805 match content_type {
2806 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2807 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::JsGetActiveContractsResponse>`"))),
2808 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::JsGetActiveContractsResponse>`")))),
2809 }
2810 } else {
2811 let content = resp.text().await?;
2812 let entity: Option<PostV2StateActiveContractsError> = serde_json::from_str(&content).ok();
2813 Err(Error::ResponseError(ResponseContent {
2814 status,
2815 content,
2816 entity,
2817 }))
2818 }
2819}
2820
2821pub async fn post_v2_updates_flats(
2823 configuration: &configuration::Configuration,
2824 get_updates_request: models::GetUpdatesRequest,
2825 limit: Option<i64>,
2826 stream_idle_timeout_ms: Option<i64>,
2827) -> Result<Vec<models::JsGetUpdatesResponse>, Error<PostV2UpdatesFlatsError>> {
2828 let p_get_updates_request = get_updates_request;
2830 let p_limit = limit;
2831 let p_stream_idle_timeout_ms = stream_idle_timeout_ms;
2832
2833 let uri_str = format!("{}/v2/updates/flats", configuration.base_path);
2834 let mut req_builder = configuration
2835 .client
2836 .request(reqwest::Method::POST, &uri_str);
2837
2838 if let Some(ref param_value) = p_limit {
2839 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
2840 }
2841 if let Some(ref param_value) = p_stream_idle_timeout_ms {
2842 req_builder = req_builder.query(&[("stream_idle_timeout_ms", ¶m_value.to_string())]);
2843 }
2844 if let Some(ref user_agent) = configuration.user_agent {
2845 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2846 }
2847 if let Some(ref token) = configuration.bearer_access_token {
2848 req_builder = req_builder.bearer_auth(token.to_owned());
2849 };
2850 if let Some(ref apikey) = configuration.api_key {
2851 let key = apikey.key.clone();
2852 let value = match apikey.prefix {
2853 Some(ref prefix) => format!("{} {}", prefix, key),
2854 None => key,
2855 };
2856 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2857 };
2858 req_builder = req_builder.json(&p_get_updates_request);
2859
2860 let req = req_builder.build()?;
2861 let resp = configuration.client.execute(req).await?;
2862
2863 let status = resp.status();
2864 let content_type = resp
2865 .headers()
2866 .get("content-type")
2867 .and_then(|v| v.to_str().ok())
2868 .unwrap_or("application/octet-stream");
2869 let content_type = super::ContentType::from(content_type);
2870
2871 if !status.is_client_error() && !status.is_server_error() {
2872 let content = resp.text().await?;
2873 match content_type {
2874 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2875 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::JsGetUpdatesResponse>`"))),
2876 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::JsGetUpdatesResponse>`")))),
2877 }
2878 } else {
2879 let content = resp.text().await?;
2880 let entity: Option<PostV2UpdatesFlatsError> = serde_json::from_str(&content).ok();
2881 Err(Error::ResponseError(ResponseContent {
2882 status,
2883 content,
2884 entity,
2885 }))
2886 }
2887}
2888
2889pub async fn post_v2_updates_transaction_by_id(
2891 configuration: &configuration::Configuration,
2892 get_transaction_by_id_request: models::GetTransactionByIdRequest,
2893) -> Result<models::JsGetTransactionResponse, Error<PostV2UpdatesTransactionByIdError>> {
2894 let p_get_transaction_by_id_request = get_transaction_by_id_request;
2896
2897 let uri_str = format!("{}/v2/updates/transaction-by-id", configuration.base_path);
2898 let mut req_builder = configuration
2899 .client
2900 .request(reqwest::Method::POST, &uri_str);
2901
2902 if let Some(ref user_agent) = configuration.user_agent {
2903 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2904 }
2905 if let Some(ref token) = configuration.bearer_access_token {
2906 req_builder = req_builder.bearer_auth(token.to_owned());
2907 };
2908 if let Some(ref apikey) = configuration.api_key {
2909 let key = apikey.key.clone();
2910 let value = match apikey.prefix {
2911 Some(ref prefix) => format!("{} {}", prefix, key),
2912 None => key,
2913 };
2914 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2915 };
2916 req_builder = req_builder.json(&p_get_transaction_by_id_request);
2917
2918 let req = req_builder.build()?;
2919 let resp = configuration.client.execute(req).await?;
2920
2921 let status = resp.status();
2922 let content_type = resp
2923 .headers()
2924 .get("content-type")
2925 .and_then(|v| v.to_str().ok())
2926 .unwrap_or("application/octet-stream");
2927 let content_type = super::ContentType::from(content_type);
2928
2929 if !status.is_client_error() && !status.is_server_error() {
2930 let content = resp.text().await?;
2931 match content_type {
2932 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2933 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsGetTransactionResponse`"))),
2934 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::JsGetTransactionResponse`")))),
2935 }
2936 } else {
2937 let content = resp.text().await?;
2938 let entity: Option<PostV2UpdatesTransactionByIdError> = serde_json::from_str(&content).ok();
2939 Err(Error::ResponseError(ResponseContent {
2940 status,
2941 content,
2942 entity,
2943 }))
2944 }
2945}
2946
2947pub async fn post_v2_updates_transaction_by_offset(
2949 configuration: &configuration::Configuration,
2950 get_transaction_by_offset_request: models::GetTransactionByOffsetRequest,
2951) -> Result<models::JsGetTransactionResponse, Error<PostV2UpdatesTransactionByOffsetError>> {
2952 let p_get_transaction_by_offset_request = get_transaction_by_offset_request;
2954
2955 let uri_str = format!(
2956 "{}/v2/updates/transaction-by-offset",
2957 configuration.base_path
2958 );
2959 let mut req_builder = configuration
2960 .client
2961 .request(reqwest::Method::POST, &uri_str);
2962
2963 if let Some(ref user_agent) = configuration.user_agent {
2964 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2965 }
2966 if let Some(ref token) = configuration.bearer_access_token {
2967 req_builder = req_builder.bearer_auth(token.to_owned());
2968 };
2969 if let Some(ref apikey) = configuration.api_key {
2970 let key = apikey.key.clone();
2971 let value = match apikey.prefix {
2972 Some(ref prefix) => format!("{} {}", prefix, key),
2973 None => key,
2974 };
2975 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
2976 };
2977 req_builder = req_builder.json(&p_get_transaction_by_offset_request);
2978
2979 let req = req_builder.build()?;
2980 let resp = configuration.client.execute(req).await?;
2981
2982 let status = resp.status();
2983 let content_type = resp
2984 .headers()
2985 .get("content-type")
2986 .and_then(|v| v.to_str().ok())
2987 .unwrap_or("application/octet-stream");
2988 let content_type = super::ContentType::from(content_type);
2989
2990 if !status.is_client_error() && !status.is_server_error() {
2991 let content = resp.text().await?;
2992 match content_type {
2993 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2994 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsGetTransactionResponse`"))),
2995 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::JsGetTransactionResponse`")))),
2996 }
2997 } else {
2998 let content = resp.text().await?;
2999 let entity: Option<PostV2UpdatesTransactionByOffsetError> =
3000 serde_json::from_str(&content).ok();
3001 Err(Error::ResponseError(ResponseContent {
3002 status,
3003 content,
3004 entity,
3005 }))
3006 }
3007}
3008
3009pub async fn post_v2_updates_trees(
3011 configuration: &configuration::Configuration,
3012 get_updates_request: models::GetUpdatesRequest,
3013 limit: Option<i64>,
3014 stream_idle_timeout_ms: Option<i64>,
3015) -> Result<Vec<models::JsGetUpdateTreesResponse>, Error<PostV2UpdatesTreesError>> {
3016 let p_get_updates_request = get_updates_request;
3018 let p_limit = limit;
3019 let p_stream_idle_timeout_ms = stream_idle_timeout_ms;
3020
3021 let uri_str = format!("{}/v2/updates/trees", configuration.base_path);
3022 let mut req_builder = configuration
3023 .client
3024 .request(reqwest::Method::POST, &uri_str);
3025
3026 if let Some(ref param_value) = p_limit {
3027 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
3028 }
3029 if let Some(ref param_value) = p_stream_idle_timeout_ms {
3030 req_builder = req_builder.query(&[("stream_idle_timeout_ms", ¶m_value.to_string())]);
3031 }
3032 if let Some(ref user_agent) = configuration.user_agent {
3033 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3034 }
3035 if let Some(ref token) = configuration.bearer_access_token {
3036 req_builder = req_builder.bearer_auth(token.to_owned());
3037 };
3038 if let Some(ref apikey) = configuration.api_key {
3039 let key = apikey.key.clone();
3040 let value = match apikey.prefix {
3041 Some(ref prefix) => format!("{} {}", prefix, key),
3042 None => key,
3043 };
3044 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
3045 };
3046 req_builder = req_builder.json(&p_get_updates_request);
3047
3048 let req = req_builder.build()?;
3049 let resp = configuration.client.execute(req).await?;
3050
3051 let status = resp.status();
3052 let content_type = resp
3053 .headers()
3054 .get("content-type")
3055 .and_then(|v| v.to_str().ok())
3056 .unwrap_or("application/octet-stream");
3057 let content_type = super::ContentType::from(content_type);
3058
3059 if !status.is_client_error() && !status.is_server_error() {
3060 let content = resp.text().await?;
3061 match content_type {
3062 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3063 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::JsGetUpdateTreesResponse>`"))),
3064 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::JsGetUpdateTreesResponse>`")))),
3065 }
3066 } else {
3067 let content = resp.text().await?;
3068 let entity: Option<PostV2UpdatesTreesError> = serde_json::from_str(&content).ok();
3069 Err(Error::ResponseError(ResponseContent {
3070 status,
3071 content,
3072 entity,
3073 }))
3074 }
3075}
3076
3077pub async fn post_v2_updates_update_by_id(
3079 configuration: &configuration::Configuration,
3080 get_update_by_id_request: models::GetUpdateByIdRequest,
3081) -> Result<models::JsGetUpdateResponse, Error<PostV2UpdatesUpdateByIdError>> {
3082 let p_get_update_by_id_request = get_update_by_id_request;
3084
3085 let uri_str = format!("{}/v2/updates/update-by-id", configuration.base_path);
3086 let mut req_builder = configuration
3087 .client
3088 .request(reqwest::Method::POST, &uri_str);
3089
3090 if let Some(ref user_agent) = configuration.user_agent {
3091 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3092 }
3093 if let Some(ref token) = configuration.bearer_access_token {
3094 req_builder = req_builder.bearer_auth(token.to_owned());
3095 };
3096 if let Some(ref apikey) = configuration.api_key {
3097 let key = apikey.key.clone();
3098 let value = match apikey.prefix {
3099 Some(ref prefix) => format!("{} {}", prefix, key),
3100 None => key,
3101 };
3102 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
3103 };
3104 req_builder = req_builder.json(&p_get_update_by_id_request);
3105
3106 let req = req_builder.build()?;
3107 let resp = configuration.client.execute(req).await?;
3108
3109 let status = resp.status();
3110 let content_type = resp
3111 .headers()
3112 .get("content-type")
3113 .and_then(|v| v.to_str().ok())
3114 .unwrap_or("application/octet-stream");
3115 let content_type = super::ContentType::from(content_type);
3116
3117 if !status.is_client_error() && !status.is_server_error() {
3118 let content = resp.text().await?;
3119 match content_type {
3120 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3121 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsGetUpdateResponse`"))),
3122 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::JsGetUpdateResponse`")))),
3123 }
3124 } else {
3125 let content = resp.text().await?;
3126 let entity: Option<PostV2UpdatesUpdateByIdError> = serde_json::from_str(&content).ok();
3127 Err(Error::ResponseError(ResponseContent {
3128 status,
3129 content,
3130 entity,
3131 }))
3132 }
3133}
3134
3135pub async fn post_v2_updates_update_by_offset(
3137 configuration: &configuration::Configuration,
3138 get_update_by_offset_request: models::GetUpdateByOffsetRequest,
3139) -> Result<models::JsGetUpdateResponse, Error<PostV2UpdatesUpdateByOffsetError>> {
3140 let p_get_update_by_offset_request = get_update_by_offset_request;
3142
3143 let uri_str = format!("{}/v2/updates/update-by-offset", configuration.base_path);
3144 let mut req_builder = configuration
3145 .client
3146 .request(reqwest::Method::POST, &uri_str);
3147
3148 if let Some(ref user_agent) = configuration.user_agent {
3149 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3150 }
3151 if let Some(ref token) = configuration.bearer_access_token {
3152 req_builder = req_builder.bearer_auth(token.to_owned());
3153 };
3154 if let Some(ref apikey) = configuration.api_key {
3155 let key = apikey.key.clone();
3156 let value = match apikey.prefix {
3157 Some(ref prefix) => format!("{} {}", prefix, key),
3158 None => key,
3159 };
3160 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
3161 };
3162 req_builder = req_builder.json(&p_get_update_by_offset_request);
3163
3164 let req = req_builder.build()?;
3165 let resp = configuration.client.execute(req).await?;
3166
3167 let status = resp.status();
3168 let content_type = resp
3169 .headers()
3170 .get("content-type")
3171 .and_then(|v| v.to_str().ok())
3172 .unwrap_or("application/octet-stream");
3173 let content_type = super::ContentType::from(content_type);
3174
3175 if !status.is_client_error() && !status.is_server_error() {
3176 let content = resp.text().await?;
3177 match content_type {
3178 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3179 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsGetUpdateResponse`"))),
3180 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::JsGetUpdateResponse`")))),
3181 }
3182 } else {
3183 let content = resp.text().await?;
3184 let entity: Option<PostV2UpdatesUpdateByOffsetError> = serde_json::from_str(&content).ok();
3185 Err(Error::ResponseError(ResponseContent {
3186 status,
3187 content,
3188 entity,
3189 }))
3190 }
3191}
3192
3193pub async fn post_v2_users(
3195 configuration: &configuration::Configuration,
3196 create_user_request: models::CreateUserRequest,
3197) -> Result<models::CreateUserResponse, Error<PostV2UsersError>> {
3198 let p_create_user_request = create_user_request;
3200
3201 let uri_str = format!("{}/v2/users", configuration.base_path);
3202 let mut req_builder = configuration
3203 .client
3204 .request(reqwest::Method::POST, &uri_str);
3205
3206 if let Some(ref user_agent) = configuration.user_agent {
3207 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3208 }
3209 if let Some(ref token) = configuration.bearer_access_token {
3210 req_builder = req_builder.bearer_auth(token.to_owned());
3211 };
3212 if let Some(ref apikey) = configuration.api_key {
3213 let key = apikey.key.clone();
3214 let value = match apikey.prefix {
3215 Some(ref prefix) => format!("{} {}", prefix, key),
3216 None => key,
3217 };
3218 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
3219 };
3220 req_builder = req_builder.json(&p_create_user_request);
3221
3222 let req = req_builder.build()?;
3223 let resp = configuration.client.execute(req).await?;
3224
3225 let status = resp.status();
3226 let content_type = resp
3227 .headers()
3228 .get("content-type")
3229 .and_then(|v| v.to_str().ok())
3230 .unwrap_or("application/octet-stream");
3231 let content_type = super::ContentType::from(content_type);
3232
3233 if !status.is_client_error() && !status.is_server_error() {
3234 let content = resp.text().await?;
3235 match content_type {
3236 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3237 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateUserResponse`"))),
3238 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::CreateUserResponse`")))),
3239 }
3240 } else {
3241 let content = resp.text().await?;
3242 let entity: Option<PostV2UsersError> = serde_json::from_str(&content).ok();
3243 Err(Error::ResponseError(ResponseContent {
3244 status,
3245 content,
3246 entity,
3247 }))
3248 }
3249}
3250
3251pub async fn post_v2_users_user_id_rights(
3253 configuration: &configuration::Configuration,
3254 user_id: &str,
3255 grant_user_rights_request: models::GrantUserRightsRequest,
3256) -> Result<models::GrantUserRightsResponse, Error<PostV2UsersUserIdRightsError>> {
3257 let p_user_id = user_id;
3259 let p_grant_user_rights_request = grant_user_rights_request;
3260
3261 let uri_str = format!(
3262 "{}/v2/users/{user_id}/rights",
3263 configuration.base_path,
3264 user_id = crate::apis::urlencode(p_user_id)
3265 );
3266 let mut req_builder = configuration
3267 .client
3268 .request(reqwest::Method::POST, &uri_str);
3269
3270 if let Some(ref user_agent) = configuration.user_agent {
3271 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3272 }
3273 if let Some(ref token) = configuration.bearer_access_token {
3274 req_builder = req_builder.bearer_auth(token.to_owned());
3275 };
3276 if let Some(ref apikey) = configuration.api_key {
3277 let key = apikey.key.clone();
3278 let value = match apikey.prefix {
3279 Some(ref prefix) => format!("{} {}", prefix, key),
3280 None => key,
3281 };
3282 req_builder = req_builder.header("Sec-WebSocket-Protocol", value);
3283 };
3284 req_builder = req_builder.json(&p_grant_user_rights_request);
3285
3286 let req = req_builder.build()?;
3287 let resp = configuration.client.execute(req).await?;
3288
3289 let status = resp.status();
3290 let content_type = resp
3291 .headers()
3292 .get("content-type")
3293 .and_then(|v| v.to_str().ok())
3294 .unwrap_or("application/octet-stream");
3295 let content_type = super::ContentType::from(content_type);
3296
3297 if !status.is_client_error() && !status.is_server_error() {
3298 let content = resp.text().await?;
3299 match content_type {
3300 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3301 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GrantUserRightsResponse`"))),
3302 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::GrantUserRightsResponse`")))),
3303 }
3304 } else {
3305 let content = resp.text().await?;
3306 let entity: Option<PostV2UsersUserIdRightsError> = serde_json::from_str(&content).ok();
3307 Err(Error::ResponseError(ResponseContent {
3308 status,
3309 content,
3310 entity,
3311 }))
3312 }
3313}