docs: update comprehensive API documentation and project guides
This commit updates all documentation files throughout the project: - Updated IMPLEMENTATION_PLAN.md with new implementation details - Updated PROJECT_GUIDELINES.md with coding standards and practices - Updated README.md with current project information - Updated SCREENSHOT_AUTOMATION.md with new automation details - Added TEST_DATA.md with test fixtures data - Updated cover_image_serving_plan.md with static URL patterns Documentation API updates: - Updated API reference documentation for all endpoints including: - Authentication (login, logout, register, refresh_token) - Book matching (auto_link, bulk_link, link_book, search) - Collections (CRUD operations, shelf mappings, auto-assign rules) - Conflicts (bulk operations, resolve/dismiss) - Devices (registration, approval, shelf management) - Highlights (create, update, delete, get) - Kobo sync (bookmark, markup, initialization, sync) - KOReader sync (library, metadata, bookmarks, progress) - Libraries (CRUD, folders, media items, stats) - Media items (bulk operations, CRUD) - Notes (CRUD operations) - OPDS (acquisition, feeds, publication) - Progress (reading progress tracking) - Queue (device queue management) - Ratings (star ratings) - Scanner (watch mode, scan operations) - Sync protocols (Kobo, KOReader) - Users (profile, password, admin operations) - WebSocket protocols - Updated user guides (admin, dashboard, settings, sync) - Updated device setup guides (Kobo, KOReader) - Updated developer guides (testing, contributing, operations) - Updated scripts/README.md
This commit is contained in:
@@ -10,10 +10,12 @@ Real-time bidirectional sync API for live updates and notifications.
|
||||
Connect to the WebSocket endpoint with authentication:
|
||||
|
||||
```javascript
|
||||
const ws = new WebSocket('wss://bookhoard.example/ws/sync?token=eyJhbGci...');
|
||||
const ws = new WebSocket("wss://bookhoard.example/ws/sync?token=eyJhbGci...");
|
||||
|
||||
// Or with device authentication
|
||||
const ws = new WebSocket('wss://bookhoard.example/ws/sync?device_id=uuid&device_key=key');
|
||||
const ws = new WebSocket(
|
||||
"wss://bookhoard.example/ws/sync?device_id=uuid&device_key=key",
|
||||
);
|
||||
```
|
||||
|
||||
## Message Format
|
||||
@@ -214,23 +216,27 @@ wss://bookhoard.example/ws/sync?device_id=<uuid>&device_key=<key>
|
||||
## Usage Example
|
||||
|
||||
```javascript
|
||||
const ws = new WebSocket('wss://bookhoard.example/ws/sync?token=eyJhbGci...');
|
||||
const ws = new WebSocket("wss://bookhoard.example/ws/sync?token=eyJhbGci...");
|
||||
|
||||
ws.onopen = () => {
|
||||
console.log('Connected to sync WebSocket');
|
||||
console.log("Connected to sync WebSocket");
|
||||
|
||||
// Subscribe to progress updates
|
||||
ws.send(JSON.stringify({
|
||||
type: 'subscribe',
|
||||
data: { topic: 'progress', device_id: 'device-uuid' }
|
||||
}));
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
type: "subscribe",
|
||||
data: { topic: "progress", device_id: "device-uuid" },
|
||||
}),
|
||||
);
|
||||
|
||||
// Start heartbeat
|
||||
setInterval(() => {
|
||||
ws.send(JSON.stringify({
|
||||
type: 'ping',
|
||||
data: { timestamp: new Date().toISOString() }
|
||||
}));
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
type: "ping",
|
||||
data: { timestamp: new Date().toISOString() },
|
||||
}),
|
||||
);
|
||||
}, 30000);
|
||||
};
|
||||
|
||||
@@ -238,41 +244,41 @@ ws.onmessage = (event) => {
|
||||
const message = JSON.parse(event.data);
|
||||
|
||||
switch (message.type) {
|
||||
case 'progress_updated':
|
||||
console.log('Progress updated:', message.data);
|
||||
case "progress_updated":
|
||||
console.log("Progress updated:", message.data);
|
||||
break;
|
||||
case 'conflict_detected':
|
||||
console.log('New conflict detected:', message.data);
|
||||
case "conflict_detected":
|
||||
console.log("New conflict detected:", message.data);
|
||||
break;
|
||||
case 'scan_complete':
|
||||
console.log('Scan complete:', message.data);
|
||||
case "scan_complete":
|
||||
console.log("Scan complete:", message.data);
|
||||
break;
|
||||
case 'pong':
|
||||
console.log('Pong received');
|
||||
case "pong":
|
||||
console.log("Pong received");
|
||||
break;
|
||||
default:
|
||||
console.log('Unknown message type:', message.type);
|
||||
console.log("Unknown message type:", message.type);
|
||||
}
|
||||
};
|
||||
|
||||
ws.onerror = (error) => {
|
||||
console.error('WebSocket error:', error);
|
||||
console.error("WebSocket error:", error);
|
||||
};
|
||||
|
||||
ws.onclose = () => {
|
||||
console.log('WebSocket connection closed');
|
||||
console.log("WebSocket connection closed");
|
||||
};
|
||||
```
|
||||
|
||||
## Topics
|
||||
|
||||
| Topic | Description | Events |
|
||||
|-------|-------------|--------|
|
||||
| progress | Reading progress updates | progress_updated |
|
||||
| conflicts | Sync conflict events | conflict_detected, conflict_resolved |
|
||||
| scanner | Library scan events | scan_progress, scan_complete |
|
||||
| devices | Device connection events | device_connected, device_disconnected |
|
||||
| queue | Sync queue events | queue_item_added, queue_item_processed |
|
||||
| Topic | Description | Events |
|
||||
| --------- | ------------------------ | -------------------------------------- |
|
||||
| progress | Reading progress updates | progress_updated |
|
||||
| conflicts | Sync conflict events | conflict_detected, conflict_resolved |
|
||||
| scanner | Library scan events | scan_progress, scan_complete |
|
||||
| devices | Device connection events | device_connected, device_disconnected |
|
||||
| queue | Sync queue events | queue_item_added, queue_item_processed |
|
||||
|
||||
## Best Practices
|
||||
|
||||
|
||||
Reference in New Issue
Block a user