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