1pub use near_openapi_types::*;
2use near_openapi_types as types;
3#[allow(unused_imports)]
4use progenitor_client::{encode_path, ClientHooks, OperationInfo, RequestBuilderExt};
5#[allow(unused_imports)]
6pub use progenitor_client::{ByteStream, ClientInfo, Error, ResponseValue};
7#[derive(Clone, Debug)]
8#[doc = "Client for NEAR Protocol JSON RPC API\n\nVersion: 1.0.0"]
9pub struct Client {
10 pub(crate) baseurl: String,
11 pub(crate) client: reqwest::Client,
12}
13impl Client {
14 #[doc = r" Create a new client."]
15 #[doc = r""]
16 #[doc = r" `baseurl` is the base URL provided to the internal"]
17 #[doc = r" `reqwest::Client`, and should include a scheme and hostname,"]
18 #[doc = r" as well as port and a path stem if applicable."]
19 pub fn new(baseurl: &str) -> Self {
20 #[cfg(not(target_arch = "wasm32"))]
21 let client = {
22 let dur = std::time::Duration::from_secs(15);
23 reqwest::ClientBuilder::new()
24 .connect_timeout(dur)
25 .timeout(dur)
26 };
27 #[cfg(target_arch = "wasm32")]
28 let client = reqwest::ClientBuilder::new();
29 Self::new_with_client(baseurl, client.build().unwrap())
30 }
31 #[doc = r" Construct a new client with an existing `reqwest::Client`,"]
32 #[doc = r" allowing more control over its configuration."]
33 #[doc = r""]
34 #[doc = r" `baseurl` is the base URL provided to the internal"]
35 #[doc = r" `reqwest::Client`, and should include a scheme and hostname,"]
36 #[doc = r" as well as port and a path stem if applicable."]
37 pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self {
38 Self {
39 baseurl: baseurl.to_string(),
40 client,
41 }
42 }
43}
44impl ClientInfo<()> for Client {
45 fn api_version() -> &'static str {
46 "1.0.0"
47 }
48 fn baseurl(&self) -> &str {
49 self.baseurl.as_str()
50 }
51 fn client(&self) -> &reqwest::Client {
52 &self.client
53 }
54 fn inner(&self) -> &() {
55 &()
56 }
57}
58impl ClientHooks<()> for &Client {}
59#[allow(clippy::all)]
60#[allow(elided_named_lifetimes)]
61impl Client {
62 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_changes`\n\n"]
63 pub async fn experimental_changes<'a>(
64 &'a self,
65 body: &'a types::JsonRpcRequestForExperimentalChanges,
66 ) -> Result<
67 ResponseValue<types::JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcError>,
68 Error<()>,
69 > {
70 let url = format!("{}/", self.baseurl,);
71 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
72 header_map.append(
73 ::reqwest::header::HeaderName::from_static("api-version"),
74 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
75 );
76 #[allow(unused_mut)]
77 let mut request = self
78 .client
79 .post(url)
80 .header(
81 ::reqwest::header::ACCEPT,
82 ::reqwest::header::HeaderValue::from_static("application/json"),
83 )
84 .json(&body)
85 .headers(header_map)
86 .build()?;
87 let info = OperationInfo {
88 operation_id: "experimental_changes",
89 };
90 self.pre(&mut request, &info).await?;
91 let result = self.exec(request, &info).await;
92 self.post(&result, &info).await?;
93 let response = result?;
94 match response.status().as_u16() {
95 200u16 => ResponseValue::from_response(response).await,
96 _ => Err(Error::UnexpectedResponse(response)),
97 }
98 }
99 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_changes_in_block`\n\n"]
100 pub async fn experimental_changes_in_block<'a>(
101 &'a self,
102 body: &'a types::JsonRpcRequestForExperimentalChangesInBlock,
103 ) -> Result<
104 ResponseValue<types::JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcError>,
105 Error<()>,
106 > {
107 let url = format!("{}/", self.baseurl,);
108 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
109 header_map.append(
110 ::reqwest::header::HeaderName::from_static("api-version"),
111 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
112 );
113 #[allow(unused_mut)]
114 let mut request = self
115 .client
116 .post(url)
117 .header(
118 ::reqwest::header::ACCEPT,
119 ::reqwest::header::HeaderValue::from_static("application/json"),
120 )
121 .json(&body)
122 .headers(header_map)
123 .build()?;
124 let info = OperationInfo {
125 operation_id: "experimental_changes_in_block",
126 };
127 self.pre(&mut request, &info).await?;
128 let result = self.exec(request, &info).await;
129 self.post(&result, &info).await?;
130 let response = result?;
131 match response.status().as_u16() {
132 200u16 => ResponseValue::from_response(response).await,
133 _ => Err(Error::UnexpectedResponse(response)),
134 }
135 }
136 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_congestion_level`\n\n"]
137 pub async fn experimental_congestion_level<'a>(
138 &'a self,
139 body: &'a types::JsonRpcRequestForExperimentalCongestionLevel,
140 ) -> Result<
141 ResponseValue<types::JsonRpcResponseForRpcCongestionLevelResponseAndRpcError>,
142 Error<()>,
143 > {
144 let url = format!("{}/", self.baseurl,);
145 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
146 header_map.append(
147 ::reqwest::header::HeaderName::from_static("api-version"),
148 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
149 );
150 #[allow(unused_mut)]
151 let mut request = self
152 .client
153 .post(url)
154 .header(
155 ::reqwest::header::ACCEPT,
156 ::reqwest::header::HeaderValue::from_static("application/json"),
157 )
158 .json(&body)
159 .headers(header_map)
160 .build()?;
161 let info = OperationInfo {
162 operation_id: "experimental_congestion_level",
163 };
164 self.pre(&mut request, &info).await?;
165 let result = self.exec(request, &info).await;
166 self.post(&result, &info).await?;
167 let response = result?;
168 match response.status().as_u16() {
169 200u16 => ResponseValue::from_response(response).await,
170 _ => Err(Error::UnexpectedResponse(response)),
171 }
172 }
173 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_genesis_config`\n\n"]
174 pub async fn experimental_genesis_config<'a>(
175 &'a self,
176 body: &'a types::JsonRpcRequestForExperimentalGenesisConfig,
177 ) -> Result<ResponseValue<types::JsonRpcResponseForGenesisConfigAndRpcError>, Error<()>> {
178 let url = format!("{}/", self.baseurl,);
179 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
180 header_map.append(
181 ::reqwest::header::HeaderName::from_static("api-version"),
182 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
183 );
184 #[allow(unused_mut)]
185 let mut request = self
186 .client
187 .post(url)
188 .header(
189 ::reqwest::header::ACCEPT,
190 ::reqwest::header::HeaderValue::from_static("application/json"),
191 )
192 .json(&body)
193 .headers(header_map)
194 .build()?;
195 let info = OperationInfo {
196 operation_id: "experimental_genesis_config",
197 };
198 self.pre(&mut request, &info).await?;
199 let result = self.exec(request, &info).await;
200 self.post(&result, &info).await?;
201 let response = result?;
202 match response.status().as_u16() {
203 200u16 => ResponseValue::from_response(response).await,
204 _ => Err(Error::UnexpectedResponse(response)),
205 }
206 }
207 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_light_client_block_proof`\n\n"]
208 pub async fn experimental_light_client_block_proof<'a>(
209 &'a self,
210 body: &'a types::JsonRpcRequestForExperimentalLightClientBlockProof,
211 ) -> Result<
212 ResponseValue<types::JsonRpcResponseForRpcLightClientBlockProofResponseAndRpcError>,
213 Error<()>,
214 > {
215 let url = format!("{}/", self.baseurl,);
216 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
217 header_map.append(
218 ::reqwest::header::HeaderName::from_static("api-version"),
219 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
220 );
221 #[allow(unused_mut)]
222 let mut request = self
223 .client
224 .post(url)
225 .header(
226 ::reqwest::header::ACCEPT,
227 ::reqwest::header::HeaderValue::from_static("application/json"),
228 )
229 .json(&body)
230 .headers(header_map)
231 .build()?;
232 let info = OperationInfo {
233 operation_id: "experimental_light_client_block_proof",
234 };
235 self.pre(&mut request, &info).await?;
236 let result = self.exec(request, &info).await;
237 self.post(&result, &info).await?;
238 let response = result?;
239 match response.status().as_u16() {
240 200u16 => ResponseValue::from_response(response).await,
241 _ => Err(Error::UnexpectedResponse(response)),
242 }
243 }
244 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_light_client_proof`\n\n"]
245 pub async fn experimental_light_client_proof<'a>(
246 &'a self,
247 body: &'a types::JsonRpcRequestForExperimentalLightClientProof,
248 ) -> Result<
249 ResponseValue<types::JsonRpcResponseForRpcLightClientExecutionProofResponseAndRpcError>,
250 Error<()>,
251 > {
252 let url = format!("{}/", self.baseurl,);
253 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
254 header_map.append(
255 ::reqwest::header::HeaderName::from_static("api-version"),
256 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
257 );
258 #[allow(unused_mut)]
259 let mut request = self
260 .client
261 .post(url)
262 .header(
263 ::reqwest::header::ACCEPT,
264 ::reqwest::header::HeaderValue::from_static("application/json"),
265 )
266 .json(&body)
267 .headers(header_map)
268 .build()?;
269 let info = OperationInfo {
270 operation_id: "experimental_light_client_proof",
271 };
272 self.pre(&mut request, &info).await?;
273 let result = self.exec(request, &info).await;
274 self.post(&result, &info).await?;
275 let response = result?;
276 match response.status().as_u16() {
277 200u16 => ResponseValue::from_response(response).await,
278 _ => Err(Error::UnexpectedResponse(response)),
279 }
280 }
281 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_maintenance_windows`\n\n"]
282 pub async fn experimental_maintenance_windows<'a>(
283 &'a self,
284 body: &'a types::JsonRpcRequestForExperimentalMaintenanceWindows,
285 ) -> Result<ResponseValue<types::JsonRpcResponseForArrayOfRangeOfUint64AndRpcError>, Error<()>>
286 {
287 let url = format!("{}/", self.baseurl,);
288 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
289 header_map.append(
290 ::reqwest::header::HeaderName::from_static("api-version"),
291 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
292 );
293 #[allow(unused_mut)]
294 let mut request = self
295 .client
296 .post(url)
297 .header(
298 ::reqwest::header::ACCEPT,
299 ::reqwest::header::HeaderValue::from_static("application/json"),
300 )
301 .json(&body)
302 .headers(header_map)
303 .build()?;
304 let info = OperationInfo {
305 operation_id: "experimental_maintenance_windows",
306 };
307 self.pre(&mut request, &info).await?;
308 let result = self.exec(request, &info).await;
309 self.post(&result, &info).await?;
310 let response = result?;
311 match response.status().as_u16() {
312 200u16 => ResponseValue::from_response(response).await,
313 _ => Err(Error::UnexpectedResponse(response)),
314 }
315 }
316 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_protocol_config`\n\n"]
317 pub async fn experimental_protocol_config<'a>(
318 &'a self,
319 body: &'a types::JsonRpcRequestForExperimentalProtocolConfig,
320 ) -> Result<
321 ResponseValue<types::JsonRpcResponseForRpcProtocolConfigResponseAndRpcError>,
322 Error<()>,
323 > {
324 let url = format!("{}/", self.baseurl,);
325 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
326 header_map.append(
327 ::reqwest::header::HeaderName::from_static("api-version"),
328 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
329 );
330 #[allow(unused_mut)]
331 let mut request = self
332 .client
333 .post(url)
334 .header(
335 ::reqwest::header::ACCEPT,
336 ::reqwest::header::HeaderValue::from_static("application/json"),
337 )
338 .json(&body)
339 .headers(header_map)
340 .build()?;
341 let info = OperationInfo {
342 operation_id: "experimental_protocol_config",
343 };
344 self.pre(&mut request, &info).await?;
345 let result = self.exec(request, &info).await;
346 self.post(&result, &info).await?;
347 let response = result?;
348 match response.status().as_u16() {
349 200u16 => ResponseValue::from_response(response).await,
350 _ => Err(Error::UnexpectedResponse(response)),
351 }
352 }
353 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_receipt`\n\n"]
354 pub async fn experimental_receipt<'a>(
355 &'a self,
356 body: &'a types::JsonRpcRequestForExperimentalReceipt,
357 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcReceiptResponseAndRpcError>, Error<()>>
358 {
359 let url = format!("{}/", self.baseurl,);
360 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
361 header_map.append(
362 ::reqwest::header::HeaderName::from_static("api-version"),
363 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
364 );
365 #[allow(unused_mut)]
366 let mut request = self
367 .client
368 .post(url)
369 .header(
370 ::reqwest::header::ACCEPT,
371 ::reqwest::header::HeaderValue::from_static("application/json"),
372 )
373 .json(&body)
374 .headers(header_map)
375 .build()?;
376 let info = OperationInfo {
377 operation_id: "experimental_receipt",
378 };
379 self.pre(&mut request, &info).await?;
380 let result = self.exec(request, &info).await;
381 self.post(&result, &info).await?;
382 let response = result?;
383 match response.status().as_u16() {
384 200u16 => ResponseValue::from_response(response).await,
385 _ => Err(Error::UnexpectedResponse(response)),
386 }
387 }
388 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_split_storage_info`\n\n"]
389 pub async fn experimental_split_storage_info<'a>(
390 &'a self,
391 body: &'a types::JsonRpcRequestForExperimentalSplitStorageInfo,
392 ) -> Result<
393 ResponseValue<types::JsonRpcResponseForRpcSplitStorageInfoResponseAndRpcError>,
394 Error<()>,
395 > {
396 let url = format!("{}/", self.baseurl,);
397 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
398 header_map.append(
399 ::reqwest::header::HeaderName::from_static("api-version"),
400 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
401 );
402 #[allow(unused_mut)]
403 let mut request = self
404 .client
405 .post(url)
406 .header(
407 ::reqwest::header::ACCEPT,
408 ::reqwest::header::HeaderValue::from_static("application/json"),
409 )
410 .json(&body)
411 .headers(header_map)
412 .build()?;
413 let info = OperationInfo {
414 operation_id: "experimental_split_storage_info",
415 };
416 self.pre(&mut request, &info).await?;
417 let result = self.exec(request, &info).await;
418 self.post(&result, &info).await?;
419 let response = result?;
420 match response.status().as_u16() {
421 200u16 => ResponseValue::from_response(response).await,
422 _ => Err(Error::UnexpectedResponse(response)),
423 }
424 }
425 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_tx_status`\n\n"]
426 pub async fn experimental_tx_status<'a>(
427 &'a self,
428 body: &'a types::JsonRpcRequestForExperimentalTxStatus,
429 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcError>, Error<()>>
430 {
431 let url = format!("{}/", self.baseurl,);
432 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
433 header_map.append(
434 ::reqwest::header::HeaderName::from_static("api-version"),
435 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
436 );
437 #[allow(unused_mut)]
438 let mut request = self
439 .client
440 .post(url)
441 .header(
442 ::reqwest::header::ACCEPT,
443 ::reqwest::header::HeaderValue::from_static("application/json"),
444 )
445 .json(&body)
446 .headers(header_map)
447 .build()?;
448 let info = OperationInfo {
449 operation_id: "experimental_tx_status",
450 };
451 self.pre(&mut request, &info).await?;
452 let result = self.exec(request, &info).await;
453 self.post(&result, &info).await?;
454 let response = result?;
455 match response.status().as_u16() {
456 200u16 => ResponseValue::from_response(response).await,
457 _ => Err(Error::UnexpectedResponse(response)),
458 }
459 }
460 #[doc = "Sends a `POST` request to `/EXPERIMENTAL_validators_ordered`\n\n"]
461 pub async fn experimental_validators_ordered<'a>(
462 &'a self,
463 body: &'a types::JsonRpcRequestForExperimentalValidatorsOrdered,
464 ) -> Result<
465 ResponseValue<types::JsonRpcResponseForArrayOfValidatorStakeViewAndRpcError>,
466 Error<()>,
467 > {
468 let url = format!("{}/", self.baseurl,);
469 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
470 header_map.append(
471 ::reqwest::header::HeaderName::from_static("api-version"),
472 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
473 );
474 #[allow(unused_mut)]
475 let mut request = self
476 .client
477 .post(url)
478 .header(
479 ::reqwest::header::ACCEPT,
480 ::reqwest::header::HeaderValue::from_static("application/json"),
481 )
482 .json(&body)
483 .headers(header_map)
484 .build()?;
485 let info = OperationInfo {
486 operation_id: "experimental_validators_ordered",
487 };
488 self.pre(&mut request, &info).await?;
489 let result = self.exec(request, &info).await;
490 self.post(&result, &info).await?;
491 let response = result?;
492 match response.status().as_u16() {
493 200u16 => ResponseValue::from_response(response).await,
494 _ => Err(Error::UnexpectedResponse(response)),
495 }
496 }
497 #[doc = "Sends a `POST` request to `/block`\n\n"]
498 pub async fn block<'a>(
499 &'a self,
500 body: &'a types::JsonRpcRequestForBlock,
501 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcBlockResponseAndRpcError>, Error<()>>
502 {
503 let url = format!("{}/", self.baseurl,);
504 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
505 header_map.append(
506 ::reqwest::header::HeaderName::from_static("api-version"),
507 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
508 );
509 #[allow(unused_mut)]
510 let mut request = self
511 .client
512 .post(url)
513 .header(
514 ::reqwest::header::ACCEPT,
515 ::reqwest::header::HeaderValue::from_static("application/json"),
516 )
517 .json(&body)
518 .headers(header_map)
519 .build()?;
520 let info = OperationInfo {
521 operation_id: "block",
522 };
523 self.pre(&mut request, &info).await?;
524 let result = self.exec(request, &info).await;
525 self.post(&result, &info).await?;
526 let response = result?;
527 match response.status().as_u16() {
528 200u16 => ResponseValue::from_response(response).await,
529 _ => Err(Error::UnexpectedResponse(response)),
530 }
531 }
532 #[doc = "Sends a `POST` request to `/broadcast_tx_async`\n\n"]
533 pub async fn broadcast_tx_async<'a>(
534 &'a self,
535 body: &'a types::JsonRpcRequestForBroadcastTxAsync,
536 ) -> Result<ResponseValue<types::JsonRpcResponseForCryptoHashAndRpcError>, Error<()>> {
537 let url = format!("{}/", self.baseurl,);
538 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
539 header_map.append(
540 ::reqwest::header::HeaderName::from_static("api-version"),
541 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
542 );
543 #[allow(unused_mut)]
544 let mut request = self
545 .client
546 .post(url)
547 .header(
548 ::reqwest::header::ACCEPT,
549 ::reqwest::header::HeaderValue::from_static("application/json"),
550 )
551 .json(&body)
552 .headers(header_map)
553 .build()?;
554 let info = OperationInfo {
555 operation_id: "broadcast_tx_async",
556 };
557 self.pre(&mut request, &info).await?;
558 let result = self.exec(request, &info).await;
559 self.post(&result, &info).await?;
560 let response = result?;
561 match response.status().as_u16() {
562 200u16 => ResponseValue::from_response(response).await,
563 _ => Err(Error::UnexpectedResponse(response)),
564 }
565 }
566 #[doc = "Sends a `POST` request to `/broadcast_tx_commit`\n\n"]
567 pub async fn broadcast_tx_commit<'a>(
568 &'a self,
569 body: &'a types::JsonRpcRequestForBroadcastTxCommit,
570 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcError>, Error<()>>
571 {
572 let url = format!("{}/", self.baseurl,);
573 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
574 header_map.append(
575 ::reqwest::header::HeaderName::from_static("api-version"),
576 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
577 );
578 #[allow(unused_mut)]
579 let mut request = self
580 .client
581 .post(url)
582 .header(
583 ::reqwest::header::ACCEPT,
584 ::reqwest::header::HeaderValue::from_static("application/json"),
585 )
586 .json(&body)
587 .headers(header_map)
588 .build()?;
589 let info = OperationInfo {
590 operation_id: "broadcast_tx_commit",
591 };
592 self.pre(&mut request, &info).await?;
593 let result = self.exec(request, &info).await;
594 self.post(&result, &info).await?;
595 let response = result?;
596 match response.status().as_u16() {
597 200u16 => ResponseValue::from_response(response).await,
598 _ => Err(Error::UnexpectedResponse(response)),
599 }
600 }
601 #[doc = "Sends a `POST` request to `/chunk`\n\n"]
602 pub async fn chunk<'a>(
603 &'a self,
604 body: &'a types::JsonRpcRequestForChunk,
605 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcChunkResponseAndRpcError>, Error<()>>
606 {
607 let url = format!("{}/", self.baseurl,);
608 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
609 header_map.append(
610 ::reqwest::header::HeaderName::from_static("api-version"),
611 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
612 );
613 #[allow(unused_mut)]
614 let mut request = self
615 .client
616 .post(url)
617 .header(
618 ::reqwest::header::ACCEPT,
619 ::reqwest::header::HeaderValue::from_static("application/json"),
620 )
621 .json(&body)
622 .headers(header_map)
623 .build()?;
624 let info = OperationInfo {
625 operation_id: "chunk",
626 };
627 self.pre(&mut request, &info).await?;
628 let result = self.exec(request, &info).await;
629 self.post(&result, &info).await?;
630 let response = result?;
631 match response.status().as_u16() {
632 200u16 => ResponseValue::from_response(response).await,
633 _ => Err(Error::UnexpectedResponse(response)),
634 }
635 }
636 #[doc = "Sends a `POST` request to `/client_config`\n\n"]
637 pub async fn client_config<'a>(
638 &'a self,
639 body: &'a types::JsonRpcRequestForClientConfig,
640 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcClientConfigResponseAndRpcError>, Error<()>>
641 {
642 let url = format!("{}/", self.baseurl,);
643 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
644 header_map.append(
645 ::reqwest::header::HeaderName::from_static("api-version"),
646 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
647 );
648 #[allow(unused_mut)]
649 let mut request = self
650 .client
651 .post(url)
652 .header(
653 ::reqwest::header::ACCEPT,
654 ::reqwest::header::HeaderValue::from_static("application/json"),
655 )
656 .json(&body)
657 .headers(header_map)
658 .build()?;
659 let info = OperationInfo {
660 operation_id: "client_config",
661 };
662 self.pre(&mut request, &info).await?;
663 let result = self.exec(request, &info).await;
664 self.post(&result, &info).await?;
665 let response = result?;
666 match response.status().as_u16() {
667 200u16 => ResponseValue::from_response(response).await,
668 _ => Err(Error::UnexpectedResponse(response)),
669 }
670 }
671 #[doc = "Sends a `POST` request to `/gas_price`\n\n"]
672 pub async fn gas_price<'a>(
673 &'a self,
674 body: &'a types::JsonRpcRequestForGasPrice,
675 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcGasPriceResponseAndRpcError>, Error<()>>
676 {
677 let url = format!("{}/", self.baseurl,);
678 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
679 header_map.append(
680 ::reqwest::header::HeaderName::from_static("api-version"),
681 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
682 );
683 #[allow(unused_mut)]
684 let mut request = self
685 .client
686 .post(url)
687 .header(
688 ::reqwest::header::ACCEPT,
689 ::reqwest::header::HeaderValue::from_static("application/json"),
690 )
691 .json(&body)
692 .headers(header_map)
693 .build()?;
694 let info = OperationInfo {
695 operation_id: "gas_price",
696 };
697 self.pre(&mut request, &info).await?;
698 let result = self.exec(request, &info).await;
699 self.post(&result, &info).await?;
700 let response = result?;
701 match response.status().as_u16() {
702 200u16 => ResponseValue::from_response(response).await,
703 _ => Err(Error::UnexpectedResponse(response)),
704 }
705 }
706 #[doc = "Sends a `POST` request to `/health`\n\n"]
707 pub async fn health<'a>(
708 &'a self,
709 body: &'a types::JsonRpcRequestForHealth,
710 ) -> Result<
711 ResponseValue<types::JsonRpcResponseForNullableRpcHealthResponseAndRpcError>,
712 Error<()>,
713 > {
714 let url = format!("{}/", self.baseurl,);
715 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
716 header_map.append(
717 ::reqwest::header::HeaderName::from_static("api-version"),
718 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
719 );
720 #[allow(unused_mut)]
721 let mut request = self
722 .client
723 .post(url)
724 .header(
725 ::reqwest::header::ACCEPT,
726 ::reqwest::header::HeaderValue::from_static("application/json"),
727 )
728 .json(&body)
729 .headers(header_map)
730 .build()?;
731 let info = OperationInfo {
732 operation_id: "health",
733 };
734 self.pre(&mut request, &info).await?;
735 let result = self.exec(request, &info).await;
736 self.post(&result, &info).await?;
737 let response = result?;
738 match response.status().as_u16() {
739 200u16 => ResponseValue::from_response(response).await,
740 _ => Err(Error::UnexpectedResponse(response)),
741 }
742 }
743 #[doc = "Sends a `POST` request to `/light_client_proof`\n\n"]
744 pub async fn light_client_proof<'a>(
745 &'a self,
746 body: &'a types::JsonRpcRequestForLightClientProof,
747 ) -> Result<
748 ResponseValue<types::JsonRpcResponseForRpcLightClientExecutionProofResponseAndRpcError>,
749 Error<()>,
750 > {
751 let url = format!("{}/", self.baseurl,);
752 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
753 header_map.append(
754 ::reqwest::header::HeaderName::from_static("api-version"),
755 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
756 );
757 #[allow(unused_mut)]
758 let mut request = self
759 .client
760 .post(url)
761 .header(
762 ::reqwest::header::ACCEPT,
763 ::reqwest::header::HeaderValue::from_static("application/json"),
764 )
765 .json(&body)
766 .headers(header_map)
767 .build()?;
768 let info = OperationInfo {
769 operation_id: "light_client_proof",
770 };
771 self.pre(&mut request, &info).await?;
772 let result = self.exec(request, &info).await;
773 self.post(&result, &info).await?;
774 let response = result?;
775 match response.status().as_u16() {
776 200u16 => ResponseValue::from_response(response).await,
777 _ => Err(Error::UnexpectedResponse(response)),
778 }
779 }
780 #[doc = "Sends a `POST` request to `/network_info`\n\n"]
781 pub async fn network_info<'a>(
782 &'a self,
783 body: &'a types::JsonRpcRequestForNetworkInfo,
784 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcNetworkInfoResponseAndRpcError>, Error<()>>
785 {
786 let url = format!("{}/", self.baseurl,);
787 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
788 header_map.append(
789 ::reqwest::header::HeaderName::from_static("api-version"),
790 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
791 );
792 #[allow(unused_mut)]
793 let mut request = self
794 .client
795 .post(url)
796 .header(
797 ::reqwest::header::ACCEPT,
798 ::reqwest::header::HeaderValue::from_static("application/json"),
799 )
800 .json(&body)
801 .headers(header_map)
802 .build()?;
803 let info = OperationInfo {
804 operation_id: "network_info",
805 };
806 self.pre(&mut request, &info).await?;
807 let result = self.exec(request, &info).await;
808 self.post(&result, &info).await?;
809 let response = result?;
810 match response.status().as_u16() {
811 200u16 => ResponseValue::from_response(response).await,
812 _ => Err(Error::UnexpectedResponse(response)),
813 }
814 }
815 #[doc = "Sends a `POST` request to `/next_light_client_block`\n\n"]
816 pub async fn next_light_client_block<'a>(
817 &'a self,
818 body: &'a types::JsonRpcRequestForNextLightClientBlock,
819 ) -> Result<
820 ResponseValue<types::JsonRpcResponseForRpcLightClientNextBlockResponseAndRpcError>,
821 Error<()>,
822 > {
823 let url = format!("{}/", self.baseurl,);
824 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
825 header_map.append(
826 ::reqwest::header::HeaderName::from_static("api-version"),
827 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
828 );
829 #[allow(unused_mut)]
830 let mut request = self
831 .client
832 .post(url)
833 .header(
834 ::reqwest::header::ACCEPT,
835 ::reqwest::header::HeaderValue::from_static("application/json"),
836 )
837 .json(&body)
838 .headers(header_map)
839 .build()?;
840 let info = OperationInfo {
841 operation_id: "next_light_client_block",
842 };
843 self.pre(&mut request, &info).await?;
844 let result = self.exec(request, &info).await;
845 self.post(&result, &info).await?;
846 let response = result?;
847 match response.status().as_u16() {
848 200u16 => ResponseValue::from_response(response).await,
849 _ => Err(Error::UnexpectedResponse(response)),
850 }
851 }
852 #[doc = "Sends a `POST` request to `/query`\n\n"]
853 pub async fn query<'a>(
854 &'a self,
855 body: &'a types::JsonRpcRequestForQuery,
856 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcQueryResponseAndRpcError>, Error<()>>
857 {
858 let url = format!("{}/", self.baseurl,);
859 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
860 header_map.append(
861 ::reqwest::header::HeaderName::from_static("api-version"),
862 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
863 );
864 #[allow(unused_mut)]
865 let mut request = self
866 .client
867 .post(url)
868 .header(
869 ::reqwest::header::ACCEPT,
870 ::reqwest::header::HeaderValue::from_static("application/json"),
871 )
872 .json(&body)
873 .headers(header_map)
874 .build()?;
875 let info = OperationInfo {
876 operation_id: "query",
877 };
878 self.pre(&mut request, &info).await?;
879 let result = self.exec(request, &info).await;
880 self.post(&result, &info).await?;
881 let response = result?;
882 match response.status().as_u16() {
883 200u16 => ResponseValue::from_response(response).await,
884 _ => Err(Error::UnexpectedResponse(response)),
885 }
886 }
887 #[doc = "Sends a `POST` request to `/send_tx`\n\n"]
888 pub async fn send_tx<'a>(
889 &'a self,
890 body: &'a types::JsonRpcRequestForSendTx,
891 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcError>, Error<()>>
892 {
893 let url = format!("{}/", self.baseurl,);
894 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
895 header_map.append(
896 ::reqwest::header::HeaderName::from_static("api-version"),
897 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
898 );
899 #[allow(unused_mut)]
900 let mut request = self
901 .client
902 .post(url)
903 .header(
904 ::reqwest::header::ACCEPT,
905 ::reqwest::header::HeaderValue::from_static("application/json"),
906 )
907 .json(&body)
908 .headers(header_map)
909 .build()?;
910 let info = OperationInfo {
911 operation_id: "send_tx",
912 };
913 self.pre(&mut request, &info).await?;
914 let result = self.exec(request, &info).await;
915 self.post(&result, &info).await?;
916 let response = result?;
917 match response.status().as_u16() {
918 200u16 => ResponseValue::from_response(response).await,
919 _ => Err(Error::UnexpectedResponse(response)),
920 }
921 }
922 #[doc = "Sends a `POST` request to `/status`\n\n"]
923 pub async fn status<'a>(
924 &'a self,
925 body: &'a types::JsonRpcRequestForStatus,
926 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcStatusResponseAndRpcError>, Error<()>>
927 {
928 let url = format!("{}/", self.baseurl,);
929 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
930 header_map.append(
931 ::reqwest::header::HeaderName::from_static("api-version"),
932 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
933 );
934 #[allow(unused_mut)]
935 let mut request = self
936 .client
937 .post(url)
938 .header(
939 ::reqwest::header::ACCEPT,
940 ::reqwest::header::HeaderValue::from_static("application/json"),
941 )
942 .json(&body)
943 .headers(header_map)
944 .build()?;
945 let info = OperationInfo {
946 operation_id: "status",
947 };
948 self.pre(&mut request, &info).await?;
949 let result = self.exec(request, &info).await;
950 self.post(&result, &info).await?;
951 let response = result?;
952 match response.status().as_u16() {
953 200u16 => ResponseValue::from_response(response).await,
954 _ => Err(Error::UnexpectedResponse(response)),
955 }
956 }
957 #[doc = "Sends a `POST` request to `/tx`\n\n"]
958 pub async fn tx<'a>(
959 &'a self,
960 body: &'a types::JsonRpcRequestForTx,
961 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcError>, Error<()>>
962 {
963 let url = format!("{}/", self.baseurl,);
964 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
965 header_map.append(
966 ::reqwest::header::HeaderName::from_static("api-version"),
967 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
968 );
969 #[allow(unused_mut)]
970 let mut request = self
971 .client
972 .post(url)
973 .header(
974 ::reqwest::header::ACCEPT,
975 ::reqwest::header::HeaderValue::from_static("application/json"),
976 )
977 .json(&body)
978 .headers(header_map)
979 .build()?;
980 let info = OperationInfo { operation_id: "tx" };
981 self.pre(&mut request, &info).await?;
982 let result = self.exec(request, &info).await;
983 self.post(&result, &info).await?;
984 let response = result?;
985 match response.status().as_u16() {
986 200u16 => ResponseValue::from_response(response).await,
987 _ => Err(Error::UnexpectedResponse(response)),
988 }
989 }
990 #[doc = "Sends a `POST` request to `/validators`\n\n"]
991 pub async fn validators<'a>(
992 &'a self,
993 body: &'a types::JsonRpcRequestForValidators,
994 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcValidatorResponseAndRpcError>, Error<()>>
995 {
996 let url = format!("{}/", self.baseurl,);
997 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
998 header_map.append(
999 ::reqwest::header::HeaderName::from_static("api-version"),
1000 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1001 );
1002 #[allow(unused_mut)]
1003 let mut request = self
1004 .client
1005 .post(url)
1006 .header(
1007 ::reqwest::header::ACCEPT,
1008 ::reqwest::header::HeaderValue::from_static("application/json"),
1009 )
1010 .json(&body)
1011 .headers(header_map)
1012 .build()?;
1013 let info = OperationInfo {
1014 operation_id: "validators",
1015 };
1016 self.pre(&mut request, &info).await?;
1017 let result = self.exec(request, &info).await;
1018 self.post(&result, &info).await?;
1019 let response = result?;
1020 match response.status().as_u16() {
1021 200u16 => ResponseValue::from_response(response).await,
1022 _ => Err(Error::UnexpectedResponse(response)),
1023 }
1024 }
1025}
1026#[doc = r" Items consumers will typically use such as the Client."]
1027pub mod prelude {
1028 #[allow(unused_imports)]
1029 pub use super::Client;
1030}