@vulog/aima-product
v1.2.48
Published
Product catalog — retrieve products by ID or list all fleet products.
Readme
@vulog/aima-product
Product catalog — retrieve products by ID or list all fleet products.
Installation
npm install @vulog/aima-product @vulog/aima-client @vulog/aima-coreUsage
import { getClient } from '@vulog/aima-client';
import { getProductById, getProducts } from '@vulog/aima-product';
const client = getClient({ ... });
const product = await getProductById(client, 'product-id');
const allProducts = await getProducts(client);API Reference
getProductById
getProductById(client: Client, id: string): Promise<Product>Retrieves a single product by ID. Strips fleetId from the API response.
| Param | Type | Description |
| -------- | -------- | ------------------------- |
| client | Client | Authenticated AIMA client |
| id | string | Product identifier |
Returns: Promise<Product>
getProducts
getProducts(client: Client): Promise<Product[]>Returns all products for the fleet. Strips fleetId from each product in the response.
| Param | Type | Description |
| -------- | -------- | ------------------------- |
| client | Client | Authenticated AIMA client |
Returns: Promise<Product[]>
Types
ProductTaxe
{
taxName?: string;
taxRate: number;
}Product
Extends ProductTaxe.
{
id: string;
type: string;
name: string;
price: number;
taxIncluded: boolean;
taxName?: string;
priceRate?: number;
serviceIds: string[];
taxes: (ProductTaxe & { id: string })[];
pricePerUnitExceedingAllowance: number;
distanceIncluded: number;
}