asic_rs/miners/api/
mod.rs

1use anyhow::Result;
2use async_trait::async_trait;
3use reqwest::Method;
4use serde_json::Value;
5
6use crate::miners::commands::MinerCommand;
7
8pub mod rpc;
9
10#[async_trait]
11pub trait APIClient: Send + Sync {
12    async fn get_api_result(&self, command: &MinerCommand) -> Result<Value>;
13}
14
15#[async_trait]
16pub trait WebAPIClient: Send + Sync + APIClient {
17    async fn send_command(
18        &self,
19        command: &str,
20        _privileged: bool,
21        parameters: Option<Value>,
22        method: Method,
23    ) -> Result<Value>;
24}
25
26#[async_trait]
27pub trait RPCAPIClient: Send + Sync + APIClient {
28    async fn send_command(
29        &self,
30        command: &str,
31        _privileged: bool,
32        parameters: Option<Value>,
33    ) -> Result<Value>;
34}