FastComments Rust SDK
The official Rust SDK for FastComments, a fast and developer-friendly commenting platform. This SDK provides typed API clients and utilities for integrating FastComments into your Rust applications.
Installation
The SDK requires Rust 2021 edition or later.
Library Contents
The FastComments Rust SDK consists of several modules:
-
Client Module - Auto-generated API client for FastComments REST APIs
- Complete type definitions for all API models
- Both authenticated (
DefaultApi) and public (PublicApi) endpoints - Full async/await support with tokio
- See client/README.md for detailed API documentation
-
SSO Module - Server-side Single Sign-On utilities
- Secure token generation for user authentication
- Support for both simple and secure SSO modes
- HMAC-SHA256 based token signing
-
Core Types - Shared type definitions and utilities
- Comment models and metadata structures
- User and tenant configurations
- Helper functions for common operations
Quick Start
Using the Public API
use Configuration;
use public_api;
async
Using the Authenticated API
use ;
use default_api;
async
Using SSO for Authentication
use ;
Common Issues
401 Unauthorized Errors
If you're getting 401 errors when using the authenticated API:
- Check your API key: Ensure you're using the correct API key from your FastComments dashboard
- Verify the tenant ID: Make sure the tenant ID matches your account
- API key format: The API key should be passed in the Configuration:
let mut config = new;
config.api_key = Some;
SSO Token Issues
If SSO tokens aren't working:
- Use secure mode for production: Always use
FastCommentsSSO::new_secure()with your API key for production - Server-side only: Generate SSO tokens on your server, never expose your API key to clients
- Check user data: Ensure all required fields (id, email, username) are provided
Async Runtime Errors
The SDK uses tokio for async operations. Make sure to:
- Add tokio to your dependencies:
[]
= { = "1", = ["full"] }
- Use the tokio runtime:
async
Notes
Broadcast IDs
You'll see you're supposed to pass a broadcastId in some API calls. When you receive events, you'll get this ID back, so you know to ignore the event if you plan to optimistically apply changes on the client
(which you'll probably want to do since it offers the best experience). Pass a UUID here. The ID should be unique enough to not occur twice in a browser session.
Support
For issues, questions, or feature requests:
- GitHub Issues: https://github.com/fastcomments/fastcomments-rust
- Documentation: https://docs.fastcomments.com
- Support: support@fastcomments.com
License
MIT - See LICENSE file for details.