fireblocks_sdk/apis/
nfts_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::{configuration, Error},
11    crate::{
12        apis::{ContentType, ResponseContent},
13        models,
14    },
15    async_trait::async_trait,
16    reqwest,
17    serde::{de::Error as _, Deserialize, Serialize},
18    std::sync::Arc,
19};
20
21#[async_trait]
22pub trait NftsApi: Send + Sync {
23    /// GET /nfts/tokens/{id}
24    ///
25    /// Returns the requested token data. </br>Endpoint Permission: Admin,
26    /// Non-Signing Admin, Signer, Approver, Editor.
27    async fn get_nft(
28        &self,
29        params: GetNftParams,
30    ) -> Result<models::TokenResponse, Error<GetNftError>>;
31
32    /// GET /nfts/tokens
33    ///
34    /// Returns the requested tokens data. </br>Endpoint Permission: Admin,
35    /// Non-Signing Admin, Signer, Approver, Editor.
36    async fn get_nfts(
37        &self,
38        params: GetNftsParams,
39    ) -> Result<models::GetNftsResponse, Error<GetNftsError>>;
40
41    /// GET /nfts/ownership/tokens
42    ///
43    /// Returns all tokens and their data in your workspace.  </br>Endpoint
44    /// Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
45    async fn get_ownership_tokens(
46        &self,
47        params: GetOwnershipTokensParams,
48    ) -> Result<models::GetOwnershipTokensResponse, Error<GetOwnershipTokensError>>;
49
50    /// GET /nfts/ownership/collections
51    ///
52    /// Returns all collections in your workspace. </br>Endpoint Permission:
53    /// Admin, Non-Signing Admin, Signer, Approver, Editor.
54    async fn list_owned_collections(
55        &self,
56        params: ListOwnedCollectionsParams,
57    ) -> Result<models::ListOwnedCollectionsResponse, Error<ListOwnedCollectionsError>>;
58
59    /// GET /nfts/ownership/assets
60    ///
61    /// Returns all owned distinct tokens (for your workspace) and their data in
62    /// your workspace. </br>Endpoint Permission: Admin, Non-Signing Admin,
63    /// Signer, Approver, Editor.
64    async fn list_owned_tokens(
65        &self,
66        params: ListOwnedTokensParams,
67    ) -> Result<models::ListOwnedTokensResponse, Error<ListOwnedTokensError>>;
68
69    /// PUT /nfts/tokens/{id}
70    ///
71    /// Updates the latest token metadata. Learn more about Fireblocks NFT management in the following [guide](https://developers.fireblocks.com/reference/deploy-an-nft-collection).  </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
72    async fn refresh_nft_metadata(
73        &self,
74        params: RefreshNftMetadataParams,
75    ) -> Result<(), Error<RefreshNftMetadataError>>;
76
77    /// PUT /nfts/ownership/tokens
78    ///
79    /// Updates all tokens and balances per blockchain and vault account. Learn more about Fireblocks NFT management in the following [guide](https://developers.fireblocks.com/reference/deploy-an-nft-collection).  </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
80    async fn update_ownership_tokens(
81        &self,
82        params: UpdateOwnershipTokensParams,
83    ) -> Result<(), Error<UpdateOwnershipTokensError>>;
84
85    /// PUT /nfts/ownership/tokens/{id}/status
86    ///
87    /// Updates token status for a workspace, in all workspace vaults.
88    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
89    /// Editor.
90    async fn update_token_ownership_status(
91        &self,
92        params: UpdateTokenOwnershipStatusParams,
93    ) -> Result<(), Error<UpdateTokenOwnershipStatusError>>;
94
95    /// PUT /nfts/ownership/tokens/spam
96    ///
97    /// Updates tokens spam property for a workspace's token ownerships, in all
98    /// vault accounts.  </br>Endpoint Permission: Admin, Non-Signing Admin,
99    /// Signer, Approver, Editor.
100    async fn update_tokens_ownership_spam(
101        &self,
102        params: UpdateTokensOwnershipSpamParams,
103    ) -> Result<(), Error<UpdateTokensOwnershipSpamError>>;
104
105    /// PUT /nfts/ownership/tokens/status
106    ///
107    /// Updates tokens status for a workspace, in all vault accounts.
108    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
109    /// Editor.
110    async fn update_tokens_ownership_status(
111        &self,
112        params: UpdateTokensOwnershipStatusParams,
113    ) -> Result<(), Error<UpdateTokensOwnershipStatusError>>;
114}
115
116pub struct NftsApiClient {
117    configuration: Arc<configuration::Configuration>,
118}
119
120impl NftsApiClient {
121    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
122        Self { configuration }
123    }
124}
125
126/// struct for passing parameters to the method [`get_nft`]
127#[derive(Clone, Debug)]
128#[cfg_attr(feature = "bon", derive(::bon::Builder))]
129pub struct GetNftParams {
130    /// NFT ID
131    pub id: String,
132}
133
134/// struct for passing parameters to the method [`get_nfts`]
135#[derive(Clone, Debug)]
136#[cfg_attr(feature = "bon", derive(::bon::Builder))]
137pub struct GetNftsParams {
138    /// A comma separated list of NFT IDs. Up to 100 are allowed in a single
139    /// request.
140    pub ids: String,
141    /// Page cursor to fetch
142    pub page_cursor: Option<String>,
143    /// Items per page (max 100)
144    pub page_size: Option<f64>,
145    /// Sort by param, it can be one param or a list of params separated by
146    /// comma
147    pub sort: Option<Vec<String>>,
148    /// Order direction, it can be `ASC` for ascending or `DESC` for descending
149    pub order: Option<String>,
150}
151
152/// struct for passing parameters to the method [`get_ownership_tokens`]
153#[derive(Clone, Debug)]
154#[cfg_attr(feature = "bon", derive(::bon::Builder))]
155pub struct GetOwnershipTokensParams {
156    /// Blockchain descriptor filter
157    pub blockchain_descriptor: Option<String>,
158    /// A comma separated list of Vault Account IDs. Up to 100 are allowed in a
159    /// single request.  This field will be ignored when
160    /// walletType=END_USER_WALLET or ncwId is provided.
161    pub vault_account_ids: Option<String>,
162    /// Non-Custodial Wallet ID
163    pub ncw_id: Option<String>,
164    /// A comma separated list of Non-Custodial account IDs. Up to 100 are
165    /// allowed in a single request. This field will be ignored when
166    /// walletType=VAULT_ACCOUNT or ncwId is not provided.
167    pub ncw_account_ids: Option<String>,
168    /// Wallet type, it can be `VAULT_ACCOUNT` or `END_USER_WALLET`
169    pub wallet_type: Option<String>,
170    /// A comma separated list of NFT IDs. Up to 100 are allowed in a single
171    /// request.
172    pub ids: Option<String>,
173    /// A comma separated list of collection IDs. Up to 100 are allowed in a
174    /// single request.
175    pub collection_ids: Option<String>,
176    /// Page cursor to fetch
177    pub page_cursor: Option<String>,
178    /// Items per page (max 100)
179    pub page_size: Option<f64>,
180    /// Sort by param, it can be one param or a list of params separated by
181    /// comma
182    pub sort: Option<Vec<String>>,
183    /// Order direction, it can be `ASC` for ascending or `DESC` for descending
184    pub order: Option<String>,
185    /// Token ownership status
186    pub status: Option<String>,
187    /// Search owned tokens and their collections. Possible criteria for search:
188    /// token name and id within the contract/collection, collection name,
189    /// blockchain descriptor and name.
190    pub search: Option<String>,
191    /// Token ownership spam status.
192    pub spam: Option<String>,
193}
194
195/// struct for passing parameters to the method [`list_owned_collections`]
196#[derive(Clone, Debug)]
197#[cfg_attr(feature = "bon", derive(::bon::Builder))]
198pub struct ListOwnedCollectionsParams {
199    /// Tenant's Non-Custodial Wallet ID
200    pub ncw_id: Option<String>,
201    /// Wallet type, it can be `VAULT_ACCOUNT` or `END_USER_WALLET`
202    pub wallet_type: Option<String>,
203    /// Search owned collections. Possible criteria for search: collection name,
204    /// collection contract address.
205    pub search: Option<String>,
206    /// Page cursor to fetch
207    pub page_cursor: Option<String>,
208    /// Items per page (max 100)
209    pub page_size: Option<f64>,
210    /// Sort by param, it can be one param or a list of params separated by
211    /// comma
212    pub sort: Option<Vec<String>>,
213    /// Order direction, it can be `ASC` for ascending or `DESC` for descending
214    pub order: Option<String>,
215    /// Token ownership status
216    pub status: Option<String>,
217}
218
219/// struct for passing parameters to the method [`list_owned_tokens`]
220#[derive(Clone, Debug)]
221#[cfg_attr(feature = "bon", derive(::bon::Builder))]
222pub struct ListOwnedTokensParams {
223    /// Non-Custodial Wallet ID
224    pub ncw_id: Option<String>,
225    /// Wallet type, it can be `VAULT_ACCOUNT` or `END_USER_WALLET`
226    pub wallet_type: Option<String>,
227    /// Page cursor to fetch
228    pub page_cursor: Option<String>,
229    /// Items per page (max 100)
230    pub page_size: Option<f64>,
231    /// Sort by param, it can be one param or a list of params separated by
232    /// comma
233    pub sort: Option<Vec<String>>,
234    /// Order direction, it can be `ASC` for ascending or `DESC` for descending
235    pub order: Option<String>,
236    /// Token ownership status
237    pub status: Option<String>,
238    /// Search owned tokens by token name
239    pub search: Option<String>,
240    /// Token ownership spam status.
241    pub spam: Option<String>,
242}
243
244/// struct for passing parameters to the method [`refresh_nft_metadata`]
245#[derive(Clone, Debug)]
246#[cfg_attr(feature = "bon", derive(::bon::Builder))]
247pub struct RefreshNftMetadataParams {
248    /// NFT ID
249    pub id: String,
250    /// A unique identifier for the request. If the request is sent multiple
251    /// times with the same idempotency key, the server will return the same
252    /// response as the first request. The idempotency key is valid for 24
253    /// hours.
254    pub idempotency_key: Option<String>,
255}
256
257/// struct for passing parameters to the method [`update_ownership_tokens`]
258#[derive(Clone, Debug)]
259#[cfg_attr(feature = "bon", derive(::bon::Builder))]
260pub struct UpdateOwnershipTokensParams {
261    /// Blockchain descriptor filter
262    pub blockchain_descriptor: String,
263    /// Vault account filter
264    pub vault_account_id: String,
265    /// A unique identifier for the request. If the request is sent multiple
266    /// times with the same idempotency key, the server will return the same
267    /// response as the first request. The idempotency key is valid for 24
268    /// hours.
269    pub idempotency_key: Option<String>,
270}
271
272/// struct for passing parameters to the method
273/// [`update_token_ownership_status`]
274#[derive(Clone, Debug)]
275#[cfg_attr(feature = "bon", derive(::bon::Builder))]
276pub struct UpdateTokenOwnershipStatusParams {
277    /// NFT ID
278    pub id: String,
279    pub update_token_ownership_status_dto: models::UpdateTokenOwnershipStatusDto,
280    /// A unique identifier for the request. If the request is sent multiple
281    /// times with the same idempotency key, the server will return the same
282    /// response as the first request. The idempotency key is valid for 24
283    /// hours.
284    pub idempotency_key: Option<String>,
285}
286
287/// struct for passing parameters to the method [`update_tokens_ownership_spam`]
288#[derive(Clone, Debug)]
289#[cfg_attr(feature = "bon", derive(::bon::Builder))]
290pub struct UpdateTokensOwnershipSpamParams {
291    pub token_ownership_spam_update_payload: Vec<models::TokenOwnershipSpamUpdatePayload>,
292    /// A unique identifier for the request. If the request is sent multiple
293    /// times with the same idempotency key, the server will return the same
294    /// response as the first request. The idempotency key is valid for 24
295    /// hours.
296    pub idempotency_key: Option<String>,
297}
298
299/// struct for passing parameters to the method
300/// [`update_tokens_ownership_status`]
301#[derive(Clone, Debug)]
302#[cfg_attr(feature = "bon", derive(::bon::Builder))]
303pub struct UpdateTokensOwnershipStatusParams {
304    pub token_ownership_status_update_payload: Vec<models::TokenOwnershipStatusUpdatePayload>,
305    /// A unique identifier for the request. If the request is sent multiple
306    /// times with the same idempotency key, the server will return the same
307    /// response as the first request. The idempotency key is valid for 24
308    /// hours.
309    pub idempotency_key: Option<String>,
310}
311
312#[async_trait]
313impl NftsApi for NftsApiClient {
314    /// Returns the requested token data. </br>Endpoint Permission: Admin,
315    /// Non-Signing Admin, Signer, Approver, Editor.
316    async fn get_nft(
317        &self,
318        params: GetNftParams,
319    ) -> Result<models::TokenResponse, Error<GetNftError>> {
320        let GetNftParams { id } = params;
321
322        let local_var_configuration = &self.configuration;
323
324        let local_var_client = &local_var_configuration.client;
325
326        let local_var_uri_str = format!(
327            "{}/nfts/tokens/{id}",
328            local_var_configuration.base_path,
329            id = crate::apis::urlencode(id)
330        );
331        let mut local_var_req_builder =
332            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
333
334        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
335            local_var_req_builder = local_var_req_builder
336                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
337        }
338
339        let local_var_req = local_var_req_builder.build()?;
340        let local_var_resp = local_var_client.execute(local_var_req).await?;
341
342        let local_var_status = local_var_resp.status();
343        let local_var_content_type = local_var_resp
344            .headers()
345            .get("content-type")
346            .and_then(|v| v.to_str().ok())
347            .unwrap_or("application/octet-stream");
348        let local_var_content_type = super::ContentType::from(local_var_content_type);
349        let local_var_content = local_var_resp.text().await?;
350
351        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
352            match local_var_content_type {
353                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
354                ContentType::Text => {
355                    return Err(Error::from(serde_json::Error::custom(
356                        "Received `text/plain` content type response that cannot be converted to \
357                         `models::TokenResponse`",
358                    )))
359                }
360                ContentType::Unsupported(local_var_unknown_type) => {
361                    return Err(Error::from(serde_json::Error::custom(format!(
362                        "Received `{local_var_unknown_type}` content type response that cannot be \
363                         converted to `models::TokenResponse`"
364                    ))))
365                }
366            }
367        } else {
368            let local_var_entity: Option<GetNftError> =
369                serde_json::from_str(&local_var_content).ok();
370            let local_var_error = ResponseContent {
371                status: local_var_status,
372                content: local_var_content,
373                entity: local_var_entity,
374            };
375            Err(Error::ResponseError(local_var_error))
376        }
377    }
378
379    /// Returns the requested tokens data. </br>Endpoint Permission: Admin,
380    /// Non-Signing Admin, Signer, Approver, Editor.
381    async fn get_nfts(
382        &self,
383        params: GetNftsParams,
384    ) -> Result<models::GetNftsResponse, Error<GetNftsError>> {
385        let GetNftsParams {
386            ids,
387            page_cursor,
388            page_size,
389            sort,
390            order,
391        } = params;
392
393        let local_var_configuration = &self.configuration;
394
395        let local_var_client = &local_var_configuration.client;
396
397        let local_var_uri_str = format!("{}/nfts/tokens", local_var_configuration.base_path);
398        let mut local_var_req_builder =
399            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
400
401        local_var_req_builder = local_var_req_builder.query(&[("ids", &ids.to_string())]);
402        if let Some(ref local_var_str) = page_cursor {
403            local_var_req_builder =
404                local_var_req_builder.query(&[("pageCursor", &local_var_str.to_string())]);
405        }
406        if let Some(ref local_var_str) = page_size {
407            local_var_req_builder =
408                local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
409        }
410        if let Some(ref local_var_str) = sort {
411            local_var_req_builder = match "multi" {
412                "multi" => local_var_req_builder.query(
413                    &local_var_str
414                        .into_iter()
415                        .map(|p| ("sort".to_owned(), p.to_string()))
416                        .collect::<Vec<(std::string::String, std::string::String)>>(),
417                ),
418                _ => local_var_req_builder.query(&[(
419                    "sort",
420                    &local_var_str
421                        .into_iter()
422                        .map(|p| p.to_string())
423                        .collect::<Vec<String>>()
424                        .join(",")
425                        .to_string(),
426                )]),
427            };
428        }
429        if let Some(ref local_var_str) = order {
430            local_var_req_builder =
431                local_var_req_builder.query(&[("order", &local_var_str.to_string())]);
432        }
433        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
434            local_var_req_builder = local_var_req_builder
435                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
436        }
437
438        let local_var_req = local_var_req_builder.build()?;
439        let local_var_resp = local_var_client.execute(local_var_req).await?;
440
441        let local_var_status = local_var_resp.status();
442        let local_var_content_type = local_var_resp
443            .headers()
444            .get("content-type")
445            .and_then(|v| v.to_str().ok())
446            .unwrap_or("application/octet-stream");
447        let local_var_content_type = super::ContentType::from(local_var_content_type);
448        let local_var_content = local_var_resp.text().await?;
449
450        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
451            match local_var_content_type {
452                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
453                ContentType::Text => {
454                    return Err(Error::from(serde_json::Error::custom(
455                        "Received `text/plain` content type response that cannot be converted to \
456                         `models::GetNftsResponse`",
457                    )))
458                }
459                ContentType::Unsupported(local_var_unknown_type) => {
460                    return Err(Error::from(serde_json::Error::custom(format!(
461                        "Received `{local_var_unknown_type}` content type response that cannot be \
462                         converted to `models::GetNftsResponse`"
463                    ))))
464                }
465            }
466        } else {
467            let local_var_entity: Option<GetNftsError> =
468                serde_json::from_str(&local_var_content).ok();
469            let local_var_error = ResponseContent {
470                status: local_var_status,
471                content: local_var_content,
472                entity: local_var_entity,
473            };
474            Err(Error::ResponseError(local_var_error))
475        }
476    }
477
478    /// Returns all tokens and their data in your workspace.  </br>Endpoint
479    /// Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
480    async fn get_ownership_tokens(
481        &self,
482        params: GetOwnershipTokensParams,
483    ) -> Result<models::GetOwnershipTokensResponse, Error<GetOwnershipTokensError>> {
484        let GetOwnershipTokensParams {
485            blockchain_descriptor,
486            vault_account_ids,
487            ncw_id,
488            ncw_account_ids,
489            wallet_type,
490            ids,
491            collection_ids,
492            page_cursor,
493            page_size,
494            sort,
495            order,
496            status,
497            search,
498            spam,
499        } = params;
500
501        let local_var_configuration = &self.configuration;
502
503        let local_var_client = &local_var_configuration.client;
504
505        let local_var_uri_str = format!(
506            "{}/nfts/ownership/tokens",
507            local_var_configuration.base_path
508        );
509        let mut local_var_req_builder =
510            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
511
512        if let Some(ref local_var_str) = blockchain_descriptor {
513            local_var_req_builder = local_var_req_builder
514                .query(&[("blockchainDescriptor", &local_var_str.to_string())]);
515        }
516        if let Some(ref local_var_str) = vault_account_ids {
517            local_var_req_builder =
518                local_var_req_builder.query(&[("vaultAccountIds", &local_var_str.to_string())]);
519        }
520        if let Some(ref local_var_str) = ncw_id {
521            local_var_req_builder =
522                local_var_req_builder.query(&[("ncwId", &local_var_str.to_string())]);
523        }
524        if let Some(ref local_var_str) = ncw_account_ids {
525            local_var_req_builder =
526                local_var_req_builder.query(&[("ncwAccountIds", &local_var_str.to_string())]);
527        }
528        if let Some(ref local_var_str) = wallet_type {
529            local_var_req_builder =
530                local_var_req_builder.query(&[("walletType", &local_var_str.to_string())]);
531        }
532        if let Some(ref local_var_str) = ids {
533            local_var_req_builder =
534                local_var_req_builder.query(&[("ids", &local_var_str.to_string())]);
535        }
536        if let Some(ref local_var_str) = collection_ids {
537            local_var_req_builder =
538                local_var_req_builder.query(&[("collectionIds", &local_var_str.to_string())]);
539        }
540        if let Some(ref local_var_str) = page_cursor {
541            local_var_req_builder =
542                local_var_req_builder.query(&[("pageCursor", &local_var_str.to_string())]);
543        }
544        if let Some(ref local_var_str) = page_size {
545            local_var_req_builder =
546                local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
547        }
548        if let Some(ref local_var_str) = sort {
549            local_var_req_builder = match "multi" {
550                "multi" => local_var_req_builder.query(
551                    &local_var_str
552                        .into_iter()
553                        .map(|p| ("sort".to_owned(), p.to_string()))
554                        .collect::<Vec<(std::string::String, std::string::String)>>(),
555                ),
556                _ => local_var_req_builder.query(&[(
557                    "sort",
558                    &local_var_str
559                        .into_iter()
560                        .map(|p| p.to_string())
561                        .collect::<Vec<String>>()
562                        .join(",")
563                        .to_string(),
564                )]),
565            };
566        }
567        if let Some(ref local_var_str) = order {
568            local_var_req_builder =
569                local_var_req_builder.query(&[("order", &local_var_str.to_string())]);
570        }
571        if let Some(ref local_var_str) = status {
572            local_var_req_builder =
573                local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
574        }
575        if let Some(ref local_var_str) = search {
576            local_var_req_builder =
577                local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
578        }
579        if let Some(ref local_var_str) = spam {
580            local_var_req_builder =
581                local_var_req_builder.query(&[("spam", &local_var_str.to_string())]);
582        }
583        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
584            local_var_req_builder = local_var_req_builder
585                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
586        }
587
588        let local_var_req = local_var_req_builder.build()?;
589        let local_var_resp = local_var_client.execute(local_var_req).await?;
590
591        let local_var_status = local_var_resp.status();
592        let local_var_content_type = local_var_resp
593            .headers()
594            .get("content-type")
595            .and_then(|v| v.to_str().ok())
596            .unwrap_or("application/octet-stream");
597        let local_var_content_type = super::ContentType::from(local_var_content_type);
598        let local_var_content = local_var_resp.text().await?;
599
600        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
601            match local_var_content_type {
602                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
603                ContentType::Text => {
604                    return Err(Error::from(serde_json::Error::custom(
605                        "Received `text/plain` content type response that cannot be converted to \
606                         `models::GetOwnershipTokensResponse`",
607                    )))
608                }
609                ContentType::Unsupported(local_var_unknown_type) => {
610                    return Err(Error::from(serde_json::Error::custom(format!(
611                        "Received `{local_var_unknown_type}` content type response that cannot be \
612                         converted to `models::GetOwnershipTokensResponse`"
613                    ))))
614                }
615            }
616        } else {
617            let local_var_entity: Option<GetOwnershipTokensError> =
618                serde_json::from_str(&local_var_content).ok();
619            let local_var_error = ResponseContent {
620                status: local_var_status,
621                content: local_var_content,
622                entity: local_var_entity,
623            };
624            Err(Error::ResponseError(local_var_error))
625        }
626    }
627
628    /// Returns all collections in your workspace. </br>Endpoint Permission:
629    /// Admin, Non-Signing Admin, Signer, Approver, Editor.
630    async fn list_owned_collections(
631        &self,
632        params: ListOwnedCollectionsParams,
633    ) -> Result<models::ListOwnedCollectionsResponse, Error<ListOwnedCollectionsError>> {
634        let ListOwnedCollectionsParams {
635            ncw_id,
636            wallet_type,
637            search,
638            page_cursor,
639            page_size,
640            sort,
641            order,
642            status,
643        } = params;
644
645        let local_var_configuration = &self.configuration;
646
647        let local_var_client = &local_var_configuration.client;
648
649        let local_var_uri_str = format!(
650            "{}/nfts/ownership/collections",
651            local_var_configuration.base_path
652        );
653        let mut local_var_req_builder =
654            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
655
656        if let Some(ref local_var_str) = ncw_id {
657            local_var_req_builder =
658                local_var_req_builder.query(&[("ncwId", &local_var_str.to_string())]);
659        }
660        if let Some(ref local_var_str) = wallet_type {
661            local_var_req_builder =
662                local_var_req_builder.query(&[("walletType", &local_var_str.to_string())]);
663        }
664        if let Some(ref local_var_str) = search {
665            local_var_req_builder =
666                local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
667        }
668        if let Some(ref local_var_str) = page_cursor {
669            local_var_req_builder =
670                local_var_req_builder.query(&[("pageCursor", &local_var_str.to_string())]);
671        }
672        if let Some(ref local_var_str) = page_size {
673            local_var_req_builder =
674                local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
675        }
676        if let Some(ref local_var_str) = sort {
677            local_var_req_builder = match "multi" {
678                "multi" => local_var_req_builder.query(
679                    &local_var_str
680                        .into_iter()
681                        .map(|p| ("sort".to_owned(), p.to_string()))
682                        .collect::<Vec<(std::string::String, std::string::String)>>(),
683                ),
684                _ => local_var_req_builder.query(&[(
685                    "sort",
686                    &local_var_str
687                        .into_iter()
688                        .map(|p| p.to_string())
689                        .collect::<Vec<String>>()
690                        .join(",")
691                        .to_string(),
692                )]),
693            };
694        }
695        if let Some(ref local_var_str) = order {
696            local_var_req_builder =
697                local_var_req_builder.query(&[("order", &local_var_str.to_string())]);
698        }
699        if let Some(ref local_var_str) = status {
700            local_var_req_builder =
701                local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
702        }
703        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
704            local_var_req_builder = local_var_req_builder
705                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
706        }
707
708        let local_var_req = local_var_req_builder.build()?;
709        let local_var_resp = local_var_client.execute(local_var_req).await?;
710
711        let local_var_status = local_var_resp.status();
712        let local_var_content_type = local_var_resp
713            .headers()
714            .get("content-type")
715            .and_then(|v| v.to_str().ok())
716            .unwrap_or("application/octet-stream");
717        let local_var_content_type = super::ContentType::from(local_var_content_type);
718        let local_var_content = local_var_resp.text().await?;
719
720        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
721            match local_var_content_type {
722                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
723                ContentType::Text => {
724                    return Err(Error::from(serde_json::Error::custom(
725                        "Received `text/plain` content type response that cannot be converted to \
726                         `models::ListOwnedCollectionsResponse`",
727                    )))
728                }
729                ContentType::Unsupported(local_var_unknown_type) => {
730                    return Err(Error::from(serde_json::Error::custom(format!(
731                        "Received `{local_var_unknown_type}` content type response that cannot be \
732                         converted to `models::ListOwnedCollectionsResponse`"
733                    ))))
734                }
735            }
736        } else {
737            let local_var_entity: Option<ListOwnedCollectionsError> =
738                serde_json::from_str(&local_var_content).ok();
739            let local_var_error = ResponseContent {
740                status: local_var_status,
741                content: local_var_content,
742                entity: local_var_entity,
743            };
744            Err(Error::ResponseError(local_var_error))
745        }
746    }
747
748    /// Returns all owned distinct tokens (for your workspace) and their data in
749    /// your workspace. </br>Endpoint Permission: Admin, Non-Signing Admin,
750    /// Signer, Approver, Editor.
751    async fn list_owned_tokens(
752        &self,
753        params: ListOwnedTokensParams,
754    ) -> Result<models::ListOwnedTokensResponse, Error<ListOwnedTokensError>> {
755        let ListOwnedTokensParams {
756            ncw_id,
757            wallet_type,
758            page_cursor,
759            page_size,
760            sort,
761            order,
762            status,
763            search,
764            spam,
765        } = params;
766
767        let local_var_configuration = &self.configuration;
768
769        let local_var_client = &local_var_configuration.client;
770
771        let local_var_uri_str = format!(
772            "{}/nfts/ownership/assets",
773            local_var_configuration.base_path
774        );
775        let mut local_var_req_builder =
776            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
777
778        if let Some(ref local_var_str) = ncw_id {
779            local_var_req_builder =
780                local_var_req_builder.query(&[("ncwId", &local_var_str.to_string())]);
781        }
782        if let Some(ref local_var_str) = wallet_type {
783            local_var_req_builder =
784                local_var_req_builder.query(&[("walletType", &local_var_str.to_string())]);
785        }
786        if let Some(ref local_var_str) = page_cursor {
787            local_var_req_builder =
788                local_var_req_builder.query(&[("pageCursor", &local_var_str.to_string())]);
789        }
790        if let Some(ref local_var_str) = page_size {
791            local_var_req_builder =
792                local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
793        }
794        if let Some(ref local_var_str) = sort {
795            local_var_req_builder = match "multi" {
796                "multi" => local_var_req_builder.query(
797                    &local_var_str
798                        .into_iter()
799                        .map(|p| ("sort".to_owned(), p.to_string()))
800                        .collect::<Vec<(std::string::String, std::string::String)>>(),
801                ),
802                _ => local_var_req_builder.query(&[(
803                    "sort",
804                    &local_var_str
805                        .into_iter()
806                        .map(|p| p.to_string())
807                        .collect::<Vec<String>>()
808                        .join(",")
809                        .to_string(),
810                )]),
811            };
812        }
813        if let Some(ref local_var_str) = order {
814            local_var_req_builder =
815                local_var_req_builder.query(&[("order", &local_var_str.to_string())]);
816        }
817        if let Some(ref local_var_str) = status {
818            local_var_req_builder =
819                local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
820        }
821        if let Some(ref local_var_str) = search {
822            local_var_req_builder =
823                local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
824        }
825        if let Some(ref local_var_str) = spam {
826            local_var_req_builder =
827                local_var_req_builder.query(&[("spam", &local_var_str.to_string())]);
828        }
829        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
830            local_var_req_builder = local_var_req_builder
831                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
832        }
833
834        let local_var_req = local_var_req_builder.build()?;
835        let local_var_resp = local_var_client.execute(local_var_req).await?;
836
837        let local_var_status = local_var_resp.status();
838        let local_var_content_type = local_var_resp
839            .headers()
840            .get("content-type")
841            .and_then(|v| v.to_str().ok())
842            .unwrap_or("application/octet-stream");
843        let local_var_content_type = super::ContentType::from(local_var_content_type);
844        let local_var_content = local_var_resp.text().await?;
845
846        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
847            match local_var_content_type {
848                ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
849                ContentType::Text => {
850                    return Err(Error::from(serde_json::Error::custom(
851                        "Received `text/plain` content type response that cannot be converted to \
852                         `models::ListOwnedTokensResponse`",
853                    )))
854                }
855                ContentType::Unsupported(local_var_unknown_type) => {
856                    return Err(Error::from(serde_json::Error::custom(format!(
857                        "Received `{local_var_unknown_type}` content type response that cannot be \
858                         converted to `models::ListOwnedTokensResponse`"
859                    ))))
860                }
861            }
862        } else {
863            let local_var_entity: Option<ListOwnedTokensError> =
864                serde_json::from_str(&local_var_content).ok();
865            let local_var_error = ResponseContent {
866                status: local_var_status,
867                content: local_var_content,
868                entity: local_var_entity,
869            };
870            Err(Error::ResponseError(local_var_error))
871        }
872    }
873
874    /// Updates the latest token metadata. Learn more about Fireblocks NFT management in the following [guide](https://developers.fireblocks.com/reference/deploy-an-nft-collection).  </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
875    async fn refresh_nft_metadata(
876        &self,
877        params: RefreshNftMetadataParams,
878    ) -> Result<(), Error<RefreshNftMetadataError>> {
879        let RefreshNftMetadataParams {
880            id,
881            idempotency_key,
882        } = params;
883
884        let local_var_configuration = &self.configuration;
885
886        let local_var_client = &local_var_configuration.client;
887
888        let local_var_uri_str = format!(
889            "{}/nfts/tokens/{id}",
890            local_var_configuration.base_path,
891            id = crate::apis::urlencode(id)
892        );
893        let mut local_var_req_builder =
894            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
895
896        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
897            local_var_req_builder = local_var_req_builder
898                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
899        }
900        if let Some(local_var_param_value) = idempotency_key {
901            local_var_req_builder =
902                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
903        }
904
905        let local_var_req = local_var_req_builder.build()?;
906        let local_var_resp = local_var_client.execute(local_var_req).await?;
907
908        let local_var_status = local_var_resp.status();
909        let local_var_content = local_var_resp.text().await?;
910
911        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
912            Ok(())
913        } else {
914            let local_var_entity: Option<RefreshNftMetadataError> =
915                serde_json::from_str(&local_var_content).ok();
916            let local_var_error = ResponseContent {
917                status: local_var_status,
918                content: local_var_content,
919                entity: local_var_entity,
920            };
921            Err(Error::ResponseError(local_var_error))
922        }
923    }
924
925    /// Updates all tokens and balances per blockchain and vault account. Learn more about Fireblocks NFT management in the following [guide](https://developers.fireblocks.com/reference/deploy-an-nft-collection).  </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
926    async fn update_ownership_tokens(
927        &self,
928        params: UpdateOwnershipTokensParams,
929    ) -> Result<(), Error<UpdateOwnershipTokensError>> {
930        let UpdateOwnershipTokensParams {
931            blockchain_descriptor,
932            vault_account_id,
933            idempotency_key,
934        } = params;
935
936        let local_var_configuration = &self.configuration;
937
938        let local_var_client = &local_var_configuration.client;
939
940        let local_var_uri_str = format!(
941            "{}/nfts/ownership/tokens",
942            local_var_configuration.base_path
943        );
944        let mut local_var_req_builder =
945            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
946
947        local_var_req_builder = local_var_req_builder
948            .query(&[("blockchainDescriptor", &blockchain_descriptor.to_string())]);
949        local_var_req_builder =
950            local_var_req_builder.query(&[("vaultAccountId", &vault_account_id.to_string())]);
951        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
952            local_var_req_builder = local_var_req_builder
953                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
954        }
955        if let Some(local_var_param_value) = idempotency_key {
956            local_var_req_builder =
957                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
958        }
959
960        let local_var_req = local_var_req_builder.build()?;
961        let local_var_resp = local_var_client.execute(local_var_req).await?;
962
963        let local_var_status = local_var_resp.status();
964        let local_var_content = local_var_resp.text().await?;
965
966        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
967            Ok(())
968        } else {
969            let local_var_entity: Option<UpdateOwnershipTokensError> =
970                serde_json::from_str(&local_var_content).ok();
971            let local_var_error = ResponseContent {
972                status: local_var_status,
973                content: local_var_content,
974                entity: local_var_entity,
975            };
976            Err(Error::ResponseError(local_var_error))
977        }
978    }
979
980    /// Updates token status for a workspace, in all workspace vaults.
981    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
982    /// Editor.
983    async fn update_token_ownership_status(
984        &self,
985        params: UpdateTokenOwnershipStatusParams,
986    ) -> Result<(), Error<UpdateTokenOwnershipStatusError>> {
987        let UpdateTokenOwnershipStatusParams {
988            id,
989            update_token_ownership_status_dto,
990            idempotency_key,
991        } = params;
992
993        let local_var_configuration = &self.configuration;
994
995        let local_var_client = &local_var_configuration.client;
996
997        let local_var_uri_str = format!(
998            "{}/nfts/ownership/tokens/{id}/status",
999            local_var_configuration.base_path,
1000            id = crate::apis::urlencode(id)
1001        );
1002        let mut local_var_req_builder =
1003            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1004
1005        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1006            local_var_req_builder = local_var_req_builder
1007                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1008        }
1009        if let Some(local_var_param_value) = idempotency_key {
1010            local_var_req_builder =
1011                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1012        }
1013        local_var_req_builder = local_var_req_builder.json(&update_token_ownership_status_dto);
1014
1015        let local_var_req = local_var_req_builder.build()?;
1016        let local_var_resp = local_var_client.execute(local_var_req).await?;
1017
1018        let local_var_status = local_var_resp.status();
1019        let local_var_content = local_var_resp.text().await?;
1020
1021        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1022            Ok(())
1023        } else {
1024            let local_var_entity: Option<UpdateTokenOwnershipStatusError> =
1025                serde_json::from_str(&local_var_content).ok();
1026            let local_var_error = ResponseContent {
1027                status: local_var_status,
1028                content: local_var_content,
1029                entity: local_var_entity,
1030            };
1031            Err(Error::ResponseError(local_var_error))
1032        }
1033    }
1034
1035    /// Updates tokens spam property for a workspace's token ownerships, in all
1036    /// vault accounts.  </br>Endpoint Permission: Admin, Non-Signing Admin,
1037    /// Signer, Approver, Editor.
1038    async fn update_tokens_ownership_spam(
1039        &self,
1040        params: UpdateTokensOwnershipSpamParams,
1041    ) -> Result<(), Error<UpdateTokensOwnershipSpamError>> {
1042        let UpdateTokensOwnershipSpamParams {
1043            token_ownership_spam_update_payload,
1044            idempotency_key,
1045        } = params;
1046
1047        let local_var_configuration = &self.configuration;
1048
1049        let local_var_client = &local_var_configuration.client;
1050
1051        let local_var_uri_str = format!(
1052            "{}/nfts/ownership/tokens/spam",
1053            local_var_configuration.base_path
1054        );
1055        let mut local_var_req_builder =
1056            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1057
1058        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1059            local_var_req_builder = local_var_req_builder
1060                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1061        }
1062        if let Some(local_var_param_value) = idempotency_key {
1063            local_var_req_builder =
1064                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1065        }
1066        local_var_req_builder = local_var_req_builder.json(&token_ownership_spam_update_payload);
1067
1068        let local_var_req = local_var_req_builder.build()?;
1069        let local_var_resp = local_var_client.execute(local_var_req).await?;
1070
1071        let local_var_status = local_var_resp.status();
1072        let local_var_content = local_var_resp.text().await?;
1073
1074        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1075            Ok(())
1076        } else {
1077            let local_var_entity: Option<UpdateTokensOwnershipSpamError> =
1078                serde_json::from_str(&local_var_content).ok();
1079            let local_var_error = ResponseContent {
1080                status: local_var_status,
1081                content: local_var_content,
1082                entity: local_var_entity,
1083            };
1084            Err(Error::ResponseError(local_var_error))
1085        }
1086    }
1087
1088    /// Updates tokens status for a workspace, in all vault accounts.
1089    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
1090    /// Editor.
1091    async fn update_tokens_ownership_status(
1092        &self,
1093        params: UpdateTokensOwnershipStatusParams,
1094    ) -> Result<(), Error<UpdateTokensOwnershipStatusError>> {
1095        let UpdateTokensOwnershipStatusParams {
1096            token_ownership_status_update_payload,
1097            idempotency_key,
1098        } = params;
1099
1100        let local_var_configuration = &self.configuration;
1101
1102        let local_var_client = &local_var_configuration.client;
1103
1104        let local_var_uri_str = format!(
1105            "{}/nfts/ownership/tokens/status",
1106            local_var_configuration.base_path
1107        );
1108        let mut local_var_req_builder =
1109            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1110
1111        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1112            local_var_req_builder = local_var_req_builder
1113                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1114        }
1115        if let Some(local_var_param_value) = idempotency_key {
1116            local_var_req_builder =
1117                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1118        }
1119        local_var_req_builder = local_var_req_builder.json(&token_ownership_status_update_payload);
1120
1121        let local_var_req = local_var_req_builder.build()?;
1122        let local_var_resp = local_var_client.execute(local_var_req).await?;
1123
1124        let local_var_status = local_var_resp.status();
1125        let local_var_content = local_var_resp.text().await?;
1126
1127        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1128            Ok(())
1129        } else {
1130            let local_var_entity: Option<UpdateTokensOwnershipStatusError> =
1131                serde_json::from_str(&local_var_content).ok();
1132            let local_var_error = ResponseContent {
1133                status: local_var_status,
1134                content: local_var_content,
1135                entity: local_var_entity,
1136            };
1137            Err(Error::ResponseError(local_var_error))
1138        }
1139    }
1140}
1141
1142/// struct for typed errors of method [`get_nft`]
1143#[derive(Debug, Clone, Serialize, Deserialize)]
1144#[serde(untagged)]
1145pub enum GetNftError {
1146    UnknownValue(serde_json::Value),
1147}
1148
1149/// struct for typed errors of method [`get_nfts`]
1150#[derive(Debug, Clone, Serialize, Deserialize)]
1151#[serde(untagged)]
1152pub enum GetNftsError {
1153    UnknownValue(serde_json::Value),
1154}
1155
1156/// struct for typed errors of method [`get_ownership_tokens`]
1157#[derive(Debug, Clone, Serialize, Deserialize)]
1158#[serde(untagged)]
1159pub enum GetOwnershipTokensError {
1160    UnknownValue(serde_json::Value),
1161}
1162
1163/// struct for typed errors of method [`list_owned_collections`]
1164#[derive(Debug, Clone, Serialize, Deserialize)]
1165#[serde(untagged)]
1166pub enum ListOwnedCollectionsError {
1167    UnknownValue(serde_json::Value),
1168}
1169
1170/// struct for typed errors of method [`list_owned_tokens`]
1171#[derive(Debug, Clone, Serialize, Deserialize)]
1172#[serde(untagged)]
1173pub enum ListOwnedTokensError {
1174    UnknownValue(serde_json::Value),
1175}
1176
1177/// struct for typed errors of method [`refresh_nft_metadata`]
1178#[derive(Debug, Clone, Serialize, Deserialize)]
1179#[serde(untagged)]
1180pub enum RefreshNftMetadataError {
1181    UnknownValue(serde_json::Value),
1182}
1183
1184/// struct for typed errors of method [`update_ownership_tokens`]
1185#[derive(Debug, Clone, Serialize, Deserialize)]
1186#[serde(untagged)]
1187pub enum UpdateOwnershipTokensError {
1188    UnknownValue(serde_json::Value),
1189}
1190
1191/// struct for typed errors of method [`update_token_ownership_status`]
1192#[derive(Debug, Clone, Serialize, Deserialize)]
1193#[serde(untagged)]
1194pub enum UpdateTokenOwnershipStatusError {
1195    UnknownValue(serde_json::Value),
1196}
1197
1198/// struct for typed errors of method [`update_tokens_ownership_spam`]
1199#[derive(Debug, Clone, Serialize, Deserialize)]
1200#[serde(untagged)]
1201pub enum UpdateTokensOwnershipSpamError {
1202    Status400(),
1203    Status404(),
1204    UnknownValue(serde_json::Value),
1205}
1206
1207/// struct for typed errors of method [`update_tokens_ownership_status`]
1208#[derive(Debug, Clone, Serialize, Deserialize)]
1209#[serde(untagged)]
1210pub enum UpdateTokensOwnershipStatusError {
1211    Status400(),
1212    Status404(),
1213    UnknownValue(serde_json::Value),
1214}