forked from StrafesNET/asset-tool
use old asset api for compile-upload-asset
This commit is contained in:
parent
74b84f6de0
commit
4c00d7fe1a
37
src/main.rs
37
src/main.rs
@ -193,12 +193,14 @@ struct CompileSubcommand{
|
|||||||
struct CompileUploadAssetSubcommand{
|
struct CompileUploadAssetSubcommand{
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
asset_id:AssetID,
|
asset_id:AssetID,
|
||||||
#[arg(long,group="api_key",required=true)]
|
#[arg(long,group="cookie",required=true)]
|
||||||
api_key_literal:Option<String>,
|
cookie_literal:Option<String>,
|
||||||
#[arg(long,group="api_key",required=true)]
|
#[arg(long,group="cookie",required=true)]
|
||||||
api_key_envvar:Option<String>,
|
cookie_envvar:Option<String>,
|
||||||
#[arg(long,group="api_key",required=true)]
|
#[arg(long,group="cookie",required=true)]
|
||||||
api_key_file:Option<PathBuf>,
|
cookie_file:Option<PathBuf>,
|
||||||
|
#[arg(long)]
|
||||||
|
group_id:Option<u64>,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
input_folder:Option<PathBuf>,
|
input_folder:Option<PathBuf>,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
@ -462,12 +464,13 @@ async fn main()->AResult<()>{
|
|||||||
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
||||||
template:subcommand.template,
|
template:subcommand.template,
|
||||||
style:subcommand.style.map(|s|s.rox()),
|
style:subcommand.style.map(|s|s.rox()),
|
||||||
api_key:api_key_from_args(
|
cookie:cookie_from_args(
|
||||||
subcommand.api_key_literal,
|
subcommand.cookie_literal,
|
||||||
subcommand.api_key_envvar,
|
subcommand.cookie_envvar,
|
||||||
subcommand.api_key_file,
|
subcommand.cookie_file,
|
||||||
).await?,
|
).await?,
|
||||||
asset_id:subcommand.asset_id,
|
asset_id:subcommand.asset_id,
|
||||||
|
group_id:subcommand.group_id,
|
||||||
}).await,
|
}).await,
|
||||||
Commands::CompileUploadPlace(subcommand)=>compile_upload_place(CompileUploadPlaceConfig{
|
Commands::CompileUploadPlace(subcommand)=>compile_upload_place(CompileUploadPlaceConfig{
|
||||||
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
||||||
@ -1137,7 +1140,8 @@ struct CompileUploadAssetConfig{
|
|||||||
input_folder:PathBuf,
|
input_folder:PathBuf,
|
||||||
template:Option<PathBuf>,
|
template:Option<PathBuf>,
|
||||||
style:Option<rox_compiler::Style>,
|
style:Option<rox_compiler::Style>,
|
||||||
api_key:ApiKey,
|
cookie:Cookie,
|
||||||
|
group_id:Option<u64>,
|
||||||
asset_id:AssetID,
|
asset_id:AssetID,
|
||||||
}
|
}
|
||||||
async fn compile_upload_asset(config:CompileUploadAssetConfig)->AResult<()>{
|
async fn compile_upload_asset(config:CompileUploadAssetConfig)->AResult<()>{
|
||||||
@ -1157,11 +1161,14 @@ async fn compile_upload_asset(config:CompileUploadAssetConfig)->AResult<()>{
|
|||||||
rbx_binary::to_writer(std::io::Cursor::new(&mut data),&dom,dom.root().children())?;
|
rbx_binary::to_writer(std::io::Cursor::new(&mut data),&dom,dom.root().children())?;
|
||||||
|
|
||||||
//upload it
|
//upload it
|
||||||
let context=CloudContext::new(config.api_key);
|
let context=CookieContext::new(config.cookie);
|
||||||
let resp=context.update_asset(rbx_asset::cloud::UpdateAssetRequest{
|
let resp=context.upload(rbx_asset::cookie::UploadRequest{
|
||||||
assetId:config.asset_id,
|
groupId:config.group_id,
|
||||||
displayName:None,
|
assetid:config.asset_id,
|
||||||
|
name:None,
|
||||||
description:None,
|
description:None,
|
||||||
|
ispublic:None,
|
||||||
|
allowComments:None,
|
||||||
},data).await?;
|
},data).await?;
|
||||||
println!("UploadResponse={:?}",resp);
|
println!("UploadResponse={:?}",resp);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user