From 779520caa65715859a60f4f25728d7bc700d6f6e Mon Sep 17 00:00:00 2001 From: Phillip Bosek Date: Thu, 16 Nov 2023 09:09:39 -0500 Subject: [PATCH 01/12] add username search endpoint --- src/users/mod.rs | 77 ++++++++++++++++++++++++++++++++++++++ src/users/request_types.rs | 21 +++++++++++ 2 files changed, 98 insertions(+) diff --git a/src/users/mod.rs b/src/users/mod.rs index 088195d..a4ec663 100644 --- a/src/users/mod.rs +++ b/src/users/mod.rs @@ -7,6 +7,7 @@ mod request_types; const AUTHENTICATED_USER_DETAILS_API: &str = "https://users.roblox.com/v1/users/authenticated"; const USERS_SEARCH_API: &str = "https://users.roblox.com/v1/users/search"; const USER_DETAILS_API: &str = "https://users.roblox.com/v1/users/{user_id}"; +const USER_FROM_USERNAME_API: &str = "https://users.roblox.com/v1/usernames/users"; /// Basic information about the account of the Roblosecurity. Retrieved /// from . @@ -41,6 +42,20 @@ pub struct UserDetails { pub has_verified_badge: bool, } +/// The details of a user. Fetched from . +#[allow(missing_docs)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Serialize, Deserialize)] +pub struct UsernameUserDetails { + pub requested_username: String, + #[serde(alias = "name")] + pub username: String, + #[serde(alias = "displayName")] + pub display_name: String, + pub id: u64, + #[serde(alias = "hasVerifiedBadge")] + pub has_verified_badge: bool, +} + impl Client { /// Grabs information about the user from using the /// Roblosecurity inside the client. @@ -174,4 +189,66 @@ impl Client { Ok(user_details) } + + /// Fetches user details using . + /// + /// # Notes + /// * Does not require a valid roblosecurity. + /// + /// # Errors + /// * All errors under [Standard Errors](#standard-errors). + /// + /// # Example + /// + /// ```no_run + /// use roboat::ClientBuilder; + /// + /// const USERNAME: &str = "Slavanomics"; + /// + /// # #[tokio::main] + /// # async fn main() -> Result<(), Box> { + /// let client = ClientBuilder::new().build(); + /// + /// let user_details = client.user_details(USER_ID).await?; + /// + /// println!("Username: {}", user_details.username); + /// println!("Display Name: {}", user_details.display_name); + /// println!("Year Created: {}", user_details.created_at.chars().take(4).collect::()); + /// + /// # Ok(()) + /// # } + /// ``` + pub async fn username_user_details( + &self, + usernames: Vec, + exclude_banned_users: Option, + ) -> Result, RoboatError> { + let request_result = self + .reqwest_client + .post(USER_FROM_USERNAME_API) + .json(&request_types::UsernameUserDetailsRequest { + usernames, + exclude_banned_users, + }) + .send() + .await; + + let response = Self::validate_request_result(request_result).await?; + let raw = + Self::parse_to_raw::(response).await?; + + let mut users = Vec::new(); + for user in raw.data { + let user_data = UsernameUserDetails { + requested_username: user.requested_username, + username: user.name, + display_name: user.display_name, + id: user.id, + has_verified_badge: user.has_verified_badge, + }; + + users.push(user_data); + } + Ok(users) + } } diff --git a/src/users/request_types.rs b/src/users/request_types.rs index e017200..aecf8d4 100644 --- a/src/users/request_types.rs +++ b/src/users/request_types.rs @@ -17,3 +17,24 @@ pub(super) struct UserSearchUserInformationRaw { pub previous_usernames: Vec, pub display_name: String, } + +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub(super) struct UsernameUserDetailsRequest { + pub usernames: Vec, + pub exclude_banned_users: Option, +} +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub(super) struct UsernameUserInformationRaw { + pub requested_username: String, + pub has_verified_badge: bool, + pub id: u64, + pub name: String, + pub display_name: String, +} +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub(super) struct UsernameUserDetailsResponse { + pub data: Vec, +} From f6e640d9750f45377ad3ae62eaf18296c6cc5226 Mon Sep 17 00:00:00 2001 From: Phillip Bosek Date: Thu, 16 Nov 2023 11:48:54 -0500 Subject: [PATCH 02/12] add examples --- examples/fetch_user_details_by_username.rs | 18 ++++++++++++++++ src/users/mod.rs | 25 +++++++++++----------- 2 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 examples/fetch_user_details_by_username.rs diff --git a/examples/fetch_user_details_by_username.rs b/examples/fetch_user_details_by_username.rs new file mode 100644 index 0000000..bb26313 --- /dev/null +++ b/examples/fetch_user_details_by_username.rs @@ -0,0 +1,18 @@ +use roboat::ClientBuilder; + +const USERNAME: &str = "Builderman"; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = ClientBuilder::new().build(); + + let users = vec![USERNAME.to_owned()]; + let all_username_user_details = client.username_user_details(users, Some(true)).await?; + let username_user_details = all_username_user_details.first().ok_or("User not found")?; + + println!("Username: {}", username_user_details.username); + println!("Display Name: {}", username_user_details.display_name); + println!("ID: {}", username_user_details.id); + + Ok(()) +} diff --git a/src/users/mod.rs b/src/users/mod.rs index a4ec663..319a81c 100644 --- a/src/users/mod.rs +++ b/src/users/mod.rs @@ -203,17 +203,19 @@ impl Client { /// ```no_run /// use roboat::ClientBuilder; /// - /// const USERNAME: &str = "Slavanomics"; + /// const USERNAME: &str = "Builderman"; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { /// let client = ClientBuilder::new().build(); /// - /// let user_details = client.user_details(USER_ID).await?; + /// let users = vec![USERNAME.to_owned()]; + /// let all_username_user_details = client.username_user_details(users, Some(true)).await?; + /// let username_user_details = all_username_user_details.first().ok_or("User not found")?; /// - /// println!("Username: {}", user_details.username); - /// println!("Display Name: {}", user_details.display_name); - /// println!("Year Created: {}", user_details.created_at.chars().take(4).collect::()); + /// println!("Username: {}", username_user_details.username); + /// println!("Display Name: {}", username_user_details.display_name); + /// println!("ID: {}", username_user_details.id); /// /// # Ok(()) /// # } @@ -237,18 +239,17 @@ impl Client { let raw = Self::parse_to_raw::(response).await?; - let mut users = Vec::new(); - for user in raw.data { - let user_data = UsernameUserDetails { + let users = raw + .data + .into_iter() + .map(|user| UsernameUserDetails { requested_username: user.requested_username, username: user.name, display_name: user.display_name, id: user.id, has_verified_badge: user.has_verified_badge, - }; - - users.push(user_data); - } + }) + .collect(); Ok(users) } } From 13cc3380ef882a5bbcb5f56ba8b23e0fc0e83736 Mon Sep 17 00:00:00 2001 From: Chloe-Woahie <68732833+Chloe-Woahie@users.noreply.github.com> Date: Fri, 17 Nov 2023 02:15:50 -0500 Subject: [PATCH 03/12] chore: tweak username_user_details --- examples/fetch_user_details_by_username.rs | 2 +- src/users/mod.rs | 4 ++-- src/users/request_types.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/fetch_user_details_by_username.rs b/examples/fetch_user_details_by_username.rs index bb26313..eabac08 100644 --- a/examples/fetch_user_details_by_username.rs +++ b/examples/fetch_user_details_by_username.rs @@ -7,7 +7,7 @@ async fn main() -> Result<(), Box> { let client = ClientBuilder::new().build(); let users = vec![USERNAME.to_owned()]; - let all_username_user_details = client.username_user_details(users, Some(true)).await?; + let all_username_user_details = client.username_user_details(users, true).await?; let username_user_details = all_username_user_details.first().ok_or("User not found")?; println!("Username: {}", username_user_details.username); diff --git a/src/users/mod.rs b/src/users/mod.rs index 319a81c..fe75aba 100644 --- a/src/users/mod.rs +++ b/src/users/mod.rs @@ -210,7 +210,7 @@ impl Client { /// let client = ClientBuilder::new().build(); /// /// let users = vec![USERNAME.to_owned()]; - /// let all_username_user_details = client.username_user_details(users, Some(true)).await?; + /// let all_username_user_details = client.username_user_details(users, true).await?; /// let username_user_details = all_username_user_details.first().ok_or("User not found")?; /// /// println!("Username: {}", username_user_details.username); @@ -223,7 +223,7 @@ impl Client { pub async fn username_user_details( &self, usernames: Vec, - exclude_banned_users: Option, + exclude_banned_users: bool, ) -> Result, RoboatError> { let request_result = self .reqwest_client diff --git a/src/users/request_types.rs b/src/users/request_types.rs index aecf8d4..7477591 100644 --- a/src/users/request_types.rs +++ b/src/users/request_types.rs @@ -22,7 +22,7 @@ pub(super) struct UserSearchUserInformationRaw { #[serde(rename_all = "camelCase")] pub(super) struct UsernameUserDetailsRequest { pub usernames: Vec, - pub exclude_banned_users: Option, + pub exclude_banned_users: bool, } #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] From 6cf31fbae20b5e0302416cf0c2cb52d14ecd4308 Mon Sep 17 00:00:00 2001 From: Chloe-Woahie <68732833+Chloe-Woahie@users.noreply.github.com> Date: Fri, 17 Nov 2023 02:16:10 -0500 Subject: [PATCH 04/12] chore: add todo for future me --- src/users/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/users/mod.rs b/src/users/mod.rs index fe75aba..0eff37c 100644 --- a/src/users/mod.rs +++ b/src/users/mod.rs @@ -9,6 +9,8 @@ const USERS_SEARCH_API: &str = "https://users.roblox.com/v1/users/search"; const USER_DETAILS_API: &str = "https://users.roblox.com/v1/users/{user_id}"; const USER_FROM_USERNAME_API: &str = "https://users.roblox.com/v1/usernames/users"; +// TODO: try to make a unified user details struct + /// Basic information about the account of the Roblosecurity. Retrieved /// from . #[allow(missing_docs)] From 94a0a5b7e0d9c53310bddf6bbfc4a545fc47bd3f Mon Sep 17 00:00:00 2001 From: Chloe-Woahie <68732833+Chloe-Woahie@users.noreply.github.com> Date: Fri, 17 Nov 2023 02:17:28 -0500 Subject: [PATCH 05/12] docs: improve docs for username_user_details --- src/users/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/users/mod.rs b/src/users/mod.rs index 0eff37c..f6fd3bb 100644 --- a/src/users/mod.rs +++ b/src/users/mod.rs @@ -192,10 +192,19 @@ impl Client { Ok(user_details) } - /// Fetches user details using . + /// Fetches user details using . + /// + /// This endpoint uses a post request instead of a get request so + /// it can be used to retrieve information about multiple users at once. + /// + /// To fetch a single user, or to fetch a user using a user ID instead of a username, + /// use [`Client::user_details`] instead. /// /// # Notes /// * Does not require a valid roblosecurity. + /// * This is virtually the same as [`Client::user_details`] except that it can + /// fetch multiple users at once, and it searches using usernames instead of user IDs. + /// * The usernames are not case sensitive. /// /// # Errors /// * All errors under [Standard Errors](#standard-errors). From a327363618f6edc39ab8e7932cb609ab45da07a4 Mon Sep 17 00:00:00 2001 From: Chloe-Woahie <68732833+Chloe-Woahie@users.noreply.github.com> Date: Fri, 17 Nov 2023 02:17:41 -0500 Subject: [PATCH 06/12] improve docs for user_details --- src/users/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/users/mod.rs b/src/users/mod.rs index f6fd3bb..2351bf1 100644 --- a/src/users/mod.rs +++ b/src/users/mod.rs @@ -155,6 +155,11 @@ impl Client { /// Fetches user details using . /// + /// For bulk fetching, it is recommended to use [`Client::username_user_details`] + /// instead. This is because more users can be fetched at once using that endpoint. + /// The only downside of this is that you can only search using usernames instead + /// of user IDs. + /// /// # Notes /// * Does not require a valid roblosecurity. /// From 079ece79c66e1a56ddfb2992b631dc76e35068b0 Mon Sep 17 00:00:00 2001 From: Chloe-Woahie <68732833+Chloe-Woahie@users.noreply.github.com> Date: Fri, 17 Nov 2023 02:47:10 -0500 Subject: [PATCH 07/12] chore: bump version --- Cargo.toml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 15bbb1f..d67b74f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,15 +8,18 @@ license = "MIT" name = "roboat" readme = "README.md" repository = "https://github.com/Chloe-Woahie/roboat" -version = "0.33.0" +version = "0.34.0" [dependencies] -reqwest = { version = "0.11.14", default-features=false, features = ["rustls-tls", "json"] } +reqwest = { version = "0.11.14", default-features = false, features = [ + "rustls-tls", + "json", +] } thiserror = "1.0.40" -serde = {version="1.0.136", features=["derive"]} +serde = { version = "1.0.136", features = ["derive"] } serde_json = "1.0.94" tokio = { version = "1.27.0", features = ["full"] } -uuid = {version="1.3.1", features=["fast-rng", "v4"]} +uuid = { version = "1.3.1", features = ["fast-rng", "v4"] } base64 = "0.21.2" From 561968fef1fed90b79214156cd84b785300c8b05 Mon Sep 17 00:00:00 2001 From: Chloe-Woahie <68732833+Chloe-Woahie@users.noreply.github.com> Date: Fri, 17 Nov 2023 02:58:48 -0500 Subject: [PATCH 08/12] chore: add username_user_search to coverage --- README.md | 121 +++++++++++++++++++++++++++++------------------------ src/lib.rs | 2 + 2 files changed, 68 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 078b7d1..ec16c2e 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ roboat logo # roboat + A high performance interface for the Roblox API. This library is designed to be high-performance capable, meaning that it supports proxies @@ -15,63 +16,68 @@ and is capable of making requests in parallel. Note that this crate is still in early development and updates may be breaking until the first major version is released. # Documentation -Extensive documentation is used throughout this crate. + +Extensive documentation is used throughout this crate. All public methods in this crate are documented and have at least one corresponding example. Documentation can be found [here](https://docs.rs/roboat/). # Coverage -* Auth API - [`auth.roblox.com/*`] - - Force Refresh X-CSRF-TOKEN - [`Client::force_refresh_xcsrf_token`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.force_refresh_xcsrf_token) -* BEDEV2 API - [`apis.roblox.com/*`] - - Fetch Non-Tradable Limited Details - [`Client::non_tradable_limited_details`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.non_tradable_limited_details) - - Fetch Collectible Product ID - [`Client::collectible_product_id`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.collectible_product_id) - - Fetch Collectible Product ID Bulk - [`Client::collectible_product_id_bulk`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.collectible_product_id_bulk) - - Fetch Collectible Creator ID - [`Client::collectible_creator_id`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.collectible_creator_id) - - Purchase Non-Tradable Limited - [`Client::purchase_non_tradable_limited`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.purchase_non_tradable_limited) -* Catalog API - [`catalog.roblox.com/*`] - - Fetch Item Details - [`Client::item_details`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.item_details) - - Fetch Product ID - [`Client::product_id`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.product_id) - - Fetch Product ID Bulk - [`Client::product_id_bulk`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.product_id_bulk) - - Fetch Collectible Item ID - [`Client::collectible_item_id`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.collectible_item_id) - - Fetch Collectible Item ID Bulk - [`Client::collectible_item_id_bulk`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.collectible_item_id_bulk) - - Avatar Catalog Search - [`Client::avatar_catalog_search`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.avatar_catalog_search) -* Chat API - [`chat.roblox.com/*`] - - Fetch Unread Conversation Count - [`Client::unread_conversation_count`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.unread_conversation_count) -* Economy API - [`economy.roblox.com/*`] - - Fetch Robux Balance - [`Client::robux`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.robux) - - Fetch Resellers - [`Client::resellers`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.resellers) - - Fetch User Sales - [`Client::user_sales`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.user_sales) - - Put Limited On Sale - [`Client::put_limited_on_sale`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.put_limited_on_sale) - - Take Limited Off Sale - [`Client::take_limited_off_sale`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.take_limited_off_sale) - - Purchase Tradable Limited - [`Client::purchase_tradable_limited`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.purchase_tradable_limited) -* Group API - [`groups.roblox.com/*`] - - Fetch Group Roles - [`Client::group_roles`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.group_roles) - - Fetch Group Role Members - [`Client::group_role_members`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.group_role_members) - - Set Group Member Role - [`Client::set_group_member_role`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.set_group_member_role) -* Presence API - [`presence.roblox.com/*`] - - Register Presence - [`Client::register_presence`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.register_presence) -* Private Messages API - [`privatemessages.roblox.com/*`] - - Fetch Messages - [`Client::messages`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.messages) -* Thumbnails API - [`thumbnails.roblox.com/*`] - - Fetch Thumbnail Url Bulk - [`Client::thumbnail_url_bulk`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.thumbnail_url_bulk) - - Fetch Thumbnail Url - [`Client::thumbnail_url`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.thumbnail_url) -* Trades API - [`trades.roblox.com/*`] - - Accept Trade - [`Client::accept_trade`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.accept_trade) - - Decline Trade - [`Client::decline_trade`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.decline_trade) - - Send Trade - [`Client::send_trade`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.send_trade) - - Fetch Trades List - [`Client::trades`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.trades) - - Fetch Trade Details - [`Client::trade_details`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.trade_details) - - Fetch Trade Count - [`Client::trade_count`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.trade_count) -* Users API - [`users.roblox.com/*`] - - Fetch User ID - [`Client::user_id`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.user_id) - - Fetch Username - [`Client::username`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.username) - - Fetch Display Name - [`Client::display_name`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.display_name) - - User Search - [`Client::user_search`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.user_search) - - Fetch User Details - [`Client::user_details`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.user_details) + +- Auth API - [`auth.roblox.com/*`] + - Force Refresh X-CSRF-TOKEN - [`Client::force_refresh_xcsrf_token`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.force_refresh_xcsrf_token) +- BEDEV2 API - [`apis.roblox.com/*`] + - Fetch Non-Tradable Limited Details - [`Client::non_tradable_limited_details`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.non_tradable_limited_details) + - Fetch Collectible Product ID - [`Client::collectible_product_id`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.collectible_product_id) + - Fetch Collectible Product ID Bulk - [`Client::collectible_product_id_bulk`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.collectible_product_id_bulk) + - Fetch Collectible Creator ID - [`Client::collectible_creator_id`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.collectible_creator_id) + - Purchase Non-Tradable Limited - [`Client::purchase_non_tradable_limited`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.purchase_non_tradable_limited) +- Catalog API - [`catalog.roblox.com/*`] + - Fetch Item Details - [`Client::item_details`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.item_details) + - Fetch Product ID - [`Client::product_id`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.product_id) + - Fetch Product ID Bulk - [`Client::product_id_bulk`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.product_id_bulk) + - Fetch Collectible Item ID - [`Client::collectible_item_id`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.collectible_item_id) + - Fetch Collectible Item ID Bulk - [`Client::collectible_item_id_bulk`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.collectible_item_id_bulk) + - Avatar Catalog Search - [`Client::avatar_catalog_search`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.avatar_catalog_search) +- Chat API - [`chat.roblox.com/*`] + - Fetch Unread Conversation Count - [`Client::unread_conversation_count`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.unread_conversation_count) +- Economy API - [`economy.roblox.com/*`] + - Fetch Robux Balance - [`Client::robux`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.robux) + - Fetch Resellers - [`Client::resellers`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.resellers) + - Fetch User Sales - [`Client::user_sales`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.user_sales) + - Put Limited On Sale - [`Client::put_limited_on_sale`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.put_limited_on_sale) + - Take Limited Off Sale - [`Client::take_limited_off_sale`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.take_limited_off_sale) + - Purchase Tradable Limited - [`Client::purchase_tradable_limited`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.purchase_tradable_limited) +- Group API - [`groups.roblox.com/*`] + - Fetch Group Roles - [`Client::group_roles`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.group_roles) + - Fetch Group Role Members - [`Client::group_role_members`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.group_role_members) + - Set Group Member Role - [`Client::set_group_member_role`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.set_group_member_role) +- Presence API - [`presence.roblox.com/*`] + - Register Presence - [`Client::register_presence`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.register_presence) +- Private Messages API - [`privatemessages.roblox.com/*`] + - Fetch Messages - [`Client::messages`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.messages) +- Thumbnails API - [`thumbnails.roblox.com/*`] + - Fetch Thumbnail Url Bulk - [`Client::thumbnail_url_bulk`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.thumbnail_url_bulk) + - Fetch Thumbnail Url - [`Client::thumbnail_url`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.thumbnail_url) +- Trades API - [`trades.roblox.com/*`] + - Accept Trade - [`Client::accept_trade`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.accept_trade) + - Decline Trade - [`Client::decline_trade`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.decline_trade) + - Send Trade - [`Client::send_trade`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.send_trade) + - Fetch Trades List - [`Client::trades`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.trades) + - Fetch Trade Details - [`Client::trade_details`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.trade_details) + - Fetch Trade Count - [`Client::trade_count`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.trade_count) +- Users API - [`users.roblox.com/*`] + - Fetch User ID - [`Client::user_id`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.user_id) + - Fetch Username - [`Client::username`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.username) + - Fetch Display Name - [`Client::display_name`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.display_name) + - User Search - [`Client::user_search`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.user_search) + - Username User Search - [`Client::username_user_search`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.username_user_search) + - Fetch User Details - [`Client::user_details`](https://docs.rs/roboat/latest/roboat/struct.Client.html#method.user_details) # Setup + You can add the latest version of roboat to your project by running: + ```bash cargo add roboat ``` @@ -79,6 +85,7 @@ cargo add roboat # Quick Start Examples ## Example 1 - Purchase Free UGC Limited + This code snippet allows you to purchase a free ugc limited. It can be modified to purchase a non-free ugc limited by changing the price. @@ -139,14 +146,14 @@ async fn main() -> Result<(), Box> { let robux = client.robux().await?; let user_id = client.user_id().await?; let username = client.username().await?; - let display_name = client.display_name().await?; + let display_name = client.display_name().await?; println!("Robux: {}", robux); println!("User ID: {}", user_id); println!("Username: {}", username); println!("Display Name: {}", display_name); - Ok(()) + Ok(()) } ``` @@ -171,9 +178,9 @@ async fn main() -> Result<(), Box> { let (resellers, _) = client.resellers(item_id, limit, cursor).await?; - println!("Lowest Price for Valkyrie Helm: {}", resellers[0].price); + println!("Lowest Price for Valkyrie Helm: {}", resellers[0].price); - Ok(()) + Ok(()) } ``` @@ -205,22 +212,26 @@ async fn main() -> Result<(), Box> { println!("Creator Name: {}", creator_name); println!("Price: {}", price); - Ok(()) + Ok(()) } ``` # More Examples + More examples can be found in the [examples](examples) directory. # Related Crates + This crate is a sister crate of [roli](https://crates.io/crates/roli), an API wrapper for [Rolimons.com](https://www.rolimons.com/). # Contributing -Pull requests and issues are welcome! + +Pull requests and issues are welcome! Please refer to [CONVENTIONS.md](CONVENTIONS.md) for information on conventions used in this crate. Additional resources used to help make this crate are available in [RESOURCES.md](RESOURCES.md). # License + MIT License diff --git a/src/lib.rs b/src/lib.rs index 6418efb..9e20329 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -56,7 +56,9 @@ //! - Fetch Username - [`Client::username`] //! - Fetch Display Name - [`Client::display_name`] //! - User Search - [`Client::user_search`] +//! - Username User Search - [`Client::username_user_search`] //! - Fetch User Details - [`Client::user_details`] + //! //! # Quick Start Examples //! From 19acc60dc22eb1dc27003658585064eb320f8bae Mon Sep 17 00:00:00 2001 From: Chloe-Woahie <68732833+Chloe-Woahie@users.noreply.github.com> Date: Fri, 17 Nov 2023 02:59:25 -0500 Subject: [PATCH 09/12] chore: bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d67b74f..939bec5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" name = "roboat" readme = "README.md" repository = "https://github.com/Chloe-Woahie/roboat" -version = "0.34.0" +version = "0.34.1" [dependencies] reqwest = { version = "0.11.14", default-features = false, features = [ From 73261b97539ae95a117c9533ec8f8fd66509f10f Mon Sep 17 00:00:00 2001 From: Chloe-Woahie <68732833+Chloe-Woahie@users.noreply.github.com> Date: Fri, 17 Nov 2023 03:03:57 -0500 Subject: [PATCH 10/12] chore: update readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index ec16c2e..678d314 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,11 @@ More examples can be found in the [examples](examples) directory. This crate is a sister crate of [roli](https://crates.io/crates/roli), an API wrapper for [Rolimons.com](https://www.rolimons.com/). +# Requesting + +Don't see an endpoint you need covered? Request it in an issue or join the [Discord Server](https://discord.com/invite/QmBEgPaFSD) and mention it to us in the #api-coverage-requests channel! Since Roblox has a lot of endpoints, +we find it easier to add endpoints as they are needed/requested. + # Contributing Pull requests and issues are welcome! From f51ed75929c1eabeb0be6a2f2ba02999d0197068 Mon Sep 17 00:00:00 2001 From: Chloe-Woahie <68732833+fekie@users.noreply.github.com> Date: Sat, 25 Nov 2023 00:15:57 -0500 Subject: [PATCH 11/12] chore: update github --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 939bec5..d64698c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["roblox", "api", "roblox-api"] license = "MIT" name = "roboat" readme = "README.md" -repository = "https://github.com/Chloe-Woahie/roboat" +repository = "https://github.com/fekie/roboat" version = "0.34.1" [dependencies] From 84197c6db4bb47aa64573b3bc54e9ab729d9dc9e Mon Sep 17 00:00:00 2001 From: Chloe-Woahie <68732833+fekie@users.noreply.github.com> Date: Sat, 25 Nov 2023 00:17:05 -0500 Subject: [PATCH 12/12] chore: bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d64698c..cb98494 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" name = "roboat" readme = "README.md" repository = "https://github.com/fekie/roboat" -version = "0.34.1" +version = "0.34.2" [dependencies] reqwest = { version = "0.11.14", default-features = false, features = [