@amigodoturista/api-types
v1.3.0
Published
Public TypeScript types for Amigo do Turista API
Downloads
287
Maintainers
Readme
@amigodoturista/api-types
Public TypeScript types for Amigo do Turista API.
Contract pattern
- Request, response and public error types live in
src/types/*.interface.ts. - Those types are exported from
src/index.tsand consumed by both frontend and backend.
What is published
- Declaration files.
- A runtime JS entrypoint so bundlers like Vite can resolve
@amigodoturista/api-types. - Official Cloud Functions contracts exported by
FUNCTIONS. CHANGELOG.mdwith consumer-facing history.
Documentation access
Available at
https://docs-f635bwwbia-rj.a.run.app/Update package
Update with:
npm install @amigodoturista/api-types@latestRegenerate JS after type changes
When you change anything in src/*.ts, run:
cd packages/api-types
npm run buildFor active development, use:
cd packages/api-types
npm run build:watchThat keeps dist/*.js and dist/*.d.ts in sync.
Frontend usage
import { FUNCTIONS } from '@amigodoturista/api-types';
// example: httpsCallable(FUNCTIONS.checkCanSubscribe.name)Use FUNCTIONS as the single source of truth for function name, invocation type and client method.
Invocation type
Read FUNCTIONS[<name>].invocationType and FUNCTIONS[<name>].method when you need to know how to call a function:
onCallfunctions should be invoked withhttpsCallable(...).onRequestfunctions should be invoked withfetch(...).
The package also exports FUNCTION_INVOCATION_TYPES and FUNCTION_METHODS for quick lookups.
