diff --git a/rbx_asset/src/cloud.rs b/rbx_asset/src/cloud.rs index dc276c8..03ac425 100644 --- a/rbx_asset/src/cloud.rs +++ b/rbx_asset/src/cloud.rs @@ -279,16 +279,11 @@ impl CloudContext{ Ok(resp.json::().await.map_err(UpdateError::Reqwest)?) } pub async fn get_asset(&self,config:GetAssetRequest)->Result,GetError>{ - let mut url=reqwest::Url::parse("https://assetdelivery.roblox.com/v1/asset/").map_err(GetError::ParseError)?; - //url borrow scope - { - let mut query=url.query_pairs_mut();//borrow here - query.append_pair("ID",config.asset_id.to_string().as_str()); - if let Some(version)=config.version{ - query.append_pair("version",version.to_string().as_str()); - } - } - let resp=self.get(url).await.map_err(GetError::Reqwest)?; + let raw_url=match config.version{ + Some(version)=>format!("https://apis.roblox.com/assets/v1/assets/{}/versions/{version}",config.asset_id), + None=>format!("https://apis.roblox.com/assets/v1/assets/{}",config.asset_id), + }; + let url=reqwest::Url::parse(raw_url.as_str()).map_err(GetError::ParseError)?; let body=self.get(url).await.map_err(GetError::Reqwest)? .error_for_status().map_err(GetError::Reqwest)?