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