1pub use near_openapi_types as types;
401#[allow(unused_imports)]
402use progenitor_client::{encode_path, ClientHooks, OperationInfo, RequestBuilderExt};
403#[allow(unused_imports)]
404pub use progenitor_client::{ByteStream, ClientInfo, Error, ResponseValue};
405#[derive(Clone, Debug)]
406#[doc = "Client for NEAR Protocol JSON RPC API\n\nVersion: 1.2.0"]
407pub struct Client {
408 pub(crate) baseurl: String,
409 pub(crate) client: reqwest::Client,
410}
411impl Client {
412 #[doc = r" Create a new client."]
413 #[doc = r""]
414 #[doc = r" `baseurl` is the base URL provided to the internal"]
415 #[doc = r" `reqwest::Client`, and should include a scheme and hostname,"]
416 #[doc = r" as well as port and a path stem if applicable."]
417 pub fn new(baseurl: &str) -> Self {
418 #[cfg(not(target_arch = "wasm32"))]
419 let client = {
420 let dur = std::time::Duration::from_secs(15);
421 reqwest::ClientBuilder::new()
422 .connect_timeout(dur)
423 .timeout(dur)
424 };
425 #[cfg(target_arch = "wasm32")]
426 let client = reqwest::ClientBuilder::new();
427 Self::new_with_client(baseurl, client.build().unwrap())
428 }
429 #[doc = r" Construct a new client with an existing `reqwest::Client`,"]
430 #[doc = r" allowing more control over its configuration."]
431 #[doc = r""]
432 #[doc = r" `baseurl` is the base URL provided to the internal"]
433 #[doc = r" `reqwest::Client`, and should include a scheme and hostname,"]
434 #[doc = r" as well as port and a path stem if applicable."]
435 pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self {
436 Self {
437 baseurl: baseurl.to_string(),
438 client,
439 }
440 }
441}
442impl ClientInfo<()> for Client {
443 fn api_version() -> &'static str {
444 "1.2.0"
445 }
446 fn baseurl(&self) -> &str {
447 self.baseurl.as_str()
448 }
449 fn client(&self) -> &reqwest::Client {
450 &self.client
451 }
452 fn inner(&self) -> &() {
453 &()
454 }
455}
456impl ClientHooks<()> for &Client {}
457#[allow(clippy::all)]
458#[allow(elided_named_lifetimes)]
459impl Client {
460 #[doc = "[Deprecated] Returns changes for a given account, contract or contract code for given block height or hash. Consider using changes instead.\n\nSends a `POST` request to `/EXPERIMENTAL_changes`\n\n"]
461 pub async fn experimental_changes<'a>(
462 &'a self,
463 body: &'a types::JsonRpcRequestForExperimentalChanges,
464 ) -> Result<
465 ResponseValue<
466 types::JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcStateChangesError,
467 >,
468 Error<()>,
469 > {
470 let url = format!("{}/", self.baseurl,);
471 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
472 header_map.append(
473 ::reqwest::header::HeaderName::from_static("api-version"),
474 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
475 );
476 #[allow(unused_mut)]
477 let mut request = self
478 .client
479 .post(url)
480 .header(
481 ::reqwest::header::ACCEPT,
482 ::reqwest::header::HeaderValue::from_static("application/json"),
483 )
484 .json(&body)
485 .headers(header_map)
486 .build()?;
487 let info = OperationInfo {
488 operation_id: "experimental_changes",
489 };
490 self.pre(&mut request, &info).await?;
491 let result = self.exec(request, &info).await;
492 self.post(&result, &info).await?;
493 let response = result?;
494 match response.status().as_u16() {
495 200u16 => ResponseValue::from_response(response).await,
496 _ => Err(Error::UnexpectedResponse(response)),
497 }
498 }
499 #[doc = "[Deprecated] Returns changes in block for given block height or hash over all transactions for all the types. Includes changes like account_touched, access_key_touched, data_touched, contract_code_touched. Consider using block_effects instead\n\nSends a `POST` request to `/EXPERIMENTAL_changes_in_block`\n\n"]
500 pub async fn experimental_changes_in_block<'a>(
501 &'a self,
502 body: &'a types::JsonRpcRequestForExperimentalChangesInBlock,
503 ) -> Result<
504 ResponseValue<
505 types::JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcStateChangesError,
506 >,
507 Error<()>,
508 > {
509 let url = format!("{}/", self.baseurl,);
510 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
511 header_map.append(
512 ::reqwest::header::HeaderName::from_static("api-version"),
513 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
514 );
515 #[allow(unused_mut)]
516 let mut request = self
517 .client
518 .post(url)
519 .header(
520 ::reqwest::header::ACCEPT,
521 ::reqwest::header::HeaderValue::from_static("application/json"),
522 )
523 .json(&body)
524 .headers(header_map)
525 .build()?;
526 let info = OperationInfo {
527 operation_id: "experimental_changes_in_block",
528 };
529 self.pre(&mut request, &info).await?;
530 let result = self.exec(request, &info).await;
531 self.post(&result, &info).await?;
532 let response = result?;
533 match response.status().as_u16() {
534 200u16 => ResponseValue::from_response(response).await,
535 _ => Err(Error::UnexpectedResponse(response)),
536 }
537 }
538 #[doc = "Queries the congestion level of a shard. More info about congestion [here](https://near.github.io/nearcore/architecture/how/receipt-congestion.html?highlight=congestion#receipt-congestion)\n\nSends a `POST` request to `/EXPERIMENTAL_congestion_level`\n\n"]
539 pub async fn experimental_congestion_level<'a>(
540 &'a self,
541 body: &'a types::JsonRpcRequestForExperimentalCongestionLevel,
542 ) -> Result<
543 ResponseValue<types::JsonRpcResponseForRpcCongestionLevelResponseAndRpcChunkError>,
544 Error<()>,
545 > {
546 let url = format!("{}/", self.baseurl,);
547 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
548 header_map.append(
549 ::reqwest::header::HeaderName::from_static("api-version"),
550 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
551 );
552 #[allow(unused_mut)]
553 let mut request = self
554 .client
555 .post(url)
556 .header(
557 ::reqwest::header::ACCEPT,
558 ::reqwest::header::HeaderValue::from_static("application/json"),
559 )
560 .json(&body)
561 .headers(header_map)
562 .build()?;
563 let info = OperationInfo {
564 operation_id: "experimental_congestion_level",
565 };
566 self.pre(&mut request, &info).await?;
567 let result = self.exec(request, &info).await;
568 self.post(&result, &info).await?;
569 let response = result?;
570 match response.status().as_u16() {
571 200u16 => ResponseValue::from_response(response).await,
572 _ => Err(Error::UnexpectedResponse(response)),
573 }
574 }
575 #[doc = "[Deprecated] Get initial state and parameters for the genesis block. Consider genesis_config instead.\n\nSends a `POST` request to `/EXPERIMENTAL_genesis_config`\n\n"]
576 pub async fn experimental_genesis_config<'a>(
577 &'a self,
578 body: &'a types::JsonRpcRequestForExperimentalGenesisConfig,
579 ) -> Result<ResponseValue<types::JsonRpcResponseForGenesisConfigAndGenesisConfigError>, Error<()>>
580 {
581 let url = format!("{}/", self.baseurl,);
582 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
583 header_map.append(
584 ::reqwest::header::HeaderName::from_static("api-version"),
585 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
586 );
587 #[allow(unused_mut)]
588 let mut request = self
589 .client
590 .post(url)
591 .header(
592 ::reqwest::header::ACCEPT,
593 ::reqwest::header::HeaderValue::from_static("application/json"),
594 )
595 .json(&body)
596 .headers(header_map)
597 .build()?;
598 let info = OperationInfo {
599 operation_id: "experimental_genesis_config",
600 };
601 self.pre(&mut request, &info).await?;
602 let result = self.exec(request, &info).await;
603 self.post(&result, &info).await?;
604 let response = result?;
605 match response.status().as_u16() {
606 200u16 => ResponseValue::from_response(response).await,
607 _ => Err(Error::UnexpectedResponse(response)),
608 }
609 }
610 #[doc = "Returns the proofs for a transaction execution.\n\nSends a `POST` request to `/EXPERIMENTAL_light_client_block_proof`\n\n"]
611 pub async fn experimental_light_client_block_proof<'a>(
612 &'a self,
613 body: &'a types::JsonRpcRequestForExperimentalLightClientBlockProof,
614 ) -> Result<
615 ResponseValue<
616 types::JsonRpcResponseForRpcLightClientBlockProofResponseAndRpcLightClientProofError,
617 >,
618 Error<()>,
619 > {
620 let url = format!("{}/", self.baseurl,);
621 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
622 header_map.append(
623 ::reqwest::header::HeaderName::from_static("api-version"),
624 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
625 );
626 #[allow(unused_mut)]
627 let mut request = self
628 .client
629 .post(url)
630 .header(
631 ::reqwest::header::ACCEPT,
632 ::reqwest::header::HeaderValue::from_static("application/json"),
633 )
634 .json(&body)
635 .headers(header_map)
636 .build()?;
637 let info = OperationInfo {
638 operation_id: "experimental_light_client_block_proof",
639 };
640 self.pre(&mut request, &info).await?;
641 let result = self.exec(request, &info).await;
642 self.post(&result, &info).await?;
643 let response = result?;
644 match response.status().as_u16() {
645 200u16 => ResponseValue::from_response(response).await,
646 _ => Err(Error::UnexpectedResponse(response)),
647 }
648 }
649 #[doc = "Returns the proofs for a transaction execution.\n\nSends a `POST` request to `/EXPERIMENTAL_light_client_proof`\n\n"] pub async fn experimental_light_client_proof < 'a > (& 'a self , body : & 'a types :: JsonRpcRequestForExperimentalLightClientProof) -> Result < ResponseValue < types :: JsonRpcResponseForRpcLightClientExecutionProofResponseAndRpcLightClientProofError > , Error < () > , >{
650 let url = format!("{}/", self.baseurl,);
651 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
652 header_map.append(
653 ::reqwest::header::HeaderName::from_static("api-version"),
654 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
655 );
656 #[allow(unused_mut)]
657 let mut request = self
658 .client
659 .post(url)
660 .header(
661 ::reqwest::header::ACCEPT,
662 ::reqwest::header::HeaderValue::from_static("application/json"),
663 )
664 .json(&body)
665 .headers(header_map)
666 .build()?;
667 let info = OperationInfo {
668 operation_id: "experimental_light_client_proof",
669 };
670 self.pre(&mut request, &info).await?;
671 let result = self.exec(request, &info).await;
672 self.post(&result, &info).await?;
673 let response = result?;
674 match response.status().as_u16() {
675 200u16 => ResponseValue::from_response(response).await,
676 _ => Err(Error::UnexpectedResponse(response)),
677 }
678 }
679 #[doc = "[Deprecated] Returns the future windows for maintenance in current epoch for the specified account. In the maintenance windows, the node will not be block producer or chunk producer. Consider using maintenance_windows instead.\n\nSends a `POST` request to `/EXPERIMENTAL_maintenance_windows`\n\n"]
680 pub async fn experimental_maintenance_windows<'a>(
681 &'a self,
682 body: &'a types::JsonRpcRequestForExperimentalMaintenanceWindows,
683 ) -> Result<
684 ResponseValue<types::JsonRpcResponseForArrayOfRangeOfUint64AndRpcMaintenanceWindowsError>,
685 Error<()>,
686 > {
687 let url = format!("{}/", self.baseurl,);
688 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
689 header_map.append(
690 ::reqwest::header::HeaderName::from_static("api-version"),
691 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
692 );
693 #[allow(unused_mut)]
694 let mut request = self
695 .client
696 .post(url)
697 .header(
698 ::reqwest::header::ACCEPT,
699 ::reqwest::header::HeaderValue::from_static("application/json"),
700 )
701 .json(&body)
702 .headers(header_map)
703 .build()?;
704 let info = OperationInfo {
705 operation_id: "experimental_maintenance_windows",
706 };
707 self.pre(&mut request, &info).await?;
708 let result = self.exec(request, &info).await;
709 self.post(&result, &info).await?;
710 let response = result?;
711 match response.status().as_u16() {
712 200u16 => ResponseValue::from_response(response).await,
713 _ => Err(Error::UnexpectedResponse(response)),
714 }
715 }
716 #[doc = "A configuration that defines the protocol-level parameters such as gas/storage costs, limits, feature flags, other settings\n\nSends a `POST` request to `/EXPERIMENTAL_protocol_config`\n\n"]
717 pub async fn experimental_protocol_config<'a>(
718 &'a self,
719 body: &'a types::JsonRpcRequestForExperimentalProtocolConfig,
720 ) -> Result<
721 ResponseValue<types::JsonRpcResponseForRpcProtocolConfigResponseAndRpcProtocolConfigError>,
722 Error<()>,
723 > {
724 let url = format!("{}/", self.baseurl,);
725 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
726 header_map.append(
727 ::reqwest::header::HeaderName::from_static("api-version"),
728 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
729 );
730 #[allow(unused_mut)]
731 let mut request = self
732 .client
733 .post(url)
734 .header(
735 ::reqwest::header::ACCEPT,
736 ::reqwest::header::HeaderValue::from_static("application/json"),
737 )
738 .json(&body)
739 .headers(header_map)
740 .build()?;
741 let info = OperationInfo {
742 operation_id: "experimental_protocol_config",
743 };
744 self.pre(&mut request, &info).await?;
745 let result = self.exec(request, &info).await;
746 self.post(&result, &info).await?;
747 let response = result?;
748 match response.status().as_u16() {
749 200u16 => ResponseValue::from_response(response).await,
750 _ => Err(Error::UnexpectedResponse(response)),
751 }
752 }
753 #[doc = "Fetches a receipt by its ID (as is, without a status or execution outcome)\n\nSends a `POST` request to `/EXPERIMENTAL_receipt`\n\n"]
754 pub async fn experimental_receipt<'a>(
755 &'a self,
756 body: &'a types::JsonRpcRequestForExperimentalReceipt,
757 ) -> Result<
758 ResponseValue<types::JsonRpcResponseForRpcReceiptResponseAndRpcReceiptError>,
759 Error<()>,
760 > {
761 let url = format!("{}/", self.baseurl,);
762 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
763 header_map.append(
764 ::reqwest::header::HeaderName::from_static("api-version"),
765 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
766 );
767 #[allow(unused_mut)]
768 let mut request = self
769 .client
770 .post(url)
771 .header(
772 ::reqwest::header::ACCEPT,
773 ::reqwest::header::HeaderValue::from_static("application/json"),
774 )
775 .json(&body)
776 .headers(header_map)
777 .build()?;
778 let info = OperationInfo {
779 operation_id: "experimental_receipt",
780 };
781 self.pre(&mut request, &info).await?;
782 let result = self.exec(request, &info).await;
783 self.post(&result, &info).await?;
784 let response = result?;
785 match response.status().as_u16() {
786 200u16 => ResponseValue::from_response(response).await,
787 _ => Err(Error::UnexpectedResponse(response)),
788 }
789 }
790 #[doc = "Contains the split storage information. More info on split storage [here](https://near-nodes.io/archival/split-storage-archival)\n\nSends a `POST` request to `/EXPERIMENTAL_split_storage_info`\n\n"]
791 pub async fn experimental_split_storage_info<'a>(
792 &'a self,
793 body: &'a types::JsonRpcRequestForExperimentalSplitStorageInfo,
794 ) -> Result<
795 ResponseValue<
796 types::JsonRpcResponseForRpcSplitStorageInfoResponseAndRpcSplitStorageInfoError,
797 >,
798 Error<()>,
799 > {
800 let url = format!("{}/", self.baseurl,);
801 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
802 header_map.append(
803 ::reqwest::header::HeaderName::from_static("api-version"),
804 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
805 );
806 #[allow(unused_mut)]
807 let mut request = self
808 .client
809 .post(url)
810 .header(
811 ::reqwest::header::ACCEPT,
812 ::reqwest::header::HeaderValue::from_static("application/json"),
813 )
814 .json(&body)
815 .headers(header_map)
816 .build()?;
817 let info = OperationInfo {
818 operation_id: "experimental_split_storage_info",
819 };
820 self.pre(&mut request, &info).await?;
821 let result = self.exec(request, &info).await;
822 self.post(&result, &info).await?;
823 let response = result?;
824 match response.status().as_u16() {
825 200u16 => ResponseValue::from_response(response).await,
826 _ => Err(Error::UnexpectedResponse(response)),
827 }
828 }
829 #[doc = "Queries status of a transaction by hash, returning the final transaction result and details of all receipts.\n\nSends a `POST` request to `/EXPERIMENTAL_tx_status`\n\n"]
830 pub async fn experimental_tx_status<'a>(
831 &'a self,
832 body: &'a types::JsonRpcRequestForExperimentalTxStatus,
833 ) -> Result<
834 ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
835 Error<()>,
836 > {
837 let url = format!("{}/", self.baseurl,);
838 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
839 header_map.append(
840 ::reqwest::header::HeaderName::from_static("api-version"),
841 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
842 );
843 #[allow(unused_mut)]
844 let mut request = self
845 .client
846 .post(url)
847 .header(
848 ::reqwest::header::ACCEPT,
849 ::reqwest::header::HeaderValue::from_static("application/json"),
850 )
851 .json(&body)
852 .headers(header_map)
853 .build()?;
854 let info = OperationInfo {
855 operation_id: "experimental_tx_status",
856 };
857 self.pre(&mut request, &info).await?;
858 let result = self.exec(request, &info).await;
859 self.post(&result, &info).await?;
860 let response = result?;
861 match response.status().as_u16() {
862 200u16 => ResponseValue::from_response(response).await,
863 _ => Err(Error::UnexpectedResponse(response)),
864 }
865 }
866 #[doc = "Returns the current epoch validators ordered in the block producer order with repetition. This endpoint is solely used for bridge currently and is not intended for other external use cases.\n\nSends a `POST` request to `/EXPERIMENTAL_validators_ordered`\n\n"]
867 pub async fn experimental_validators_ordered<'a>(
868 &'a self,
869 body: &'a types::JsonRpcRequestForExperimentalValidatorsOrdered,
870 ) -> Result<
871 ResponseValue<types::JsonRpcResponseForArrayOfValidatorStakeViewAndRpcValidatorError>,
872 Error<()>,
873 > {
874 let url = format!("{}/", self.baseurl,);
875 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
876 header_map.append(
877 ::reqwest::header::HeaderName::from_static("api-version"),
878 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
879 );
880 #[allow(unused_mut)]
881 let mut request = self
882 .client
883 .post(url)
884 .header(
885 ::reqwest::header::ACCEPT,
886 ::reqwest::header::HeaderValue::from_static("application/json"),
887 )
888 .json(&body)
889 .headers(header_map)
890 .build()?;
891 let info = OperationInfo {
892 operation_id: "experimental_validators_ordered",
893 };
894 self.pre(&mut request, &info).await?;
895 let result = self.exec(request, &info).await;
896 self.post(&result, &info).await?;
897 let response = result?;
898 match response.status().as_u16() {
899 200u16 => ResponseValue::from_response(response).await,
900 _ => Err(Error::UnexpectedResponse(response)),
901 }
902 }
903 #[doc = "Returns block details for given height or hash\n\nSends a `POST` request to `/block`\n\n"]
904 pub async fn block<'a>(
905 &'a self,
906 body: &'a types::JsonRpcRequestForBlock,
907 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcBlockResponseAndRpcBlockError>, Error<()>>
908 {
909 let url = format!("{}/", self.baseurl,);
910 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
911 header_map.append(
912 ::reqwest::header::HeaderName::from_static("api-version"),
913 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
914 );
915 #[allow(unused_mut)]
916 let mut request = self
917 .client
918 .post(url)
919 .header(
920 ::reqwest::header::ACCEPT,
921 ::reqwest::header::HeaderValue::from_static("application/json"),
922 )
923 .json(&body)
924 .headers(header_map)
925 .build()?;
926 let info = OperationInfo {
927 operation_id: "block",
928 };
929 self.pre(&mut request, &info).await?;
930 let result = self.exec(request, &info).await;
931 self.post(&result, &info).await?;
932 let response = result?;
933 match response.status().as_u16() {
934 200u16 => ResponseValue::from_response(response).await,
935 _ => Err(Error::UnexpectedResponse(response)),
936 }
937 }
938 #[doc = "Returns changes in block for given block height or hash over all transactions for all the types. Includes changes like account_touched, access_key_touched, data_touched, contract_code_touched.\n\nSends a `POST` request to `/block_effects`\n\n"]
939 pub async fn block_effects<'a>(
940 &'a self,
941 body: &'a types::JsonRpcRequestForBlockEffects,
942 ) -> Result<
943 ResponseValue<
944 types::JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcStateChangesError,
945 >,
946 Error<()>,
947 > {
948 let url = format!("{}/", self.baseurl,);
949 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
950 header_map.append(
951 ::reqwest::header::HeaderName::from_static("api-version"),
952 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
953 );
954 #[allow(unused_mut)]
955 let mut request = self
956 .client
957 .post(url)
958 .header(
959 ::reqwest::header::ACCEPT,
960 ::reqwest::header::HeaderValue::from_static("application/json"),
961 )
962 .json(&body)
963 .headers(header_map)
964 .build()?;
965 let info = OperationInfo {
966 operation_id: "block_effects",
967 };
968 self.pre(&mut request, &info).await?;
969 let result = self.exec(request, &info).await;
970 self.post(&result, &info).await?;
971 let response = result?;
972 match response.status().as_u16() {
973 200u16 => ResponseValue::from_response(response).await,
974 _ => Err(Error::UnexpectedResponse(response)),
975 }
976 }
977 #[doc = "[Deprecated] Sends a transaction and immediately returns transaction hash. Consider using send_tx instead.\n\nSends a `POST` request to `/broadcast_tx_async`\n\n"]
978 pub async fn broadcast_tx_async<'a>(
979 &'a self,
980 body: &'a types::JsonRpcRequestForBroadcastTxAsync,
981 ) -> Result<ResponseValue<types::JsonRpcResponseForCryptoHashAndRpcTransactionError>, Error<()>>
982 {
983 let url = format!("{}/", self.baseurl,);
984 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
985 header_map.append(
986 ::reqwest::header::HeaderName::from_static("api-version"),
987 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
988 );
989 #[allow(unused_mut)]
990 let mut request = self
991 .client
992 .post(url)
993 .header(
994 ::reqwest::header::ACCEPT,
995 ::reqwest::header::HeaderValue::from_static("application/json"),
996 )
997 .json(&body)
998 .headers(header_map)
999 .build()?;
1000 let info = OperationInfo {
1001 operation_id: "broadcast_tx_async",
1002 };
1003 self.pre(&mut request, &info).await?;
1004 let result = self.exec(request, &info).await;
1005 self.post(&result, &info).await?;
1006 let response = result?;
1007 match response.status().as_u16() {
1008 200u16 => ResponseValue::from_response(response).await,
1009 _ => Err(Error::UnexpectedResponse(response)),
1010 }
1011 }
1012 #[doc = "[Deprecated] Sends a transaction and waits until transaction is fully complete. (Has a 10 second timeout). Consider using send_tx instead.\n\nSends a `POST` request to `/broadcast_tx_commit`\n\n"]
1013 pub async fn broadcast_tx_commit<'a>(
1014 &'a self,
1015 body: &'a types::JsonRpcRequestForBroadcastTxCommit,
1016 ) -> Result<
1017 ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
1018 Error<()>,
1019 > {
1020 let url = format!("{}/", self.baseurl,);
1021 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1022 header_map.append(
1023 ::reqwest::header::HeaderName::from_static("api-version"),
1024 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1025 );
1026 #[allow(unused_mut)]
1027 let mut request = self
1028 .client
1029 .post(url)
1030 .header(
1031 ::reqwest::header::ACCEPT,
1032 ::reqwest::header::HeaderValue::from_static("application/json"),
1033 )
1034 .json(&body)
1035 .headers(header_map)
1036 .build()?;
1037 let info = OperationInfo {
1038 operation_id: "broadcast_tx_commit",
1039 };
1040 self.pre(&mut request, &info).await?;
1041 let result = self.exec(request, &info).await;
1042 self.post(&result, &info).await?;
1043 let response = result?;
1044 match response.status().as_u16() {
1045 200u16 => ResponseValue::from_response(response).await,
1046 _ => Err(Error::UnexpectedResponse(response)),
1047 }
1048 }
1049 #[doc = "Returns changes for a given account, contract or contract code for given block height or hash.\n\nSends a `POST` request to `/changes`\n\n"]
1050 pub async fn changes<'a>(
1051 &'a self,
1052 body: &'a types::JsonRpcRequestForChanges,
1053 ) -> Result<
1054 ResponseValue<
1055 types::JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcStateChangesError,
1056 >,
1057 Error<()>,
1058 > {
1059 let url = format!("{}/", self.baseurl,);
1060 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1061 header_map.append(
1062 ::reqwest::header::HeaderName::from_static("api-version"),
1063 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1064 );
1065 #[allow(unused_mut)]
1066 let mut request = self
1067 .client
1068 .post(url)
1069 .header(
1070 ::reqwest::header::ACCEPT,
1071 ::reqwest::header::HeaderValue::from_static("application/json"),
1072 )
1073 .json(&body)
1074 .headers(header_map)
1075 .build()?;
1076 let info = OperationInfo {
1077 operation_id: "changes",
1078 };
1079 self.pre(&mut request, &info).await?;
1080 let result = self.exec(request, &info).await;
1081 self.post(&result, &info).await?;
1082 let response = result?;
1083 match response.status().as_u16() {
1084 200u16 => ResponseValue::from_response(response).await,
1085 _ => Err(Error::UnexpectedResponse(response)),
1086 }
1087 }
1088 #[doc = "Returns details of a specific chunk. You can run a block details query to get a valid chunk hash.\n\nSends a `POST` request to `/chunk`\n\n"]
1089 pub async fn chunk<'a>(
1090 &'a self,
1091 body: &'a types::JsonRpcRequestForChunk,
1092 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcChunkResponseAndRpcChunkError>, Error<()>>
1093 {
1094 let url = format!("{}/", self.baseurl,);
1095 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1096 header_map.append(
1097 ::reqwest::header::HeaderName::from_static("api-version"),
1098 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1099 );
1100 #[allow(unused_mut)]
1101 let mut request = self
1102 .client
1103 .post(url)
1104 .header(
1105 ::reqwest::header::ACCEPT,
1106 ::reqwest::header::HeaderValue::from_static("application/json"),
1107 )
1108 .json(&body)
1109 .headers(header_map)
1110 .build()?;
1111 let info = OperationInfo {
1112 operation_id: "chunk",
1113 };
1114 self.pre(&mut request, &info).await?;
1115 let result = self.exec(request, &info).await;
1116 self.post(&result, &info).await?;
1117 let response = result?;
1118 match response.status().as_u16() {
1119 200u16 => ResponseValue::from_response(response).await,
1120 _ => Err(Error::UnexpectedResponse(response)),
1121 }
1122 }
1123 #[doc = "Queries client node configuration\n\nSends a `POST` request to `/client_config`\n\n"]
1124 pub async fn client_config<'a>(
1125 &'a self,
1126 body: &'a types::JsonRpcRequestForClientConfig,
1127 ) -> Result<
1128 ResponseValue<types::JsonRpcResponseForRpcClientConfigResponseAndRpcClientConfigError>,
1129 Error<()>,
1130 > {
1131 let url = format!("{}/", self.baseurl,);
1132 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1133 header_map.append(
1134 ::reqwest::header::HeaderName::from_static("api-version"),
1135 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1136 );
1137 #[allow(unused_mut)]
1138 let mut request = self
1139 .client
1140 .post(url)
1141 .header(
1142 ::reqwest::header::ACCEPT,
1143 ::reqwest::header::HeaderValue::from_static("application/json"),
1144 )
1145 .json(&body)
1146 .headers(header_map)
1147 .build()?;
1148 let info = OperationInfo {
1149 operation_id: "client_config",
1150 };
1151 self.pre(&mut request, &info).await?;
1152 let result = self.exec(request, &info).await;
1153 self.post(&result, &info).await?;
1154 let response = result?;
1155 match response.status().as_u16() {
1156 200u16 => ResponseValue::from_response(response).await,
1157 _ => Err(Error::UnexpectedResponse(response)),
1158 }
1159 }
1160 #[doc = "Returns gas price for a specific block_height or block_hash. Using [null] will return the most recent block's gas price.\n\nSends a `POST` request to `/gas_price`\n\n"]
1161 pub async fn gas_price<'a>(
1162 &'a self,
1163 body: &'a types::JsonRpcRequestForGasPrice,
1164 ) -> Result<
1165 ResponseValue<types::JsonRpcResponseForRpcGasPriceResponseAndRpcGasPriceError>,
1166 Error<()>,
1167 > {
1168 let url = format!("{}/", self.baseurl,);
1169 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1170 header_map.append(
1171 ::reqwest::header::HeaderName::from_static("api-version"),
1172 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1173 );
1174 #[allow(unused_mut)]
1175 let mut request = self
1176 .client
1177 .post(url)
1178 .header(
1179 ::reqwest::header::ACCEPT,
1180 ::reqwest::header::HeaderValue::from_static("application/json"),
1181 )
1182 .json(&body)
1183 .headers(header_map)
1184 .build()?;
1185 let info = OperationInfo {
1186 operation_id: "gas_price",
1187 };
1188 self.pre(&mut request, &info).await?;
1189 let result = self.exec(request, &info).await;
1190 self.post(&result, &info).await?;
1191 let response = result?;
1192 match response.status().as_u16() {
1193 200u16 => ResponseValue::from_response(response).await,
1194 _ => Err(Error::UnexpectedResponse(response)),
1195 }
1196 }
1197 #[doc = "Get initial state and parameters for the genesis block\n\nSends a `POST` request to `/genesis_config`\n\n"]
1198 pub async fn genesis_config<'a>(
1199 &'a self,
1200 body: &'a types::JsonRpcRequestForGenesisConfig,
1201 ) -> Result<ResponseValue<types::JsonRpcResponseForGenesisConfigAndGenesisConfigError>, Error<()>>
1202 {
1203 let url = format!("{}/", self.baseurl,);
1204 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1205 header_map.append(
1206 ::reqwest::header::HeaderName::from_static("api-version"),
1207 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1208 );
1209 #[allow(unused_mut)]
1210 let mut request = self
1211 .client
1212 .post(url)
1213 .header(
1214 ::reqwest::header::ACCEPT,
1215 ::reqwest::header::HeaderValue::from_static("application/json"),
1216 )
1217 .json(&body)
1218 .headers(header_map)
1219 .build()?;
1220 let info = OperationInfo {
1221 operation_id: "genesis_config",
1222 };
1223 self.pre(&mut request, &info).await?;
1224 let result = self.exec(request, &info).await;
1225 self.post(&result, &info).await?;
1226 let response = result?;
1227 match response.status().as_u16() {
1228 200u16 => ResponseValue::from_response(response).await,
1229 _ => Err(Error::UnexpectedResponse(response)),
1230 }
1231 }
1232 #[doc = "Returns the current health status of the RPC node the client connects to.\n\nSends a `POST` request to `/health`\n\n"]
1233 pub async fn health<'a>(
1234 &'a self,
1235 body: &'a types::JsonRpcRequestForHealth,
1236 ) -> Result<
1237 ResponseValue<types::JsonRpcResponseForNullableRpcHealthResponseAndRpcStatusError>,
1238 Error<()>,
1239 > {
1240 let url = format!("{}/", self.baseurl,);
1241 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1242 header_map.append(
1243 ::reqwest::header::HeaderName::from_static("api-version"),
1244 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1245 );
1246 #[allow(unused_mut)]
1247 let mut request = self
1248 .client
1249 .post(url)
1250 .header(
1251 ::reqwest::header::ACCEPT,
1252 ::reqwest::header::HeaderValue::from_static("application/json"),
1253 )
1254 .json(&body)
1255 .headers(header_map)
1256 .build()?;
1257 let info = OperationInfo {
1258 operation_id: "health",
1259 };
1260 self.pre(&mut request, &info).await?;
1261 let result = self.exec(request, &info).await;
1262 self.post(&result, &info).await?;
1263 let response = result?;
1264 match response.status().as_u16() {
1265 200u16 => ResponseValue::from_response(response).await,
1266 _ => Err(Error::UnexpectedResponse(response)),
1267 }
1268 }
1269 #[doc = "Returns the proofs for a transaction execution.\n\nSends a `POST` request to `/light_client_proof`\n\n"] pub async fn light_client_proof < 'a > (& 'a self , body : & 'a types :: JsonRpcRequestForLightClientProof) -> Result < ResponseValue < types :: JsonRpcResponseForRpcLightClientExecutionProofResponseAndRpcLightClientProofError > , Error < () > , >{
1270 let url = format!("{}/", self.baseurl,);
1271 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1272 header_map.append(
1273 ::reqwest::header::HeaderName::from_static("api-version"),
1274 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1275 );
1276 #[allow(unused_mut)]
1277 let mut request = self
1278 .client
1279 .post(url)
1280 .header(
1281 ::reqwest::header::ACCEPT,
1282 ::reqwest::header::HeaderValue::from_static("application/json"),
1283 )
1284 .json(&body)
1285 .headers(header_map)
1286 .build()?;
1287 let info = OperationInfo {
1288 operation_id: "light_client_proof",
1289 };
1290 self.pre(&mut request, &info).await?;
1291 let result = self.exec(request, &info).await;
1292 self.post(&result, &info).await?;
1293 let response = result?;
1294 match response.status().as_u16() {
1295 200u16 => ResponseValue::from_response(response).await,
1296 _ => Err(Error::UnexpectedResponse(response)),
1297 }
1298 }
1299 #[doc = "Returns the future windows for maintenance in current epoch for the specified account. In the maintenance windows, the node will not be block producer or chunk producer.\n\nSends a `POST` request to `/maintenance_windows`\n\n"]
1300 pub async fn maintenance_windows<'a>(
1301 &'a self,
1302 body: &'a types::JsonRpcRequestForMaintenanceWindows,
1303 ) -> Result<
1304 ResponseValue<types::JsonRpcResponseForArrayOfRangeOfUint64AndRpcMaintenanceWindowsError>,
1305 Error<()>,
1306 > {
1307 let url = format!("{}/", self.baseurl,);
1308 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1309 header_map.append(
1310 ::reqwest::header::HeaderName::from_static("api-version"),
1311 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1312 );
1313 #[allow(unused_mut)]
1314 let mut request = self
1315 .client
1316 .post(url)
1317 .header(
1318 ::reqwest::header::ACCEPT,
1319 ::reqwest::header::HeaderValue::from_static("application/json"),
1320 )
1321 .json(&body)
1322 .headers(header_map)
1323 .build()?;
1324 let info = OperationInfo {
1325 operation_id: "maintenance_windows",
1326 };
1327 self.pre(&mut request, &info).await?;
1328 let result = self.exec(request, &info).await;
1329 self.post(&result, &info).await?;
1330 let response = result?;
1331 match response.status().as_u16() {
1332 200u16 => ResponseValue::from_response(response).await,
1333 _ => Err(Error::UnexpectedResponse(response)),
1334 }
1335 }
1336 #[doc = "Queries the current state of node network connections. This includes information about active peers, transmitted data, known producers, etc.\n\nSends a `POST` request to `/network_info`\n\n"]
1337 pub async fn network_info<'a>(
1338 &'a self,
1339 body: &'a types::JsonRpcRequestForNetworkInfo,
1340 ) -> Result<
1341 ResponseValue<types::JsonRpcResponseForRpcNetworkInfoResponseAndRpcNetworkInfoError>,
1342 Error<()>,
1343 > {
1344 let url = format!("{}/", self.baseurl,);
1345 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1346 header_map.append(
1347 ::reqwest::header::HeaderName::from_static("api-version"),
1348 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1349 );
1350 #[allow(unused_mut)]
1351 let mut request = self
1352 .client
1353 .post(url)
1354 .header(
1355 ::reqwest::header::ACCEPT,
1356 ::reqwest::header::HeaderValue::from_static("application/json"),
1357 )
1358 .json(&body)
1359 .headers(header_map)
1360 .build()?;
1361 let info = OperationInfo {
1362 operation_id: "network_info",
1363 };
1364 self.pre(&mut request, &info).await?;
1365 let result = self.exec(request, &info).await;
1366 self.post(&result, &info).await?;
1367 let response = result?;
1368 match response.status().as_u16() {
1369 200u16 => ResponseValue::from_response(response).await,
1370 _ => Err(Error::UnexpectedResponse(response)),
1371 }
1372 }
1373 #[doc = "Returns the next light client block.\n\nSends a `POST` request to `/next_light_client_block`\n\n"]
1374 pub async fn next_light_client_block<'a>(
1375 &'a self,
1376 body: &'a types::JsonRpcRequestForNextLightClientBlock,
1377 ) -> Result<
1378 ResponseValue<
1379 types::JsonRpcResponseForRpcLightClientNextBlockResponseAndRpcLightClientNextBlockError,
1380 >,
1381 Error<()>,
1382 > {
1383 let url = format!("{}/", self.baseurl,);
1384 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1385 header_map.append(
1386 ::reqwest::header::HeaderName::from_static("api-version"),
1387 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1388 );
1389 #[allow(unused_mut)]
1390 let mut request = self
1391 .client
1392 .post(url)
1393 .header(
1394 ::reqwest::header::ACCEPT,
1395 ::reqwest::header::HeaderValue::from_static("application/json"),
1396 )
1397 .json(&body)
1398 .headers(header_map)
1399 .build()?;
1400 let info = OperationInfo {
1401 operation_id: "next_light_client_block",
1402 };
1403 self.pre(&mut request, &info).await?;
1404 let result = self.exec(request, &info).await;
1405 self.post(&result, &info).await?;
1406 let response = result?;
1407 match response.status().as_u16() {
1408 200u16 => ResponseValue::from_response(response).await,
1409 _ => Err(Error::UnexpectedResponse(response)),
1410 }
1411 }
1412 #[doc = "This module allows you to make generic requests to the network.\n\nThe `RpcQueryRequest` struct takes in a [`BlockReference`](https://docs.rs/near-primitives/0.12.0/near_primitives/types/enum.BlockReference.html) and a [`QueryRequest`](https://docs.rs/near-primitives/0.12.0/near_primitives/views/enum.QueryRequest.html).\n\nThe `BlockReference` enum allows you to specify a block by `Finality`, `BlockId` or `SyncCheckpoint`.\n\nThe `QueryRequest` enum provides multiple variants for performing the following actions:\n - View an account's details\n - View a contract's code\n - View the state of an account\n - View the `AccessKey` of an account\n - View the `AccessKeyList` of an account\n - Call a function in a contract deployed on the network.\n\nSends a `POST` request to `/query`\n\n"]
1413 pub async fn query<'a>(
1414 &'a self,
1415 body: &'a types::JsonRpcRequestForQuery,
1416 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcQueryResponseAndRpcQueryError>, Error<()>>
1417 {
1418 let url = format!("{}/", self.baseurl,);
1419 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1420 header_map.append(
1421 ::reqwest::header::HeaderName::from_static("api-version"),
1422 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1423 );
1424 #[allow(unused_mut)]
1425 let mut request = self
1426 .client
1427 .post(url)
1428 .header(
1429 ::reqwest::header::ACCEPT,
1430 ::reqwest::header::HeaderValue::from_static("application/json"),
1431 )
1432 .json(&body)
1433 .headers(header_map)
1434 .build()?;
1435 let info = OperationInfo {
1436 operation_id: "query",
1437 };
1438 self.pre(&mut request, &info).await?;
1439 let result = self.exec(request, &info).await;
1440 self.post(&result, &info).await?;
1441 let response = result?;
1442 match response.status().as_u16() {
1443 200u16 => ResponseValue::from_response(response).await,
1444 _ => Err(Error::UnexpectedResponse(response)),
1445 }
1446 }
1447 #[doc = "Sends transaction. Returns the guaranteed execution status and the results the blockchain can provide at the moment.\n\nSends a `POST` request to `/send_tx`\n\n"]
1448 pub async fn send_tx<'a>(
1449 &'a self,
1450 body: &'a types::JsonRpcRequestForSendTx,
1451 ) -> Result<
1452 ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
1453 Error<()>,
1454 > {
1455 let url = format!("{}/", self.baseurl,);
1456 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1457 header_map.append(
1458 ::reqwest::header::HeaderName::from_static("api-version"),
1459 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1460 );
1461 #[allow(unused_mut)]
1462 let mut request = self
1463 .client
1464 .post(url)
1465 .header(
1466 ::reqwest::header::ACCEPT,
1467 ::reqwest::header::HeaderValue::from_static("application/json"),
1468 )
1469 .json(&body)
1470 .headers(header_map)
1471 .build()?;
1472 let info = OperationInfo {
1473 operation_id: "send_tx",
1474 };
1475 self.pre(&mut request, &info).await?;
1476 let result = self.exec(request, &info).await;
1477 self.post(&result, &info).await?;
1478 let response = result?;
1479 match response.status().as_u16() {
1480 200u16 => ResponseValue::from_response(response).await,
1481 _ => Err(Error::UnexpectedResponse(response)),
1482 }
1483 }
1484 #[doc = "Requests the status of the connected RPC node. This includes information about sync status, nearcore node version, protocol version, the current set of validators, etc.\n\nSends a `POST` request to `/status`\n\n"]
1485 pub async fn status<'a>(
1486 &'a self,
1487 body: &'a types::JsonRpcRequestForStatus,
1488 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcStatusResponseAndRpcStatusError>, Error<()>>
1489 {
1490 let url = format!("{}/", self.baseurl,);
1491 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1492 header_map.append(
1493 ::reqwest::header::HeaderName::from_static("api-version"),
1494 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1495 );
1496 #[allow(unused_mut)]
1497 let mut request = self
1498 .client
1499 .post(url)
1500 .header(
1501 ::reqwest::header::ACCEPT,
1502 ::reqwest::header::HeaderValue::from_static("application/json"),
1503 )
1504 .json(&body)
1505 .headers(header_map)
1506 .build()?;
1507 let info = OperationInfo {
1508 operation_id: "status",
1509 };
1510 self.pre(&mut request, &info).await?;
1511 let result = self.exec(request, &info).await;
1512 self.post(&result, &info).await?;
1513 let response = result?;
1514 match response.status().as_u16() {
1515 200u16 => ResponseValue::from_response(response).await,
1516 _ => Err(Error::UnexpectedResponse(response)),
1517 }
1518 }
1519 #[doc = "Queries status of a transaction by hash and returns the final transaction result.\n\nSends a `POST` request to `/tx`\n\n"]
1520 pub async fn tx<'a>(
1521 &'a self,
1522 body: &'a types::JsonRpcRequestForTx,
1523 ) -> Result<
1524 ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
1525 Error<()>,
1526 > {
1527 let url = format!("{}/", self.baseurl,);
1528 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1529 header_map.append(
1530 ::reqwest::header::HeaderName::from_static("api-version"),
1531 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1532 );
1533 #[allow(unused_mut)]
1534 let mut request = self
1535 .client
1536 .post(url)
1537 .header(
1538 ::reqwest::header::ACCEPT,
1539 ::reqwest::header::HeaderValue::from_static("application/json"),
1540 )
1541 .json(&body)
1542 .headers(header_map)
1543 .build()?;
1544 let info = OperationInfo { operation_id: "tx" };
1545 self.pre(&mut request, &info).await?;
1546 let result = self.exec(request, &info).await;
1547 self.post(&result, &info).await?;
1548 let response = result?;
1549 match response.status().as_u16() {
1550 200u16 => ResponseValue::from_response(response).await,
1551 _ => Err(Error::UnexpectedResponse(response)),
1552 }
1553 }
1554 #[doc = "Queries active validators on the network. Returns details and the state of validation on the blockchain.\n\nSends a `POST` request to `/validators`\n\n"]
1555 pub async fn validators<'a>(
1556 &'a self,
1557 body: &'a types::JsonRpcRequestForValidators,
1558 ) -> Result<
1559 ResponseValue<types::JsonRpcResponseForRpcValidatorResponseAndRpcValidatorError>,
1560 Error<()>,
1561 > {
1562 let url = format!("{}/", self.baseurl,);
1563 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1564 header_map.append(
1565 ::reqwest::header::HeaderName::from_static("api-version"),
1566 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1567 );
1568 #[allow(unused_mut)]
1569 let mut request = self
1570 .client
1571 .post(url)
1572 .header(
1573 ::reqwest::header::ACCEPT,
1574 ::reqwest::header::HeaderValue::from_static("application/json"),
1575 )
1576 .json(&body)
1577 .headers(header_map)
1578 .build()?;
1579 let info = OperationInfo {
1580 operation_id: "validators",
1581 };
1582 self.pre(&mut request, &info).await?;
1583 let result = self.exec(request, &info).await;
1584 self.post(&result, &info).await?;
1585 let response = result?;
1586 match response.status().as_u16() {
1587 200u16 => ResponseValue::from_response(response).await,
1588 _ => Err(Error::UnexpectedResponse(response)),
1589 }
1590 }
1591}
1592#[doc = r" Items consumers will typically use such as the Client."]
1593pub mod prelude {
1594 #[allow(unused_imports)]
1595 pub use super::Client;
1596}