forked from StrafesNET/asset-tool
rename limited commands
This commit is contained in:
parent
0d92221a27
commit
04d092c76f
20
src/main.rs
20
src/main.rs
@ -24,8 +24,8 @@ enum Commands{
|
||||
Download(DownloadSubcommand),
|
||||
DownloadDecompile(DownloadDecompileSubcommand),
|
||||
DownloadGroupInventoryJson(DownloadGroupInventoryJsonSubcommand),
|
||||
CreateAsset(CreateAssetSubcommand),
|
||||
UploadAsset(UpdateAssetSubcommand),
|
||||
CreateAssetMedia(CreateAssetMediaSubcommand),
|
||||
UploadAssetMedia(UpdateAssetMediaSubcommand),
|
||||
UploadPlace(UpdatePlaceSubcommand),
|
||||
Compile(CompileSubcommand),
|
||||
CompileUploadAsset(CompileUploadAssetSubcommand),
|
||||
@ -81,7 +81,7 @@ struct DownloadGroupInventoryJsonSubcommand{
|
||||
group:u64,
|
||||
}
|
||||
#[derive(Args)]
|
||||
struct CreateAssetSubcommand{
|
||||
struct CreateAssetMediaSubcommand{
|
||||
#[arg(long,group="api_key",required=true)]
|
||||
api_key_literal:Option<String>,
|
||||
#[arg(long,group="api_key",required=true)]
|
||||
@ -100,7 +100,7 @@ struct CreateAssetSubcommand{
|
||||
creator_group_id:Option<u64>,
|
||||
}
|
||||
#[derive(Args)]
|
||||
struct UpdateAssetSubcommand{
|
||||
struct UpdateAssetMediaSubcommand{
|
||||
#[arg(long)]
|
||||
asset_id:AssetID,
|
||||
#[arg(long,group="api_key",required=true)]
|
||||
@ -326,7 +326,7 @@ async fn main()->AResult<()>{
|
||||
subcommand.group,
|
||||
subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
||||
).await,
|
||||
Commands::CreateAsset(subcommand)=>create(CreateConfig{
|
||||
Commands::CreateAssetMedia(subcommand)=>create_asset_media(CreateAssetMediaConfig{
|
||||
api_key:api_key_from_args(
|
||||
subcommand.api_key_literal,
|
||||
subcommand.api_key_envvar,
|
||||
@ -338,7 +338,7 @@ async fn main()->AResult<()>{
|
||||
model_name:subcommand.model_name,
|
||||
description:subcommand.description.unwrap_or_else(||String::with_capacity(0)),
|
||||
}).await,
|
||||
Commands::UploadAsset(subcommand)=>upload_asset(UploadAssetConfig{
|
||||
Commands::UploadAssetMedia(subcommand)=>upload_asset_media(UploadAssetMediaConfig{
|
||||
api_key:api_key_from_args(
|
||||
subcommand.api_key_literal,
|
||||
subcommand.api_key_envvar,
|
||||
@ -441,7 +441,7 @@ async fn api_key_from_args(literal:Option<String>,environment:Option<String>,fil
|
||||
Ok(ApiKey::new(api_key))
|
||||
}
|
||||
|
||||
struct CreateConfig{
|
||||
struct CreateAssetMediaConfig{
|
||||
api_key:ApiKey,
|
||||
model_name:String,
|
||||
description:String,
|
||||
@ -451,7 +451,7 @@ struct CreateConfig{
|
||||
}
|
||||
|
||||
///This is hardcoded to create models atm
|
||||
async fn create(config:CreateConfig)->AResult<()>{
|
||||
async fn create_asset_media(config:CreateAssetMediaConfig)->AResult<()>{
|
||||
let resp=CloudContext::new(config.api_key)
|
||||
.create_asset(rbx_asset::cloud::CreateAssetRequest{
|
||||
assetType:rbx_asset::cloud::AssetType::Model,
|
||||
@ -469,12 +469,12 @@ async fn create(config:CreateConfig)->AResult<()>{
|
||||
Ok(())
|
||||
}
|
||||
|
||||
struct UploadAssetConfig{
|
||||
struct UploadAssetMediaConfig{
|
||||
api_key:ApiKey,
|
||||
asset_id:u64,
|
||||
input_file:PathBuf,
|
||||
}
|
||||
async fn upload_asset(config:UploadAssetConfig)->AResult<()>{
|
||||
async fn upload_asset_media(config:UploadAssetMediaConfig)->AResult<()>{
|
||||
let context=CloudContext::new(config.api_key);
|
||||
let resp=context.update_asset(rbx_asset::cloud::UpdateAssetRequest{
|
||||
assetId:config.asset_id,
|
||||
|
Loading…
Reference in New Issue
Block a user