Skip to main content

canton_api_client/apis/
default_api.rs

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