-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from bloodnighttw/metadata
Metadata Migration
- Loading branch information
Showing
17 changed files
with
845 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
mod auth; | ||
mod auth; | ||
mod metadata; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#[cfg(test)] | ||
mod client{ | ||
use std::path::PathBuf; | ||
use reginleif::metadata::client::package::PackageList; | ||
use reginleif_macro::BaseStorePoint; | ||
|
||
#[derive(Clone,Debug,BaseStorePoint)] | ||
struct TestPath(PathBuf); | ||
|
||
impl TestPath{ | ||
pub fn new() -> Self{ | ||
Self(PathBuf::from("test-metadata")) | ||
} | ||
} | ||
|
||
type TestPackageList = PackageList<TestPath>; | ||
|
||
#[tokio::test] | ||
async fn test_metadata_fetch()->anyhow::Result<()>{ | ||
|
||
let client = reqwest::Client::new(); | ||
let base_path = TestPath::new(); | ||
let endpoint = "https://meta.prismlauncher.org/v1/"; | ||
|
||
let test_package = [ | ||
("net.minecraft","1.14"), | ||
("net.fabricmc.fabric-loader","0.16.0"), | ||
]; | ||
|
||
let packages = TestPackageList::fetch(&base_path,client.clone(),endpoint).await?; | ||
|
||
|
||
for (uid,version) in test_package{ | ||
let pkg = packages.iter().find(|x| x.uid == uid).unwrap(); | ||
let pkg_details = pkg.get_details(&base_path,client.clone(),endpoint).await.unwrap(); | ||
// println!("{:?}",pkg_details); | ||
let version_info = pkg_details.iter().find(|x| x.version == version).unwrap(); | ||
// println!("{:?}",version_info); | ||
let version_details = version_info.get_details(&base_path,client.clone(),endpoint,uid).await?; | ||
// println!("{:?}",version_details); | ||
if version_details.asset_index.is_some(){ | ||
let assets = version_details.asset_index.unwrap().fetch_assets_info(&base_path,client.clone()).await?; | ||
// println!("{:?}",assets); | ||
} | ||
|
||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod expiring_data; | ||
pub mod serde_convert; | ||
pub mod save_path; | ||
pub mod sha; |
Oops, something went wrong.