@proveanything/smartlinks 1.3.19 → 1.3.20
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/dist/api/crate.d.ts +96 -7
- package/dist/api/crate.js +104 -8
- package/dist/docs/API_SUMMARY.md +85 -11
- package/dist/types/crate.d.ts +79 -0
- package/dist/types/crate.js +6 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/docs/API_SUMMARY.md +85 -11
- package/package.json +1 -1
package/dist/api/crate.d.ts
CHANGED
|
@@ -1,22 +1,111 @@
|
|
|
1
|
+
import { GetCrateResponse, CreateCrateRequest, CreateCrateResponse, UpdateCrateRequest, UpdateCrateResponse, DeleteCrateResponse, ListCratesRequest, ListCratesResponse } from "../types/crate";
|
|
2
|
+
/**
|
|
3
|
+
* Crate Management API
|
|
4
|
+
*
|
|
5
|
+
* Manage crates (containers for tags/products) within collections.
|
|
6
|
+
*/
|
|
1
7
|
export declare namespace crate {
|
|
2
8
|
/**
|
|
3
|
-
*
|
|
9
|
+
* List crates for a collection with pagination support.
|
|
10
|
+
* Returns crates in pages, with support for soft-deleted crates.
|
|
11
|
+
*
|
|
12
|
+
* @param collectionId - Identifier of the parent collection
|
|
13
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
14
|
+
* @returns Promise resolving to a ListCratesResponse object
|
|
15
|
+
* @throws ErrorResponse if the request fails
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Get first page
|
|
20
|
+
* const page1 = await crate.list('coll_123', { limit: 100 })
|
|
21
|
+
* console.log(`Found ${page1.items.length} crates`)
|
|
22
|
+
*
|
|
23
|
+
* // Get next page
|
|
24
|
+
* if (page1.hasMore) {
|
|
25
|
+
* const page2 = await crate.list('coll_123', {
|
|
26
|
+
* limit: 100,
|
|
27
|
+
* startAfter: page1.lastId
|
|
28
|
+
* })
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* // Include soft-deleted crates
|
|
32
|
+
* const withDeleted = await crate.list('coll_123', {
|
|
33
|
+
* includeDeleted: true
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
4
36
|
*/
|
|
5
|
-
function
|
|
37
|
+
function list(collectionId: string, params?: ListCratesRequest): Promise<ListCratesResponse>;
|
|
6
38
|
/**
|
|
7
|
-
*
|
|
39
|
+
* Get a single crate by ID for a collection (admin only).
|
|
40
|
+
*
|
|
41
|
+
* @param collectionId - Identifier of the parent collection
|
|
42
|
+
* @param crateId - Crate ID
|
|
43
|
+
* @returns Promise resolving to a GetCrateResponse object
|
|
44
|
+
* @throws ErrorResponse if the request fails
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const crate = await crate.get('coll_123', 'crate_abc123')
|
|
49
|
+
* console.log(`Crate has ${crate.items?.length ?? 0} items`)
|
|
50
|
+
* ```
|
|
8
51
|
*/
|
|
9
|
-
function
|
|
52
|
+
function get(collectionId: string, crateId: string): Promise<GetCrateResponse>;
|
|
10
53
|
/**
|
|
11
54
|
* Create a new crate for a collection (admin only).
|
|
55
|
+
*
|
|
56
|
+
* @param collectionId - Identifier of the parent collection
|
|
57
|
+
* @param data - Crate creation data
|
|
58
|
+
* @returns Promise resolving to a CreateCrateResponse object
|
|
59
|
+
* @throws ErrorResponse if the request fails
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const newCrate = await crate.create('coll_123', {
|
|
64
|
+
* items: [
|
|
65
|
+
* {
|
|
66
|
+
* id: 'tag_001',
|
|
67
|
+
* codeId: 'ABC123',
|
|
68
|
+
* productId: 'prod_1',
|
|
69
|
+
* productName: 'Product Name'
|
|
70
|
+
* }
|
|
71
|
+
* ]
|
|
72
|
+
* })
|
|
73
|
+
* console.log(`Created crate ${newCrate.id}`)
|
|
74
|
+
* ```
|
|
12
75
|
*/
|
|
13
|
-
function create(collectionId: string, data:
|
|
76
|
+
function create(collectionId: string, data: CreateCrateRequest): Promise<CreateCrateResponse>;
|
|
14
77
|
/**
|
|
15
78
|
* Update a crate for a collection (admin only).
|
|
79
|
+
*
|
|
80
|
+
* @param collectionId - Identifier of the parent collection
|
|
81
|
+
* @param crateId - Crate ID
|
|
82
|
+
* @param data - Update data
|
|
83
|
+
* @returns Promise resolving to an UpdateCrateResponse object
|
|
84
|
+
* @throws ErrorResponse if the request fails
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const updated = await crate.update('coll_123', 'crate_abc123', {
|
|
89
|
+
* items: [
|
|
90
|
+
* { id: 'tag_002', codeId: 'XYZ789', productId: 'prod_2' }
|
|
91
|
+
* ]
|
|
92
|
+
* })
|
|
93
|
+
* ```
|
|
16
94
|
*/
|
|
17
|
-
function update(collectionId: string, crateId: string, data:
|
|
95
|
+
function update(collectionId: string, crateId: string, data: UpdateCrateRequest): Promise<UpdateCrateResponse>;
|
|
18
96
|
/**
|
|
19
97
|
* Delete a crate for a collection (admin only).
|
|
98
|
+
* This performs a soft delete.
|
|
99
|
+
*
|
|
100
|
+
* @param collectionId - Identifier of the parent collection
|
|
101
|
+
* @param crateId - Crate ID
|
|
102
|
+
* @returns Promise resolving to a DeleteCrateResponse object
|
|
103
|
+
* @throws ErrorResponse if the request fails
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* await crate.remove('coll_123', 'crate_abc123')
|
|
108
|
+
* ```
|
|
20
109
|
*/
|
|
21
|
-
function remove(collectionId: string, crateId: string): Promise<
|
|
110
|
+
function remove(collectionId: string, crateId: string): Promise<DeleteCrateResponse>;
|
|
22
111
|
}
|
package/dist/api/crate.js
CHANGED
|
@@ -1,24 +1,94 @@
|
|
|
1
1
|
import { request, post, put, del } from "../http";
|
|
2
|
+
/**
|
|
3
|
+
* Crate Management API
|
|
4
|
+
*
|
|
5
|
+
* Manage crates (containers for tags/products) within collections.
|
|
6
|
+
*/
|
|
2
7
|
export var crate;
|
|
3
8
|
(function (crate) {
|
|
4
9
|
/**
|
|
5
|
-
*
|
|
10
|
+
* List crates for a collection with pagination support.
|
|
11
|
+
* Returns crates in pages, with support for soft-deleted crates.
|
|
12
|
+
*
|
|
13
|
+
* @param collectionId - Identifier of the parent collection
|
|
14
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
15
|
+
* @returns Promise resolving to a ListCratesResponse object
|
|
16
|
+
* @throws ErrorResponse if the request fails
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Get first page
|
|
21
|
+
* const page1 = await crate.list('coll_123', { limit: 100 })
|
|
22
|
+
* console.log(`Found ${page1.items.length} crates`)
|
|
23
|
+
*
|
|
24
|
+
* // Get next page
|
|
25
|
+
* if (page1.hasMore) {
|
|
26
|
+
* const page2 = await crate.list('coll_123', {
|
|
27
|
+
* limit: 100,
|
|
28
|
+
* startAfter: page1.lastId
|
|
29
|
+
* })
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* // Include soft-deleted crates
|
|
33
|
+
* const withDeleted = await crate.list('coll_123', {
|
|
34
|
+
* includeDeleted: true
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
6
37
|
*/
|
|
7
|
-
async function
|
|
8
|
-
const
|
|
38
|
+
async function list(collectionId, params) {
|
|
39
|
+
const queryParams = new URLSearchParams();
|
|
40
|
+
if (params === null || params === void 0 ? void 0 : params.limit)
|
|
41
|
+
queryParams.append('limit', params.limit.toString());
|
|
42
|
+
if (params === null || params === void 0 ? void 0 : params.startAfter)
|
|
43
|
+
queryParams.append('startAfter', params.startAfter);
|
|
44
|
+
if (params === null || params === void 0 ? void 0 : params.includeDeleted)
|
|
45
|
+
queryParams.append('includeDeleted', 'true');
|
|
46
|
+
const query = queryParams.toString();
|
|
47
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate${query ? `?${query}` : ''}`;
|
|
9
48
|
return request(path);
|
|
10
49
|
}
|
|
11
|
-
crate.
|
|
50
|
+
crate.list = list;
|
|
12
51
|
/**
|
|
13
|
-
*
|
|
52
|
+
* Get a single crate by ID for a collection (admin only).
|
|
53
|
+
*
|
|
54
|
+
* @param collectionId - Identifier of the parent collection
|
|
55
|
+
* @param crateId - Crate ID
|
|
56
|
+
* @returns Promise resolving to a GetCrateResponse object
|
|
57
|
+
* @throws ErrorResponse if the request fails
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const crate = await crate.get('coll_123', 'crate_abc123')
|
|
62
|
+
* console.log(`Crate has ${crate.items?.length ?? 0} items`)
|
|
63
|
+
* ```
|
|
14
64
|
*/
|
|
15
|
-
async function
|
|
16
|
-
const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate`;
|
|
65
|
+
async function get(collectionId, crateId) {
|
|
66
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate/${encodeURIComponent(crateId)}`;
|
|
17
67
|
return request(path);
|
|
18
68
|
}
|
|
19
|
-
crate.
|
|
69
|
+
crate.get = get;
|
|
20
70
|
/**
|
|
21
71
|
* Create a new crate for a collection (admin only).
|
|
72
|
+
*
|
|
73
|
+
* @param collectionId - Identifier of the parent collection
|
|
74
|
+
* @param data - Crate creation data
|
|
75
|
+
* @returns Promise resolving to a CreateCrateResponse object
|
|
76
|
+
* @throws ErrorResponse if the request fails
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const newCrate = await crate.create('coll_123', {
|
|
81
|
+
* items: [
|
|
82
|
+
* {
|
|
83
|
+
* id: 'tag_001',
|
|
84
|
+
* codeId: 'ABC123',
|
|
85
|
+
* productId: 'prod_1',
|
|
86
|
+
* productName: 'Product Name'
|
|
87
|
+
* }
|
|
88
|
+
* ]
|
|
89
|
+
* })
|
|
90
|
+
* console.log(`Created crate ${newCrate.id}`)
|
|
91
|
+
* ```
|
|
22
92
|
*/
|
|
23
93
|
async function create(collectionId, data) {
|
|
24
94
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate`;
|
|
@@ -27,6 +97,21 @@ export var crate;
|
|
|
27
97
|
crate.create = create;
|
|
28
98
|
/**
|
|
29
99
|
* Update a crate for a collection (admin only).
|
|
100
|
+
*
|
|
101
|
+
* @param collectionId - Identifier of the parent collection
|
|
102
|
+
* @param crateId - Crate ID
|
|
103
|
+
* @param data - Update data
|
|
104
|
+
* @returns Promise resolving to an UpdateCrateResponse object
|
|
105
|
+
* @throws ErrorResponse if the request fails
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const updated = await crate.update('coll_123', 'crate_abc123', {
|
|
110
|
+
* items: [
|
|
111
|
+
* { id: 'tag_002', codeId: 'XYZ789', productId: 'prod_2' }
|
|
112
|
+
* ]
|
|
113
|
+
* })
|
|
114
|
+
* ```
|
|
30
115
|
*/
|
|
31
116
|
async function update(collectionId, crateId, data) {
|
|
32
117
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate/${encodeURIComponent(crateId)}`;
|
|
@@ -35,6 +120,17 @@ export var crate;
|
|
|
35
120
|
crate.update = update;
|
|
36
121
|
/**
|
|
37
122
|
* Delete a crate for a collection (admin only).
|
|
123
|
+
* This performs a soft delete.
|
|
124
|
+
*
|
|
125
|
+
* @param collectionId - Identifier of the parent collection
|
|
126
|
+
* @param crateId - Crate ID
|
|
127
|
+
* @returns Promise resolving to a DeleteCrateResponse object
|
|
128
|
+
* @throws ErrorResponse if the request fails
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* await crate.remove('coll_123', 'crate_abc123')
|
|
133
|
+
* ```
|
|
38
134
|
*/
|
|
39
135
|
async function remove(collectionId, crateId) {
|
|
40
136
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate/${encodeURIComponent(crateId)}`;
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.20 | Generated: 2026-02-08T14:25:23.483Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -1493,6 +1493,74 @@ interface ContactSchema {
|
|
|
1493
1493
|
|
|
1494
1494
|
**FieldType** = ``
|
|
1495
1495
|
|
|
1496
|
+
### crate
|
|
1497
|
+
|
|
1498
|
+
**CrateItem** (interface)
|
|
1499
|
+
```typescript
|
|
1500
|
+
interface CrateItem {
|
|
1501
|
+
id: string // Item ID (tag ID)
|
|
1502
|
+
codeId: string // Code identifier
|
|
1503
|
+
batchId?: string // Batch identifier
|
|
1504
|
+
productId?: string // Product identifier
|
|
1505
|
+
claimId?: string // Claim identifier
|
|
1506
|
+
productName?: string // Product name
|
|
1507
|
+
productGtin?: string // Product GTIN
|
|
1508
|
+
productImage?: string // Product image URL
|
|
1509
|
+
data?: Record<string, any> // Additional item data
|
|
1510
|
+
}
|
|
1511
|
+
```
|
|
1512
|
+
|
|
1513
|
+
**Crate** (interface)
|
|
1514
|
+
```typescript
|
|
1515
|
+
interface Crate {
|
|
1516
|
+
id: string // Crate ID
|
|
1517
|
+
items?: CrateItem[] // Array of items in the crate
|
|
1518
|
+
deleted?: boolean // Whether the crate is soft-deleted
|
|
1519
|
+
deletedAt?: string | null // ISO 8601 timestamp when deleted
|
|
1520
|
+
}
|
|
1521
|
+
```
|
|
1522
|
+
|
|
1523
|
+
**ListCratesRequest** (interface)
|
|
1524
|
+
```typescript
|
|
1525
|
+
interface ListCratesRequest {
|
|
1526
|
+
limit?: number // Number of results per page (default: 100, max: 100)
|
|
1527
|
+
startAfter?: string // Crate ID to start after for pagination
|
|
1528
|
+
includeDeleted?: boolean // Include soft-deleted crates (default: false)
|
|
1529
|
+
}
|
|
1530
|
+
```
|
|
1531
|
+
|
|
1532
|
+
**ListCratesResponse** (interface)
|
|
1533
|
+
```typescript
|
|
1534
|
+
interface ListCratesResponse {
|
|
1535
|
+
items: Crate[] // Array of crates
|
|
1536
|
+
hasMore: boolean // Whether more results are available
|
|
1537
|
+
lastId: string | null // ID of last crate (use as startAfter for next page)
|
|
1538
|
+
}
|
|
1539
|
+
```
|
|
1540
|
+
|
|
1541
|
+
**CreateCrateRequest** (interface)
|
|
1542
|
+
```typescript
|
|
1543
|
+
interface CreateCrateRequest {
|
|
1544
|
+
items?: CrateItem[] // Initial items for the crate
|
|
1545
|
+
[key: string]: any // Additional fields
|
|
1546
|
+
}
|
|
1547
|
+
```
|
|
1548
|
+
|
|
1549
|
+
**UpdateCrateRequest** (interface)
|
|
1550
|
+
```typescript
|
|
1551
|
+
interface UpdateCrateRequest {
|
|
1552
|
+
items?: CrateItem[] // Updated items
|
|
1553
|
+
[key: string]: any // Additional fields
|
|
1554
|
+
}
|
|
1555
|
+
```
|
|
1556
|
+
|
|
1557
|
+
**DeleteCrateResponse** (interface)
|
|
1558
|
+
```typescript
|
|
1559
|
+
interface DeleteCrateResponse {
|
|
1560
|
+
success: boolean
|
|
1561
|
+
}
|
|
1562
|
+
```
|
|
1563
|
+
|
|
1496
1564
|
### error
|
|
1497
1565
|
|
|
1498
1566
|
**ErrorResponse** (interface)
|
|
@@ -4123,20 +4191,26 @@ Public: Get contact update schema for a collection Fetches the public contact sc
|
|
|
4123
4191
|
|
|
4124
4192
|
### crate
|
|
4125
4193
|
|
|
4126
|
-
**
|
|
4127
|
-
|
|
4194
|
+
**list**(collectionId: string,
|
|
4195
|
+
params?: ListCratesRequest) → `Promise<ListCratesResponse>`
|
|
4196
|
+
List crates for a collection with pagination support. Returns crates in pages, with support for soft-deleted crates. ```typescript // Get first page const page1 = await crate.list('coll_123', { limit: 100 }) console.log(`Found ${page1.items.length} crates`) // Get next page if (page1.hasMore) { const page2 = await crate.list('coll_123', { limit: 100, startAfter: page1.lastId }) } // Include soft-deleted crates const withDeleted = await crate.list('coll_123', { includeDeleted: true }) ```
|
|
4128
4197
|
|
|
4129
|
-
**
|
|
4130
|
-
|
|
4198
|
+
**get**(collectionId: string,
|
|
4199
|
+
crateId: string) → `Promise<GetCrateResponse>`
|
|
4200
|
+
Get a single crate by ID for a collection (admin only). ```typescript const crate = await crate.get('coll_123', 'crate_abc123') console.log(`Crate has ${crate.items?.length ?? 0} items`) ```
|
|
4131
4201
|
|
|
4132
|
-
**create**(collectionId: string,
|
|
4133
|
-
|
|
4202
|
+
**create**(collectionId: string,
|
|
4203
|
+
data: CreateCrateRequest) → `Promise<CreateCrateResponse>`
|
|
4204
|
+
Create a new crate for a collection (admin only). ```typescript const newCrate = await crate.create('coll_123', { items: [ { id: 'tag_001', codeId: 'ABC123', productId: 'prod_1', productName: 'Product Name' } ] }) console.log(`Created crate ${newCrate.id}`) ```
|
|
4134
4205
|
|
|
4135
|
-
**update**(collectionId: string,
|
|
4136
|
-
|
|
4206
|
+
**update**(collectionId: string,
|
|
4207
|
+
crateId: string,
|
|
4208
|
+
data: UpdateCrateRequest) → `Promise<UpdateCrateResponse>`
|
|
4209
|
+
Update a crate for a collection (admin only). ```typescript const updated = await crate.update('coll_123', 'crate_abc123', { items: [ { id: 'tag_002', codeId: 'XYZ789', productId: 'prod_2' } ] }) ```
|
|
4137
4210
|
|
|
4138
|
-
**remove**(collectionId: string,
|
|
4139
|
-
|
|
4211
|
+
**remove**(collectionId: string,
|
|
4212
|
+
crateId: string) → `Promise<DeleteCrateResponse>`
|
|
4213
|
+
Delete a crate for a collection (admin only). This performs a soft delete. ```typescript await crate.remove('coll_123', 'crate_abc123') ```
|
|
4140
4214
|
|
|
4141
4215
|
### form
|
|
4142
4216
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crate Management Types
|
|
3
|
+
*
|
|
4
|
+
* Types for managing crates (containers for tags/products).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Item within a crate.
|
|
8
|
+
*/
|
|
9
|
+
export interface CrateItem {
|
|
10
|
+
id: string;
|
|
11
|
+
codeId: string;
|
|
12
|
+
batchId?: string;
|
|
13
|
+
productId?: string;
|
|
14
|
+
claimId?: string;
|
|
15
|
+
productName?: string;
|
|
16
|
+
productGtin?: string;
|
|
17
|
+
productImage?: string;
|
|
18
|
+
data?: Record<string, any>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Represents a crate containing items.
|
|
22
|
+
*/
|
|
23
|
+
export interface Crate {
|
|
24
|
+
id: string;
|
|
25
|
+
items?: CrateItem[];
|
|
26
|
+
deleted?: boolean;
|
|
27
|
+
deletedAt?: string | null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Query parameters for listing crates.
|
|
31
|
+
*/
|
|
32
|
+
export interface ListCratesRequest {
|
|
33
|
+
limit?: number;
|
|
34
|
+
startAfter?: string;
|
|
35
|
+
includeDeleted?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Response from listing crates.
|
|
39
|
+
*/
|
|
40
|
+
export interface ListCratesResponse {
|
|
41
|
+
items: Crate[];
|
|
42
|
+
hasMore: boolean;
|
|
43
|
+
lastId: string | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Response from getting a single crate.
|
|
47
|
+
*/
|
|
48
|
+
export interface GetCrateResponse extends Crate {
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Request to create a crate.
|
|
52
|
+
*/
|
|
53
|
+
export interface CreateCrateRequest {
|
|
54
|
+
items?: CrateItem[];
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Response from creating a crate.
|
|
59
|
+
*/
|
|
60
|
+
export interface CreateCrateResponse extends Crate {
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Request to update a crate.
|
|
64
|
+
*/
|
|
65
|
+
export interface UpdateCrateRequest {
|
|
66
|
+
items?: CrateItem[];
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Response from updating a crate.
|
|
71
|
+
*/
|
|
72
|
+
export interface UpdateCrateResponse extends Crate {
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Response from deleting a crate.
|
|
76
|
+
*/
|
|
77
|
+
export interface DeleteCrateResponse {
|
|
78
|
+
success: boolean;
|
|
79
|
+
}
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.20 | Generated: 2026-02-08T14:25:23.483Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -1493,6 +1493,74 @@ interface ContactSchema {
|
|
|
1493
1493
|
|
|
1494
1494
|
**FieldType** = ``
|
|
1495
1495
|
|
|
1496
|
+
### crate
|
|
1497
|
+
|
|
1498
|
+
**CrateItem** (interface)
|
|
1499
|
+
```typescript
|
|
1500
|
+
interface CrateItem {
|
|
1501
|
+
id: string // Item ID (tag ID)
|
|
1502
|
+
codeId: string // Code identifier
|
|
1503
|
+
batchId?: string // Batch identifier
|
|
1504
|
+
productId?: string // Product identifier
|
|
1505
|
+
claimId?: string // Claim identifier
|
|
1506
|
+
productName?: string // Product name
|
|
1507
|
+
productGtin?: string // Product GTIN
|
|
1508
|
+
productImage?: string // Product image URL
|
|
1509
|
+
data?: Record<string, any> // Additional item data
|
|
1510
|
+
}
|
|
1511
|
+
```
|
|
1512
|
+
|
|
1513
|
+
**Crate** (interface)
|
|
1514
|
+
```typescript
|
|
1515
|
+
interface Crate {
|
|
1516
|
+
id: string // Crate ID
|
|
1517
|
+
items?: CrateItem[] // Array of items in the crate
|
|
1518
|
+
deleted?: boolean // Whether the crate is soft-deleted
|
|
1519
|
+
deletedAt?: string | null // ISO 8601 timestamp when deleted
|
|
1520
|
+
}
|
|
1521
|
+
```
|
|
1522
|
+
|
|
1523
|
+
**ListCratesRequest** (interface)
|
|
1524
|
+
```typescript
|
|
1525
|
+
interface ListCratesRequest {
|
|
1526
|
+
limit?: number // Number of results per page (default: 100, max: 100)
|
|
1527
|
+
startAfter?: string // Crate ID to start after for pagination
|
|
1528
|
+
includeDeleted?: boolean // Include soft-deleted crates (default: false)
|
|
1529
|
+
}
|
|
1530
|
+
```
|
|
1531
|
+
|
|
1532
|
+
**ListCratesResponse** (interface)
|
|
1533
|
+
```typescript
|
|
1534
|
+
interface ListCratesResponse {
|
|
1535
|
+
items: Crate[] // Array of crates
|
|
1536
|
+
hasMore: boolean // Whether more results are available
|
|
1537
|
+
lastId: string | null // ID of last crate (use as startAfter for next page)
|
|
1538
|
+
}
|
|
1539
|
+
```
|
|
1540
|
+
|
|
1541
|
+
**CreateCrateRequest** (interface)
|
|
1542
|
+
```typescript
|
|
1543
|
+
interface CreateCrateRequest {
|
|
1544
|
+
items?: CrateItem[] // Initial items for the crate
|
|
1545
|
+
[key: string]: any // Additional fields
|
|
1546
|
+
}
|
|
1547
|
+
```
|
|
1548
|
+
|
|
1549
|
+
**UpdateCrateRequest** (interface)
|
|
1550
|
+
```typescript
|
|
1551
|
+
interface UpdateCrateRequest {
|
|
1552
|
+
items?: CrateItem[] // Updated items
|
|
1553
|
+
[key: string]: any // Additional fields
|
|
1554
|
+
}
|
|
1555
|
+
```
|
|
1556
|
+
|
|
1557
|
+
**DeleteCrateResponse** (interface)
|
|
1558
|
+
```typescript
|
|
1559
|
+
interface DeleteCrateResponse {
|
|
1560
|
+
success: boolean
|
|
1561
|
+
}
|
|
1562
|
+
```
|
|
1563
|
+
|
|
1496
1564
|
### error
|
|
1497
1565
|
|
|
1498
1566
|
**ErrorResponse** (interface)
|
|
@@ -4123,20 +4191,26 @@ Public: Get contact update schema for a collection Fetches the public contact sc
|
|
|
4123
4191
|
|
|
4124
4192
|
### crate
|
|
4125
4193
|
|
|
4126
|
-
**
|
|
4127
|
-
|
|
4194
|
+
**list**(collectionId: string,
|
|
4195
|
+
params?: ListCratesRequest) → `Promise<ListCratesResponse>`
|
|
4196
|
+
List crates for a collection with pagination support. Returns crates in pages, with support for soft-deleted crates. ```typescript // Get first page const page1 = await crate.list('coll_123', { limit: 100 }) console.log(`Found ${page1.items.length} crates`) // Get next page if (page1.hasMore) { const page2 = await crate.list('coll_123', { limit: 100, startAfter: page1.lastId }) } // Include soft-deleted crates const withDeleted = await crate.list('coll_123', { includeDeleted: true }) ```
|
|
4128
4197
|
|
|
4129
|
-
**
|
|
4130
|
-
|
|
4198
|
+
**get**(collectionId: string,
|
|
4199
|
+
crateId: string) → `Promise<GetCrateResponse>`
|
|
4200
|
+
Get a single crate by ID for a collection (admin only). ```typescript const crate = await crate.get('coll_123', 'crate_abc123') console.log(`Crate has ${crate.items?.length ?? 0} items`) ```
|
|
4131
4201
|
|
|
4132
|
-
**create**(collectionId: string,
|
|
4133
|
-
|
|
4202
|
+
**create**(collectionId: string,
|
|
4203
|
+
data: CreateCrateRequest) → `Promise<CreateCrateResponse>`
|
|
4204
|
+
Create a new crate for a collection (admin only). ```typescript const newCrate = await crate.create('coll_123', { items: [ { id: 'tag_001', codeId: 'ABC123', productId: 'prod_1', productName: 'Product Name' } ] }) console.log(`Created crate ${newCrate.id}`) ```
|
|
4134
4205
|
|
|
4135
|
-
**update**(collectionId: string,
|
|
4136
|
-
|
|
4206
|
+
**update**(collectionId: string,
|
|
4207
|
+
crateId: string,
|
|
4208
|
+
data: UpdateCrateRequest) → `Promise<UpdateCrateResponse>`
|
|
4209
|
+
Update a crate for a collection (admin only). ```typescript const updated = await crate.update('coll_123', 'crate_abc123', { items: [ { id: 'tag_002', codeId: 'XYZ789', productId: 'prod_2' } ] }) ```
|
|
4137
4210
|
|
|
4138
|
-
**remove**(collectionId: string,
|
|
4139
|
-
|
|
4211
|
+
**remove**(collectionId: string,
|
|
4212
|
+
crateId: string) → `Promise<DeleteCrateResponse>`
|
|
4213
|
+
Delete a crate for a collection (admin only). This performs a soft delete. ```typescript await crate.remove('coll_123', 'crate_abc123') ```
|
|
4140
4214
|
|
|
4141
4215
|
### form
|
|
4142
4216
|
|