ho-api-rust-sdk

Crates.ioho-api-rust-sdk
lib.rsho-api-rust-sdk
version1.0.0
sourcesrc
created_at2024-08-10 10:31:16.90423
updated_at2024-08-10 10:31:16.90423
description禾禾奇趣屋开放API Rust SDK
homepage
repositoryhttps://github.com/zelasier/ho-api-rust-sdk.git
max_upload_size
id1332239
size8,603
(zelasier)

documentation

https://github.com/zelasier/ho-api-rust-sdk/blob/master/README.md

README

禾禾奇趣屋-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),
        }
    }
}
Commit count: 0

cargo fmt