api/php.ts module provides typed client functions for interacting with the Corprecam PHP backend APIs.
Base URL
All API functions communicate with:Functions
getCompras
Fetches a purchase record by its code.com_codigo(string) - The purchase code identifier
Promise<Compra[]>- Array of purchase records
POST /get_compra.php
Request Example:
getCompraItems
Fetches all line items for a purchase.com_codigo(string) - The purchase code identifier
Promise<CompraItem[]>- Array of purchase item records
POST /get_compra_items.php
Request Example:
getMateriales
Fetches material details for multiple material IDs.ids(number[]) - Array of material IDs to fetch
Promise<Material[]>- Array of material records
POST /get_materiales.php
Request Example:
getMicro
Fetches micro route information by route code.com_micro_ruta(number) - The micro route code
Promise<Micro>- Micro route record
POST /get_microruta.php
Request Example:
setNgrok
Updates the ngrok tunnel URL in the Corprecam system.link(string | null) - The ngrok tunnel URL, or null to clear
Promise<any>- Response from the API
POST /set_ngrok.php
Request Example:
Implementation Notes
- All functions use
POSTmethod with JSON payloads - All functions set
Content-Type: application/jsonheader - Functions return typed promises based on TypeScript interfaces
- The
setNgrokfunction is called automatically on server startup (server.ts:51) - Material IDs are extracted from purchase items before calling
getMateriales()(server.ts:28)