1use {
10 super::{configuration, Error},
11 crate::{apis::ResponseContent, models},
12 async_trait::async_trait,
13 reqwest,
14 serde::{Deserialize, Serialize},
15 std::sync::Arc,
16};
17
18#[async_trait]
19pub trait TokenizationApi: Send + Sync {
20 async fn burn_collection_token(
21 &self,
22 params: BurnCollectionTokenParams,
23 ) -> Result<models::CollectionBurnResponseDto, Error<BurnCollectionTokenError>>;
24 async fn create_new_collection(
25 &self,
26 params: CreateNewCollectionParams,
27 ) -> Result<models::CollectionLinkDto, Error<CreateNewCollectionError>>;
28 async fn fetch_collection_token_details(
29 &self,
30 params: FetchCollectionTokenDetailsParams,
31 ) -> Result<models::CollectionLinkDto, Error<FetchCollectionTokenDetailsError>>;
32 async fn get_collection_by_id(
33 &self,
34 params: GetCollectionByIdParams,
35 ) -> Result<models::CollectionLinkDto, Error<GetCollectionByIdError>>;
36 async fn get_linked_collections(
37 &self,
38 params: GetLinkedCollectionsParams,
39 ) -> Result<models::GetLinkedCollectionsPaginatedResponse, Error<GetLinkedCollectionsError>>;
40 async fn get_linked_token(
41 &self,
42 params: GetLinkedTokenParams,
43 ) -> Result<models::TokenLinkDto, Error<GetLinkedTokenError>>;
44 async fn get_linked_tokens(
45 &self,
46 params: GetLinkedTokensParams,
47 ) -> Result<models::TokensPaginatedResponse, Error<GetLinkedTokensError>>;
48 async fn issue_new_token(
49 &self,
50 params: IssueNewTokenParams,
51 ) -> Result<models::TokenLinkDto, Error<IssueNewTokenError>>;
52 async fn link(&self, params: LinkParams) -> Result<models::TokenLinkDto, Error<LinkError>>;
53 async fn mint_collection_token(
54 &self,
55 params: MintCollectionTokenParams,
56 ) -> Result<models::CollectionMintResponseDto, Error<MintCollectionTokenError>>;
57 async fn unlink(&self, params: UnlinkParams) -> Result<(), Error<UnlinkError>>;
58 async fn unlink_collection(
59 &self,
60 params: UnlinkCollectionParams,
61 ) -> Result<(), Error<UnlinkCollectionError>>;
62}
63
64pub struct TokenizationApiClient {
65 configuration: Arc<configuration::Configuration>,
66}
67
68impl TokenizationApiClient {
69 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
70 Self { configuration }
71 }
72}
73
74#[derive(Clone, Debug)]
76#[cfg_attr(feature = "bon", derive(::bon::Builder))]
77pub struct BurnCollectionTokenParams {
78 pub id: String,
80 pub collection_burn_request_dto: models::CollectionBurnRequestDto,
81 pub idempotency_key: Option<String>,
86}
87
88#[derive(Clone, Debug)]
90#[cfg_attr(feature = "bon", derive(::bon::Builder))]
91pub struct CreateNewCollectionParams {
92 pub collection_deploy_request_dto: models::CollectionDeployRequestDto,
93 pub idempotency_key: Option<String>,
98}
99
100#[derive(Clone, Debug)]
103#[cfg_attr(feature = "bon", derive(::bon::Builder))]
104pub struct FetchCollectionTokenDetailsParams {
105 pub id: String,
107 pub token_id: String,
109}
110
111#[derive(Clone, Debug)]
113#[cfg_attr(feature = "bon", derive(::bon::Builder))]
114pub struct GetCollectionByIdParams {
115 pub id: String,
117}
118
119#[derive(Clone, Debug)]
121#[cfg_attr(feature = "bon", derive(::bon::Builder))]
122pub struct GetLinkedCollectionsParams {
123 pub page_cursor: Option<String>,
126 pub page_size: Option<f64>,
129 pub status: Option<serde_json::Value>,
131}
132
133#[derive(Clone, Debug)]
135#[cfg_attr(feature = "bon", derive(::bon::Builder))]
136pub struct GetLinkedTokenParams {
137 pub id: String,
139}
140
141#[derive(Clone, Debug)]
143#[cfg_attr(feature = "bon", derive(::bon::Builder))]
144pub struct GetLinkedTokensParams {
145 pub page_cursor: Option<String>,
147 pub page_size: Option<f64>,
149 pub status: Option<serde_json::Value>,
151}
152
153#[derive(Clone, Debug)]
155#[cfg_attr(feature = "bon", derive(::bon::Builder))]
156pub struct IssueNewTokenParams {
157 pub create_token_request_dto: models::CreateTokenRequestDto,
158 pub idempotency_key: Option<String>,
163}
164
165#[derive(Clone, Debug)]
167#[cfg_attr(feature = "bon", derive(::bon::Builder))]
168pub struct LinkParams {
169 pub token_link_request_dto: models::TokenLinkRequestDto,
170 pub idempotency_key: Option<String>,
175}
176
177#[derive(Clone, Debug)]
179#[cfg_attr(feature = "bon", derive(::bon::Builder))]
180pub struct MintCollectionTokenParams {
181 pub id: String,
183 pub collection_mint_request_dto: models::CollectionMintRequestDto,
184 pub idempotency_key: Option<String>,
189}
190
191#[derive(Clone, Debug)]
193#[cfg_attr(feature = "bon", derive(::bon::Builder))]
194pub struct UnlinkParams {
195 pub id: String,
197}
198
199#[derive(Clone, Debug)]
201#[cfg_attr(feature = "bon", derive(::bon::Builder))]
202pub struct UnlinkCollectionParams {
203 pub id: String,
205}
206
207#[async_trait]
208impl TokenizationApi for TokenizationApiClient {
209 async fn burn_collection_token(
212 &self,
213 params: BurnCollectionTokenParams,
214 ) -> Result<models::CollectionBurnResponseDto, Error<BurnCollectionTokenError>> {
215 let BurnCollectionTokenParams {
216 id,
217 collection_burn_request_dto,
218 idempotency_key,
219 } = params;
220
221 let local_var_configuration = &self.configuration;
222
223 let local_var_client = &local_var_configuration.client;
224
225 let local_var_uri_str = format!(
226 "{}/tokenization/collections/{id}/tokens/burn",
227 local_var_configuration.base_path,
228 id = crate::apis::urlencode(id)
229 );
230 let mut local_var_req_builder =
231 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
232
233 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
234 local_var_req_builder = local_var_req_builder
235 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
236 }
237 if let Some(local_var_param_value) = idempotency_key {
238 local_var_req_builder =
239 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
240 }
241 local_var_req_builder = local_var_req_builder.json(&collection_burn_request_dto);
242
243 let local_var_req = local_var_req_builder.build()?;
244 let local_var_resp = local_var_client.execute(local_var_req).await?;
245
246 let local_var_status = local_var_resp.status();
247 let local_var_content = local_var_resp.text().await?;
248
249 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
250 serde_json::from_str(&local_var_content).map_err(Error::from)
251 } else {
252 let local_var_entity: Option<BurnCollectionTokenError> =
253 serde_json::from_str(&local_var_content).ok();
254 let local_var_error = ResponseContent {
255 status: local_var_status,
256 content: local_var_content,
257 entity: local_var_entity,
258 };
259 Err(Error::ResponseError(local_var_error))
260 }
261 }
262
263 async fn create_new_collection(
266 &self,
267 params: CreateNewCollectionParams,
268 ) -> Result<models::CollectionLinkDto, Error<CreateNewCollectionError>> {
269 let CreateNewCollectionParams {
270 collection_deploy_request_dto,
271 idempotency_key,
272 } = params;
273
274 let local_var_configuration = &self.configuration;
275
276 let local_var_client = &local_var_configuration.client;
277
278 let local_var_uri_str = format!(
279 "{}/tokenization/collections",
280 local_var_configuration.base_path
281 );
282 let mut local_var_req_builder =
283 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
284
285 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
286 local_var_req_builder = local_var_req_builder
287 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
288 }
289 if let Some(local_var_param_value) = idempotency_key {
290 local_var_req_builder =
291 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
292 }
293 local_var_req_builder = local_var_req_builder.json(&collection_deploy_request_dto);
294
295 let local_var_req = local_var_req_builder.build()?;
296 let local_var_resp = local_var_client.execute(local_var_req).await?;
297
298 let local_var_status = local_var_resp.status();
299 let local_var_content = local_var_resp.text().await?;
300
301 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
302 serde_json::from_str(&local_var_content).map_err(Error::from)
303 } else {
304 let local_var_entity: Option<CreateNewCollectionError> =
305 serde_json::from_str(&local_var_content).ok();
306 let local_var_error = ResponseContent {
307 status: local_var_status,
308 content: local_var_content,
309 entity: local_var_entity,
310 };
311 Err(Error::ResponseError(local_var_error))
312 }
313 }
314
315 async fn fetch_collection_token_details(
318 &self,
319 params: FetchCollectionTokenDetailsParams,
320 ) -> Result<models::CollectionLinkDto, Error<FetchCollectionTokenDetailsError>> {
321 let FetchCollectionTokenDetailsParams { id, token_id } = params;
322
323 let local_var_configuration = &self.configuration;
324
325 let local_var_client = &local_var_configuration.client;
326
327 let local_var_uri_str = format!(
328 "{}/tokenization/collections/{id}/tokens/{tokenId}",
329 local_var_configuration.base_path,
330 id = crate::apis::urlencode(id),
331 tokenId = crate::apis::urlencode(token_id)
332 );
333 let mut local_var_req_builder =
334 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
335
336 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
337 local_var_req_builder = local_var_req_builder
338 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
339 }
340
341 let local_var_req = local_var_req_builder.build()?;
342 let local_var_resp = local_var_client.execute(local_var_req).await?;
343
344 let local_var_status = local_var_resp.status();
345 let local_var_content = local_var_resp.text().await?;
346
347 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
348 serde_json::from_str(&local_var_content).map_err(Error::from)
349 } else {
350 let local_var_entity: Option<FetchCollectionTokenDetailsError> =
351 serde_json::from_str(&local_var_content).ok();
352 let local_var_error = ResponseContent {
353 status: local_var_status,
354 content: local_var_content,
355 entity: local_var_entity,
356 };
357 Err(Error::ResponseError(local_var_error))
358 }
359 }
360
361 async fn get_collection_by_id(
364 &self,
365 params: GetCollectionByIdParams,
366 ) -> Result<models::CollectionLinkDto, Error<GetCollectionByIdError>> {
367 let GetCollectionByIdParams { id } = params;
368
369 let local_var_configuration = &self.configuration;
370
371 let local_var_client = &local_var_configuration.client;
372
373 let local_var_uri_str = format!(
374 "{}/tokenization/collections/{id}",
375 local_var_configuration.base_path,
376 id = crate::apis::urlencode(id)
377 );
378 let mut local_var_req_builder =
379 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
380
381 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
382 local_var_req_builder = local_var_req_builder
383 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
384 }
385
386 let local_var_req = local_var_req_builder.build()?;
387 let local_var_resp = local_var_client.execute(local_var_req).await?;
388
389 let local_var_status = local_var_resp.status();
390 let local_var_content = local_var_resp.text().await?;
391
392 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
393 serde_json::from_str(&local_var_content).map_err(Error::from)
394 } else {
395 let local_var_entity: Option<GetCollectionByIdError> =
396 serde_json::from_str(&local_var_content).ok();
397 let local_var_error = ResponseContent {
398 status: local_var_status,
399 content: local_var_content,
400 entity: local_var_entity,
401 };
402 Err(Error::ResponseError(local_var_error))
403 }
404 }
405
406 async fn get_linked_collections(
409 &self,
410 params: GetLinkedCollectionsParams,
411 ) -> Result<models::GetLinkedCollectionsPaginatedResponse, Error<GetLinkedCollectionsError>>
412 {
413 let GetLinkedCollectionsParams {
414 page_cursor,
415 page_size,
416 status,
417 } = params;
418
419 let local_var_configuration = &self.configuration;
420
421 let local_var_client = &local_var_configuration.client;
422
423 let local_var_uri_str = format!(
424 "{}/tokenization/collections",
425 local_var_configuration.base_path
426 );
427 let mut local_var_req_builder =
428 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
429
430 if let Some(ref local_var_str) = page_cursor {
431 local_var_req_builder =
432 local_var_req_builder.query(&[("pageCursor", &local_var_str.to_string())]);
433 }
434 if let Some(ref local_var_str) = page_size {
435 local_var_req_builder =
436 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
437 }
438 if let Some(ref local_var_str) = status {
439 local_var_req_builder =
440 local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
441 }
442 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
443 local_var_req_builder = local_var_req_builder
444 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
445 }
446
447 let local_var_req = local_var_req_builder.build()?;
448 let local_var_resp = local_var_client.execute(local_var_req).await?;
449
450 let local_var_status = local_var_resp.status();
451 let local_var_content = local_var_resp.text().await?;
452
453 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
454 serde_json::from_str(&local_var_content).map_err(Error::from)
455 } else {
456 let local_var_entity: Option<GetLinkedCollectionsError> =
457 serde_json::from_str(&local_var_content).ok();
458 let local_var_error = ResponseContent {
459 status: local_var_status,
460 content: local_var_content,
461 entity: local_var_entity,
462 };
463 Err(Error::ResponseError(local_var_error))
464 }
465 }
466
467 async fn get_linked_token(
470 &self,
471 params: GetLinkedTokenParams,
472 ) -> Result<models::TokenLinkDto, Error<GetLinkedTokenError>> {
473 let GetLinkedTokenParams { id } = params;
474
475 let local_var_configuration = &self.configuration;
476
477 let local_var_client = &local_var_configuration.client;
478
479 let local_var_uri_str = format!(
480 "{}/tokenization/tokens/{id}",
481 local_var_configuration.base_path,
482 id = crate::apis::urlencode(id)
483 );
484 let mut local_var_req_builder =
485 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
486
487 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
488 local_var_req_builder = local_var_req_builder
489 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
490 }
491
492 let local_var_req = local_var_req_builder.build()?;
493 let local_var_resp = local_var_client.execute(local_var_req).await?;
494
495 let local_var_status = local_var_resp.status();
496 let local_var_content = local_var_resp.text().await?;
497
498 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
499 serde_json::from_str(&local_var_content).map_err(Error::from)
500 } else {
501 let local_var_entity: Option<GetLinkedTokenError> =
502 serde_json::from_str(&local_var_content).ok();
503 let local_var_error = ResponseContent {
504 status: local_var_status,
505 content: local_var_content,
506 entity: local_var_entity,
507 };
508 Err(Error::ResponseError(local_var_error))
509 }
510 }
511
512 async fn get_linked_tokens(
515 &self,
516 params: GetLinkedTokensParams,
517 ) -> Result<models::TokensPaginatedResponse, Error<GetLinkedTokensError>> {
518 let GetLinkedTokensParams {
519 page_cursor,
520 page_size,
521 status,
522 } = params;
523
524 let local_var_configuration = &self.configuration;
525
526 let local_var_client = &local_var_configuration.client;
527
528 let local_var_uri_str =
529 format!("{}/tokenization/tokens", local_var_configuration.base_path);
530 let mut local_var_req_builder =
531 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
532
533 if let Some(ref local_var_str) = page_cursor {
534 local_var_req_builder =
535 local_var_req_builder.query(&[("pageCursor", &local_var_str.to_string())]);
536 }
537 if let Some(ref local_var_str) = page_size {
538 local_var_req_builder =
539 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
540 }
541 if let Some(ref local_var_str) = status {
542 local_var_req_builder =
543 local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
544 }
545 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
546 local_var_req_builder = local_var_req_builder
547 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
548 }
549
550 let local_var_req = local_var_req_builder.build()?;
551 let local_var_resp = local_var_client.execute(local_var_req).await?;
552
553 let local_var_status = local_var_resp.status();
554 let local_var_content = local_var_resp.text().await?;
555
556 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
557 serde_json::from_str(&local_var_content).map_err(Error::from)
558 } else {
559 let local_var_entity: Option<GetLinkedTokensError> =
560 serde_json::from_str(&local_var_content).ok();
561 let local_var_error = ResponseContent {
562 status: local_var_status,
563 content: local_var_content,
564 entity: local_var_entity,
565 };
566 Err(Error::ResponseError(local_var_error))
567 }
568 }
569
570 async fn issue_new_token(
579 &self,
580 params: IssueNewTokenParams,
581 ) -> Result<models::TokenLinkDto, Error<IssueNewTokenError>> {
582 let IssueNewTokenParams {
583 create_token_request_dto,
584 idempotency_key,
585 } = params;
586
587 let local_var_configuration = &self.configuration;
588
589 let local_var_client = &local_var_configuration.client;
590
591 let local_var_uri_str =
592 format!("{}/tokenization/tokens", local_var_configuration.base_path);
593 let mut local_var_req_builder =
594 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
595
596 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
597 local_var_req_builder = local_var_req_builder
598 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
599 }
600 if let Some(local_var_param_value) = idempotency_key {
601 local_var_req_builder =
602 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
603 }
604 local_var_req_builder = local_var_req_builder.json(&create_token_request_dto);
605
606 let local_var_req = local_var_req_builder.build()?;
607 let local_var_resp = local_var_client.execute(local_var_req).await?;
608
609 let local_var_status = local_var_resp.status();
610 let local_var_content = local_var_resp.text().await?;
611
612 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
613 serde_json::from_str(&local_var_content).map_err(Error::from)
614 } else {
615 let local_var_entity: Option<IssueNewTokenError> =
616 serde_json::from_str(&local_var_content).ok();
617 let local_var_error = ResponseContent {
618 status: local_var_status,
619 content: local_var_content,
620 entity: local_var_entity,
621 };
622 Err(Error::ResponseError(local_var_error))
623 }
624 }
625
626 async fn link(&self, params: LinkParams) -> Result<models::TokenLinkDto, Error<LinkError>> {
629 let LinkParams {
630 token_link_request_dto,
631 idempotency_key,
632 } = params;
633
634 let local_var_configuration = &self.configuration;
635
636 let local_var_client = &local_var_configuration.client;
637
638 let local_var_uri_str = format!(
639 "{}/tokenization/tokens/link",
640 local_var_configuration.base_path
641 );
642 let mut local_var_req_builder =
643 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
644
645 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
646 local_var_req_builder = local_var_req_builder
647 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
648 }
649 if let Some(local_var_param_value) = idempotency_key {
650 local_var_req_builder =
651 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
652 }
653 local_var_req_builder = local_var_req_builder.json(&token_link_request_dto);
654
655 let local_var_req = local_var_req_builder.build()?;
656 let local_var_resp = local_var_client.execute(local_var_req).await?;
657
658 let local_var_status = local_var_resp.status();
659 let local_var_content = local_var_resp.text().await?;
660
661 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
662 serde_json::from_str(&local_var_content).map_err(Error::from)
663 } else {
664 let local_var_entity: Option<LinkError> = serde_json::from_str(&local_var_content).ok();
665 let local_var_error = ResponseContent {
666 status: local_var_status,
667 content: local_var_content,
668 entity: local_var_entity,
669 };
670 Err(Error::ResponseError(local_var_error))
671 }
672 }
673
674 async fn mint_collection_token(
677 &self,
678 params: MintCollectionTokenParams,
679 ) -> Result<models::CollectionMintResponseDto, Error<MintCollectionTokenError>> {
680 let MintCollectionTokenParams {
681 id,
682 collection_mint_request_dto,
683 idempotency_key,
684 } = params;
685
686 let local_var_configuration = &self.configuration;
687
688 let local_var_client = &local_var_configuration.client;
689
690 let local_var_uri_str = format!(
691 "{}/tokenization/collections/{id}/tokens/mint",
692 local_var_configuration.base_path,
693 id = crate::apis::urlencode(id)
694 );
695 let mut local_var_req_builder =
696 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
697
698 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
699 local_var_req_builder = local_var_req_builder
700 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
701 }
702 if let Some(local_var_param_value) = idempotency_key {
703 local_var_req_builder =
704 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
705 }
706 local_var_req_builder = local_var_req_builder.json(&collection_mint_request_dto);
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 = local_var_resp.text().await?;
713
714 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
715 serde_json::from_str(&local_var_content).map_err(Error::from)
716 } else {
717 let local_var_entity: Option<MintCollectionTokenError> =
718 serde_json::from_str(&local_var_content).ok();
719 let local_var_error = ResponseContent {
720 status: local_var_status,
721 content: local_var_content,
722 entity: local_var_entity,
723 };
724 Err(Error::ResponseError(local_var_error))
725 }
726 }
727
728 async fn unlink(&self, params: UnlinkParams) -> Result<(), Error<UnlinkError>> {
733 let UnlinkParams { id } = params;
734
735 let local_var_configuration = &self.configuration;
736
737 let local_var_client = &local_var_configuration.client;
738
739 let local_var_uri_str = format!(
740 "{}/tokenization/tokens/{id}",
741 local_var_configuration.base_path,
742 id = crate::apis::urlencode(id)
743 );
744 let mut local_var_req_builder =
745 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
746
747 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
748 local_var_req_builder = local_var_req_builder
749 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
750 }
751
752 let local_var_req = local_var_req_builder.build()?;
753 let local_var_resp = local_var_client.execute(local_var_req).await?;
754
755 let local_var_status = local_var_resp.status();
756 let local_var_content = local_var_resp.text().await?;
757
758 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
759 Ok(())
760 } else {
761 let local_var_entity: Option<UnlinkError> =
762 serde_json::from_str(&local_var_content).ok();
763 let local_var_error = ResponseContent {
764 status: local_var_status,
765 content: local_var_content,
766 entity: local_var_entity,
767 };
768 Err(Error::ResponseError(local_var_error))
769 }
770 }
771
772 async fn unlink_collection(
775 &self,
776 params: UnlinkCollectionParams,
777 ) -> Result<(), Error<UnlinkCollectionError>> {
778 let UnlinkCollectionParams { id } = params;
779
780 let local_var_configuration = &self.configuration;
781
782 let local_var_client = &local_var_configuration.client;
783
784 let local_var_uri_str = format!(
785 "{}/tokenization/collections/{id}",
786 local_var_configuration.base_path,
787 id = crate::apis::urlencode(id)
788 );
789 let mut local_var_req_builder =
790 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
791
792 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
793 local_var_req_builder = local_var_req_builder
794 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
795 }
796
797 let local_var_req = local_var_req_builder.build()?;
798 let local_var_resp = local_var_client.execute(local_var_req).await?;
799
800 let local_var_status = local_var_resp.status();
801 let local_var_content = local_var_resp.text().await?;
802
803 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
804 Ok(())
805 } else {
806 let local_var_entity: Option<UnlinkCollectionError> =
807 serde_json::from_str(&local_var_content).ok();
808 let local_var_error = ResponseContent {
809 status: local_var_status,
810 content: local_var_content,
811 entity: local_var_entity,
812 };
813 Err(Error::ResponseError(local_var_error))
814 }
815 }
816}
817
818#[derive(Debug, Clone, Serialize, Deserialize)]
820#[serde(untagged)]
821pub enum BurnCollectionTokenError {
822 DefaultResponse(models::ErrorSchema),
823 UnknownValue(serde_json::Value),
824}
825
826#[derive(Debug, Clone, Serialize, Deserialize)]
828#[serde(untagged)]
829pub enum CreateNewCollectionError {
830 DefaultResponse(models::ErrorSchema),
831 UnknownValue(serde_json::Value),
832}
833
834#[derive(Debug, Clone, Serialize, Deserialize)]
836#[serde(untagged)]
837pub enum FetchCollectionTokenDetailsError {
838 DefaultResponse(models::ErrorSchema),
839 UnknownValue(serde_json::Value),
840}
841
842#[derive(Debug, Clone, Serialize, Deserialize)]
844#[serde(untagged)]
845pub enum GetCollectionByIdError {
846 DefaultResponse(models::ErrorSchema),
847 UnknownValue(serde_json::Value),
848}
849
850#[derive(Debug, Clone, Serialize, Deserialize)]
852#[serde(untagged)]
853pub enum GetLinkedCollectionsError {
854 DefaultResponse(models::ErrorSchema),
855 UnknownValue(serde_json::Value),
856}
857
858#[derive(Debug, Clone, Serialize, Deserialize)]
860#[serde(untagged)]
861pub enum GetLinkedTokenError {
862 DefaultResponse(models::ErrorSchema),
863 UnknownValue(serde_json::Value),
864}
865
866#[derive(Debug, Clone, Serialize, Deserialize)]
868#[serde(untagged)]
869pub enum GetLinkedTokensError {
870 DefaultResponse(models::ErrorSchema),
871 UnknownValue(serde_json::Value),
872}
873
874#[derive(Debug, Clone, Serialize, Deserialize)]
876#[serde(untagged)]
877pub enum IssueNewTokenError {
878 Status409(models::AssetAlreadyExistHttpError),
879 UnknownValue(serde_json::Value),
880}
881
882#[derive(Debug, Clone, Serialize, Deserialize)]
884#[serde(untagged)]
885pub enum LinkError {
886 Status404(),
887 Status409(models::TokenLinkExistsHttpError),
888 DefaultResponse(models::ErrorSchema),
889 UnknownValue(serde_json::Value),
890}
891
892#[derive(Debug, Clone, Serialize, Deserialize)]
894#[serde(untagged)]
895pub enum MintCollectionTokenError {
896 DefaultResponse(models::ErrorSchema),
897 UnknownValue(serde_json::Value),
898}
899
900#[derive(Debug, Clone, Serialize, Deserialize)]
902#[serde(untagged)]
903pub enum UnlinkError {
904 Status404(models::NotFoundException),
905 DefaultResponse(models::ErrorSchema),
906 UnknownValue(serde_json::Value),
907}
908
909#[derive(Debug, Clone, Serialize, Deserialize)]
911#[serde(untagged)]
912pub enum UnlinkCollectionError {
913 Status404(),
914 DefaultResponse(models::ErrorSchema),
915 UnknownValue(serde_json::Value),
916}