Create multiple assets concurrently #5
@ -15,8 +15,8 @@ pub struct CreateAssetRequest{
|
|||||||
}
|
}
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum CreateError{
|
pub enum CreateError{
|
||||||
ParseError(url::ParseError),
|
Parse(url::ParseError),
|
||||||
SerializeError(serde_json::Error),
|
Serialize(serde_json::Error),
|
||||||
Reqwest(reqwest::Error),
|
Reqwest(reqwest::Error),
|
||||||
}
|
}
|
||||||
impl std::fmt::Display for CreateError{
|
impl std::fmt::Display for CreateError{
|
||||||
@ -298,9 +298,9 @@ impl CloudContext{
|
|||||||
.send().await
|
.send().await
|
||||||
}
|
}
|
||||||
pub async fn create_asset(&self,config:CreateAssetRequest,body:impl Into<std::borrow::Cow<'static,[u8]>>)->Result<RobloxOperation,CreateError>{
|
pub async fn create_asset(&self,config:CreateAssetRequest,body:impl Into<std::borrow::Cow<'static,[u8]>>)->Result<RobloxOperation,CreateError>{
|
||||||
let url=reqwest::Url::parse("https://apis.roblox.com/assets/v1/assets").map_err(CreateError::ParseError)?;
|
let url=reqwest::Url::parse("https://apis.roblox.com/assets/v1/assets").map_err(CreateError::Parse)?;
|
||||||
|
|
||||||
let request_config=serde_json::to_string(&config).map_err(CreateError::SerializeError)?;
|
let request_config=serde_json::to_string(&config).map_err(CreateError::Serialize)?;
|
||||||
|
|
||||||
let part=reqwest::multipart::Part::bytes(body)
|
let part=reqwest::multipart::Part::bytes(body)
|
||||||
//you must have a file name or roblox will 400!!!!!!!!!
|
//you must have a file name or roblox will 400!!!!!!!!!
|
||||||
|
Loading…
Reference in New Issue
Block a user