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