roblox_api/api/economy/
v2.rs1use serde::{Deserialize, Serialize};
2
3use crate::{DateTime, endpoint};
4
5pub const URL: &str = "https://economy.roblox.com/v2";
6
7#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
8pub enum ProductType {
9 #[serde(rename = "Collectible Item")]
10 Collectible,
11}
12
13#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
14pub enum CreatorType {
15 User,
16 Group,
17}
18
19#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
20#[serde(rename_all = "PascalCase")]
21pub struct Creator {
22 pub id: u64,
23 pub name: String,
24 #[serde(rename = "CreatorType")]
25 pub kind: CreatorType,
26 #[serde(rename = "CreatorTargetId")]
27 pub target_id: u64,
28 #[serde(rename = "HasVerifiedBadge")]
29 pub is_verified: bool,
30}
31
32#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
33#[serde(rename_all = "PascalCase")]
34pub struct SaleLocation {
35 #[serde(rename = "SaleLocationType")]
36 pub kind: u8,
37 pub universe_ids: Vec<u64>,
38}
39
40#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
41#[serde(rename_all = "PascalCase")]
42pub struct CollectibleDetails {
43 #[serde(rename = "CollectibleLowestResalePrice")]
44 pub lowest_resale_price: Option<u64>,
45 #[serde(rename = "CollectibleLowestAvailableResaleProductId")]
46 pub lowest_available_product_id: Option<String>,
47 #[serde(rename = "CollectibleLowestAvailableResaleItemInstanceId")]
48 pub lowest_available_instance_id: Option<String>,
49 #[serde(rename = "CollectibleQuantityLimitPerUser")]
50 pub quantity_limit_per_user: Option<u64>,
51
52 pub is_for_sale: bool,
53 pub is_limited: bool,
54 #[serde(rename = "TotalQuantity")]
55 pub quantity: u64,
56}
57
58#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
59#[serde(rename_all = "PascalCase")]
60pub struct DetailsResponse {
61 #[serde(rename = "AssetId")]
62 pub id: u64,
63 pub target_id: u64,
64 pub product_id: u64,
65 pub product_type: ProductType,
66
67 pub name: String,
68 pub description: String,
69 pub asset_type_id: u8,
70 pub creator: Creator,
71
72 pub icon_image_asset_id: u64,
73 pub created: DateTime,
74 pub updated: DateTime,
75
76 #[serde(rename = "PriceInRobux")]
77 pub robux_price: u64,
78 #[serde(rename = "PriceInTickets")]
79 pub tickets_price: Option<u64>,
80 pub sales: u64,
81 pub remaining: u64,
82 #[serde(rename = "IsForSale")]
83 pub on_sale: bool,
84
85 pub is_new: bool,
86 pub is_public_domain: bool,
87 pub is_limited: bool,
88 pub is_limited_unique: bool,
89
90 pub minimum_membership_level: u8,
91 pub content_rating_type_id: u8,
92 pub sale_availability_locations: Option<Vec<String>>, pub sale_location: SaleLocation,
94
95 #[serde(rename = "CollectibleItemId")]
96 pub collectible_id: String,
97 pub collectible_product_id: String,
98 #[serde(rename = "CollectiblesItemDetails")]
99 pub collectible_details: CollectibleDetails,
100}
101
102endpoint! {
103 details(id: u64) -> DetailsResponse {
104 GET "{URL}/assets/{id}/details";
105 }
106}