diff --git a/src/main.rs b/src/main.rs index 8b944b9..e8501ba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,7 @@ struct Cli{ #[derive(Subcommand)] enum Commands{ + AssetDetails(AssetDetailsSubcommand), DownloadHistory(DownloadHistorySubcommand), Download(DownloadSubcommand), DownloadVersion(DownloadVersionSubcommand), @@ -61,6 +62,18 @@ struct DownloadHistorySubcommand{ #[arg(long)] end_version:Option<u64>, } +/// Print the details for an asset +#[derive(Args)] +struct AssetDetailsSubcommand{ + #[arg(long,group="cookie",required=true)] + cookie_literal:Option<String>, + #[arg(long,group="cookie",required=true)] + cookie_envvar:Option<String>, + #[arg(long,group="cookie",required=true)] + cookie_file:Option<PathBuf>, + #[arg(required=true)] + asset_id:AssetID, +} /// Download a list of assets by id. #[derive(Args)] struct DownloadSubcommand{ @@ -420,6 +433,16 @@ impl AssetType{ async fn main()->AResult<()>{ let cli=Cli::parse(); match cli.command{ + Commands::AssetDetails(subcommand)=>{ + asset_details( + cookie_from_args( + subcommand.cookie_literal, + subcommand.cookie_envvar, + subcommand.cookie_file, + ).await?, + subcommand.asset_id + ).await + }, Commands::DownloadHistory(subcommand)=>download_history(DownloadHistoryConfig{ continue_from_versions:subcommand.continue_from_versions.unwrap_or(false), end_version:subcommand.end_version, @@ -958,6 +981,13 @@ async fn upload_place(config:UploadPlaceConfig)->AResult<()>{ Ok(()) } +async fn asset_details(cookie:Cookie,asset_id:AssetID)->AResult<()>{ + let context=CookieContext::new(cookie); + let details=context.get_asset_details(rbx_asset::cookie::GetAssetDetailsRequest{asset_id}).await?; + println!("details:{details:?}"); + Ok(()) +} + async fn download_version(cookie:Cookie,asset_id:AssetID,version:Option<u64>,dest:PathBuf)->AResult<()>{ let context=CookieContext::new(cookie); let data=context.get_asset(rbx_asset::cookie::GetAssetRequest{asset_id,version}).await?;