binance_sdk/alpha/mod.rs
1pub mod rest_api;
2
3use crate::common::{
4 config::ConfigurationRestApi, constants::ALPHA_REST_API_PROD_URL, utils::build_user_agent,
5};
6
7/// Represents the Alpha REST API client for interacting with the Binance Alpha REST API.
8///
9/// This struct provides methods to create REST API clients for production environments.
10pub struct AlphaRestApi {}
11
12impl AlphaRestApi {
13 /// Creates a REST API client with the given configuration.
14 ///
15 /// If no base path is specified in the configuration, defaults to the production Alpha REST API URL.
16 ///
17 /// # Arguments
18 ///
19 /// * `config` - Configuration for the REST API client
20 ///
21 /// # Returns
22 ///
23 /// A new REST API client configured with the provided settings
24 #[must_use]
25 pub fn from_config(mut config: ConfigurationRestApi) -> rest_api::RestApi {
26 config.user_agent = build_user_agent("alpha");
27 if config.base_path.is_none() {
28 config.base_path = Some(ALPHA_REST_API_PROD_URL.to_string());
29 }
30 rest_api::RestApi::new(config)
31 }
32
33 /// Creates a REST API client configured for the production environment.
34 ///
35 /// # Arguments
36 ///
37 /// * `config` - Configuration for the REST API client
38 ///
39 /// # Returns
40 ///
41 /// A new REST API client configured for the production environment
42 #[must_use]
43 pub fn production(mut config: ConfigurationRestApi) -> rest_api::RestApi {
44 config.base_path = Some(ALPHA_REST_API_PROD_URL.to_string());
45 AlphaRestApi::from_config(config)
46 }
47}