fireblocks_sdk/apis/
smart_transfers_api.rs

1// Fireblocks API
2//
3// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain.  - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
4//
5// The version of the OpenAPI document: 1.8.0
6// Contact: developers@fireblocks.com
7// Generated by: https://openapi-generator.tech
8
9use {
10    super::{Error, configuration},
11    crate::{
12        apis::{ContentType, ResponseContent},
13        models,
14    },
15    async_trait::async_trait,
16    reqwest,
17    serde::{Deserialize, Serialize, de::Error as _},
18    std::sync::Arc,
19};
20
21#[async_trait]
22pub trait SmartTransfersApi: Send + Sync {
23    /// PUT /smart_transfers/{ticketId}/terms/{termId}/dvp/approve
24    ///
25    /// Set funding source for ticket term and creating approving transaction
26    /// for contract to transfer asset
27    async fn approve_dv_p_ticket_term(
28        &self,
29        params: ApproveDvPTicketTermParams,
30    ) -> Result<models::SmartTransferTicketTermResponse, Error<ApproveDvPTicketTermError>>;
31
32    /// PUT /smart-transfers/{ticketId}/cancel
33    ///
34    /// Cancel Smart Transfer ticket. </br>Endpoint Permission: Admin,
35    /// Non-Signing Admin, Signer, Approver, Editor.
36    async fn cancel_ticket(
37        &self,
38        params: CancelTicketParams,
39    ) -> Result<models::SmartTransferTicketResponse, Error<CancelTicketError>>;
40
41    /// POST /smart-transfers
42    ///
43    /// Creates new Smart Transfer ticket. Learn more about Fireblocks Smart Transfers in the following [guide](https://developers.fireblocks.com/docs/execute-smart-transfers). </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
44    async fn create_ticket(
45        &self,
46        params: CreateTicketParams,
47    ) -> Result<models::SmartTransferTicketResponse, Error<CreateTicketError>>;
48
49    /// POST /smart-transfers/{ticketId}/terms
50    ///
51    /// Creates new smart transfer ticket term (when the ticket status is DRAFT). Learn more about Fireblocks Smart Transfers in the following [guide](https://developers.fireblocks.com/docs/execute-smart-transfers). </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
52    async fn create_ticket_term(
53        &self,
54        params: CreateTicketTermParams,
55    ) -> Result<models::SmartTransferTicketTermResponse, Error<CreateTicketTermError>>;
56
57    /// GET /smart-transfers/{ticketId}
58    ///
59    /// Find Smart Transfer ticket by id. </br>Endpoint Permission: Admin,
60    /// Non-Signing Admin, Signer, Approver, Editor, Viewer.
61    async fn find_ticket_by_id(
62        &self,
63        params: FindTicketByIdParams,
64    ) -> Result<models::SmartTransferTicketResponse, Error<FindTicketByIdError>>;
65
66    /// GET /smart-transfers/{ticketId}/terms/{termId}
67    ///
68    /// Find a specific term of a specific Smart Transfer ticket. </br>Endpoint
69    /// Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer.
70    async fn find_ticket_term_by_id(
71        &self,
72        params: FindTicketTermByIdParams,
73    ) -> Result<models::SmartTransferTicketTermResponse, Error<FindTicketTermByIdError>>;
74
75    /// PUT /smart-transfers/{ticketId}/fulfill
76    ///
77    /// Manually fulfill ticket, in case when all terms (legs) are funded
78    /// manually. </br>Endpoint Permission: Admin, Non-Signing Admin, Signer,
79    /// Approver, Editor.
80    async fn fulfill_ticket(
81        &self,
82        params: FulfillTicketParams,
83    ) -> Result<models::SmartTransferTicketResponse, Error<FulfillTicketError>>;
84
85    /// PUT /smart_transfers/{ticketId}/dvp/fund
86    ///
87    /// Create or fulfill dvp ticket order
88    async fn fund_dvp_ticket(
89        &self,
90        params: FundDvpTicketParams,
91    ) -> Result<models::SmartTransferTicketResponse, Error<FundDvpTicketError>>;
92
93    /// PUT /smart-transfers/{ticketId}/terms/{termId}/fund
94    ///
95    /// Set funding source for ticket term (in case of ASYNC tickets, this will
96    /// execute transfer immediately). </br>Endpoint Permission: Admin,
97    /// Non-Signing Admin, Signer, Approver, Editor.
98    async fn fund_ticket_term(
99        &self,
100        params: FundTicketTermParams,
101    ) -> Result<models::SmartTransferTicketTermResponse, Error<FundTicketTermError>>;
102
103    /// GET /smart_transfers/statistic
104    ///
105    /// Get smart transfer statistic
106    async fn get_smart_transfer_statistic(
107        &self,
108    ) -> Result<models::SmartTransferStatistic, Error<GetSmartTransferStatisticError>>;
109
110    /// GET /smart-transfers/settings/user-groups
111    ///
112    /// Get Smart Transfer user groups. </br>Endpoint Permission: Admin,
113    /// Non-Signing Admin, Signer, Approver, Editor, Viewer.
114    async fn get_smart_transfer_user_groups(
115        &self,
116    ) -> Result<models::SmartTransferUserGroupsResponse, Error<GetSmartTransferUserGroupsError>>;
117
118    /// PUT /smart-transfers/{ticketId}/terms/{termId}/manually-fund
119    ///
120    /// Manually set ticket term transaction. </br>Endpoint Permission: Admin,
121    /// Non-Signing Admin, Signer, Approver, Editor.
122    async fn manually_fund_ticket_term(
123        &self,
124        params: ManuallyFundTicketTermParams,
125    ) -> Result<models::SmartTransferTicketTermResponse, Error<ManuallyFundTicketTermError>>;
126
127    /// DELETE /smart-transfers/{ticketId}/terms/{termId}
128    ///
129    /// Delete ticket term when ticket is in DRAFT status. </br>Endpoint
130    /// Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
131    async fn remove_ticket_term(
132        &self,
133        params: RemoveTicketTermParams,
134    ) -> Result<(), Error<RemoveTicketTermError>>;
135
136    /// GET /smart-transfers
137    ///
138    /// Finds Smart Transfer tickets that match the submitted criteria.
139    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
140    /// Editor,   Viewer.
141    async fn search_tickets(
142        &self,
143        params: SearchTicketsParams,
144    ) -> Result<models::SmartTransferTicketFilteredResponse, Error<SearchTicketsError>>;
145
146    /// PUT /smart-transfers/{ticketId}/external-id
147    ///
148    /// Set external id Smart Transfer ticket. </br>Endpoint Permission: Admin,
149    /// Non-Signing Admin, Signer, Approver, Editor.
150    async fn set_external_ref_id(
151        &self,
152        params: SetExternalRefIdParams,
153    ) -> Result<models::SmartTransferTicketResponse, Error<SetExternalRefIdError>>;
154
155    /// PUT /smart-transfers/{ticketId}/expires-in
156    ///
157    /// Set expiration date on Smart Transfer ticket. </br>Endpoint Permission:
158    /// Admin, Non-Signing Admin, Signer, Approver, Editor.
159    async fn set_ticket_expiration(
160        &self,
161        params: SetTicketExpirationParams,
162    ) -> Result<models::SmartTransferTicketResponse, Error<SetTicketExpirationError>>;
163
164    /// POST /smart-transfers/settings/user-groups
165    ///
166    /// Set Smart Transfers user group to receive email notifications for Smart
167    /// Transfers. </br>Endpoint Permission: Admin, Non-Signing Admin, Signer,
168    /// Approver, Editor.
169    async fn set_user_groups(
170        &self,
171        params: SetUserGroupsParams,
172    ) -> Result<models::SmartTransferUserGroupsResponse, Error<SetUserGroupsError>>;
173
174    /// PUT /smart-transfers/{ticketId}/submit
175    ///
176    /// Submit Smart Transfer ticket - change status into ready for approval if
177    /// auto approval is not turned on, or OPEN if auto approval is on.
178    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
179    /// Editor.
180    async fn submit_ticket(
181        &self,
182        params: SubmitTicketParams,
183    ) -> Result<models::SmartTransferTicketResponse, Error<SubmitTicketError>>;
184
185    /// PUT /smart-transfers/{ticketId}/terms/{termId}
186    ///
187    /// Update ticket term (when ticket status is DRAFT). </br>Endpoint
188    /// Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
189    async fn update_ticket_term(
190        &self,
191        params: UpdateTicketTermParams,
192    ) -> Result<models::SmartTransferTicketTermResponse, Error<UpdateTicketTermError>>;
193}
194
195pub struct SmartTransfersApiClient {
196    configuration: Arc<configuration::Configuration>,
197}
198
199impl SmartTransfersApiClient {
200    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
201        Self { configuration }
202    }
203}
204
205/// struct for passing parameters to the method [`approve_dv_p_ticket_term`]
206#[derive(Clone, Debug)]
207#[cfg_attr(feature = "bon", derive(::bon::Builder))]
208pub struct ApproveDvPTicketTermParams {
209    pub ticket_id: String,
210    pub term_id: String,
211    pub smart_transfer_approve_term: models::SmartTransferApproveTerm,
212    /// A unique identifier for the request. If the request is sent multiple
213    /// times with the same idempotency key, the server will return the same
214    /// response as the first request. The idempotency key is valid for 24
215    /// hours.
216    pub idempotency_key: Option<String>,
217}
218
219/// struct for passing parameters to the method [`cancel_ticket`]
220#[derive(Clone, Debug)]
221#[cfg_attr(feature = "bon", derive(::bon::Builder))]
222pub struct CancelTicketParams {
223    pub ticket_id: String,
224    /// A unique identifier for the request. If the request is sent multiple
225    /// times with the same idempotency key, the server will return the same
226    /// response as the first request. The idempotency key is valid for 24
227    /// hours.
228    pub idempotency_key: Option<String>,
229}
230
231/// struct for passing parameters to the method [`create_ticket`]
232#[derive(Clone, Debug)]
233#[cfg_attr(feature = "bon", derive(::bon::Builder))]
234pub struct CreateTicketParams {
235    pub smart_transfer_create_ticket: models::SmartTransferCreateTicket,
236    /// A unique identifier for the request. If the request is sent multiple
237    /// times with the same idempotency key, the server will return the same
238    /// response as the first request. The idempotency key is valid for 24
239    /// hours.
240    pub idempotency_key: Option<String>,
241}
242
243/// struct for passing parameters to the method [`create_ticket_term`]
244#[derive(Clone, Debug)]
245#[cfg_attr(feature = "bon", derive(::bon::Builder))]
246pub struct CreateTicketTermParams {
247    pub ticket_id: String,
248    pub smart_transfer_create_ticket_term: models::SmartTransferCreateTicketTerm,
249    /// A unique identifier for the request. If the request is sent multiple
250    /// times with the same idempotency key, the server will return the same
251    /// response as the first request. The idempotency key is valid for 24
252    /// hours.
253    pub idempotency_key: Option<String>,
254}
255
256/// struct for passing parameters to the method [`find_ticket_by_id`]
257#[derive(Clone, Debug)]
258#[cfg_attr(feature = "bon", derive(::bon::Builder))]
259pub struct FindTicketByIdParams {
260    pub ticket_id: String,
261}
262
263/// struct for passing parameters to the method [`find_ticket_term_by_id`]
264#[derive(Clone, Debug)]
265#[cfg_attr(feature = "bon", derive(::bon::Builder))]
266pub struct FindTicketTermByIdParams {
267    pub ticket_id: String,
268    pub term_id: String,
269}
270
271/// struct for passing parameters to the method [`fulfill_ticket`]
272#[derive(Clone, Debug)]
273#[cfg_attr(feature = "bon", derive(::bon::Builder))]
274pub struct FulfillTicketParams {
275    pub ticket_id: String,
276    /// A unique identifier for the request. If the request is sent multiple
277    /// times with the same idempotency key, the server will return the same
278    /// response as the first request. The idempotency key is valid for 24
279    /// hours.
280    pub idempotency_key: Option<String>,
281}
282
283/// struct for passing parameters to the method [`fund_dvp_ticket`]
284#[derive(Clone, Debug)]
285#[cfg_attr(feature = "bon", derive(::bon::Builder))]
286pub struct FundDvpTicketParams {
287    pub ticket_id: String,
288    pub smart_transfer_fund_dvp_ticket: models::SmartTransferFundDvpTicket,
289    /// A unique identifier for the request. If the request is sent multiple
290    /// times with the same idempotency key, the server will return the same
291    /// response as the first request. The idempotency key is valid for 24
292    /// hours.
293    pub idempotency_key: Option<String>,
294}
295
296/// struct for passing parameters to the method [`fund_ticket_term`]
297#[derive(Clone, Debug)]
298#[cfg_attr(feature = "bon", derive(::bon::Builder))]
299pub struct FundTicketTermParams {
300    pub ticket_id: String,
301    pub term_id: String,
302    pub smart_transfer_fund_term: models::SmartTransferFundTerm,
303    /// A unique identifier for the request. If the request is sent multiple
304    /// times with the same idempotency key, the server will return the same
305    /// response as the first request. The idempotency key is valid for 24
306    /// hours.
307    pub idempotency_key: Option<String>,
308}
309
310/// struct for passing parameters to the method [`manually_fund_ticket_term`]
311#[derive(Clone, Debug)]
312#[cfg_attr(feature = "bon", derive(::bon::Builder))]
313pub struct ManuallyFundTicketTermParams {
314    pub ticket_id: String,
315    pub term_id: String,
316    pub smart_transfer_manually_fund_term: models::SmartTransferManuallyFundTerm,
317    /// A unique identifier for the request. If the request is sent multiple
318    /// times with the same idempotency key, the server will return the same
319    /// response as the first request. The idempotency key is valid for 24
320    /// hours.
321    pub idempotency_key: Option<String>,
322}
323
324/// struct for passing parameters to the method [`remove_ticket_term`]
325#[derive(Clone, Debug)]
326#[cfg_attr(feature = "bon", derive(::bon::Builder))]
327pub struct RemoveTicketTermParams {
328    pub ticket_id: String,
329    pub term_id: String,
330}
331
332/// struct for passing parameters to the method [`search_tickets`]
333#[derive(Clone, Debug)]
334#[cfg_attr(feature = "bon", derive(::bon::Builder))]
335pub struct SearchTicketsParams {
336    /// Search string - counterparty name or asset or ticketId. Optional
337    pub q: Option<String>,
338    /// Ticket statuses for Smart Transfer tickets. Optional
339    pub statuses: Option<Vec<String>>,
340    /// NetworkId that is used in the ticket . Optional
341    pub network_id: Option<String>,
342    /// Filter created tickets by created by self or by others. Optional
343    pub created_by_me: Option<bool>,
344    /// Lower bound of search range. Optional
345    pub expires_after: Option<String>,
346    /// Upper bound of search range. Optional
347    pub expires_before: Option<String>,
348    /// Type of transfer. ASYNC executes transfers as they are funded, ATOMIC
349    /// executes all terms (legs) as one atomic transfer
350    pub r#type: Option<String>,
351    /// External ref. ID that workspace can use to identify ticket outside of
352    /// Fireblocks system.
353    pub external_ref_id: Option<String>,
354    /// ID of the record after which to fetch $limit records
355    pub after: Option<String>,
356    /// Number of records to fetch. By default, it is 100
357    pub limit: Option<f64>,
358}
359
360/// struct for passing parameters to the method [`set_external_ref_id`]
361#[derive(Clone, Debug)]
362#[cfg_attr(feature = "bon", derive(::bon::Builder))]
363pub struct SetExternalRefIdParams {
364    pub ticket_id: String,
365    pub smart_transfer_set_ticket_external_id: models::SmartTransferSetTicketExternalId,
366    /// A unique identifier for the request. If the request is sent multiple
367    /// times with the same idempotency key, the server will return the same
368    /// response as the first request. The idempotency key is valid for 24
369    /// hours.
370    pub idempotency_key: Option<String>,
371}
372
373/// struct for passing parameters to the method [`set_ticket_expiration`]
374#[derive(Clone, Debug)]
375#[cfg_attr(feature = "bon", derive(::bon::Builder))]
376pub struct SetTicketExpirationParams {
377    pub ticket_id: String,
378    pub smart_transfer_set_ticket_expiration: models::SmartTransferSetTicketExpiration,
379    /// A unique identifier for the request. If the request is sent multiple
380    /// times with the same idempotency key, the server will return the same
381    /// response as the first request. The idempotency key is valid for 24
382    /// hours.
383    pub idempotency_key: Option<String>,
384}
385
386/// struct for passing parameters to the method [`set_user_groups`]
387#[derive(Clone, Debug)]
388#[cfg_attr(feature = "bon", derive(::bon::Builder))]
389pub struct SetUserGroupsParams {
390    pub smart_transfer_set_user_groups: models::SmartTransferSetUserGroups,
391    /// A unique identifier for the request. If the request is sent multiple
392    /// times with the same idempotency key, the server will return the same
393    /// response as the first request. The idempotency key is valid for 24
394    /// hours.
395    pub idempotency_key: Option<String>,
396}
397
398/// struct for passing parameters to the method [`submit_ticket`]
399#[derive(Clone, Debug)]
400#[cfg_attr(feature = "bon", derive(::bon::Builder))]
401pub struct SubmitTicketParams {
402    pub ticket_id: String,
403    pub smart_transfer_submit_ticket: models::SmartTransferSubmitTicket,
404    /// A unique identifier for the request. If the request is sent multiple
405    /// times with the same idempotency key, the server will return the same
406    /// response as the first request. The idempotency key is valid for 24
407    /// hours.
408    pub idempotency_key: Option<String>,
409}
410
411/// struct for passing parameters to the method [`update_ticket_term`]
412#[derive(Clone, Debug)]
413#[cfg_attr(feature = "bon", derive(::bon::Builder))]
414pub struct UpdateTicketTermParams {
415    pub ticket_id: String,
416    pub term_id: String,
417    pub smart_transfer_update_ticket_term: models::SmartTransferUpdateTicketTerm,
418    /// A unique identifier for the request. If the request is sent multiple
419    /// times with the same idempotency key, the server will return the same
420    /// response as the first request. The idempotency key is valid for 24
421    /// hours.
422    pub idempotency_key: Option<String>,
423}
424
425#[async_trait]
426impl SmartTransfersApi for SmartTransfersApiClient {
427    /// Set funding source for ticket term and creating approving transaction
428    /// for contract to transfer asset
429    async fn approve_dv_p_ticket_term(
430        &self,
431        params: ApproveDvPTicketTermParams,
432    ) -> Result<models::SmartTransferTicketTermResponse, Error<ApproveDvPTicketTermError>> {
433        let ApproveDvPTicketTermParams {
434            ticket_id,
435            term_id,
436            smart_transfer_approve_term,
437            idempotency_key,
438        } = params;
439
440        let local_var_configuration = &self.configuration;
441
442        let local_var_client = &local_var_configuration.client;
443
444        let local_var_uri_str = format!(
445            "{}/smart_transfers/{ticketId}/terms/{termId}/dvp/approve",
446            local_var_configuration.base_path,
447            ticketId = crate::apis::urlencode(ticket_id),
448            termId = crate::apis::urlencode(term_id)
449        );
450        let mut local_var_req_builder =
451            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
452
453        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
454            local_var_req_builder = local_var_req_builder
455                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
456        }
457        if let Some(local_var_param_value) = idempotency_key {
458            local_var_req_builder =
459                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
460        }
461        local_var_req_builder = local_var_req_builder.json(&smart_transfer_approve_term);
462
463        let local_var_req = local_var_req_builder.build()?;
464        let local_var_resp = local_var_client.execute(local_var_req).await?;
465
466        let local_var_status = local_var_resp.status();
467        let local_var_content_type = local_var_resp
468            .headers()
469            .get("content-type")
470            .and_then(|v| v.to_str().ok())
471            .unwrap_or("application/octet-stream");
472        let local_var_content_type = super::ContentType::from(local_var_content_type);
473        let local_var_content = local_var_resp.text().await?;
474
475        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
476            match local_var_content_type {
477                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
478                ContentType::Text => {
479                    return Err(Error::from(serde_json::Error::custom(
480                        "Received `text/plain` content type response that cannot be converted to \
481                         `models::SmartTransferTicketTermResponse`",
482                    )));
483                }
484                ContentType::Unsupported(local_var_unknown_type) => {
485                    return Err(Error::from(serde_json::Error::custom(format!(
486                        "Received `{local_var_unknown_type}` content type response that cannot be \
487                         converted to `models::SmartTransferTicketTermResponse`"
488                    ))));
489                }
490            }
491        } else {
492            let local_var_entity: Option<ApproveDvPTicketTermError> =
493                serde_json::from_str(&local_var_content).ok();
494            let local_var_error = ResponseContent {
495                status: local_var_status,
496                content: local_var_content,
497                entity: local_var_entity,
498            };
499            Err(Error::ResponseError(local_var_error))
500        }
501    }
502
503    /// Cancel Smart Transfer ticket. </br>Endpoint Permission: Admin,
504    /// Non-Signing Admin, Signer, Approver, Editor.
505    async fn cancel_ticket(
506        &self,
507        params: CancelTicketParams,
508    ) -> Result<models::SmartTransferTicketResponse, Error<CancelTicketError>> {
509        let CancelTicketParams {
510            ticket_id,
511            idempotency_key,
512        } = params;
513
514        let local_var_configuration = &self.configuration;
515
516        let local_var_client = &local_var_configuration.client;
517
518        let local_var_uri_str = format!(
519            "{}/smart-transfers/{ticketId}/cancel",
520            local_var_configuration.base_path,
521            ticketId = crate::apis::urlencode(ticket_id)
522        );
523        let mut local_var_req_builder =
524            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
525
526        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
527            local_var_req_builder = local_var_req_builder
528                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
529        }
530        if let Some(local_var_param_value) = idempotency_key {
531            local_var_req_builder =
532                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
533        }
534
535        let local_var_req = local_var_req_builder.build()?;
536        let local_var_resp = local_var_client.execute(local_var_req).await?;
537
538        let local_var_status = local_var_resp.status();
539        let local_var_content_type = local_var_resp
540            .headers()
541            .get("content-type")
542            .and_then(|v| v.to_str().ok())
543            .unwrap_or("application/octet-stream");
544        let local_var_content_type = super::ContentType::from(local_var_content_type);
545        let local_var_content = local_var_resp.text().await?;
546
547        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
548            match local_var_content_type {
549                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
550                ContentType::Text => {
551                    return Err(Error::from(serde_json::Error::custom(
552                        "Received `text/plain` content type response that cannot be converted to \
553                         `models::SmartTransferTicketResponse`",
554                    )));
555                }
556                ContentType::Unsupported(local_var_unknown_type) => {
557                    return Err(Error::from(serde_json::Error::custom(format!(
558                        "Received `{local_var_unknown_type}` content type response that cannot be \
559                         converted to `models::SmartTransferTicketResponse`"
560                    ))));
561                }
562            }
563        } else {
564            let local_var_entity: Option<CancelTicketError> =
565                serde_json::from_str(&local_var_content).ok();
566            let local_var_error = ResponseContent {
567                status: local_var_status,
568                content: local_var_content,
569                entity: local_var_entity,
570            };
571            Err(Error::ResponseError(local_var_error))
572        }
573    }
574
575    /// Creates new Smart Transfer ticket. Learn more about Fireblocks Smart Transfers in the following [guide](https://developers.fireblocks.com/docs/execute-smart-transfers). </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
576    async fn create_ticket(
577        &self,
578        params: CreateTicketParams,
579    ) -> Result<models::SmartTransferTicketResponse, Error<CreateTicketError>> {
580        let CreateTicketParams {
581            smart_transfer_create_ticket,
582            idempotency_key,
583        } = params;
584
585        let local_var_configuration = &self.configuration;
586
587        let local_var_client = &local_var_configuration.client;
588
589        let local_var_uri_str = format!("{}/smart-transfers", local_var_configuration.base_path);
590        let mut local_var_req_builder =
591            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
592
593        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
594            local_var_req_builder = local_var_req_builder
595                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
596        }
597        if let Some(local_var_param_value) = idempotency_key {
598            local_var_req_builder =
599                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
600        }
601        local_var_req_builder = local_var_req_builder.json(&smart_transfer_create_ticket);
602
603        let local_var_req = local_var_req_builder.build()?;
604        let local_var_resp = local_var_client.execute(local_var_req).await?;
605
606        let local_var_status = local_var_resp.status();
607        let local_var_content_type = local_var_resp
608            .headers()
609            .get("content-type")
610            .and_then(|v| v.to_str().ok())
611            .unwrap_or("application/octet-stream");
612        let local_var_content_type = super::ContentType::from(local_var_content_type);
613        let local_var_content = local_var_resp.text().await?;
614
615        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
616            match local_var_content_type {
617                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
618                ContentType::Text => {
619                    return Err(Error::from(serde_json::Error::custom(
620                        "Received `text/plain` content type response that cannot be converted to \
621                         `models::SmartTransferTicketResponse`",
622                    )));
623                }
624                ContentType::Unsupported(local_var_unknown_type) => {
625                    return Err(Error::from(serde_json::Error::custom(format!(
626                        "Received `{local_var_unknown_type}` content type response that cannot be \
627                         converted to `models::SmartTransferTicketResponse`"
628                    ))));
629                }
630            }
631        } else {
632            let local_var_entity: Option<CreateTicketError> =
633                serde_json::from_str(&local_var_content).ok();
634            let local_var_error = ResponseContent {
635                status: local_var_status,
636                content: local_var_content,
637                entity: local_var_entity,
638            };
639            Err(Error::ResponseError(local_var_error))
640        }
641    }
642
643    /// Creates new smart transfer ticket term (when the ticket status is DRAFT). Learn more about Fireblocks Smart Transfers in the following [guide](https://developers.fireblocks.com/docs/execute-smart-transfers). </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
644    async fn create_ticket_term(
645        &self,
646        params: CreateTicketTermParams,
647    ) -> Result<models::SmartTransferTicketTermResponse, Error<CreateTicketTermError>> {
648        let CreateTicketTermParams {
649            ticket_id,
650            smart_transfer_create_ticket_term,
651            idempotency_key,
652        } = params;
653
654        let local_var_configuration = &self.configuration;
655
656        let local_var_client = &local_var_configuration.client;
657
658        let local_var_uri_str = format!(
659            "{}/smart-transfers/{ticketId}/terms",
660            local_var_configuration.base_path,
661            ticketId = crate::apis::urlencode(ticket_id)
662        );
663        let mut local_var_req_builder =
664            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
665
666        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
667            local_var_req_builder = local_var_req_builder
668                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
669        }
670        if let Some(local_var_param_value) = idempotency_key {
671            local_var_req_builder =
672                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
673        }
674        local_var_req_builder = local_var_req_builder.json(&smart_transfer_create_ticket_term);
675
676        let local_var_req = local_var_req_builder.build()?;
677        let local_var_resp = local_var_client.execute(local_var_req).await?;
678
679        let local_var_status = local_var_resp.status();
680        let local_var_content_type = local_var_resp
681            .headers()
682            .get("content-type")
683            .and_then(|v| v.to_str().ok())
684            .unwrap_or("application/octet-stream");
685        let local_var_content_type = super::ContentType::from(local_var_content_type);
686        let local_var_content = local_var_resp.text().await?;
687
688        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
689            match local_var_content_type {
690                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
691                ContentType::Text => {
692                    return Err(Error::from(serde_json::Error::custom(
693                        "Received `text/plain` content type response that cannot be converted to \
694                         `models::SmartTransferTicketTermResponse`",
695                    )));
696                }
697                ContentType::Unsupported(local_var_unknown_type) => {
698                    return Err(Error::from(serde_json::Error::custom(format!(
699                        "Received `{local_var_unknown_type}` content type response that cannot be \
700                         converted to `models::SmartTransferTicketTermResponse`"
701                    ))));
702                }
703            }
704        } else {
705            let local_var_entity: Option<CreateTicketTermError> =
706                serde_json::from_str(&local_var_content).ok();
707            let local_var_error = ResponseContent {
708                status: local_var_status,
709                content: local_var_content,
710                entity: local_var_entity,
711            };
712            Err(Error::ResponseError(local_var_error))
713        }
714    }
715
716    /// Find Smart Transfer ticket by id. </br>Endpoint Permission: Admin,
717    /// Non-Signing Admin, Signer, Approver, Editor, Viewer.
718    async fn find_ticket_by_id(
719        &self,
720        params: FindTicketByIdParams,
721    ) -> Result<models::SmartTransferTicketResponse, Error<FindTicketByIdError>> {
722        let FindTicketByIdParams { ticket_id } = params;
723
724        let local_var_configuration = &self.configuration;
725
726        let local_var_client = &local_var_configuration.client;
727
728        let local_var_uri_str = format!(
729            "{}/smart-transfers/{ticketId}",
730            local_var_configuration.base_path,
731            ticketId = crate::apis::urlencode(ticket_id)
732        );
733        let mut local_var_req_builder =
734            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
735
736        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
737            local_var_req_builder = local_var_req_builder
738                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
739        }
740
741        let local_var_req = local_var_req_builder.build()?;
742        let local_var_resp = local_var_client.execute(local_var_req).await?;
743
744        let local_var_status = local_var_resp.status();
745        let local_var_content_type = local_var_resp
746            .headers()
747            .get("content-type")
748            .and_then(|v| v.to_str().ok())
749            .unwrap_or("application/octet-stream");
750        let local_var_content_type = super::ContentType::from(local_var_content_type);
751        let local_var_content = local_var_resp.text().await?;
752
753        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
754            match local_var_content_type {
755                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
756                ContentType::Text => {
757                    return Err(Error::from(serde_json::Error::custom(
758                        "Received `text/plain` content type response that cannot be converted to \
759                         `models::SmartTransferTicketResponse`",
760                    )));
761                }
762                ContentType::Unsupported(local_var_unknown_type) => {
763                    return Err(Error::from(serde_json::Error::custom(format!(
764                        "Received `{local_var_unknown_type}` content type response that cannot be \
765                         converted to `models::SmartTransferTicketResponse`"
766                    ))));
767                }
768            }
769        } else {
770            let local_var_entity: Option<FindTicketByIdError> =
771                serde_json::from_str(&local_var_content).ok();
772            let local_var_error = ResponseContent {
773                status: local_var_status,
774                content: local_var_content,
775                entity: local_var_entity,
776            };
777            Err(Error::ResponseError(local_var_error))
778        }
779    }
780
781    /// Find a specific term of a specific Smart Transfer ticket. </br>Endpoint
782    /// Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer.
783    async fn find_ticket_term_by_id(
784        &self,
785        params: FindTicketTermByIdParams,
786    ) -> Result<models::SmartTransferTicketTermResponse, Error<FindTicketTermByIdError>> {
787        let FindTicketTermByIdParams { ticket_id, term_id } = params;
788
789        let local_var_configuration = &self.configuration;
790
791        let local_var_client = &local_var_configuration.client;
792
793        let local_var_uri_str = format!(
794            "{}/smart-transfers/{ticketId}/terms/{termId}",
795            local_var_configuration.base_path,
796            ticketId = crate::apis::urlencode(ticket_id),
797            termId = crate::apis::urlencode(term_id)
798        );
799        let mut local_var_req_builder =
800            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
801
802        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
803            local_var_req_builder = local_var_req_builder
804                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
805        }
806
807        let local_var_req = local_var_req_builder.build()?;
808        let local_var_resp = local_var_client.execute(local_var_req).await?;
809
810        let local_var_status = local_var_resp.status();
811        let local_var_content_type = local_var_resp
812            .headers()
813            .get("content-type")
814            .and_then(|v| v.to_str().ok())
815            .unwrap_or("application/octet-stream");
816        let local_var_content_type = super::ContentType::from(local_var_content_type);
817        let local_var_content = local_var_resp.text().await?;
818
819        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
820            match local_var_content_type {
821                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
822                ContentType::Text => {
823                    return Err(Error::from(serde_json::Error::custom(
824                        "Received `text/plain` content type response that cannot be converted to \
825                         `models::SmartTransferTicketTermResponse`",
826                    )));
827                }
828                ContentType::Unsupported(local_var_unknown_type) => {
829                    return Err(Error::from(serde_json::Error::custom(format!(
830                        "Received `{local_var_unknown_type}` content type response that cannot be \
831                         converted to `models::SmartTransferTicketTermResponse`"
832                    ))));
833                }
834            }
835        } else {
836            let local_var_entity: Option<FindTicketTermByIdError> =
837                serde_json::from_str(&local_var_content).ok();
838            let local_var_error = ResponseContent {
839                status: local_var_status,
840                content: local_var_content,
841                entity: local_var_entity,
842            };
843            Err(Error::ResponseError(local_var_error))
844        }
845    }
846
847    /// Manually fulfill ticket, in case when all terms (legs) are funded
848    /// manually. </br>Endpoint Permission: Admin, Non-Signing Admin, Signer,
849    /// Approver, Editor.
850    async fn fulfill_ticket(
851        &self,
852        params: FulfillTicketParams,
853    ) -> Result<models::SmartTransferTicketResponse, Error<FulfillTicketError>> {
854        let FulfillTicketParams {
855            ticket_id,
856            idempotency_key,
857        } = params;
858
859        let local_var_configuration = &self.configuration;
860
861        let local_var_client = &local_var_configuration.client;
862
863        let local_var_uri_str = format!(
864            "{}/smart-transfers/{ticketId}/fulfill",
865            local_var_configuration.base_path,
866            ticketId = crate::apis::urlencode(ticket_id)
867        );
868        let mut local_var_req_builder =
869            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
870
871        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
872            local_var_req_builder = local_var_req_builder
873                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
874        }
875        if let Some(local_var_param_value) = idempotency_key {
876            local_var_req_builder =
877                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
878        }
879
880        let local_var_req = local_var_req_builder.build()?;
881        let local_var_resp = local_var_client.execute(local_var_req).await?;
882
883        let local_var_status = local_var_resp.status();
884        let local_var_content_type = local_var_resp
885            .headers()
886            .get("content-type")
887            .and_then(|v| v.to_str().ok())
888            .unwrap_or("application/octet-stream");
889        let local_var_content_type = super::ContentType::from(local_var_content_type);
890        let local_var_content = local_var_resp.text().await?;
891
892        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
893            match local_var_content_type {
894                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
895                ContentType::Text => {
896                    return Err(Error::from(serde_json::Error::custom(
897                        "Received `text/plain` content type response that cannot be converted to \
898                         `models::SmartTransferTicketResponse`",
899                    )));
900                }
901                ContentType::Unsupported(local_var_unknown_type) => {
902                    return Err(Error::from(serde_json::Error::custom(format!(
903                        "Received `{local_var_unknown_type}` content type response that cannot be \
904                         converted to `models::SmartTransferTicketResponse`"
905                    ))));
906                }
907            }
908        } else {
909            let local_var_entity: Option<FulfillTicketError> =
910                serde_json::from_str(&local_var_content).ok();
911            let local_var_error = ResponseContent {
912                status: local_var_status,
913                content: local_var_content,
914                entity: local_var_entity,
915            };
916            Err(Error::ResponseError(local_var_error))
917        }
918    }
919
920    /// Create or fulfill dvp ticket order
921    async fn fund_dvp_ticket(
922        &self,
923        params: FundDvpTicketParams,
924    ) -> Result<models::SmartTransferTicketResponse, Error<FundDvpTicketError>> {
925        let FundDvpTicketParams {
926            ticket_id,
927            smart_transfer_fund_dvp_ticket,
928            idempotency_key,
929        } = params;
930
931        let local_var_configuration = &self.configuration;
932
933        let local_var_client = &local_var_configuration.client;
934
935        let local_var_uri_str = format!(
936            "{}/smart_transfers/{ticketId}/dvp/fund",
937            local_var_configuration.base_path,
938            ticketId = crate::apis::urlencode(ticket_id)
939        );
940        let mut local_var_req_builder =
941            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
942
943        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
944            local_var_req_builder = local_var_req_builder
945                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
946        }
947        if let Some(local_var_param_value) = idempotency_key {
948            local_var_req_builder =
949                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
950        }
951        local_var_req_builder = local_var_req_builder.json(&smart_transfer_fund_dvp_ticket);
952
953        let local_var_req = local_var_req_builder.build()?;
954        let local_var_resp = local_var_client.execute(local_var_req).await?;
955
956        let local_var_status = local_var_resp.status();
957        let local_var_content_type = local_var_resp
958            .headers()
959            .get("content-type")
960            .and_then(|v| v.to_str().ok())
961            .unwrap_or("application/octet-stream");
962        let local_var_content_type = super::ContentType::from(local_var_content_type);
963        let local_var_content = local_var_resp.text().await?;
964
965        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
966            match local_var_content_type {
967                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
968                ContentType::Text => {
969                    return Err(Error::from(serde_json::Error::custom(
970                        "Received `text/plain` content type response that cannot be converted to \
971                         `models::SmartTransferTicketResponse`",
972                    )));
973                }
974                ContentType::Unsupported(local_var_unknown_type) => {
975                    return Err(Error::from(serde_json::Error::custom(format!(
976                        "Received `{local_var_unknown_type}` content type response that cannot be \
977                         converted to `models::SmartTransferTicketResponse`"
978                    ))));
979                }
980            }
981        } else {
982            let local_var_entity: Option<FundDvpTicketError> =
983                serde_json::from_str(&local_var_content).ok();
984            let local_var_error = ResponseContent {
985                status: local_var_status,
986                content: local_var_content,
987                entity: local_var_entity,
988            };
989            Err(Error::ResponseError(local_var_error))
990        }
991    }
992
993    /// Set funding source for ticket term (in case of ASYNC tickets, this will
994    /// execute transfer immediately). </br>Endpoint Permission: Admin,
995    /// Non-Signing Admin, Signer, Approver, Editor.
996    async fn fund_ticket_term(
997        &self,
998        params: FundTicketTermParams,
999    ) -> Result<models::SmartTransferTicketTermResponse, Error<FundTicketTermError>> {
1000        let FundTicketTermParams {
1001            ticket_id,
1002            term_id,
1003            smart_transfer_fund_term,
1004            idempotency_key,
1005        } = params;
1006
1007        let local_var_configuration = &self.configuration;
1008
1009        let local_var_client = &local_var_configuration.client;
1010
1011        let local_var_uri_str = format!(
1012            "{}/smart-transfers/{ticketId}/terms/{termId}/fund",
1013            local_var_configuration.base_path,
1014            ticketId = crate::apis::urlencode(ticket_id),
1015            termId = crate::apis::urlencode(term_id)
1016        );
1017        let mut local_var_req_builder =
1018            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1019
1020        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1021            local_var_req_builder = local_var_req_builder
1022                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1023        }
1024        if let Some(local_var_param_value) = idempotency_key {
1025            local_var_req_builder =
1026                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1027        }
1028        local_var_req_builder = local_var_req_builder.json(&smart_transfer_fund_term);
1029
1030        let local_var_req = local_var_req_builder.build()?;
1031        let local_var_resp = local_var_client.execute(local_var_req).await?;
1032
1033        let local_var_status = local_var_resp.status();
1034        let local_var_content_type = local_var_resp
1035            .headers()
1036            .get("content-type")
1037            .and_then(|v| v.to_str().ok())
1038            .unwrap_or("application/octet-stream");
1039        let local_var_content_type = super::ContentType::from(local_var_content_type);
1040        let local_var_content = local_var_resp.text().await?;
1041
1042        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1043            match local_var_content_type {
1044                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1045                ContentType::Text => {
1046                    return Err(Error::from(serde_json::Error::custom(
1047                        "Received `text/plain` content type response that cannot be converted to \
1048                         `models::SmartTransferTicketTermResponse`",
1049                    )));
1050                }
1051                ContentType::Unsupported(local_var_unknown_type) => {
1052                    return Err(Error::from(serde_json::Error::custom(format!(
1053                        "Received `{local_var_unknown_type}` content type response that cannot be \
1054                         converted to `models::SmartTransferTicketTermResponse`"
1055                    ))));
1056                }
1057            }
1058        } else {
1059            let local_var_entity: Option<FundTicketTermError> =
1060                serde_json::from_str(&local_var_content).ok();
1061            let local_var_error = ResponseContent {
1062                status: local_var_status,
1063                content: local_var_content,
1064                entity: local_var_entity,
1065            };
1066            Err(Error::ResponseError(local_var_error))
1067        }
1068    }
1069
1070    /// Get smart transfer statistic
1071    async fn get_smart_transfer_statistic(
1072        &self,
1073    ) -> Result<models::SmartTransferStatistic, Error<GetSmartTransferStatisticError>> {
1074        let local_var_configuration = &self.configuration;
1075
1076        let local_var_client = &local_var_configuration.client;
1077
1078        let local_var_uri_str = format!(
1079            "{}/smart_transfers/statistic",
1080            local_var_configuration.base_path
1081        );
1082        let mut local_var_req_builder =
1083            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1084
1085        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1086            local_var_req_builder = local_var_req_builder
1087                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1088        }
1089
1090        let local_var_req = local_var_req_builder.build()?;
1091        let local_var_resp = local_var_client.execute(local_var_req).await?;
1092
1093        let local_var_status = local_var_resp.status();
1094        let local_var_content_type = local_var_resp
1095            .headers()
1096            .get("content-type")
1097            .and_then(|v| v.to_str().ok())
1098            .unwrap_or("application/octet-stream");
1099        let local_var_content_type = super::ContentType::from(local_var_content_type);
1100        let local_var_content = local_var_resp.text().await?;
1101
1102        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1103            match local_var_content_type {
1104                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1105                ContentType::Text => {
1106                    return Err(Error::from(serde_json::Error::custom(
1107                        "Received `text/plain` content type response that cannot be converted to \
1108                         `models::SmartTransferStatistic`",
1109                    )));
1110                }
1111                ContentType::Unsupported(local_var_unknown_type) => {
1112                    return Err(Error::from(serde_json::Error::custom(format!(
1113                        "Received `{local_var_unknown_type}` content type response that cannot be \
1114                         converted to `models::SmartTransferStatistic`"
1115                    ))));
1116                }
1117            }
1118        } else {
1119            let local_var_entity: Option<GetSmartTransferStatisticError> =
1120                serde_json::from_str(&local_var_content).ok();
1121            let local_var_error = ResponseContent {
1122                status: local_var_status,
1123                content: local_var_content,
1124                entity: local_var_entity,
1125            };
1126            Err(Error::ResponseError(local_var_error))
1127        }
1128    }
1129
1130    /// Get Smart Transfer user groups. </br>Endpoint Permission: Admin,
1131    /// Non-Signing Admin, Signer, Approver, Editor, Viewer.
1132    async fn get_smart_transfer_user_groups(
1133        &self,
1134    ) -> Result<models::SmartTransferUserGroupsResponse, Error<GetSmartTransferUserGroupsError>>
1135    {
1136        let local_var_configuration = &self.configuration;
1137
1138        let local_var_client = &local_var_configuration.client;
1139
1140        let local_var_uri_str = format!(
1141            "{}/smart-transfers/settings/user-groups",
1142            local_var_configuration.base_path
1143        );
1144        let mut local_var_req_builder =
1145            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1146
1147        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1148            local_var_req_builder = local_var_req_builder
1149                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1150        }
1151
1152        let local_var_req = local_var_req_builder.build()?;
1153        let local_var_resp = local_var_client.execute(local_var_req).await?;
1154
1155        let local_var_status = local_var_resp.status();
1156        let local_var_content_type = local_var_resp
1157            .headers()
1158            .get("content-type")
1159            .and_then(|v| v.to_str().ok())
1160            .unwrap_or("application/octet-stream");
1161        let local_var_content_type = super::ContentType::from(local_var_content_type);
1162        let local_var_content = local_var_resp.text().await?;
1163
1164        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1165            match local_var_content_type {
1166                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1167                ContentType::Text => {
1168                    return Err(Error::from(serde_json::Error::custom(
1169                        "Received `text/plain` content type response that cannot be converted to \
1170                         `models::SmartTransferUserGroupsResponse`",
1171                    )));
1172                }
1173                ContentType::Unsupported(local_var_unknown_type) => {
1174                    return Err(Error::from(serde_json::Error::custom(format!(
1175                        "Received `{local_var_unknown_type}` content type response that cannot be \
1176                         converted to `models::SmartTransferUserGroupsResponse`"
1177                    ))));
1178                }
1179            }
1180        } else {
1181            let local_var_entity: Option<GetSmartTransferUserGroupsError> =
1182                serde_json::from_str(&local_var_content).ok();
1183            let local_var_error = ResponseContent {
1184                status: local_var_status,
1185                content: local_var_content,
1186                entity: local_var_entity,
1187            };
1188            Err(Error::ResponseError(local_var_error))
1189        }
1190    }
1191
1192    /// Manually set ticket term transaction. </br>Endpoint Permission: Admin,
1193    /// Non-Signing Admin, Signer, Approver, Editor.
1194    async fn manually_fund_ticket_term(
1195        &self,
1196        params: ManuallyFundTicketTermParams,
1197    ) -> Result<models::SmartTransferTicketTermResponse, Error<ManuallyFundTicketTermError>> {
1198        let ManuallyFundTicketTermParams {
1199            ticket_id,
1200            term_id,
1201            smart_transfer_manually_fund_term,
1202            idempotency_key,
1203        } = params;
1204
1205        let local_var_configuration = &self.configuration;
1206
1207        let local_var_client = &local_var_configuration.client;
1208
1209        let local_var_uri_str = format!(
1210            "{}/smart-transfers/{ticketId}/terms/{termId}/manually-fund",
1211            local_var_configuration.base_path,
1212            ticketId = crate::apis::urlencode(ticket_id),
1213            termId = crate::apis::urlencode(term_id)
1214        );
1215        let mut local_var_req_builder =
1216            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1217
1218        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1219            local_var_req_builder = local_var_req_builder
1220                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1221        }
1222        if let Some(local_var_param_value) = idempotency_key {
1223            local_var_req_builder =
1224                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1225        }
1226        local_var_req_builder = local_var_req_builder.json(&smart_transfer_manually_fund_term);
1227
1228        let local_var_req = local_var_req_builder.build()?;
1229        let local_var_resp = local_var_client.execute(local_var_req).await?;
1230
1231        let local_var_status = local_var_resp.status();
1232        let local_var_content_type = local_var_resp
1233            .headers()
1234            .get("content-type")
1235            .and_then(|v| v.to_str().ok())
1236            .unwrap_or("application/octet-stream");
1237        let local_var_content_type = super::ContentType::from(local_var_content_type);
1238        let local_var_content = local_var_resp.text().await?;
1239
1240        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1241            match local_var_content_type {
1242                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1243                ContentType::Text => {
1244                    return Err(Error::from(serde_json::Error::custom(
1245                        "Received `text/plain` content type response that cannot be converted to \
1246                         `models::SmartTransferTicketTermResponse`",
1247                    )));
1248                }
1249                ContentType::Unsupported(local_var_unknown_type) => {
1250                    return Err(Error::from(serde_json::Error::custom(format!(
1251                        "Received `{local_var_unknown_type}` content type response that cannot be \
1252                         converted to `models::SmartTransferTicketTermResponse`"
1253                    ))));
1254                }
1255            }
1256        } else {
1257            let local_var_entity: Option<ManuallyFundTicketTermError> =
1258                serde_json::from_str(&local_var_content).ok();
1259            let local_var_error = ResponseContent {
1260                status: local_var_status,
1261                content: local_var_content,
1262                entity: local_var_entity,
1263            };
1264            Err(Error::ResponseError(local_var_error))
1265        }
1266    }
1267
1268    /// Delete ticket term when ticket is in DRAFT status. </br>Endpoint
1269    /// Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
1270    async fn remove_ticket_term(
1271        &self,
1272        params: RemoveTicketTermParams,
1273    ) -> Result<(), Error<RemoveTicketTermError>> {
1274        let RemoveTicketTermParams { ticket_id, term_id } = params;
1275
1276        let local_var_configuration = &self.configuration;
1277
1278        let local_var_client = &local_var_configuration.client;
1279
1280        let local_var_uri_str = format!(
1281            "{}/smart-transfers/{ticketId}/terms/{termId}",
1282            local_var_configuration.base_path,
1283            ticketId = crate::apis::urlencode(ticket_id),
1284            termId = crate::apis::urlencode(term_id)
1285        );
1286        let mut local_var_req_builder =
1287            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1288
1289        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1290            local_var_req_builder = local_var_req_builder
1291                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1292        }
1293
1294        let local_var_req = local_var_req_builder.build()?;
1295        let local_var_resp = local_var_client.execute(local_var_req).await?;
1296
1297        let local_var_status = local_var_resp.status();
1298        let local_var_content = local_var_resp.text().await?;
1299
1300        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1301            Ok(())
1302        } else {
1303            let local_var_entity: Option<RemoveTicketTermError> =
1304                serde_json::from_str(&local_var_content).ok();
1305            let local_var_error = ResponseContent {
1306                status: local_var_status,
1307                content: local_var_content,
1308                entity: local_var_entity,
1309            };
1310            Err(Error::ResponseError(local_var_error))
1311        }
1312    }
1313
1314    /// Finds Smart Transfer tickets that match the submitted criteria.
1315    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
1316    /// Editor,   Viewer.
1317    async fn search_tickets(
1318        &self,
1319        params: SearchTicketsParams,
1320    ) -> Result<models::SmartTransferTicketFilteredResponse, Error<SearchTicketsError>> {
1321        let SearchTicketsParams {
1322            q,
1323            statuses,
1324            network_id,
1325            created_by_me,
1326            expires_after,
1327            expires_before,
1328            r#type,
1329            external_ref_id,
1330            after,
1331            limit,
1332        } = params;
1333
1334        let local_var_configuration = &self.configuration;
1335
1336        let local_var_client = &local_var_configuration.client;
1337
1338        let local_var_uri_str = format!("{}/smart-transfers", local_var_configuration.base_path);
1339        let mut local_var_req_builder =
1340            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1341
1342        if let Some(ref local_var_str) = q {
1343            local_var_req_builder =
1344                local_var_req_builder.query(&[("q", &local_var_str.to_string())]);
1345        }
1346        if let Some(ref local_var_str) = statuses {
1347            local_var_req_builder = match "multi" {
1348                "multi" => local_var_req_builder.query(
1349                    &local_var_str
1350                        .into_iter()
1351                        .map(|p| ("statuses".to_owned(), p.to_string()))
1352                        .collect::<Vec<(std::string::String, std::string::String)>>(),
1353                ),
1354                _ => local_var_req_builder.query(&[(
1355                    "statuses",
1356                    &local_var_str
1357                        .into_iter()
1358                        .map(|p| p.to_string())
1359                        .collect::<Vec<String>>()
1360                        .join(",")
1361                        .to_string(),
1362                )]),
1363            };
1364        }
1365        if let Some(ref local_var_str) = network_id {
1366            local_var_req_builder =
1367                local_var_req_builder.query(&[("networkId", &local_var_str.to_string())]);
1368        }
1369        if let Some(ref local_var_str) = created_by_me {
1370            local_var_req_builder =
1371                local_var_req_builder.query(&[("createdByMe", &local_var_str.to_string())]);
1372        }
1373        if let Some(ref local_var_str) = expires_after {
1374            local_var_req_builder =
1375                local_var_req_builder.query(&[("expiresAfter", &local_var_str.to_string())]);
1376        }
1377        if let Some(ref local_var_str) = expires_before {
1378            local_var_req_builder =
1379                local_var_req_builder.query(&[("expiresBefore", &local_var_str.to_string())]);
1380        }
1381        if let Some(ref local_var_str) = r#type {
1382            local_var_req_builder =
1383                local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
1384        }
1385        if let Some(ref local_var_str) = external_ref_id {
1386            local_var_req_builder =
1387                local_var_req_builder.query(&[("externalRefId", &local_var_str.to_string())]);
1388        }
1389        if let Some(ref local_var_str) = after {
1390            local_var_req_builder =
1391                local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
1392        }
1393        if let Some(ref local_var_str) = limit {
1394            local_var_req_builder =
1395                local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1396        }
1397        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1398            local_var_req_builder = local_var_req_builder
1399                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1400        }
1401
1402        let local_var_req = local_var_req_builder.build()?;
1403        let local_var_resp = local_var_client.execute(local_var_req).await?;
1404
1405        let local_var_status = local_var_resp.status();
1406        let local_var_content_type = local_var_resp
1407            .headers()
1408            .get("content-type")
1409            .and_then(|v| v.to_str().ok())
1410            .unwrap_or("application/octet-stream");
1411        let local_var_content_type = super::ContentType::from(local_var_content_type);
1412        let local_var_content = local_var_resp.text().await?;
1413
1414        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1415            match local_var_content_type {
1416                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1417                ContentType::Text => {
1418                    return Err(Error::from(serde_json::Error::custom(
1419                        "Received `text/plain` content type response that cannot be converted to \
1420                         `models::SmartTransferTicketFilteredResponse`",
1421                    )));
1422                }
1423                ContentType::Unsupported(local_var_unknown_type) => {
1424                    return Err(Error::from(serde_json::Error::custom(format!(
1425                        "Received `{local_var_unknown_type}` content type response that cannot be \
1426                         converted to `models::SmartTransferTicketFilteredResponse`"
1427                    ))));
1428                }
1429            }
1430        } else {
1431            let local_var_entity: Option<SearchTicketsError> =
1432                serde_json::from_str(&local_var_content).ok();
1433            let local_var_error = ResponseContent {
1434                status: local_var_status,
1435                content: local_var_content,
1436                entity: local_var_entity,
1437            };
1438            Err(Error::ResponseError(local_var_error))
1439        }
1440    }
1441
1442    /// Set external id Smart Transfer ticket. </br>Endpoint Permission: Admin,
1443    /// Non-Signing Admin, Signer, Approver, Editor.
1444    async fn set_external_ref_id(
1445        &self,
1446        params: SetExternalRefIdParams,
1447    ) -> Result<models::SmartTransferTicketResponse, Error<SetExternalRefIdError>> {
1448        let SetExternalRefIdParams {
1449            ticket_id,
1450            smart_transfer_set_ticket_external_id,
1451            idempotency_key,
1452        } = params;
1453
1454        let local_var_configuration = &self.configuration;
1455
1456        let local_var_client = &local_var_configuration.client;
1457
1458        let local_var_uri_str = format!(
1459            "{}/smart-transfers/{ticketId}/external-id",
1460            local_var_configuration.base_path,
1461            ticketId = crate::apis::urlencode(ticket_id)
1462        );
1463        let mut local_var_req_builder =
1464            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1465
1466        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1467            local_var_req_builder = local_var_req_builder
1468                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1469        }
1470        if let Some(local_var_param_value) = idempotency_key {
1471            local_var_req_builder =
1472                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1473        }
1474        local_var_req_builder = local_var_req_builder.json(&smart_transfer_set_ticket_external_id);
1475
1476        let local_var_req = local_var_req_builder.build()?;
1477        let local_var_resp = local_var_client.execute(local_var_req).await?;
1478
1479        let local_var_status = local_var_resp.status();
1480        let local_var_content_type = local_var_resp
1481            .headers()
1482            .get("content-type")
1483            .and_then(|v| v.to_str().ok())
1484            .unwrap_or("application/octet-stream");
1485        let local_var_content_type = super::ContentType::from(local_var_content_type);
1486        let local_var_content = local_var_resp.text().await?;
1487
1488        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1489            match local_var_content_type {
1490                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1491                ContentType::Text => {
1492                    return Err(Error::from(serde_json::Error::custom(
1493                        "Received `text/plain` content type response that cannot be converted to \
1494                         `models::SmartTransferTicketResponse`",
1495                    )));
1496                }
1497                ContentType::Unsupported(local_var_unknown_type) => {
1498                    return Err(Error::from(serde_json::Error::custom(format!(
1499                        "Received `{local_var_unknown_type}` content type response that cannot be \
1500                         converted to `models::SmartTransferTicketResponse`"
1501                    ))));
1502                }
1503            }
1504        } else {
1505            let local_var_entity: Option<SetExternalRefIdError> =
1506                serde_json::from_str(&local_var_content).ok();
1507            let local_var_error = ResponseContent {
1508                status: local_var_status,
1509                content: local_var_content,
1510                entity: local_var_entity,
1511            };
1512            Err(Error::ResponseError(local_var_error))
1513        }
1514    }
1515
1516    /// Set expiration date on Smart Transfer ticket. </br>Endpoint Permission:
1517    /// Admin, Non-Signing Admin, Signer, Approver, Editor.
1518    async fn set_ticket_expiration(
1519        &self,
1520        params: SetTicketExpirationParams,
1521    ) -> Result<models::SmartTransferTicketResponse, Error<SetTicketExpirationError>> {
1522        let SetTicketExpirationParams {
1523            ticket_id,
1524            smart_transfer_set_ticket_expiration,
1525            idempotency_key,
1526        } = params;
1527
1528        let local_var_configuration = &self.configuration;
1529
1530        let local_var_client = &local_var_configuration.client;
1531
1532        let local_var_uri_str = format!(
1533            "{}/smart-transfers/{ticketId}/expires-in",
1534            local_var_configuration.base_path,
1535            ticketId = crate::apis::urlencode(ticket_id)
1536        );
1537        let mut local_var_req_builder =
1538            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1539
1540        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1541            local_var_req_builder = local_var_req_builder
1542                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1543        }
1544        if let Some(local_var_param_value) = idempotency_key {
1545            local_var_req_builder =
1546                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1547        }
1548        local_var_req_builder = local_var_req_builder.json(&smart_transfer_set_ticket_expiration);
1549
1550        let local_var_req = local_var_req_builder.build()?;
1551        let local_var_resp = local_var_client.execute(local_var_req).await?;
1552
1553        let local_var_status = local_var_resp.status();
1554        let local_var_content_type = local_var_resp
1555            .headers()
1556            .get("content-type")
1557            .and_then(|v| v.to_str().ok())
1558            .unwrap_or("application/octet-stream");
1559        let local_var_content_type = super::ContentType::from(local_var_content_type);
1560        let local_var_content = local_var_resp.text().await?;
1561
1562        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1563            match local_var_content_type {
1564                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1565                ContentType::Text => {
1566                    return Err(Error::from(serde_json::Error::custom(
1567                        "Received `text/plain` content type response that cannot be converted to \
1568                         `models::SmartTransferTicketResponse`",
1569                    )));
1570                }
1571                ContentType::Unsupported(local_var_unknown_type) => {
1572                    return Err(Error::from(serde_json::Error::custom(format!(
1573                        "Received `{local_var_unknown_type}` content type response that cannot be \
1574                         converted to `models::SmartTransferTicketResponse`"
1575                    ))));
1576                }
1577            }
1578        } else {
1579            let local_var_entity: Option<SetTicketExpirationError> =
1580                serde_json::from_str(&local_var_content).ok();
1581            let local_var_error = ResponseContent {
1582                status: local_var_status,
1583                content: local_var_content,
1584                entity: local_var_entity,
1585            };
1586            Err(Error::ResponseError(local_var_error))
1587        }
1588    }
1589
1590    /// Set Smart Transfers user group to receive email notifications for Smart
1591    /// Transfers. </br>Endpoint Permission: Admin, Non-Signing Admin, Signer,
1592    /// Approver, Editor.
1593    async fn set_user_groups(
1594        &self,
1595        params: SetUserGroupsParams,
1596    ) -> Result<models::SmartTransferUserGroupsResponse, Error<SetUserGroupsError>> {
1597        let SetUserGroupsParams {
1598            smart_transfer_set_user_groups,
1599            idempotency_key,
1600        } = params;
1601
1602        let local_var_configuration = &self.configuration;
1603
1604        let local_var_client = &local_var_configuration.client;
1605
1606        let local_var_uri_str = format!(
1607            "{}/smart-transfers/settings/user-groups",
1608            local_var_configuration.base_path
1609        );
1610        let mut local_var_req_builder =
1611            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1612
1613        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1614            local_var_req_builder = local_var_req_builder
1615                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1616        }
1617        if let Some(local_var_param_value) = idempotency_key {
1618            local_var_req_builder =
1619                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1620        }
1621        local_var_req_builder = local_var_req_builder.json(&smart_transfer_set_user_groups);
1622
1623        let local_var_req = local_var_req_builder.build()?;
1624        let local_var_resp = local_var_client.execute(local_var_req).await?;
1625
1626        let local_var_status = local_var_resp.status();
1627        let local_var_content_type = local_var_resp
1628            .headers()
1629            .get("content-type")
1630            .and_then(|v| v.to_str().ok())
1631            .unwrap_or("application/octet-stream");
1632        let local_var_content_type = super::ContentType::from(local_var_content_type);
1633        let local_var_content = local_var_resp.text().await?;
1634
1635        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1636            match local_var_content_type {
1637                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1638                ContentType::Text => {
1639                    return Err(Error::from(serde_json::Error::custom(
1640                        "Received `text/plain` content type response that cannot be converted to \
1641                         `models::SmartTransferUserGroupsResponse`",
1642                    )));
1643                }
1644                ContentType::Unsupported(local_var_unknown_type) => {
1645                    return Err(Error::from(serde_json::Error::custom(format!(
1646                        "Received `{local_var_unknown_type}` content type response that cannot be \
1647                         converted to `models::SmartTransferUserGroupsResponse`"
1648                    ))));
1649                }
1650            }
1651        } else {
1652            let local_var_entity: Option<SetUserGroupsError> =
1653                serde_json::from_str(&local_var_content).ok();
1654            let local_var_error = ResponseContent {
1655                status: local_var_status,
1656                content: local_var_content,
1657                entity: local_var_entity,
1658            };
1659            Err(Error::ResponseError(local_var_error))
1660        }
1661    }
1662
1663    /// Submit Smart Transfer ticket - change status into ready for approval if
1664    /// auto approval is not turned on, or OPEN if auto approval is on.
1665    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
1666    /// Editor.
1667    async fn submit_ticket(
1668        &self,
1669        params: SubmitTicketParams,
1670    ) -> Result<models::SmartTransferTicketResponse, Error<SubmitTicketError>> {
1671        let SubmitTicketParams {
1672            ticket_id,
1673            smart_transfer_submit_ticket,
1674            idempotency_key,
1675        } = params;
1676
1677        let local_var_configuration = &self.configuration;
1678
1679        let local_var_client = &local_var_configuration.client;
1680
1681        let local_var_uri_str = format!(
1682            "{}/smart-transfers/{ticketId}/submit",
1683            local_var_configuration.base_path,
1684            ticketId = crate::apis::urlencode(ticket_id)
1685        );
1686        let mut local_var_req_builder =
1687            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1688
1689        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1690            local_var_req_builder = local_var_req_builder
1691                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1692        }
1693        if let Some(local_var_param_value) = idempotency_key {
1694            local_var_req_builder =
1695                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1696        }
1697        local_var_req_builder = local_var_req_builder.json(&smart_transfer_submit_ticket);
1698
1699        let local_var_req = local_var_req_builder.build()?;
1700        let local_var_resp = local_var_client.execute(local_var_req).await?;
1701
1702        let local_var_status = local_var_resp.status();
1703        let local_var_content_type = local_var_resp
1704            .headers()
1705            .get("content-type")
1706            .and_then(|v| v.to_str().ok())
1707            .unwrap_or("application/octet-stream");
1708        let local_var_content_type = super::ContentType::from(local_var_content_type);
1709        let local_var_content = local_var_resp.text().await?;
1710
1711        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1712            match local_var_content_type {
1713                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1714                ContentType::Text => {
1715                    return Err(Error::from(serde_json::Error::custom(
1716                        "Received `text/plain` content type response that cannot be converted to \
1717                         `models::SmartTransferTicketResponse`",
1718                    )));
1719                }
1720                ContentType::Unsupported(local_var_unknown_type) => {
1721                    return Err(Error::from(serde_json::Error::custom(format!(
1722                        "Received `{local_var_unknown_type}` content type response that cannot be \
1723                         converted to `models::SmartTransferTicketResponse`"
1724                    ))));
1725                }
1726            }
1727        } else {
1728            let local_var_entity: Option<SubmitTicketError> =
1729                serde_json::from_str(&local_var_content).ok();
1730            let local_var_error = ResponseContent {
1731                status: local_var_status,
1732                content: local_var_content,
1733                entity: local_var_entity,
1734            };
1735            Err(Error::ResponseError(local_var_error))
1736        }
1737    }
1738
1739    /// Update ticket term (when ticket status is DRAFT). </br>Endpoint
1740    /// Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
1741    async fn update_ticket_term(
1742        &self,
1743        params: UpdateTicketTermParams,
1744    ) -> Result<models::SmartTransferTicketTermResponse, Error<UpdateTicketTermError>> {
1745        let UpdateTicketTermParams {
1746            ticket_id,
1747            term_id,
1748            smart_transfer_update_ticket_term,
1749            idempotency_key,
1750        } = params;
1751
1752        let local_var_configuration = &self.configuration;
1753
1754        let local_var_client = &local_var_configuration.client;
1755
1756        let local_var_uri_str = format!(
1757            "{}/smart-transfers/{ticketId}/terms/{termId}",
1758            local_var_configuration.base_path,
1759            ticketId = crate::apis::urlencode(ticket_id),
1760            termId = crate::apis::urlencode(term_id)
1761        );
1762        let mut local_var_req_builder =
1763            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1764
1765        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1766            local_var_req_builder = local_var_req_builder
1767                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1768        }
1769        if let Some(local_var_param_value) = idempotency_key {
1770            local_var_req_builder =
1771                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1772        }
1773        local_var_req_builder = local_var_req_builder.json(&smart_transfer_update_ticket_term);
1774
1775        let local_var_req = local_var_req_builder.build()?;
1776        let local_var_resp = local_var_client.execute(local_var_req).await?;
1777
1778        let local_var_status = local_var_resp.status();
1779        let local_var_content_type = local_var_resp
1780            .headers()
1781            .get("content-type")
1782            .and_then(|v| v.to_str().ok())
1783            .unwrap_or("application/octet-stream");
1784        let local_var_content_type = super::ContentType::from(local_var_content_type);
1785        let local_var_content = local_var_resp.text().await?;
1786
1787        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1788            match local_var_content_type {
1789                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1790                ContentType::Text => {
1791                    return Err(Error::from(serde_json::Error::custom(
1792                        "Received `text/plain` content type response that cannot be converted to \
1793                         `models::SmartTransferTicketTermResponse`",
1794                    )));
1795                }
1796                ContentType::Unsupported(local_var_unknown_type) => {
1797                    return Err(Error::from(serde_json::Error::custom(format!(
1798                        "Received `{local_var_unknown_type}` content type response that cannot be \
1799                         converted to `models::SmartTransferTicketTermResponse`"
1800                    ))));
1801                }
1802            }
1803        } else {
1804            let local_var_entity: Option<UpdateTicketTermError> =
1805                serde_json::from_str(&local_var_content).ok();
1806            let local_var_error = ResponseContent {
1807                status: local_var_status,
1808                content: local_var_content,
1809                entity: local_var_entity,
1810            };
1811            Err(Error::ResponseError(local_var_error))
1812        }
1813    }
1814}
1815
1816/// struct for typed errors of method [`approve_dv_p_ticket_term`]
1817#[derive(Debug, Clone, Serialize, Deserialize)]
1818#[serde(untagged)]
1819pub enum ApproveDvPTicketTermError {
1820    Status403(models::SmartTransferForbiddenResponse),
1821    Status404(models::SmartTransferNotFoundResponse),
1822    Status422(models::SmartTransferBadRequestResponse),
1823    UnknownValue(serde_json::Value),
1824}
1825
1826/// struct for typed errors of method [`cancel_ticket`]
1827#[derive(Debug, Clone, Serialize, Deserialize)]
1828#[serde(untagged)]
1829pub enum CancelTicketError {
1830    Status403(models::SmartTransferForbiddenResponse),
1831    Status404(models::SmartTransferNotFoundResponse),
1832    Status422(models::SmartTransferBadRequestResponse),
1833    UnknownValue(serde_json::Value),
1834}
1835
1836/// struct for typed errors of method [`create_ticket`]
1837#[derive(Debug, Clone, Serialize, Deserialize)]
1838#[serde(untagged)]
1839pub enum CreateTicketError {
1840    Status403(models::SmartTransferForbiddenResponse),
1841    Status422(models::SmartTransferBadRequestResponse),
1842    UnknownValue(serde_json::Value),
1843}
1844
1845/// struct for typed errors of method [`create_ticket_term`]
1846#[derive(Debug, Clone, Serialize, Deserialize)]
1847#[serde(untagged)]
1848pub enum CreateTicketTermError {
1849    Status403(models::SmartTransferForbiddenResponse),
1850    Status422(models::SmartTransferBadRequestResponse),
1851    UnknownValue(serde_json::Value),
1852}
1853
1854/// struct for typed errors of method [`find_ticket_by_id`]
1855#[derive(Debug, Clone, Serialize, Deserialize)]
1856#[serde(untagged)]
1857pub enum FindTicketByIdError {
1858    Status403(models::SmartTransferForbiddenResponse),
1859    Status404(models::SmartTransferNotFoundResponse),
1860    UnknownValue(serde_json::Value),
1861}
1862
1863/// struct for typed errors of method [`find_ticket_term_by_id`]
1864#[derive(Debug, Clone, Serialize, Deserialize)]
1865#[serde(untagged)]
1866pub enum FindTicketTermByIdError {
1867    Status403(models::SmartTransferForbiddenResponse),
1868    Status404(models::SmartTransferNotFoundResponse),
1869    UnknownValue(serde_json::Value),
1870}
1871
1872/// struct for typed errors of method [`fulfill_ticket`]
1873#[derive(Debug, Clone, Serialize, Deserialize)]
1874#[serde(untagged)]
1875pub enum FulfillTicketError {
1876    Status403(models::SmartTransferForbiddenResponse),
1877    Status404(models::SmartTransferNotFoundResponse),
1878    Status422(models::SmartTransferBadRequestResponse),
1879    UnknownValue(serde_json::Value),
1880}
1881
1882/// struct for typed errors of method [`fund_dvp_ticket`]
1883#[derive(Debug, Clone, Serialize, Deserialize)]
1884#[serde(untagged)]
1885pub enum FundDvpTicketError {
1886    Status403(models::SmartTransferForbiddenResponse),
1887    Status404(models::SmartTransferNotFoundResponse),
1888    Status422(models::SmartTransferBadRequestResponse),
1889    UnknownValue(serde_json::Value),
1890}
1891
1892/// struct for typed errors of method [`fund_ticket_term`]
1893#[derive(Debug, Clone, Serialize, Deserialize)]
1894#[serde(untagged)]
1895pub enum FundTicketTermError {
1896    Status403(models::SmartTransferForbiddenResponse),
1897    Status404(models::SmartTransferNotFoundResponse),
1898    Status422(models::SmartTransferBadRequestResponse),
1899    UnknownValue(serde_json::Value),
1900}
1901
1902/// struct for typed errors of method [`get_smart_transfer_statistic`]
1903#[derive(Debug, Clone, Serialize, Deserialize)]
1904#[serde(untagged)]
1905pub enum GetSmartTransferStatisticError {
1906    Status403(models::SmartTransferForbiddenResponse),
1907    DefaultResponse(models::ErrorSchema),
1908    UnknownValue(serde_json::Value),
1909}
1910
1911/// struct for typed errors of method [`get_smart_transfer_user_groups`]
1912#[derive(Debug, Clone, Serialize, Deserialize)]
1913#[serde(untagged)]
1914pub enum GetSmartTransferUserGroupsError {
1915    Status403(models::SmartTransferForbiddenResponse),
1916    Status422(models::SmartTransferBadRequestResponse),
1917    UnknownValue(serde_json::Value),
1918}
1919
1920/// struct for typed errors of method [`manually_fund_ticket_term`]
1921#[derive(Debug, Clone, Serialize, Deserialize)]
1922#[serde(untagged)]
1923pub enum ManuallyFundTicketTermError {
1924    Status403(models::SmartTransferForbiddenResponse),
1925    Status404(models::SmartTransferNotFoundResponse),
1926    Status422(models::SmartTransferBadRequestResponse),
1927    UnknownValue(serde_json::Value),
1928}
1929
1930/// struct for typed errors of method [`remove_ticket_term`]
1931#[derive(Debug, Clone, Serialize, Deserialize)]
1932#[serde(untagged)]
1933pub enum RemoveTicketTermError {
1934    Status403(models::SmartTransferForbiddenResponse),
1935    Status404(models::SmartTransferNotFoundResponse),
1936    UnknownValue(serde_json::Value),
1937}
1938
1939/// struct for typed errors of method [`search_tickets`]
1940#[derive(Debug, Clone, Serialize, Deserialize)]
1941#[serde(untagged)]
1942pub enum SearchTicketsError {
1943    Status403(models::SmartTransferForbiddenResponse),
1944    UnknownValue(serde_json::Value),
1945}
1946
1947/// struct for typed errors of method [`set_external_ref_id`]
1948#[derive(Debug, Clone, Serialize, Deserialize)]
1949#[serde(untagged)]
1950pub enum SetExternalRefIdError {
1951    Status403(models::SmartTransferForbiddenResponse),
1952    Status404(models::SmartTransferNotFoundResponse),
1953    Status422(models::SmartTransferBadRequestResponse),
1954    UnknownValue(serde_json::Value),
1955}
1956
1957/// struct for typed errors of method [`set_ticket_expiration`]
1958#[derive(Debug, Clone, Serialize, Deserialize)]
1959#[serde(untagged)]
1960pub enum SetTicketExpirationError {
1961    Status403(models::SmartTransferForbiddenResponse),
1962    Status404(models::SmartTransferNotFoundResponse),
1963    Status422(models::SmartTransferBadRequestResponse),
1964    UnknownValue(serde_json::Value),
1965}
1966
1967/// struct for typed errors of method [`set_user_groups`]
1968#[derive(Debug, Clone, Serialize, Deserialize)]
1969#[serde(untagged)]
1970pub enum SetUserGroupsError {
1971    Status403(models::SmartTransferForbiddenResponse),
1972    Status422(models::SmartTransferBadRequestResponse),
1973    UnknownValue(serde_json::Value),
1974}
1975
1976/// struct for typed errors of method [`submit_ticket`]
1977#[derive(Debug, Clone, Serialize, Deserialize)]
1978#[serde(untagged)]
1979pub enum SubmitTicketError {
1980    Status403(models::SmartTransferForbiddenResponse),
1981    Status404(models::SmartTransferNotFoundResponse),
1982    Status422(models::SmartTransferBadRequestResponse),
1983    UnknownValue(serde_json::Value),
1984}
1985
1986/// struct for typed errors of method [`update_ticket_term`]
1987#[derive(Debug, Clone, Serialize, Deserialize)]
1988#[serde(untagged)]
1989pub enum UpdateTicketTermError {
1990    Status403(models::SmartTransferForbiddenResponse),
1991    Status404(models::SmartTransferNotFoundResponse),
1992    UnknownValue(serde_json::Value),
1993}