feat(search): add bmkg, jadwal-sholat, weather, yt-search, google endpoints
This commit is contained in:
1 parent
091a68bd55
commit
7ffc1bdd81
11 files changed
+442
-24
No files matched your search
@@ -13,21 +13,15 @@ pub async fn currency_converter(amount: f64, from: &str, to: &str) -> Result<Val
|
||||
|
||||
/// Harga emas Antam.
|
||||
pub async fn harga_emas() -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_harga_emas()
|
||||
.await
|
||||
.map_err(ScrapingError::Http)
|
||||
Repo::fetch_harga_emas().await.map_err(ScrapingError::Http)
|
||||
}
|
||||
|
||||
/// Kurs BCA (jual/beli).
|
||||
pub async fn kurs_bca() -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_kurs_bca()
|
||||
.await
|
||||
.map_err(ScrapingError::Http)
|
||||
Repo::fetch_kurs_bca().await.map_err(ScrapingError::Http)
|
||||
}
|
||||
|
||||
/// Server info (OS/CPU/RAM/disk).
|
||||
pub async fn server_info() -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_server_info()
|
||||
.await
|
||||
.map_err(ScrapingError::Http)
|
||||
Repo::fetch_server_info().await.map_err(ScrapingError::Http)
|
||||
}
|
||||
@@ -4,5 +4,6 @@ pub mod downloader;
|
||||
pub mod komik;
|
||||
pub mod misc;
|
||||
pub mod proxy;
|
||||
pub mod search;
|
||||
pub mod stalk;
|
||||
pub mod weebs;
|
||||
@@ -0,0 +1,29 @@
|
||||
//! Application use-cases for search utilities.
|
||||
|
||||
use crate::domain::error::ScrapingError;
|
||||
use crate::infrastructure::repository::search as Repo;
|
||||
use serde_json::Value;
|
||||
|
||||
pub async fn bmkg() -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_bmkg().await.map_err(ScrapingError::Http)
|
||||
}
|
||||
|
||||
pub async fn jadwal_sholat(kota: &str) -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_jadwal_sholat(kota)
|
||||
.await
|
||||
.map_err(ScrapingError::Http)
|
||||
}
|
||||
|
||||
pub async fn weather(city: &str) -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_weather(city).await.map_err(ScrapingError::Http)
|
||||
}
|
||||
|
||||
pub async fn google(query: &str) -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_google(query).await.map_err(ScrapingError::Http)
|
||||
}
|
||||
|
||||
pub async fn yt_search(query: &str) -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_yt_search(query)
|
||||
.await
|
||||
.map_err(ScrapingError::Http)
|
||||
}
|
||||
Reference in new issue
Block a user