rbx_asset: add get_asset_details
This commit is contained in:
parent
aea777ecd3
commit
b0f1e964a6
@ -72,6 +72,10 @@ pub struct UploadResponse{
|
||||
pub AssetId:u64,
|
||||
}
|
||||
|
||||
#[allow(nonstandard_style,dead_code)]
|
||||
pub struct GetAssetDetailsRequest{
|
||||
pub asset_id:u64,
|
||||
}
|
||||
#[allow(nonstandard_style,dead_code)]
|
||||
pub struct GetAssetRequest{
|
||||
pub asset_id:u64,
|
||||
@ -98,6 +102,50 @@ pub enum CreatorType{
|
||||
Group,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(serde::Deserialize)]
|
||||
#[allow(nonstandard_style,dead_code)]
|
||||
pub struct Creator{
|
||||
pub Id:u64,
|
||||
pub Name:String,
|
||||
pub CreatorType:CreatorType,
|
||||
pub CreatorTargetId:u64,
|
||||
pub HasVerifiedBadge:bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(serde::Deserialize)]
|
||||
#[allow(nonstandard_style,dead_code)]
|
||||
pub struct AssetDetails{
|
||||
pub TargetId:u64,
|
||||
pub ProductType:String,
|
||||
pub AssetId:u64,
|
||||
pub ProductId:u64,
|
||||
pub Name:String,
|
||||
pub Description:String,
|
||||
pub AssetTypeId:u32,
|
||||
pub Creator:Creator,
|
||||
pub IconImageAssetId:u64,
|
||||
pub Created:chrono::DateTime<chrono::Utc>,
|
||||
pub Updated:chrono::DateTime<chrono::Utc>,
|
||||
pub PriceInRobux:Option<u32>,
|
||||
pub PriceInTickets:Option<u32>,
|
||||
pub Sales:u32,
|
||||
pub IsNew:bool,
|
||||
pub IsForSale:bool,
|
||||
pub IsPublicDomain:bool,
|
||||
pub IsLimited:bool,
|
||||
pub IsLimitedUnique:bool,
|
||||
pub Remaining:Option<u32>,
|
||||
pub MinimumMembershipLevel:u32,
|
||||
pub ContentRatingTypeId:u32,
|
||||
pub SaleAvailabilityLocations:Option<String>,
|
||||
pub SaleLocation:Option<String>,
|
||||
pub CollectibleItemId:Option<u64>,
|
||||
pub CollectibleProductId:Option<u64>,
|
||||
pub CollectiblesItemDetails:Option<String>,
|
||||
}
|
||||
|
||||
pub struct AssetVersionsPageRequest{
|
||||
pub asset_id:u64,
|
||||
pub cursor:Option<String>,
|
||||
@ -363,6 +411,13 @@ impl CookieContext{
|
||||
Err(e)=>Err(e),
|
||||
}.map_err(GetError::IO)
|
||||
}
|
||||
pub async fn get_asset_details(&self,config:GetAssetDetailsRequest)->Result<AssetDetails,GetError>{
|
||||
let url=reqwest::Url::parse(format!("https://economy.roblox.com/v2/assets/{}/details",config.asset_id).as_str()).map_err(GetError::ParseError)?;
|
||||
crate::response_ok(
|
||||
self.get(url).await.map_err(GetError::Reqwest)?
|
||||
).await.map_err(GetError::Response)?
|
||||
.json().await.map_err(GetError::Reqwest)
|
||||
}
|
||||
pub async fn get_asset_versions_page(&self,config:AssetVersionsPageRequest)->Result<AssetVersionsPageResponse,PageError>{
|
||||
let mut url=reqwest::Url::parse(format!("https://develop.roblox.com/v1/assets/{}/saved-versions",config.asset_id).as_str()).map_err(PageError::ParseError)?;
|
||||
//url borrow scope
|
||||
|
Loading…
x
Reference in New Issue
Block a user