asset-tool: add AssetDetails

This commit is contained in:
Quaternions 2025-04-03 12:41:43 -07:00
parent 656de62bdc
commit e6fe04aa73
Signed by: Quaternions
GPG Key ID: D0DF5964F79AC131

@ -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?;