rustyroblox/groups/
metadata.rs1use rspc::Type;
2use serde::{Deserialize, Serialize};
3
4use crate::util::{jar::RequestJar, Error};
5
6#[derive(Debug, Serialize, Deserialize, Clone, Type)]
7#[serde(rename_all = "camelCase")]
8pub struct GroupConfigMetadata {
9 pub group_configuration: GroupConfigurationMetadata,
10 pub recurring_payouts_configuration: GroupRecurringPayoutsConfigurationMetadata,
11 pub role_configuration: GroupRoleConfigurationMetadata,
12 pub group_name_change_configuration: GroupNameChangeConfigurationMetadata,
13 pub is_premium_payouts_enabled: bool,
14 pub is_default_emblem_policy_enabled: bool,
15}
16
17#[derive(Debug, Serialize, Deserialize, Clone, Type)]
18#[serde(rename_all = "camelCase")]
19pub struct GroupConfigurationMetadata {
20 pub name_max_length: i64,
21 pub description_max_length: i64,
22 pub icon_max_file_size_mb: i64,
23 pub cost: i64,
24 pub is_using_two_step_webview_component: bool,
25}
26
27#[derive(Debug, Serialize, Deserialize, Clone, Type)]
28#[serde(rename_all = "camelCase")]
29pub struct GroupRecurringPayoutsConfigurationMetadata {
30 pub max_payout_partners: i64,
31}
32
33#[derive(Debug, Serialize, Deserialize, Clone, Type)]
34#[serde(rename_all = "camelCase")]
35pub struct GroupRoleConfigurationMetadata {
36 pub name_max_length: i64,
37 pub description_max_length: i64,
38 pub limit: i64,
39 pub cost: i64,
40 pub min_rank: i64,
41 pub max_rank: i64,
42}
43
44#[derive(Debug, Serialize, Deserialize, Clone, Type)]
45#[serde(rename_all = "camelCase")]
46pub struct GroupNameChangeConfigurationMetadata {
47 pub cost: i64,
48 pub cooldown_in_days: i64,
49 pub ownership_cooldown_in_days: i64,
50}
51
52pub async fn config_metadata(jar: &RequestJar) -> Result<GroupConfigMetadata, Box<Error>> {
54 let url = "https://groups.roblox.com/v1/groups/configuration/metadata";
55 let response = jar.get_json::<GroupConfigMetadata>(&url).await?;
56 Ok(response)
57}
58
59#[derive(Debug, Serialize, Deserialize, Clone, Type)]
60#[serde(rename_all = "camelCase")]
61pub struct GroupMetadata {
62 pub group_limit: i64,
63 pub current_group_count: i64,
64 pub group_status_max_length: i64,
65 pub group_post_max_length: i64,
66 pub is_group_wall_notifications_enabled: bool,
67 pub group_wall_notifications_subscribe_interval_in_milliseconds: i64,
68 pub are_profile_groups_hidden: bool,
69 pub is_group_details_policy_enabled: bool,
70 pub show_previous_group_names: bool,
71}
72
73pub async fn metadata(jar: &RequestJar) -> Result<GroupMetadata, Box<Error>> {
75 let url = "https://groups.roblox.com/v1/groups/metadata";
76 let response = jar.get_json::<GroupMetadata>(&url).await?;
77 Ok(response)
78}