docs: complete Phase 8 documentation and examples
- Update README with native-first architecture and compatibility matrix - Enhance API documentation with TimeSafari-specific examples - Update integration guide with current architecture and troubleshooting - Add comprehensive observability dashboards guide - Add accessibility and localization implementation guide - Add legal and store compliance guide - Add manual smoke testing documentation - Update all documentation to reflect native-first architecture Documentation: API reference, integration guide, observability, A11y, compliance
This commit is contained in:
110
API.md
110
API.md
@@ -1,4 +1,18 @@
|
||||
# API Reference
|
||||
# TimeSafari Daily Notification Plugin API Reference
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Version**: 2.2.0
|
||||
**Last Updated**: 2025-10-08 06:02:45 UTC
|
||||
|
||||
## Overview
|
||||
|
||||
This API reference provides comprehensive documentation for the TimeSafari Daily Notification Plugin, optimized for **native-first architecture** supporting Android, iOS, and Electron platforms.
|
||||
|
||||
### Platform Support
|
||||
- ✅ **Android**: WorkManager + AlarmManager + SQLite
|
||||
- ✅ **iOS**: BGTaskScheduler + UNUserNotificationCenter + Core Data
|
||||
- ✅ **Electron**: Desktop notifications + SQLite/LocalStorage
|
||||
- ❌ **Web (PWA)**: Removed for native-first focus
|
||||
|
||||
## DailyNotificationPlugin Interface
|
||||
|
||||
@@ -233,9 +247,93 @@ All methods return promises that reject with descriptive error messages. The plu
|
||||
- Automatic background task management
|
||||
- Battery optimization built-in
|
||||
|
||||
### Web
|
||||
### Electron
|
||||
|
||||
- Placeholder implementations for development
|
||||
- No actual notification scheduling
|
||||
- All methods return mock data
|
||||
- Used for testing and development
|
||||
- Desktop notification support
|
||||
- SQLite or LocalStorage fallback
|
||||
- Native desktop notification APIs
|
||||
- Cross-platform desktop compatibility
|
||||
|
||||
## TimeSafari-Specific Integration Examples
|
||||
|
||||
### Basic TimeSafari Integration
|
||||
|
||||
```typescript
|
||||
import { DailyNotification } from '@timesafari/daily-notification-plugin';
|
||||
import { TimeSafariIntegrationService } from '@timesafari/daily-notification-plugin';
|
||||
|
||||
// Initialize TimeSafari integration
|
||||
const integrationService = TimeSafariIntegrationService.getInstance();
|
||||
|
||||
// Configure with TimeSafari-specific settings
|
||||
await integrationService.initialize({
|
||||
activeDid: 'did:example:timesafari-user-123',
|
||||
storageAdapter: timeSafariStorageAdapter,
|
||||
endorserApiBaseUrl: 'https://endorser.ch/api/v1'
|
||||
});
|
||||
|
||||
// Schedule TimeSafari community notifications
|
||||
await DailyNotification.scheduleDailyNotification({
|
||||
title: 'New Community Update',
|
||||
body: 'You have new offers and project updates',
|
||||
time: '09:00',
|
||||
channel: 'timesafari_community_updates'
|
||||
});
|
||||
```
|
||||
|
||||
### TimeSafari Community Features
|
||||
|
||||
```typescript
|
||||
// Fetch community data with rate limiting
|
||||
const communityService = new TimeSafariCommunityIntegrationService();
|
||||
|
||||
await communityService.initialize({
|
||||
maxRequestsPerMinute: 30,
|
||||
maxRequestsPerHour: 1000,
|
||||
basePollingIntervalMs: 300000, // 5 minutes
|
||||
adaptivePolling: true
|
||||
});
|
||||
|
||||
// Fetch community data
|
||||
const bundle = await communityService.fetchCommunityDataWithRateLimit({
|
||||
activeDid: 'did:example:timesafari-user-123',
|
||||
fetchOffersToPerson: true,
|
||||
fetchOffersToProjects: true,
|
||||
fetchProjectUpdates: true,
|
||||
starredPlanIds: ['plan-1', 'plan-2', 'plan-3']
|
||||
});
|
||||
```
|
||||
|
||||
### DID-Signed Payloads
|
||||
|
||||
```typescript
|
||||
// Generate DID-signed notification payloads
|
||||
const samplePayloads = integrationService.generateSampleDidPayloads();
|
||||
|
||||
for (const payload of samplePayloads) {
|
||||
// Verify signature
|
||||
const isValid = await integrationService.verifyDidSignature(
|
||||
JSON.stringify(payload.payload),
|
||||
payload.signature
|
||||
);
|
||||
|
||||
console.log(`Payload ${payload.type} signature valid: ${isValid}`);
|
||||
}
|
||||
```
|
||||
|
||||
### Privacy-Preserving Storage
|
||||
|
||||
```typescript
|
||||
// Configure privacy-preserving storage
|
||||
const storageAdapter = new TimeSafariStorageAdapterImpl(
|
||||
nativeStorage,
|
||||
'timesafari_notifications'
|
||||
);
|
||||
|
||||
// Store with TTL and redaction
|
||||
await storageAdapter.store('community_data', bundle, 3600); // 1 hour TTL
|
||||
|
||||
// Get data retention policy
|
||||
const policy = integrationService.getDataRetentionPolicy();
|
||||
console.log('Data retention policy:', policy);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user