asset-tool: add AssetDetails
This commit is contained in:
30
src/main.rs
30
src/main.rs
@ -20,6 +20,7 @@ struct Cli{
|
|||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
enum Commands{
|
enum Commands{
|
||||||
|
AssetDetails(AssetDetailsSubcommand),
|
||||||
DownloadHistory(DownloadHistorySubcommand),
|
DownloadHistory(DownloadHistorySubcommand),
|
||||||
Download(DownloadSubcommand),
|
Download(DownloadSubcommand),
|
||||||
DownloadVersion(DownloadVersionSubcommand),
|
DownloadVersion(DownloadVersionSubcommand),
|
||||||
@ -61,6 +62,18 @@ struct DownloadHistorySubcommand{
|
|||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
end_version:Option<u64>,
|
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.
|
/// Download a list of assets by id.
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
struct DownloadSubcommand{
|
struct DownloadSubcommand{
|
||||||
@ -420,6 +433,16 @@ impl AssetType{
|
|||||||
async fn main()->AResult<()>{
|
async fn main()->AResult<()>{
|
||||||
let cli=Cli::parse();
|
let cli=Cli::parse();
|
||||||
match cli.command{
|
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{
|
Commands::DownloadHistory(subcommand)=>download_history(DownloadHistoryConfig{
|
||||||
continue_from_versions:subcommand.continue_from_versions.unwrap_or(false),
|
continue_from_versions:subcommand.continue_from_versions.unwrap_or(false),
|
||||||
end_version:subcommand.end_version,
|
end_version:subcommand.end_version,
|
||||||
@ -958,6 +981,13 @@ async fn upload_place(config:UploadPlaceConfig)->AResult<()>{
|
|||||||
Ok(())
|
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<()>{
|
async fn download_version(cookie:Cookie,asset_id:AssetID,version:Option<u64>,dest:PathBuf)->AResult<()>{
|
||||||
let context=CookieContext::new(cookie);
|
let context=CookieContext::new(cookie);
|
||||||
let data=context.get_asset(rbx_asset::cookie::GetAssetRequest{asset_id,version}).await?;
|
let data=context.get_asset(rbx_asset::cookie::GetAssetRequest{asset_id,version}).await?;
|
||||||
|
Reference in New Issue
Block a user