{"id":30068673,"url":"https://github.com/remnawave/rust-sdk","last_synced_at":"2025-08-08T10:48:52.448Z","repository":{"id":307687895,"uuid":"1029963127","full_name":"remnawave/rust-sdk","owner":"remnawave","description":"A high-performance Rust SDK for interacting with the Remnawave API","archived":false,"fork":false,"pushed_at":"2025-08-01T16:19:08.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-01T16:37:10.521Z","etag":null,"topics":["api","client","http","remnawave","sdk"],"latest_commit_sha":null,"homepage":"https://remna.st","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remnawave.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-31T21:30:50.000Z","updated_at":"2025-08-01T16:22:28.000Z","dependencies_parsed_at":"2025-08-01T16:37:13.690Z","dependency_job_id":"7aeea70f-e305-4a5b-a4ba-fc758b99805b","html_url":"https://github.com/remnawave/rust-sdk","commit_stats":null,"previous_names":["remnawave/rust-sdk"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/remnawave/rust-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remnawave%2Frust-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remnawave%2Frust-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remnawave%2Frust-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remnawave%2Frust-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remnawave","download_url":"https://codeload.github.com/remnawave/rust-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remnawave%2Frust-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269410137,"owners_count":24412148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","client","http","remnawave","sdk"],"created_at":"2025-08-08T10:48:51.526Z","updated_at":"2025-08-08T10:48:52.306Z","avatar_url":"https://github.com/remnawave.png","language":"Rust","readme":"# Remnawave Rust SDK\n\n![Crates.io Version](https://img.shields.io/crates/v/remnawave) ![GitHub Tag](https://img.shields.io/github/v/tag/remnawave/rust-sdk) ![GitHub Repo stars](https://img.shields.io/github/stars/remnawave/rust-sdk)\n\n![Build Status](https://img.shields.io/github/actions/workflow/status/remnawave/rust-sdk/.github/workflows/publish.yml) ![Crates.io Last Update](https://img.shields.io/crates/last-update/remnawave)\n![Downloads](https://img.shields.io/crates/d/remnawave) ![License](https://img.shields.io/crates/l/remnawave)\n\n![Known Vulnerabilities](https://snyk.io/test/github/remnawave/rust-sdk/badge.svg) ![Coverage Status](https://img.shields.io/codecov/c/github/remnawave/rust-sdk)\n\nA ~~🚀 blazingly fast~~ high-performance Rust SDK for interacting with the **[Remnawave API](https://remna.st)**. This library provides a type-safe, async interface for managing and monitoring your Remnawave server, including user management, subscription handling, node monitoring, and comprehensive statistics.\n\n## Features\n\n- **Type-safe Rust API** - Leveraging Rust's type system for compile-time guarantees\n- **Async/Await Support** - Built on `tokio` and `reqwest` for high-performance async operations\n- **Controller-based Architecture** - Organized API endpoints into logical controllers\n- **Comprehensive Management** - Users, subscriptions, nodes, hosts, billing, and more\n- **Error Handling** - Detailed error types with context and debugging information\n- **Rich Type Definitions** - Complete request/response DTOs with serde support\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nremnawave = \"2.0.0\"\ntokio = { version = \"1.0\", features = [\"full\"] }\n```\n\nOr install via cargo:\n\n```bash\ncargo add remnawave\ncargo add tokio --features full\n```\n\n## Quick Start\n\n```rust\nuse remnawave::RemnawaveApiClient;\nuse anyhow::Result;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c()\u003e {\n    // Initialize the API client\n    let client = RemnawaveApiClient::new(\n        \"https://your-panel.com\".to_string(),\n        Some(\"your-bearer-token\".to_string())\n    )?;\n\n    // Get all users\n    let users_response = client.users.get_all_users(Some(10), Some(0)).await?;\n    println!(\"Total users: {}\", users_response.total);\n\n    // Get system statistics\n    let stats = client.system.get_stats().await?;\n    println!(\"System stats: {:?}\", stats);\n\n    Ok(())\n}\n```\n\n## Core Features\n\n### User Management\n\n```rust\nuse remnawave::types::{CreateUserRequestDto, UpdateUserRequestDto};\nuse uuid::Uuid;\n\n// Create a new user\nlet new_user = CreateUserRequestDto {\n    username: \"john_doe\".to_string(),\n    email: Some(\"john@example.com\".to_string()),\n    // ... other fields\n};\nlet user = client.users.create_user(new_user).await?;\n\n// Get user by UUID\nlet user_uuid = Uuid::parse_str(\"550e8400-e29b-41d4-a716-446655440000\")?;\nlet user = client.users.get_user_by_uuid(user_uuid).await?;\n\n// Update user\nlet update_data = UpdateUserRequestDto {\n    // ... update fields\n};\nlet updated_user = client.users.update_user(update_data).await?;\n\n// Bulk operations\nlet bulk_delete = client.users.bulk_delete_users(delete_request).await?;\nlet bulk_update = client.users.bulk_update_users(update_request).await?;\n```\n\n### Subscription Management\n\n```rust\n// Get all subscriptions\nlet subscriptions = client.subscriptions.get_all_subscriptions(Some(20), Some(0)).await?;\n\n// Get subscription by username\nlet subscription = client.subscriptions.get_subscription_by_username(\"john_doe\").await?;\n\n// Get subscription settings\nlet settings = client.subscription_settings.get_subscription_settings().await?;\n\n// Update subscription settings\nlet new_settings = UpdateSubscriptionSettingsRequestDto {\n    // ... settings\n};\nclient.subscription_settings.update_subscription_settings(new_settings).await?;\n```\n\n### Node and Host Management\n\n```rust\n// Get all nodes\nlet nodes = client.nodes.get_all_nodes().await?;\n\n// Get node statistics\nlet node_stats = client.nodes.get_nodes_statistics().await?;\n\n// Get real-time usage\nlet realtime_usage = client.nodes.get_nodes_realtime_usage().await?;\n\n// Restart a node\nlet node_uuid = Uuid::parse_str(\"550e8400-e29b-41d4-a716-446655440000\")?;\nclient.nodes.restart_node(node_uuid).await?;\n\n// Host management\nlet hosts = client.hosts.get_all_hosts().await?;\nlet host = client.hosts.get_one_host(host_uuid).await?;\n```\n\n### Authentication\n\n```rust\nuse remnawave::types::{LoginRequestDto, RegisterRequestDto};\n\n// Login\nlet login_request = LoginRequestDto {\n    username: \"admin\".to_string(),\n    password: \"secure_password\".to_string(),\n};\nlet login_response = client.auth.login(login_request).await?;\n\n// Register (if enabled)\nlet register_request = RegisterRequestDto {\n    username: \"new_user\".to_string(),\n    password: \"secure_password\".to_string(),\n    email: \"user@example.com\".to_string(),\n};\nlet register_response = client.auth.register(register_request).await?;\n```\n\n## API Reference\n\n### RemnawaveApiClient\n\nMain client struct for interacting with the Remnawave API.\n\n```rust\nimpl RemnawaveApiClient {\n    pub fn new(base_url: String, token: Option\u003cString\u003e) -\u003e Result\u003cSelf\u003e\n    pub fn set_token(\u0026mut self, token: Option\u003cString\u003e)\n    pub fn base_url(\u0026self) -\u003e \u0026str\n}\n```\n\n### Available Controllers\n\n| Controller                   | Description                      |\n|------------------------------|----------------------------------|\n| `auth`                       | Authentication operations        |\n| `users`                      | User management                  |\n| `subscriptions`              | Subscription handling            |\n| `subscription_templates`     | Subscription template management |\n| `subscription_settings`      | Subscription settings            |\n| `nodes`                      | Node management                  |\n| `nodes_usage`                | Node usage statistics            |\n| `hosts`                      | Host management                  |\n| `system`                     | System operations                |\n| `tokens`                     | API token management             |\n| `config_profiles`            | Configuration profiles           |\n| `internal_squads`            | Internal squad management        |\n| `hwid`                       | Hardware ID devices              |\n| `billing`                    | Infrastructure billing           |\n| `keygen`                     | Key generation                   |\n\n### Bulk Operations\n\nThe SDK supports efficient bulk operations for user management:\n\n```rust\n// Bulk delete users by status\nlet bulk_delete_request = BulkDeleteUsersByStatusRequestDto {\n    statuses: vec![UserStatus::Disabled],\n};\nclient.users.bulk_delete_users_by_status(bulk_delete_request).await?;\n\n// Bulk update users\nlet bulk_update_request = BulkUpdateUsersRequestDto {\n    user_uuids: vec![user_uuid1, user_uuid2],\n    update_data: UpdateUserRequestDto {\n        // ... update fields\n    },\n};\nclient.users.bulk_update_users(bulk_update_request).await?;\n\n// Bulk reset traffic\nlet reset_request = BulkResetTrafficUsersRequestDto {\n    user_uuids: vec![user_uuid1, user_uuid2],\n};\nclient.users.bulk_reset_user_traffic(reset_request).await?;\n```\n\n### Usage Statistics\n\n```rust\n// Get node usage by date range\nlet usage = client.nodes_usage.get_nodes_usage_by_range(\n    start_date,\n    end_date,\n    Some(node_uuid)\n).await?;\n\n// Get user usage by range\nlet user_usage = client.nodes_usage.get_user_usage_by_range(\n    user_uuid,\n    start_date,\n    end_date\n).await?;\n\n// Get node user usage\nlet node_user_usage = client.nodes_usage.get_node_user_usage_by_range(\n    node_uuid,\n    start_date,\n    end_date\n).await?;\n```\n\n## Error Handling\n\nThe SDK provides comprehensive error handling through the `ApiError` type:\n\n```rust\nuse remnawave::ApiError;\n\nmatch client.users.get_user_by_uuid(user_uuid).await {\n    Ok(user) =\u003e println!(\"User: {:?}\", user),\n    Err(e) =\u003e {\n        eprintln!(\"API Error [{}]: {}\", e.status_code, e);\n        eprintln!(\"Response: {}\", e.response_body);\n    }\n} \n```\n\n## Configuration\n\n### Client Configuration\n\n```rust\n// With token\nlet client = RemnawaveApiClient::new(\n    \"https://your-panel.com\".to_string(),\n    Some(\"your-token\".to_string())\n)?;\n\n// Without token\nlet client = RemnawaveApiClient::new(\n    \"https://your-panel.com\".to_string(),\n    None\n)?;\n\n// With token and Caddy API key\nlet client = RemnawaveApiClient::with_caddy_token(\n    \"https://your-panel.com\".to_string(),\n    Some(\"your-token\".to_string()),\n    Some(\"your-caddy-api-key\".to_string())\n)?;\n\n// Update token later\nclient.set_token(Some(\"new-token\".to_string()));\n\n// Update Caddy token later\nclient.set_caddy_token(Some(\"new-caddy-api-key\".to_string()));\n```\n\n## Examples\n\nCheck out the `tests/` directory for comprehensive examples:\n\n- `integration_tests.rs` - Real API integration examples\n- `unit_tests.rs` - Unit test examples and mocking\n\n## Compatible Versions\n\n| SDK Version | Remnawave Panel Version |\n|-------------|-------------------------|\n| 2.0.0       | \u003e=2.0.0                 |\n| Not supported       | \u003c2.0.0                   |\n\n# Contributors\n\nWe ❤️‍🔥 contributors! If you'd like to contribute, feel free to submit a pull request or open an issue.\n\nCheck [open issues](https://github.com/remnawave/rust-sdk/issues) to help the progress of this project.\n\n\u003cp align=\"center\"\u003e\nThanks to all contributors who have helped improve the Remnawave Rust SDK:\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/remnawave/rust-sdk/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=remnawave/rust-sdk\" /\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n## License\n\nMIT License\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremnawave%2Frust-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremnawave%2Frust-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremnawave%2Frust-sdk/lists"}