extended JS and TS template with Bearer token

This commit is contained in:
2026-03-30 23:32:38 +02:00
parent 394a85ef45
commit c758dc9317
4 changed files with 130 additions and 4 deletions

View File

@ -4,8 +4,8 @@
APIlite is a lightweight PHP library. A class extends `TPsoft\APIlite\APIlite`, public methods become API actions, requests are processed automatically, and responses are returned as JSON.
The project also generates frontend clients:
- JavaScript client: `format=javascript` (`.js`)
- TypeScript client: `format=typescript` (`.ts`, real typed output)
- JavaScript client: `format=javascript` (`.js`, includes `bearerSet()` helper backed by `localStorage`)
- TypeScript client: `format=typescript` (`.ts`, real typed output, includes `bearerSet()` helper backed by `localStorage`)
The HTML help page is also interactive:
- HTML help: `format=html` includes endpoint docs, a built-in request tester, and optional Bearer token support stored in browser `localStorage`
@ -22,6 +22,7 @@ The HTML help page is also interactive:
- Maintain both generated clients:
- JavaScript stays plain JS.
- TypeScript stays typed (interfaces + typed method signatures).
- Bearer token behavior stays aligned between JavaScript and TypeScript clients (`bearerSet()`, `apilite_bearer_token`, automatic `Authorization: Bearer ...` header).
- Keep the HTML help page usable both as documentation and as a lightweight in-browser tester.
- If you change output field names in JSON help, update README and templates consistently.
- If you change request metadata or tester behavior, update `README.md` and keep `src/help.tpl.php` aligned with the actual runtime request model.
@ -42,3 +43,4 @@ The HTML help page is also interactive:
## Documentation rule
When output format names/flags/URLs change, update `README.md` in the same change set.
When Bearer token helper/storage behavior changes, update `README.md` and keep JS/TS client docs aligned with the actual generated templates.