Skip to content

Commit

Permalink
get_home
Browse files Browse the repository at this point in the history
  • Loading branch information
ahqsoftwares committed Sep 25, 2024
1 parent d6493b8 commit ea361ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src-ahqstore-types/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-ahqstore-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ahqstore-types"
description = "Standard types used by AHQ Store"
version = "3.2.5"
version = "3.2.6"
edition = "2021"
license-file = "../LICENSE.md"
repository = "https://github.com/ahqsoftwares/tauri-ahq-store"
Expand Down
19 changes: 11 additions & 8 deletions src-ahqstore-types/src/api/internet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pub static DEV_DATA: LazyLock<String> = LazyLock::new(|| format!("{BASE_URL}/use

pub type GHRepoCommits = Vec<GHRepoCommit>;

#[cfg_attr(feature = "js", wasm_bindgen)]
pub async fn get_commit(token: Option<String>) -> Option<String> {
let mut builder = CLIENT.get(COMMIT_URL);

Expand All @@ -55,7 +54,6 @@ pub async fn get_commit(token: Option<String>) -> Option<String> {
Some(sha)
}

#[cfg_attr(feature = "js", wasm_bindgen)]
pub async fn get_total_maps(commit: &str) -> Option<usize> {
CLIENT
.get(TOTAL.replace("{COMMIT}", commit))
Expand All @@ -67,7 +65,17 @@ pub async fn get_total_maps(commit: &str) -> Option<usize> {
.ok()
}

#[cfg_attr(feature = "js", wasm_bindgen)]
pub async fn get_home(commit: &str) -> Option<Vec<(String, Vec<String>)>> {
CLIENT
.get(HOME.replace("{COMMIT}", commit))
.send()
.await
.ok()?
.json()
.await
.ok()
}

pub async fn get_search(commit: &str, id: &str) -> Option<Vec<super::SearchEntry>> {
CLIENT
.get(SEARCH.replace("{COMMIT}", commit).replace("{ID}", id))
Expand All @@ -84,7 +92,6 @@ pub type RespMapData = super::MapData;
#[cfg(feature = "js")]
pub type RespMapData = JsValue;

#[cfg_attr(feature = "js", wasm_bindgen)]
pub async fn get_map(commit: &str, id: &str) -> Option<RespMapData> {
let val: super::MapData = CLIENT
.get(MAP.replace("{COMMIT}", commit).replace("{ID}", id))
Expand All @@ -102,7 +109,6 @@ pub async fn get_map(commit: &str, id: &str) -> Option<RespMapData> {
return Some(val);
}

#[cfg_attr(feature = "js", wasm_bindgen)]
pub async fn get_devs_apps(commit: &str, id: &str) -> Option<Vec<String>> {
let data: String = CLIENT
.get(APPS_DEV.replace("{COMMIT}", commit).replace("{ID}", id))
Expand All @@ -123,7 +129,6 @@ pub async fn get_devs_apps(commit: &str, id: &str) -> Option<Vec<String>> {
)
}

#[cfg_attr(feature = "js", wasm_bindgen)]
pub async fn get_dev_data(commit: &str, id: &str) -> Option<super::DevData> {
CLIENT
.get(DEV_DATA.replace("{COMMIT}", commit).replace("{ID}", id))
Expand All @@ -135,7 +140,6 @@ pub async fn get_dev_data(commit: &str, id: &str) -> Option<super::DevData> {
.ok()
}

#[cfg_attr(feature = "js", wasm_bindgen)]
pub async fn get_app_asset(commit: &str, app_id: &str, asset: &str) -> Option<Vec<u8>> {
let path = APP_ASSET_URL
.replace("{COMMIT}", commit)
Expand All @@ -147,7 +151,6 @@ pub async fn get_app_asset(commit: &str, app_id: &str, asset: &str) -> Option<Ve
Some(builder.bytes().await.ok()?.to_vec())
}

#[cfg_attr(feature = "js", wasm_bindgen)]
pub async fn get_app(commit: &str, app_id: &str) -> Option<AHQStoreApplication> {
let url = APP_URL
.replace("{COMMIT}", commit)
Expand Down

0 comments on commit ea361ac

Please sign in to comment.