Skip to content

Commit d02877c

Browse files
authored
feat(blockscout-client): update to the latest swagger (pre v7.0.0)
1 parent dbc91b6 commit d02877c

15 files changed

+394
-16
lines changed

libs/blockscout-client/crate/.openapi-generator/FILES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ src/apis/addresses_api.rs
22
src/apis/blocks_api.rs
33
src/apis/config_api.rs
44
src/apis/health_api.rs
5+
src/apis/internal_transactions_api.rs
56
src/apis/main_page_api.rs
67
src/apis/mod.rs
8+
src/apis/proxy_api.rs
79
src/apis/search_api.rs
810
src/apis/smart_contracts_api.rs
911
src/apis/stats_api.rs
@@ -42,6 +44,7 @@ src/models/get_addresses_200_response.rs
4244
src/models/get_block_txs_200_response.rs
4345
src/models/get_block_withdrawals_200_response.rs
4446
src/models/get_blocks_200_response.rs
47+
src/models/get_internal_transactions_200_response.rs
4548
src/models/get_json_rpc_url_200_response.rs
4649
src/models/get_market_chart_200_response.rs
4750
src/models/get_nft_instance_transfers_200_response.rs
@@ -124,6 +127,8 @@ src/models/transaction_reward.rs
124127
src/models/transaction_summary.rs
125128
src/models/transaction_summary_obj.rs
126129
src/models/v1_data.rs
130+
src/models/v1_entry_point_indexer_status.rs
127131
src/models/v1_health_check_response.rs
132+
src/models/v1_indexer_status.rs
128133
src/models/watchlist_name.rs
129134
src/models/withdrawal.rs
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* BlockScout API
3+
*
4+
* API for BlockScout web app
5+
*
6+
* The version of the OpenAPI document: 1.0.0
7+
* Contact: [email protected]
8+
* Generated by: https://openapi-generator.tech
9+
*/
10+
11+
use super::{configuration, Error};
12+
use crate::{apis::ResponseContent, models};
13+
use reqwest;
14+
use serde::{Deserialize, Serialize};
15+
16+
/// struct for typed errors of method [`get_internal_transactions`]
17+
#[derive(Debug, Clone, Serialize, Deserialize)]
18+
#[serde(untagged)]
19+
pub enum GetInternalTransactionsError {
20+
UnknownValue(serde_json::Value),
21+
}
22+
23+
pub async fn get_internal_transactions(
24+
configuration: &configuration::Configuration,
25+
) -> Result<models::GetInternalTransactions200Response, Error<GetInternalTransactionsError>> {
26+
let uri_str = format!("{}/api/v2/internal-transactions", configuration.base_path);
27+
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
28+
29+
if let Some(ref user_agent) = configuration.user_agent {
30+
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
31+
}
32+
33+
let req = req_builder.build()?;
34+
let resp = configuration.client.execute(req).await?;
35+
36+
let status = resp.status();
37+
38+
if !status.is_client_error() && !status.is_server_error() {
39+
let content = resp.text().await?;
40+
serde_json::from_str(&content).map_err(Error::from)
41+
} else {
42+
let content = resp.text().await?;
43+
let entity: Option<GetInternalTransactionsError> = serde_json::from_str(&content).ok();
44+
Err(Error::ResponseError(ResponseContent {
45+
status,
46+
content,
47+
entity,
48+
}))
49+
}
50+
}

