Skip to content
sdoteePublic

About

A clean and elegant Rust SDK for URL shortening services using the s.ee API.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

35 Commits

Folders and files

Repository files navigation

S.EE Rust SDK

Crates.io License: MIT Build Status

A synchronous, type-safe Rust SDK for the S.EE API, including short URLs, text and file sharing, QR codes, bio pages, tags, domains, token validation, and usage statistics.

Introduction

see-sdk provides blocking APIs built on reqwest. Requests and responses follow the public Swagger schema, including paginated histories and resumable TUS uploads for files up to 5 GB.

Key Features

  • 🚀 Clean & Intuitive - Fluent API design that's easy to understand and use
  • 🔒 Type-Safe - Complete type checking and error handling
  • ⚙️ Flexible Configuration - Custom API endpoint, timeout, API key, and user agent
  • 📁 Multi-Format Support - URL, text, regular file, large file, QR code, and bio page operations
  • 🏷️ API Coverage - Histories, tags, domains, usage, private downloads, and token validation
  • 📦 Lightweight Dependencies - Minimal dependencies for fast compilation
  • ✅ Well-Tested - Comprehensive unit tests and documentation

Installation

Add this to your Cargo.toml:

[dependencies]
see-sdk = "1.4.0"

And then run cargo build to download and compile the crate. For the latest version, check out the crates.io page.

Examples

For comprehensive usage examples covering all features, please refer to the examples/ directory in this repository.

Available examples include:

  • basic.rs: Basic URL shortening operations
  • advanced.rs: Advanced features like custom aliases and expiration
  • files.rs: File upload and management operations
  • text.rs: Text sharing and pastebin functionality
  • batch.rs: Batch processing capabilities

You can run any example using cargo:

# Export your API key first
export SEE_API_KEY="your-api-key"

# Run a specific example
cargo run --example basic

API Services

Import the trait for the API group you want to call:

API group Trait Module
Short URLs, history, visit statistics, usage ShortenService see_sdk::url
Text sharing and history TextService see_sdk::text
Files, private downloads, large files, TUS FileService see_sdk::file
QR codes and history QrcodeService see_sdk::qrcode
Bio pages and history BioPageService see_sdk::bio
Token validation TokenService see_sdk::token
Tags TagService see_sdk::tag
Short URL domains DomainService see_sdk::domain
use see_sdk::client::Client;
use see_sdk::config::Config;
use see_sdk::qrcode::{CreateQrcodeRequest, QrcodeService};

let client = Client::new(Config::default().with_api_key("your-api-key"))?;
let response = client.create_qrcode(CreateQrcodeRequest {
	target_url: "https://example.com".into(),
	title: "Example".into(),
	custom_slug: None,
	domain: None,
})?;
println!("{}", response.data.png_url);
# Ok::<(), see_sdk::error::Error>(())

Large File Uploads

Large files use the TUS 1.0 workflow exposed by FileService:

  1. Call create_large_file_upload with the filename and byte size.
  2. If fast_upload is true, use existing_file; no bytes need to be sent.
  3. Otherwise call get_tus_upload_offset, then send chunks with upload_tus_chunk.
  4. Call complete_large_file_upload after the server offset reaches the file size.
  5. Use cancel_large_file_upload or delete_tus_upload to abandon an upload.

The SDK supplies Tus-Resumable, Upload-Offset, and the TUS content type. Chunk sizing and file reading remain under application control.

Development & Testing

Run the test suite:

# Run deterministic unit tests and compile all targets
cargo test --all-targets --all-features --locked

# Run ignored integration tests against the live API
export SEE_API_KEY="your-api-key"
cargo test --lib --locked -- --ignored --test-threads=1

Live API tests create and delete remote resources. They are ignored by default and run only through the manually dispatched CI workflow when live-api-tests is enabled.

Build examples:

cargo build --examples

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! If you find bugs or have feature suggestions, please submit an Issue or Pull Request.

About

A clean and elegant Rust SDK for URL shortening services using the s.ee API.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Contributors

Languages

⌂