A clean and elegant Rust SDK for URL shortening services using the s.ee API.
see-rust-sdk is a Rust client library specifically designed for the s.ee URL shortening service. It provides a type-safe and easy-to-use API that allows you to easily integrate URL shortening functionality into your Rust applications. Whether you need simple URL shortening or advanced features like custom aliases, expiration times, and tag management, this SDK has you covered.
- 🚀 Clean & Intuitive - Fluent API design that's easy to understand and use
- 🔒 Type-Safe - Complete type checking and error handling
- ⚙️ Flexible Configuration - Support for timeout, retry, custom domains, and more
- 🏷️ Feature Complete - Support for tag management, domain management, URL deletion, and more
- 📦 Lightweight Dependencies - Minimal dependencies for fast compilation
- ✅ Well-Tested - Comprehensive unit tests and documentation
Add this to your Cargo.toml:
[dependencies]
see-rust-sdk = "1.0.0"And then run cargo build to download and compile the crate. For the latest version, check out the crates.io page.
use see_rust_sdk::client::Client;
use see_rust_sdk::config::Config;
use see_rust_sdk::url::builder::UrlShortenerRequestBuilder;
use see_rust_sdk::url::ShortenService;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client with your API key
let config = Config::default().with_api_key("your-api-key-here");
let client = Client::new(config)?;
// Shorten a URL
let request = UrlShortenerRequestBuilder::new("https://example.com/very/long/url")?
.build();
let response = client.shorten(request)?;
println!("Shortened URL: {}", response.data.short_url);
Ok(())
}The examples/ directory in this repository contains complete usage examples covering various common scenarios:
basic.rs- Basic URL shortening functionalityadvanced.rs- Advanced features (tag management, domain management, custom options, etc.)batch.rs- Batch processing and error retry logic
💡 Tip: Make sure to set a valid API key in the code before running the examples.
Run the test suite:
# Run all tests
cargo test
# Run specific tests (requires API Key environment variable)
export URL_SHORTENER_API_KEY="your-api-key"
cargo test -- --nocaptureBuild examples:
cargo build --examplesThis project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! If you find bugs or have feature suggestions, please submit an Issue or Pull Request.