eventify_http_client/apis/
transaction_api.rs

1/*
2 * eventify-http-server
3 *
4 * Ethereum Indexer
5 *
6 * The version of the OpenAPI document: 0.0.0-reserved
7 * Contact: lachezarkolevgg@gmail.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use reqwest;
12
13use super::{configuration, Error};
14use crate::apis::ResponseContent;
15
16/// struct for typed errors of method [`get_transactions_count`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum GetTransactionsCountError {
20    Status500(),
21    UnknownValue(serde_json::Value),
22}
23
24/// Get the Count of Transactions  This endpoint returns the total count of transactions present in the database. The response is a JSON object containing the count.  # Responses  * `200 OK`: Successfully retrieved the count of transactions. The response body will be a JSON object with the structure `{ \"count\": i64 }`, where `i64` is the total number of transactions. * `500 Internal Server Error`: Indicates that an error occurred on the server while processing the request. The response body will contain a JSON object with an error message.  # Example  ```json { \"count\": 123 } ```
25pub async fn get_transactions_count(
26    configuration: &configuration::Configuration,
27) -> Result<(), Error<GetTransactionsCountError>> {
28    let local_var_configuration = configuration;
29
30    let local_var_client = &local_var_configuration.client;
31
32    let local_var_uri_str = format!(
33        "{}/api/v1/transactions/count",
34        local_var_configuration.base_path
35    );
36    let mut local_var_req_builder =
37        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
38
39    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
40        local_var_req_builder =
41            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
42    }
43
44    let local_var_req = local_var_req_builder.build()?;
45    let local_var_resp = local_var_client.execute(local_var_req).await?;
46
47    let local_var_status = local_var_resp.status();
48    let local_var_content = local_var_resp.text().await?;
49
50    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
51        Ok(())
52    } else {
53        let local_var_entity: Option<GetTransactionsCountError> =
54            serde_json::from_str(&local_var_content).ok();
55        let local_var_error = ResponseContent {
56            status: local_var_status,
57            content: local_var_content,
58            entity: local_var_entity,
59        };
60        Err(Error::ResponseError(local_var_error))
61    }
62}