libs/blockscout-client/crate/src/apis/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ pub mod addresses_api;
104104
pub mod blocks_api;
105105
pub mod config_api;
106106
pub mod health_api;
107+
pub mod internal_transactions_api;
107108
pub mod main_page_api;
109+
pub mod proxy_api;
108110
pub mod search_api;
109111
pub mod smart_contracts_api;
110112
pub mod stats_api;
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* BlockScout API
3+
*
4+
* API for BlockScout web app
5+
*
6+
* The version of the OpenAPI document: 1.0.0
7+
* Contact: [email protected]
8+
* Generated by: https://openapi-generator.tech
9+
*/
10+
11+
use super::{configuration, Error};
12+
use crate::{apis::ResponseContent, models};
13+
use reqwest;
14+
use serde::{Deserialize, Serialize};
15+
16+
/// struct for typed errors of method [`get_account_abstraction_status`]
17+
#[derive(Debug, Clone, Serialize, Deserialize)]
18+
#[serde(untagged)]
19+
pub enum GetAccountAbstractionStatusError {
20+
Status500(),
21+
UnknownValue(serde_json::Value),
22+
}
23+
24+
pub async fn get_account_abstraction_status(
25+
configuration: &configuration::Configuration,
26+
) -> Result<models::V1IndexerStatus, Error<GetAccountAbstractionStatusError>> {
27+
let uri_str = format!(
28+
"{}/api/v2/proxy/account-abstraction/status",
29+
configuration.base_path
30+
);
31+
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
32+
33+
if let Some(ref user_agent) = configuration.user_agent {
34+
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
35+
}
36+
37+
let req = req_builder.build()?;
38+
let resp = configuration.client.execute(req).await?;
39+
40+
let status = resp.status();
41+
42+
if !status.is_client_error() && !status.is_server_error() {
43+
let content = resp.text().await?;
44+
serde_json::from_str(&content).map_err(Error::from)
45+
} else {
46+
let content = resp.text().await?;
47+
let entity: Option<GetAccountAbstractionStatusError> = serde_json::from_str(&content).ok();
48+
Err(Error::ResponseError(ResponseContent {
49+
status,
50+
content,
51+
entity,
52+
}))
53+
}
54+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* BlockScout API
3+
*
4+
* API for BlockScout web app
5+
*
6+
* The version of the OpenAPI document: 1.0.0
7+
* Contact: [email protected]
8+
* Generated by: https://openapi-generator.tech
9+
*/
10+
11+
use crate::models;
12+
use serde::{Deserialize, Serialize};
13+
14+
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15+
pub struct GetInternalTransactions200Response {
16+
#[serde(rename = "items")]
17+
pub items: Vec<models::InternalTransaction>,
18+
#[serde(rename = "next_page_params")]
19+
pub next_page_params: serde_json::Value,
20+
}
21+
22+
impl GetInternalTransactions200Response {
23+
pub fn new(
24+
items: Vec<models::InternalTransaction>,
25+
next_page_params: serde_json::Value,
26+
) -> GetInternalTransactions200Response {
27+
GetInternalTransactions200Response {
28+
items,
29+
next_page_params,
30+
}
31+
}
32+
}

libs/blockscout-client/crate/src/models/indexing_status.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ pub struct IndexingStatus {
2424
}
2525

2626
impl IndexingStatus {
27-
pub fn new(finished_indexing: bool, finished_indexing_blocks: bool) -> IndexingStatus {
27+
pub fn new(
28+
finished_indexing: bool,
29+
finished_indexing_blocks: bool,
30+
indexed_blocks_ratio: Option<String>,
31+
indexed_internal_transactions_ratio: Option<String>,
32+
) -> IndexingStatus {
2833
IndexingStatus {
2934
finished_indexing,
3035
finished_indexing_blocks,
31-
indexed_blocks_ratio: None,
32-
indexed_internal_transactions_ratio: None,
36+
indexed_blocks_ratio,
37+
indexed_internal_transactions_ratio,
3338
}
3439
}
3540
}

libs/blockscout-client/crate/src/models/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ pub mod get_block_withdrawals_200_response;
6666
pub use self::get_block_withdrawals_200_response::GetBlockWithdrawals200Response;
6767
pub mod get_blocks_200_response;
6868
pub use self::get_blocks_200_response::GetBlocks200Response;
69+
pub mod get_internal_transactions_200_response;
70+
pub use self::get_internal_transactions_200_response::GetInternalTransactions200Response;
6971
pub mod get_json_rpc_url_200_response;
7072
pub use self::get_json_rpc_url_200_response::GetJsonRpcUrl200Response;
7173
pub mod get_market_chart_200_response;
@@ -238,8 +240,12 @@ pub mod transaction_summary_obj;
238240
pub use self::transaction_summary_obj::TransactionSummaryObj;
239241
pub mod v1_data;
240242
pub use self::v1_data::V1Data;
243+
pub mod v1_entry_point_indexer_status;
244+
pub use self::v1_entry_point_indexer_status::V1EntryPointIndexerStatus;
241245
pub mod v1_health_check_response;
242246
pub use self::v1_health_check_response::V1HealthCheckResponse;
247+
pub mod v1_indexer_status;
248+
pub use self::v1_indexer_status::V1IndexerStatus;
243249
pub mod watchlist_name;
244250
pub use self::watchlist_name::WatchlistName;
245251
pub mod withdrawal;

libs/blockscout-client/crate/src/models/token_transfer_total.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub enum TokenTransferTotal {
1717
TotalErc20(models::TotalErc20),
1818
TotalErc721(models::TotalErc721),
1919
TotalErc1155(models::TotalErc1155),
20-
TotalErc1155Batch(Vec<models::TotalErc1155>),
2120
}
2221

2322
impl Default for TokenTransferTotal {

libs/blockscout-client/crate/src/models/total_erc1155.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ pub struct TotalErc1155 {
1919
pub decimals: String,
2020
#[serde(rename = "value")]
2121
pub value: String,
22+
#[serde(rename = "token_instance", skip_serializing_if = "Option::is_none")]
23+
pub token_instance: Option<models::NftInstance>,
2224
}
2325

2426
impl TotalErc1155 {
@@ -27,6 +29,7 @@ impl TotalErc1155 {
2729
token_id,
2830
decimals,
2931
value,
32+
token_instance: None,
3033
}
3134
}
3235
}

libs/blockscout-client/crate/src/models/total_erc721.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ use serde::{Deserialize, Serialize};
1515
pub struct TotalErc721 {
1616
#[serde(rename = "token_id")]
1717
pub token_id: String,
18+
#[serde(rename = "token_instance", skip_serializing_if = "Option::is_none")]
19+
pub token_instance: Option<models::NftInstance>,
1820
}
1921

2022
impl TotalErc721 {
2123
pub fn new(token_id: String) -> TotalErc721 {
22-
TotalErc721 { token_id }
24+
TotalErc721 {
25+
token_id,
26+
token_instance: None,
27+
}
2328
}
2429
}

0 commit comments

Comments
 (0)