1 个稳定版本

1.0.0 2024年8月10日

#18#客户端发送

Download history 107/week @ 2024-08-10

每月下载 107 次

MIT/Apache

9KB
142

禾禾奇趣屋-API-RUST版本SDK

引入

[dependencies]
ho-api-rust-sdk = "1.0.0"

使用示例

#[cfg(test)]
mod tests {
    use serde_json::json;
    use tokio::test;

    use super::*;

    #[test]
    async fn test_send_request() {
        let config = ApiClientConfig {
            app_id: "your app id".to_string(),
            app_secret: "your app secret".to_string(),
            iv: "you app iv".to_string(),
            base_url: "https://server.zelaser.com".to_string(),
            content: "/server/common/api".to_string(),
        };

        let client = ApiClient::new(config).expect("Failed to create API client");

        let body = json!({
            "key": "value",
        });

        match client.send(Method::GET, "/v1/lol/champion/mate?region=cn", Some(body)).await {
            Ok(response) => {
                println!("Response Body: {}", response);
            }
            Err(e) => eprintln!("Error: {:?}", e),
        }
    }
}

依赖项

~8–21MB
~302K SLoC