API Reference¶
Rust FFI API for Flutter integration.
Initialization¶
initToss¶
Initialize the Toss core library.
Parameters:
- dataDir: Path to data directory
- deviceName: Friendly device name
Returns: void
Device Management¶
getDeviceId¶
Get the current device's unique identifier.
Returns: String - Device ID
setDeviceName¶
Set the device's friendly name.
Parameters:
- name: Device name
Returns: void
Pairing¶
startPairing¶
Start a pairing session.
Returns: PairingInfo with:
- code: 6-digit pairing code
- qrData: QR code data
- expiresAt: Expiration timestamp
- publicKey: Public key for pairing
completePairingQr¶
Complete pairing using QR code.
Parameters:
- qrData: QR code data from other device
Returns: bool - Success status
completePairingCode¶
Complete pairing using 6-digit code.
Parameters:
- code: 6-digit pairing code
Returns: bool - Success status
Device List¶
getPairedDevices¶
Get list of paired devices.
Returns: List<DeviceInfo> with:
- id: Device ID
- name: Device name
- isOnline: Online status
- lastSeen: Last seen timestamp
Clipboard Operations¶
sendClipboard¶
Send clipboard content to paired devices.
Parameters:
- contentType: MIME type of content
- content: Base64-encoded content
Returns: bool - Success status
getClipboardHistory¶
Get clipboard history.
Parameters:
- limit: Maximum number of items
Returns: List<ClipboardItemInfo> with:
- contentType: Content type
- preview: Preview text
- sizeBytes: Size in bytes
- timestamp: Timestamp
- sourceDevice: Source device ID
Events¶
pollEvent¶
Poll for network events.
Returns: NetworkEvent? - Event or null if none
Settings¶
getSettings¶
Get current settings.
Returns: TossSettings with:
- autoSync: Auto-sync enabled
- syncText: Sync text content
- syncImages: Sync images
- syncFiles: Sync files
- maxFileSizeMb: Max file size in MB
- historyEnabled: History enabled
- historyDays: History retention days
- relayUrl: Relay server URL
updateSettings¶
Update settings.
Parameters:
- settings: Updated settings object
Returns: void
Error Handling¶
All API functions may throw exceptions. Handle errors appropriately:
Next Steps¶
- Architecture - System design
- Platform Support - Platform-specific details
- Testing - Testing guide