@trustrails/sdk 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ const results = await trustrails.search({
|
|
|
27
27
|
|
|
28
28
|
console.log(`Found ${results.total} products`);
|
|
29
29
|
results.products.forEach(product => {
|
|
30
|
-
console.log(`${product.title} -
|
|
30
|
+
console.log(`${product.title} - £${product.price}`);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
// Get a specific product
|
|
@@ -53,7 +53,7 @@ new TrustRails({ apiKey: string, baseUrl?: string })
|
|
|
53
53
|
|
|
54
54
|
**Parameters:**
|
|
55
55
|
- `apiKey` - Your TrustRails API key
|
|
56
|
-
- `baseUrl` (optional) - Custom base URL (defaults to `https://
|
|
56
|
+
- `baseUrl` (optional) - Custom base URL (defaults to `https://trustrails.app`)
|
|
57
57
|
|
|
58
58
|
#### Methods
|
|
59
59
|
|
|
@@ -68,7 +68,7 @@ Search for products. Returns summary data (title, price, availability, category)
|
|
|
68
68
|
- `options.minPrice?: number` - Minimum price filter in GBP
|
|
69
69
|
- `options.maxPrice?: number` - Maximum price filter in GBP
|
|
70
70
|
- `options.lite?: boolean` - Return trimmed product objects with only essential fields (reduces payload by ~80%)
|
|
71
|
-
- `options.limit?: number` - Maximum number of results (default:
|
|
71
|
+
- `options.limit?: number` - Maximum number of results (default: 50, max: 100)
|
|
72
72
|
|
|
73
73
|
**Returns:** Promise resolving to `SearchResponse` containing `products` array and `total` count.
|
|
74
74
|
|
|
@@ -115,6 +115,7 @@ const product = await trustrails.product('prod_123');
|
|
|
115
115
|
interface Product {
|
|
116
116
|
id: string;
|
|
117
117
|
title: string;
|
|
118
|
+
description?: string;
|
|
118
119
|
brand?: string;
|
|
119
120
|
price: number;
|
|
120
121
|
currency: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -8,6 +8,7 @@ type Availability = "in_stock" | "low_stock" | "out_of_stock";
|
|
|
8
8
|
interface Product {
|
|
9
9
|
id: string;
|
|
10
10
|
title: string;
|
|
11
|
+
description?: string;
|
|
11
12
|
brand?: string;
|
|
12
13
|
price: number;
|
|
13
14
|
currency: string;
|
|
@@ -40,7 +41,7 @@ interface SearchOptions {
|
|
|
40
41
|
category?: string;
|
|
41
42
|
/** Return trimmed product objects with only essential fields. Reduces payload size by ~80%. */
|
|
42
43
|
lite?: boolean;
|
|
43
|
-
/** Maximum number of products to return (default
|
|
44
|
+
/** Maximum number of products to return (default 50, max 100) */
|
|
44
45
|
limit?: number;
|
|
45
46
|
}
|
|
46
47
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ type Availability = "in_stock" | "low_stock" | "out_of_stock";
|
|
|
8
8
|
interface Product {
|
|
9
9
|
id: string;
|
|
10
10
|
title: string;
|
|
11
|
+
description?: string;
|
|
11
12
|
brand?: string;
|
|
12
13
|
price: number;
|
|
13
14
|
currency: string;
|
|
@@ -40,7 +41,7 @@ interface SearchOptions {
|
|
|
40
41
|
category?: string;
|
|
41
42
|
/** Return trimmed product objects with only essential fields. Reduces payload size by ~80%. */
|
|
42
43
|
lite?: boolean;
|
|
43
|
-
/** Maximum number of products to return (default
|
|
44
|
+
/** Maximum number of products to return (default 50, max 100) */
|
|
44
45
|
limit?: number;
|
|
45
46
|
}
|
|
46
47
|
/**
|