|
| 1 | +# Endpoint coverage: Swagger / API definition vs client |
| 2 | + |
| 3 | +This document maps API definitions (Swagger and router definitions) to the moneyhub-api-client methods. |
| 4 | + |
| 5 | +## 1. Request routing |
| 6 | + |
| 7 | +| Config | Backend | Definition source | |
| 8 | +|--------|---------|-------------------| |
| 9 | +| `resourceServerUrl` | API Gateway (Data API) | api-gateway `swagger.json` (v2), `swagger-v3.json` (v3) | |
| 10 | +| `identityServiceUrl` | Identity | identity `swagger.json` | |
| 11 | +| `caasResourceServerUrl` | CaaS (Enrichment) | api-gateway `docs-enrichment-engine/swagger-enrichment-engine.json` | |
| 12 | +| `osipResourceServerUrl` | OSIP | api-gateway `create-router.js` + `handlers/osip.js` (no Swagger) | |
| 13 | + |
| 14 | +## 2. API Gateway (Data API) – client mapping |
| 15 | + |
| 16 | +**Swagger:** api-gateway `docs/swagger.json` (basePath `/v2.0`), `docs/swagger-v3.json` (basePath `/v3`). |
| 17 | + |
| 18 | +| Path / area | Client method(s) | Module | Notes | |
| 19 | +|-------------|------------------|--------|--------| |
| 20 | +| GET /accounts | getAccounts, getAccountsWithDetails | accounts | | |
| 21 | +| GET /accounts-list | getAccountsList, getAccountsListWithDetails | accounts | **v2 only** – not in v3 Swagger | |
| 22 | +| GET/POST/PATCH/DELETE /accounts, /accounts/{id}, /balances | getAccount, getAccountWithDetails, getAccountBalances, createAccount, updateAccount, deleteAccount, addAccountBalance | accounts | | |
| 23 | +| Holdings, counterparties, recurring-transactions, standing-orders, statements | getAccountHoldings, getAccountHoldingsWithMatches, getAccountHolding, getAccountCounterparties, getAccountRecurringTransactions, getAccountStandingOrders, getAccountStandingOrdersWithDetail, getAccountStatements, getAccountStatementsWithDetail | accounts | **v2 only:** /accounts-list, /accounts/{id}/counterparties, /accounts/{id}/recurring-transactions (no v3 path) | |
| 24 | +| Affordability | (affordability module) | affordability | | |
| 25 | +| Beneficiaries | getBeneficiary, getBeneficiaryWithDetail, getBeneficiaries, getBeneficiariesWithDetail | beneficiaries | | |
| 26 | +| GET /global-counterparties | getGlobalCounterparties | unauthenticated | | |
| 27 | +| Transactions, files, splits | getTransactions, getTransaction, getUnenrichedTransactions, getUnenrichedTransaction, addTransaction, addTransactions, getTransactionFiles, getTransactionFile, addFileToTransaction, deleteTransactionFile, getTransactionSplits, splitTransaction, patchTransactionSplit, deleteTransactionSplits | transactions, transaction-files, transaction-splits | | |
| 28 | +| Categories, category-groups | getCategories, getCategory, getCategoryGroups, getStandardCategories, getStandardCategoryGroups, createCustomCategory, updateCategory, deleteCategory | categories | | |
| 29 | +| Categorise, regular-transactions | categoriseTransactions, getRegularTransactions, addRegularTransaction, updateRegularTransaction, deleteRegularTransaction, detectRegularTransactions | categorise-transactions, regular-transactions | | |
| 30 | +| Rental records | (rental-records module) | rental-records | | |
| 31 | +| Spending analysis, spending/savings goals | getSpendingAnalysis, getSpendingGoals, getSpendingGoal, addSpendingGoal, updateSpendingGoal, deleteSpendingGoal, getSavingsGoals, getSavingsGoal, addSavingsGoal, updateSavingsGoal, deleteSavingsGoal | spending-analysis, spending-goals, savings-goals | | |
| 32 | +| **GET /standard-financial-statements**, **GET /standard-financial-statements/{reportId}** | **getStandardFinancialStatements**, **getStandardFinancialStatement** | **standard-financial-statements** | **Added in this plan** | |
| 33 | +| Sync, projects, tax | syncUserConnection, getProjects, getProject, addProject, updateProject, deleteProject, getTaxReturn | sync, projects, tax | | |
| 34 | +| Notification thresholds | getNotificationThresholds, addNotificationThreshold, getNotificationThreshold, updateNotificationThreshold, deleteNotificationThreshold | notification-thresholds | | |
| 35 | + |
| 36 | +## 3. Identity – client mapping |
| 37 | + |
| 38 | +**Swagger:** identity `docs/swagger.json`. |
| 39 | + |
| 40 | +| Path / area | Client method(s) | Module | Notes | |
| 41 | +|-------------|------------------|--------|--------| |
| 42 | +| GET .well-known/all-connections | listConnections | unauthenticated | | |
| 43 | +| GET .well-known/api-connections | listAPIConnections | unauthenticated | | |
| 44 | +| GET .well-known/legacy-connections | listLegacyConnections | unauthenticated | **Added in this plan** | |
| 45 | +| GET .well-known/test-connections | listTestConnections | unauthenticated | | |
| 46 | +| GET .well-known/payments-connections | listPaymentsConnections | unauthenticated | | |
| 47 | +| GET .well-known/beta-connections | listBetaConnections | unauthenticated | | |
| 48 | +| GET .well-known/openid-configuration | getOpenIdConfig | unauthenticated | | |
| 49 | +| Auth-requests, OIDC | createAuthRequest, getAuthRequest, getAllAuthRequests, completeAuthRequest, getAuthUrls, token helpers | auth-requests, get-auth-urls, tokens | | |
| 50 | +| Users, connections, syncs, SCIM | getUser, getUsers, registerUser, deleteUser, getUserConnections, deleteUserConnection, updateUserConnection, getConnectionSyncs, getUserSyncs, getSync, getSCIMUser, registerSCIMUser, searchSCIMUsers | users-and-connections | | |
| 51 | +| Payees, pay-links, payments | addPayee, getPayees, getPayee, getPayment, getPayments, getPaymentFromIDToken, addPayLink, getPayLink, getPayLinks | payees, pay-links, payments | | |
| 52 | +| Standing orders, recurring payments | getStandingOrder, getStandingOrders, getRecurringPayments, getRecurringPayment, makeRecurringPayment, revokeRecurringPayment, confirmFundsForRecurringPayment | standing-orders, recurring-payments | | |
| 53 | +| Reseller-check, consent-history | createResellerCheckRequest, getConsentHistory | reseller-check, consent-history | | |
| 54 | +| **Pay-file** | — | — | **Client missing** | |
| 55 | +| **Pay-file-consent** | — | — | **Client missing** | |
| 56 | +| **GET /bank-icons/{bankRef}** | — | — | **Client missing** | |
| 57 | +| **GET /consents/{authRequestId}** | — | — | **Client missing** | |
| 58 | + |
| 59 | +## 4. CaaS (Enrichment API) – client mapping |
| 60 | + |
| 61 | +**Swagger:** api-gateway `docs/docs-enrichment-engine/swagger-enrichment-engine.json` (basePath `/caas/v1`). |
| 62 | + |
| 63 | +| Path / area | Client method(s) | Module | Notes | |
| 64 | +|-------------|------------------|--------|--------| |
| 65 | +| DELETE /users/{userId} | caasDeleteUser | caas/users | | |
| 66 | +| DELETE /accounts/{accountId} | caasDeleteAccount | caas/accounts | | |
| 67 | +| GET /categories, /category-groups | caasGetCategories, caasGetCategoryGroups | caas/categories | | |
| 68 | +| GET /counterparties | caasGetCounterparties | caas/counterparties | | |
| 69 | +| GET /geotags | caasGetGeotags | caas/geotags | | |
| 70 | +| GET/PATCH/DELETE /accounts/{accountId}/transactions/{transactionId} | caasGetTransactions, caasPatchTransaction, caasDeleteTransaction | caas/transactions | | |
| 71 | +| POST /transactions/enrich | caasEnrichTransactions | caas/transactions | | |
| 72 | +| **Custom categories** (users/{userId}/custom-categories) | — | — | **Client missing** | |
| 73 | +| **Account regular-transactions** | — | — | **Client missing** | |
| 74 | +| **Transaction enhanced, splits** | — | — | **Client missing** | |
| 75 | + |
| 76 | +## 5. OSIP – client mapping |
| 77 | + |
| 78 | +**Definition:** api-gateway `src/api/create-router.js` and `src/api/handlers/osip.js` (no Swagger). |
| 79 | + |
| 80 | +| Method + path | Client method | Module | |
| 81 | +|---------------|---------------|--------| |
| 82 | +| GET /osip/v1.0/accounts | getOsipAccounts | osip | |
| 83 | +| GET /osip/v1.0/accounts/:id | getOsipAccount | osip | |
| 84 | +| GET /osip/v1.0/accounts/:id/holdings | getOsipAccountHoldings | osip | |
| 85 | +| GET /osip/v1.0/accounts/:id/transactions | getOsipAccountTransactions | osip | |
| 86 | + |
| 87 | +All require `osip:read` scope. Client fully covers these routes. |
| 88 | + |
| 89 | +## 6. Integration test files |
| 90 | + |
| 91 | +| Area | Test file(s) | |
| 92 | +|------|--------------| |
| 93 | +| Data API (accounts, transactions, etc.) | accounts.ts, accounts-with-extra-options.ts, transactions.ts, categories.ts, tax.ts, beneficiaries.ts, spending-analysis.ts, sync.ts, projects.ts, notification-thresholds.ts, regular-transactions.ts, rental-records.ts, savings-goals.ts, spending-goals.ts, transaction-files.ts, transaction-splits.ts, categorise-transactions.ts | |
| 94 | +| Identity | auth-requests.ts, auth-urls.ts, payees.ts, pay-links.ts, payments.ts, standing-orders.ts, recurring-payments.ts, consent-history.ts, reseller-check.ts, users (via index) | |
| 95 | +| Unauthenticated / connections | (listConnections etc. exercised via index or auth-urls) | |
| 96 | +| CaaS | (optional; depends on env) | |
| 97 | +| OSIP | osip.ts | |
| 98 | +| Standard financial statements | standard-financial-statements.ts | |
| 99 | + |
| 100 | +**Running tests and coverage** |
| 101 | + |
| 102 | +- **Unit only** (no API config): `npm run test:coverage` — runs `*.unit.ts`, enforces 90% coverage. |
| 103 | +- **Full suite** (unit + integration, requires config): `npm run test:integration:coverage` — runs all tests with hooks, enforces 90% line/function/branch/statement coverage. |
| 104 | +- Integration tests live in `src/__tests__/*.ts` (non-`.unit.ts`); hooks in `test/hooks.js` provide `this.config` (e.g. `testUserId`, `testAccountId`). |
0 commit comments