#roblox-api #roblox #api-wrapper #async-api #api

robloxapi-s

Roblox 的异步 Rust API 包装器

5 个版本

0.0.16 2023 年 6 月 3 日
0.0.15 2023 年 6 月 3 日
0.0.14 2023 年 6 月 3 日
0.0.1 2023 年 3 月 19 日

260游戏

Download history

每月下载 60

MIT 许可证

29KB
594

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–18MB
~258K SLoC