2.9 KiB
2.9 KiB
bunq API Client Implementation Plan
cat /home/philkunz/.claude/CLAUDE.md
Phase 1: Remove External Dependencies & Setup Core Infrastructure
- Remove @bunq-community/bunq-js-client dependency from package.json
- Remove JSONFileStore and bunqCommunityClient from bunq.plugins.ts
- Create bunq.classes.apicontext.ts for API context management
- Create bunq.classes.httpclient.ts for HTTP request handling
- Create bunq.classes.crypto.ts for cryptographic operations
- Create bunq.classes.session.ts for session management
- Create bunq.interfaces.ts for shared interfaces and types
Phase 2: Implement Core Authentication Flow
- Implement RSA key pair generation in crypto class
- Implement installation endpoint (
POST /v1/installation
) - Implement device registration (
POST /v1/device-server
) - Implement session creation (
POST /v1/session-server
) - Implement request signing mechanism
- Implement response verification
- Add session token refresh logic
Phase 3: Update Existing Classes
- Refactor BunqAccount class to use new HTTP client
- Update BunqMonetaryAccount to work with new infrastructure
- Update BunqTransaction to work with new infrastructure
- Add proper TypeScript interfaces for all API responses
- Implement error handling with bunq-specific error types
Phase 4: Implement Additional API Resources
- Create bunq.classes.user.ts for user management
- Create bunq.classes.payment.ts for payment operations
- Create bunq.classes.card.ts for card management
- Create bunq.classes.request.ts for payment requests
- Create bunq.classes.schedule.ts for scheduled payments
- Create bunq.classes.draft.ts for draft payments
- Create bunq.classes.attachment.ts for file handling
- Create bunq.classes.export.ts for statement exports
- Create bunq.classes.notification.ts for notifications
- Create bunq.classes.webhook.ts for webhook management
Phase 5: Enhanced Features
- Implement pagination support for all list endpoints
- Add rate limiting compliance
- Implement retry logic with exponential backoff
- Add request/response logging capabilities
- Implement webhook signature verification
- Add OAuth flow support for third-party apps
Phase 6: Testing & Documentation
- Write unit tests for crypto operations
- Write unit tests for HTTP client
- Write unit tests for all API classes
- Create integration tests using sandbox environment
- Update main README.md with usage examples
- Add JSDoc comments to all public methods
- Create example scripts for common use cases
Phase 7: Cleanup & Optimization
- Remove all references to old bunq-community client
- Optimize bundle size
- Ensure all TypeScript types are properly exported
- Run build and verify all tests pass
- Update package version