5 个版本

0.0.14 2023 年 4 月 28 日
0.0.13 2023 年 3 月 23 日
0.0.12 2023 年 3 月 22 日
0.0.11 2023 年 3 月 20 日
0.0.1 2023 年 3 月 19 日

#597 in 游戏

每月 21 次下载

MIT 许可证

29KB
616

RobloxApi

Latest Version Docs

robloxapi 是一个开源的异步 Rust API 包装器,用于 Roblox;PythonicIconic 的 RbxAPI-rs 的分支。

入门

您可以通过运行 cargo add robloxapi 来安装库

检索用户

检索指定用户的三种不同方法的示例!

use robloxapi;
use tokio;

// The cookie is needed for several api endpoints; Specifically those which interact with acccount / game data.
const COOKIE: &str = ""

#[tokio::main]
async fn main() {
    let mut client = rbxapi::Client::new(); // Create new client Instance
    client.set_cookie(COOKIE).await; // Set the cookie for the client instance
    
    // Example on getting users
    let my_user = client.current_user().await?; // Get the current user
    let str_user = client.user("builderman").await?; // Get user by username
    let int_user = client.user(156).await?; // Get user by userid
}

开发者产品/游戏

use robloxapi;
use tokio;

const COOKIE: &str = ""

#[tokio::main]
async fn main() {
   let place_id = 7415484311; // Place ID for game
   let mut client = robloxapi::Client()::new(); // Create a new client instance
   client.set_cookie(COOKIE).await; // We need to set the cookie if we want to have permissions for creating developer products

   // Create a new game given place id
   let mut game = client.game(place_id).await?;

    // Returns a ApiResult which can be unwrapped to a value or a APIError
    let dev_product = game.create_dev_product(
        "name-of-dev-product", // Name of the developer product
        17 // Price of the developer product
    ).await?;
}

依赖关系

~5–21MB
~278K SLoC