feature/share-libs
rs 46 lines 1.65 KB
Raw
1 use once_cell::sync::OnceCell;
2 use url_builder::URLBuilder;
3 use super::settings::api_host;
4
5 // Client ID and Client Secret
6 #[cfg(debug_assertions)]
7 pub const SF_CLIENT_ID: &str = "cli";
8 #[cfg(not(debug_assertions))]
9 pub const SF_CLIENT_ID: &str = "cli";
10 #[cfg(debug_assertions)]
11 pub const SF_CLIENT_SECRET: &str = "secretttttttt";
12 #[cfg(not(debug_assertions))]
13 pub const SF_CLIENT_SECRET: &str = "secretttttttt";
14
15 // Paths
16 pub const PATH_AUDIO: &str = "api/v1/splitfire";
17
18 // Account Paths
19 pub const PATH_ACCOUNT_LOGIN: &str = "api/v1/login";
20 pub const PATH_ACCOUNT_REGISTER: &str = "api/v1/register";
21 pub const PATH_ACCOUNT_LOGOUT: &str = "api/v1/logout";
22 pub const PATH_ACCOUNT_PROFILE: &str = "api/v1/profile/{userId}";
23
24 // Contents Paths
25 pub const PATH_CAROUSEL: &str = "api/v1/carousel";
26 pub const PATH_READY_TO_PLAY: &str = "api/v1/ready-to-play";
27 pub const PATH_SEARCH: &str = "api/v1//search";
28 pub const PATH_TOP_VOTES: &str = "api/v1/top-votes";
29 pub const PATH_SONG_BRIDGE_DETAIL: &str = "api/v1/song-bridge/{providerId}/detail";
30 pub const PATH_SONG_BRIDGE_VOTE: &str = "api/v1/song-bridge/{providerId}/vote";
31 pub const PATH_SONG_BRIDGE_SPLIT: &str = "api/v1/song-bridge/{providerId}/split";
32
33 pub fn base_url_builder() -> URLBuilder {
34 let mut url_builder = URLBuilder::new();
35 url_builder
36 .set_protocol("https")
37 .set_host(api_host())
38 .add_param("client_id", SF_CLIENT_ID)
39 .add_param("client_secret", SF_CLIENT_SECRET);
40 url_builder
41 }
42
43 pub static mut CURRENT_API_HOST: OnceCell<&str> = OnceCell::new();
44 // DEFAULT BASE_URL
45 pub const API_HOST_PRODUCTION: &str = "api.musik88.com";
46 pub const API_HOST_DEVELOPMENT: &str = "localhost:3001";