@proveanything/smartlinks 1.3.2 → 1.3.3
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/contact.d.ts +12 -0
- package/dist/api/contact.js +12 -1
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/order.d.ts +189 -0
- package/dist/api/order.js +240 -0
- package/dist/api/tags.d.ts +194 -0
- package/dist/api/tags.js +258 -0
- package/dist/docs/API_SUMMARY.md +587 -221
- package/dist/types/contact.d.ts +32 -1
- package/dist/types/contact.js +35 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/order.d.ts +137 -0
- package/dist/types/order.js +7 -0
- package/dist/types/tags.d.ts +172 -0
- package/dist/types/tags.js +7 -0
- package/docs/API_SUMMARY.md +368 -2
- package/package.json +1 -1
- package/dist/API_SUMMARY.md +0 -3230
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.3 | Generated: 2026-02-02T14:13:32.582Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -51,7 +51,9 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
51
51
|
- **jobs** - Functions for jobs operations
|
|
52
52
|
- **journeysAnalytics** - Functions for journeysAnalytics operations
|
|
53
53
|
- **location** - Functions for location operations
|
|
54
|
+
- **order** - Functions for order operations
|
|
54
55
|
- **realtime** - Functions for realtime operations
|
|
56
|
+
- **tags** - Functions for tags operations
|
|
55
57
|
- **template** - Functions for template operations
|
|
56
58
|
|
|
57
59
|
## HTTP Utilities
|
|
@@ -1386,6 +1388,15 @@ interface CommsState {
|
|
|
1386
1388
|
}
|
|
1387
1389
|
```
|
|
1388
1390
|
|
|
1391
|
+
**FieldCondition** (interface)
|
|
1392
|
+
```typescript
|
|
1393
|
+
interface FieldCondition {
|
|
1394
|
+
dependsOn: string // key of the field to check (not path)
|
|
1395
|
+
operator: ConditionOperator
|
|
1396
|
+
value?: string | string[] // required for equals/notEquals/contains/notContains
|
|
1397
|
+
}
|
|
1398
|
+
```
|
|
1399
|
+
|
|
1389
1400
|
**BaseField** (interface)
|
|
1390
1401
|
```typescript
|
|
1391
1402
|
interface BaseField {
|
|
@@ -1429,7 +1440,9 @@ interface ContactSchema {
|
|
|
1429
1440
|
|
|
1430
1441
|
**SubjectType** = `'product' | 'proof' | 'batch'`
|
|
1431
1442
|
|
|
1432
|
-
**
|
|
1443
|
+
**ConditionOperator** = ``
|
|
1444
|
+
|
|
1445
|
+
**FieldWidget** = `'text' | 'email' | 'tel' | 'select' | 'multiselect' | 'checkbox' | 'number' | 'date' | 'url'`
|
|
1433
1446
|
|
|
1434
1447
|
**FieldType** = ``
|
|
1435
1448
|
|
|
@@ -1943,6 +1956,124 @@ interface NfcClaimTagRequest {
|
|
|
1943
1956
|
}
|
|
1944
1957
|
```
|
|
1945
1958
|
|
|
1959
|
+
### order
|
|
1960
|
+
|
|
1961
|
+
**OrderItem** (interface)
|
|
1962
|
+
```typescript
|
|
1963
|
+
interface OrderItem {
|
|
1964
|
+
id: string // UUID
|
|
1965
|
+
orderId: string // Parent order ID
|
|
1966
|
+
itemType: 'tag' | 'proof' | 'serial' // Type of item
|
|
1967
|
+
itemId: string // The tag ID, proof ID, or serial number
|
|
1968
|
+
metadata: Record<string, any> // Item-specific metadata
|
|
1969
|
+
createdAt: string // ISO 8601 timestamp
|
|
1970
|
+
}
|
|
1971
|
+
```
|
|
1972
|
+
|
|
1973
|
+
**Order** (interface)
|
|
1974
|
+
```typescript
|
|
1975
|
+
interface Order {
|
|
1976
|
+
id: string // UUID
|
|
1977
|
+
orgId: string // Organization ID
|
|
1978
|
+
collectionId: string // Collection ID
|
|
1979
|
+
orderRef?: string // Customer's own order reference/ID (e.g., "ORD-12345")
|
|
1980
|
+
customerId?: string // Customer's own customer ID (can map to CRM/contacts)
|
|
1981
|
+
status: string // e.g., "pending", "processing", "shipped", "completed"
|
|
1982
|
+
itemCount: number // Cached count of items (maintained automatically)
|
|
1983
|
+
metadata: Record<string, any> // Flexible additional data
|
|
1984
|
+
items: OrderItem[] // Array of items in this order
|
|
1985
|
+
createdAt: string // ISO 8601 timestamp
|
|
1986
|
+
updatedAt: string // ISO 8601 timestamp
|
|
1987
|
+
}
|
|
1988
|
+
```
|
|
1989
|
+
|
|
1990
|
+
**CreateOrderRequest** (interface)
|
|
1991
|
+
```typescript
|
|
1992
|
+
interface CreateOrderRequest {
|
|
1993
|
+
items: Array<{
|
|
1994
|
+
itemType: 'tag' | 'proof' | 'serial' // Required: Type of item
|
|
1995
|
+
itemId: string // Required: Item identifier
|
|
1996
|
+
metadata?: Record<string, any> // Optional: Item-specific data
|
|
1997
|
+
}>
|
|
1998
|
+
orderRef?: string // Optional: Your own order reference/ID
|
|
1999
|
+
customerId?: string // Optional: Your customer ID
|
|
2000
|
+
status?: string // Optional: Order status (default: "pending")
|
|
2001
|
+
metadata?: Record<string, any> // Optional: Order-level metadata
|
|
2002
|
+
}
|
|
2003
|
+
```
|
|
2004
|
+
|
|
2005
|
+
**UpdateOrderRequest** (interface)
|
|
2006
|
+
```typescript
|
|
2007
|
+
interface UpdateOrderRequest {
|
|
2008
|
+
orderRef?: string // Optional: Update order reference
|
|
2009
|
+
customerId?: string // Optional: Update customer ID
|
|
2010
|
+
status?: string // Optional: Update status
|
|
2011
|
+
metadata?: Record<string, any> // Optional: Merge with existing metadata
|
|
2012
|
+
}
|
|
2013
|
+
```
|
|
2014
|
+
|
|
2015
|
+
**DeleteOrderResponse** (interface)
|
|
2016
|
+
```typescript
|
|
2017
|
+
interface DeleteOrderResponse {
|
|
2018
|
+
success: boolean
|
|
2019
|
+
}
|
|
2020
|
+
```
|
|
2021
|
+
|
|
2022
|
+
**ListOrdersRequest** (interface)
|
|
2023
|
+
```typescript
|
|
2024
|
+
interface ListOrdersRequest {
|
|
2025
|
+
limit?: number // Optional: Max results (default: 100)
|
|
2026
|
+
offset?: number // Optional: Pagination offset (default: 0)
|
|
2027
|
+
status?: string // Optional: Filter by status
|
|
2028
|
+
orderRef?: string // Optional: Filter by order reference
|
|
2029
|
+
customerId?: string // Optional: Filter by customer ID
|
|
2030
|
+
}
|
|
2031
|
+
```
|
|
2032
|
+
|
|
2033
|
+
**ListOrdersResponse** (interface)
|
|
2034
|
+
```typescript
|
|
2035
|
+
interface ListOrdersResponse {
|
|
2036
|
+
orders: Order[]
|
|
2037
|
+
limit: number
|
|
2038
|
+
offset: number
|
|
2039
|
+
}
|
|
2040
|
+
```
|
|
2041
|
+
|
|
2042
|
+
**AddItemsRequest** (interface)
|
|
2043
|
+
```typescript
|
|
2044
|
+
interface AddItemsRequest {
|
|
2045
|
+
items: Array<{
|
|
2046
|
+
itemType: 'tag' | 'proof' | 'serial' // Required: Type of item
|
|
2047
|
+
itemId: string // Required: Item identifier
|
|
2048
|
+
metadata?: Record<string, any> // Optional: Item-specific data
|
|
2049
|
+
}>
|
|
2050
|
+
}
|
|
2051
|
+
```
|
|
2052
|
+
|
|
2053
|
+
**RemoveItemsRequest** (interface)
|
|
2054
|
+
```typescript
|
|
2055
|
+
interface RemoveItemsRequest {
|
|
2056
|
+
itemIds: string[] // Array of OrderItem IDs to remove
|
|
2057
|
+
}
|
|
2058
|
+
```
|
|
2059
|
+
|
|
2060
|
+
**LookupOrdersRequest** (interface)
|
|
2061
|
+
```typescript
|
|
2062
|
+
interface LookupOrdersRequest {
|
|
2063
|
+
items: Array<{
|
|
2064
|
+
itemType: 'tag' | 'proof' | 'serial' // Required: Type of item
|
|
2065
|
+
itemId: string // Required: Item identifier
|
|
2066
|
+
}>
|
|
2067
|
+
}
|
|
2068
|
+
```
|
|
2069
|
+
|
|
2070
|
+
**LookupOrdersResponse** (interface)
|
|
2071
|
+
```typescript
|
|
2072
|
+
interface LookupOrdersResponse {
|
|
2073
|
+
orders: Order[] // All orders containing any of the specified items
|
|
2074
|
+
}
|
|
2075
|
+
```
|
|
2076
|
+
|
|
1946
2077
|
### product
|
|
1947
2078
|
|
|
1948
2079
|
**Product** (interface)
|
|
@@ -2108,6 +2239,164 @@ interface SegmentRecipientsResponse {
|
|
|
2108
2239
|
}
|
|
2109
2240
|
```
|
|
2110
2241
|
|
|
2242
|
+
### tags
|
|
2243
|
+
|
|
2244
|
+
**Tag** (interface)
|
|
2245
|
+
```typescript
|
|
2246
|
+
interface Tag {
|
|
2247
|
+
id: string // UUID
|
|
2248
|
+
orgId: string // Organization ID
|
|
2249
|
+
tagId: string // Unique tag identifier (globally unique)
|
|
2250
|
+
collectionId: string // Collection ID
|
|
2251
|
+
productId: string // Product ID
|
|
2252
|
+
variantId?: string | null // Optional: Variant ID
|
|
2253
|
+
batchId?: string | null // Optional: Batch ID
|
|
2254
|
+
proofId: string // Proof ID (serial number or explicit)
|
|
2255
|
+
metadata: Record<string, any> // Additional metadata (e.g., serialIndex)
|
|
2256
|
+
createdAt: string // ISO 8601 timestamp
|
|
2257
|
+
updatedAt: string // ISO 8601 timestamp
|
|
2258
|
+
}
|
|
2259
|
+
```
|
|
2260
|
+
|
|
2261
|
+
**CreateTagRequest** (interface)
|
|
2262
|
+
```typescript
|
|
2263
|
+
interface CreateTagRequest {
|
|
2264
|
+
tagId: string // Required: Unique tag identifier
|
|
2265
|
+
productId: string // Required: Product ID
|
|
2266
|
+
variantId?: string // Optional: Variant ID
|
|
2267
|
+
batchId?: string // Optional: Batch ID
|
|
2268
|
+
proofId?: string // Optional: Explicit proof ID (if omitted, auto-generates serial)
|
|
2269
|
+
useSerialNumber?: boolean // Optional: Explicitly request serial number generation
|
|
2270
|
+
metadata?: Record<string, any> // Optional: Additional metadata
|
|
2271
|
+
force?: boolean // Optional: Overwrite if tag exists in same collection (default: false)
|
|
2272
|
+
}
|
|
2273
|
+
```
|
|
2274
|
+
|
|
2275
|
+
**CreateTagsBatchRequest** (interface)
|
|
2276
|
+
```typescript
|
|
2277
|
+
interface CreateTagsBatchRequest {
|
|
2278
|
+
tags: Array<{
|
|
2279
|
+
tagId: string // Required: Unique tag identifier
|
|
2280
|
+
productId: string // Required: Product ID
|
|
2281
|
+
variantId?: string // Optional: Variant ID
|
|
2282
|
+
batchId?: string // Optional: Batch ID
|
|
2283
|
+
proofId?: string // Optional: If omitted, auto-generates serial number
|
|
2284
|
+
metadata?: Record<string, any> // Optional: Additional metadata
|
|
2285
|
+
}>
|
|
2286
|
+
force?: boolean // Optional: Overwrite existing tags in same collection (default: false)
|
|
2287
|
+
}
|
|
2288
|
+
```
|
|
2289
|
+
|
|
2290
|
+
**CreateTagsBatchResponse** (interface)
|
|
2291
|
+
```typescript
|
|
2292
|
+
interface CreateTagsBatchResponse {
|
|
2293
|
+
summary: {
|
|
2294
|
+
total: number // Total tags in request
|
|
2295
|
+
created: number // Successfully created
|
|
2296
|
+
updated: number // Successfully updated (with force=true)
|
|
2297
|
+
failed: number // Failed to create/update
|
|
2298
|
+
conflicts: number // Already exist (without force=true)
|
|
2299
|
+
}
|
|
2300
|
+
results: {
|
|
2301
|
+
created: Tag[] // Array of successfully created tags
|
|
2302
|
+
updated: Tag[] // Array of successfully updated tags
|
|
2303
|
+
failed: Array<{
|
|
2304
|
+
tagId: string
|
|
2305
|
+
reason: string // Error code (e.g., "TAG_ASSIGNED_ELSEWHERE", "CREATE_FAILED")
|
|
2306
|
+
message: string // Human-readable error message
|
|
2307
|
+
existingTag?: Tag // Existing tag if applicable
|
|
2308
|
+
}>
|
|
2309
|
+
conflicts: Array<{
|
|
2310
|
+
tagId: string
|
|
2311
|
+
reason: string // "TAG_ALREADY_ASSIGNED"
|
|
2312
|
+
message: string
|
|
2313
|
+
existingTag: Tag // The existing tag
|
|
2314
|
+
}>
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
```
|
|
2318
|
+
|
|
2319
|
+
**UpdateTagRequest** (interface)
|
|
2320
|
+
```typescript
|
|
2321
|
+
interface UpdateTagRequest {
|
|
2322
|
+
productId?: string // Optional: Update product ID
|
|
2323
|
+
variantId?: string | null // Optional: Update variant ID (null to clear)
|
|
2324
|
+
batchId?: string | null // Optional: Update batch ID (null to clear)
|
|
2325
|
+
proofId?: string // Optional: Update proof ID
|
|
2326
|
+
metadata?: Record<string, any> // Optional: Merge with existing metadata
|
|
2327
|
+
}
|
|
2328
|
+
```
|
|
2329
|
+
|
|
2330
|
+
**DeleteTagResponse** (interface)
|
|
2331
|
+
```typescript
|
|
2332
|
+
interface DeleteTagResponse {
|
|
2333
|
+
success: boolean
|
|
2334
|
+
}
|
|
2335
|
+
```
|
|
2336
|
+
|
|
2337
|
+
**ListTagsRequest** (interface)
|
|
2338
|
+
```typescript
|
|
2339
|
+
interface ListTagsRequest {
|
|
2340
|
+
limit?: number // Optional: Max results (default: 100)
|
|
2341
|
+
offset?: number // Optional: Pagination offset (default: 0)
|
|
2342
|
+
productId?: string // Optional: Filter by product ID
|
|
2343
|
+
variantId?: string // Optional: Filter by variant ID
|
|
2344
|
+
batchId?: string // Optional: Filter by batch ID
|
|
2345
|
+
}
|
|
2346
|
+
```
|
|
2347
|
+
|
|
2348
|
+
**ListTagsResponse** (interface)
|
|
2349
|
+
```typescript
|
|
2350
|
+
interface ListTagsResponse {
|
|
2351
|
+
tags: Tag[]
|
|
2352
|
+
limit: number
|
|
2353
|
+
offset: number
|
|
2354
|
+
}
|
|
2355
|
+
```
|
|
2356
|
+
|
|
2357
|
+
**PublicGetTagRequest** (interface)
|
|
2358
|
+
```typescript
|
|
2359
|
+
interface PublicGetTagRequest {
|
|
2360
|
+
embed?: string // Optional: Comma-separated values: "collection", "product", "proof"
|
|
2361
|
+
}
|
|
2362
|
+
```
|
|
2363
|
+
|
|
2364
|
+
**PublicGetTagResponse** (interface)
|
|
2365
|
+
```typescript
|
|
2366
|
+
interface PublicGetTagResponse {
|
|
2367
|
+
tag: Tag
|
|
2368
|
+
collection?: any // Included if embed contains "collection"
|
|
2369
|
+
product?: any // Included if embed contains "product"
|
|
2370
|
+
proof?: any // Included if embed contains "proof"
|
|
2371
|
+
}
|
|
2372
|
+
```
|
|
2373
|
+
|
|
2374
|
+
**PublicBatchLookupRequest** (interface)
|
|
2375
|
+
```typescript
|
|
2376
|
+
interface PublicBatchLookupRequest {
|
|
2377
|
+
tagIds: string[] // Array of tag IDs to lookup
|
|
2378
|
+
embed?: string // Optional: Comma-separated: "collection", "product", "proof"
|
|
2379
|
+
}
|
|
2380
|
+
```
|
|
2381
|
+
|
|
2382
|
+
**PublicBatchLookupResponse** (interface)
|
|
2383
|
+
```typescript
|
|
2384
|
+
interface PublicBatchLookupResponse {
|
|
2385
|
+
tags: Record<string, Tag> // Map: tagId → Tag object
|
|
2386
|
+
collections?: Record<string, any> // Map: collectionId → Collection (if embed=collection)
|
|
2387
|
+
products?: Record<string, any> // Map: productId → Product (if embed=product)
|
|
2388
|
+
proofs?: Record<string, any> // Map: proofId → Proof (if embed=proof)
|
|
2389
|
+
}
|
|
2390
|
+
```
|
|
2391
|
+
|
|
2392
|
+
**PublicBatchLookupQueryRequest** (interface)
|
|
2393
|
+
```typescript
|
|
2394
|
+
interface PublicBatchLookupQueryRequest {
|
|
2395
|
+
tagIds: string // Comma-separated tag IDs
|
|
2396
|
+
embed?: string // Optional: Comma-separated: "collection", "product", "proof"
|
|
2397
|
+
}
|
|
2398
|
+
```
|
|
2399
|
+
|
|
2111
2400
|
### template
|
|
2112
2401
|
|
|
2113
2402
|
**TemplateBase** (interface)
|
|
@@ -2847,11 +3136,14 @@ Logging: Append many communication events for a list of IDs. POST /admin/collect
|
|
|
2847
3136
|
data: ContactPatch) → `Promise<PublicUpdateMyContactResponse>`
|
|
2848
3137
|
|
|
2849
3138
|
**publicGetSchema**(collectionId: string) → `Promise<ContactSchema>`
|
|
3139
|
+
Public: Get contact update schema for a collection Fetches the public contact schema including core fields, custom fields with conditional visibility rules, and visibility/editability settings. Custom fields may include a `condition` property that specifies when the field should be displayed. Apps rendering these forms should: 1. Evaluate each field's `condition` against current form values 2. Hide fields whose conditions are not met 3. Skip validation for hidden fields (they shouldn't be required when not visible)
|
|
2850
3140
|
|
|
2851
3141
|
**erase**(collectionId: string, contactId: string, body?: any) → `Promise<ContactResponse>`
|
|
3142
|
+
Public: Get contact update schema for a collection Fetches the public contact schema including core fields, custom fields with conditional visibility rules, and visibility/editability settings. Custom fields may include a `condition` property that specifies when the field should be displayed. Apps rendering these forms should: 1. Evaluate each field's `condition` against current form values 2. Hide fields whose conditions are not met 3. Skip validation for hidden fields (they shouldn't be required when not visible)
|
|
2852
3143
|
|
|
2853
3144
|
**getUser**(collectionId: string,
|
|
2854
3145
|
userId: string,) → `Promise<UserSearchResponse>`
|
|
3146
|
+
Public: Get contact update schema for a collection Fetches the public contact schema including core fields, custom fields with conditional visibility rules, and visibility/editability settings. Custom fields may include a `condition` property that specifies when the field should be displayed. Apps rendering these forms should: 1. Evaluate each field's `condition` against current form values 2. Hide fields whose conditions are not met 3. Skip validation for hidden fields (they shouldn't be required when not visible)
|
|
2855
3147
|
|
|
2856
3148
|
### crate
|
|
2857
3149
|
|
|
@@ -3024,6 +3316,43 @@ Validate an NFC tag payload (public). POST /public/nfc/validate
|
|
|
3024
3316
|
**lookupTag**(tagId: string) → `Promise<NfcTagInfo[]>`
|
|
3025
3317
|
Lookup a tag by its ID (public). GET /public/nfc/findByTag/:tagId
|
|
3026
3318
|
|
|
3319
|
+
### order
|
|
3320
|
+
|
|
3321
|
+
**create**(collectionId: string,
|
|
3322
|
+
data: CreateOrderRequest) → `Promise<CreateOrderResponse>`
|
|
3323
|
+
Create a new order with items. ```typescript const order = await order.create('coll_123', { orderRef: 'ORD-12345', customerId: 'CUST-789', items: [ { itemType: 'tag', itemId: 'TAG001' }, { itemType: 'tag', itemId: 'TAG002' }, { itemType: 'serial', itemId: 'SN12345' } ], status: 'pending', metadata: { shipmentId: 'SHIP-789', destination: 'Warehouse B' } }) ```
|
|
3324
|
+
|
|
3325
|
+
**get**(collectionId: string,
|
|
3326
|
+
orderId: string) → `Promise<GetOrderResponse>`
|
|
3327
|
+
Get a single order by ID with all its items. ```typescript const order = await order.get('coll_123', 'order_abc123') console.log(`Order has ${order.itemCount} items`) ```
|
|
3328
|
+
|
|
3329
|
+
**update**(collectionId: string,
|
|
3330
|
+
orderId: string,
|
|
3331
|
+
data: UpdateOrderRequest) → `Promise<UpdateOrderResponse>`
|
|
3332
|
+
Update order status or metadata. Items are managed separately via addItems/removeItems. ```typescript const updated = await order.update('coll_123', 'order_abc123', { status: 'shipped', metadata: { trackingNumber: '1Z999AA10123456784', shippedAt: '2026-02-02T14:30:00Z' } }) ```
|
|
3333
|
+
|
|
3334
|
+
**remove**(collectionId: string,
|
|
3335
|
+
orderId: string) → `Promise<DeleteOrderResponse>`
|
|
3336
|
+
Delete an order and all its items (cascade delete). ```typescript await order.remove('coll_123', 'order_abc123') ```
|
|
3337
|
+
|
|
3338
|
+
**list**(collectionId: string,
|
|
3339
|
+
params?: ListOrdersRequest) → `Promise<ListOrdersResponse>`
|
|
3340
|
+
List orders for a collection with optional filters and pagination. Orders are returned in descending order by createdAt (newest first). ```typescript // List all orders const all = await order.list('coll_123') // List with filters const pending = await order.list('coll_123', { status: 'pending', limit: 50, offset: 0 }) // Filter by customer const customerOrders = await order.list('coll_123', { customerId: 'CUST-789' }) ```
|
|
3341
|
+
|
|
3342
|
+
**addItems**(collectionId: string,
|
|
3343
|
+
orderId: string,
|
|
3344
|
+
data: AddItemsRequest) → `Promise<AddItemsResponse>`
|
|
3345
|
+
Add additional items to an existing order. ```typescript const updated = await order.addItems('coll_123', 'order_abc123', { items: [ { itemType: 'tag', itemId: 'TAG003' }, { itemType: 'proof', itemId: 'proof_xyz' } ] }) console.log(`Order now has ${updated.itemCount} items`) ```
|
|
3346
|
+
|
|
3347
|
+
**removeItems**(collectionId: string,
|
|
3348
|
+
orderId: string,
|
|
3349
|
+
data: RemoveItemsRequest) → `Promise<RemoveItemsResponse>`
|
|
3350
|
+
Remove specific items from an order. ```typescript const updated = await order.removeItems('coll_123', 'order_abc123', { itemIds: ['item_001', 'item_002'] }) ```
|
|
3351
|
+
|
|
3352
|
+
**lookup**(collectionId: string,
|
|
3353
|
+
data: LookupOrdersRequest) → `Promise<LookupOrdersResponse>`
|
|
3354
|
+
Find all orders containing specific items (tags, proofs, or serial numbers). Use case: Scan a tag and immediately see if it's part of any order. ```typescript // Scan a tag and find associated orders const result = await order.lookup('coll_123', { items: [ { itemType: 'tag', itemId: 'TAG001' } ] }) if (result.orders.length > 0) { console.log(`Tag is part of ${result.orders.length} order(s)`) result.orders.forEach(ord => { console.log(`Order ${ord.orderRef}: ${ord.status}`) }) } // Batch lookup multiple items const batchResult = await order.lookup('coll_123', { items: [ { itemType: 'tag', itemId: 'TAG001' }, { itemType: 'serial', itemId: 'SN12345' }, { itemType: 'proof', itemId: 'proof_xyz' } ] }) ```
|
|
3355
|
+
|
|
3027
3356
|
### product
|
|
3028
3357
|
|
|
3029
3358
|
**get**(collectionId: string,
|
|
@@ -3150,6 +3479,43 @@ Get an Ably token for admin real-time communication. This endpoint returns an Ab
|
|
|
3150
3479
|
id: string,
|
|
3151
3480
|
query: { limit?: number; offset?: number } = {}) → `Promise<SegmentRecipientsResponse>`
|
|
3152
3481
|
|
|
3482
|
+
### tags
|
|
3483
|
+
|
|
3484
|
+
**create**(collectionId: string,
|
|
3485
|
+
data: CreateTagRequest) → `Promise<CreateTagResponse>`
|
|
3486
|
+
Create a single tag mapping. If proofId is not provided, automatically generates a serial number. ```typescript // Auto-generate serial number const tag = await tags.create('coll_123', { tagId: 'TAG001', productId: 'prod_456', variantId: 'var_789' }) // Use explicit proof ID const tag2 = await tags.create('coll_123', { tagId: 'TAG002', productId: 'prod_456', proofId: 'proof_explicit_123' }) ```
|
|
3487
|
+
|
|
3488
|
+
**createBatch**(collectionId: string,
|
|
3489
|
+
data: CreateTagsBatchRequest) → `Promise<CreateTagsBatchResponse>`
|
|
3490
|
+
Create multiple tag mappings efficiently in a batch operation. By default, auto-generates serial numbers for all tags without explicit proofId. Tags are grouped by product/variant/batch and serial numbers are generated in a single transaction per group for optimal performance. ```typescript const result = await tags.createBatch('coll_123', { tags: [ { tagId: 'TAG001', productId: 'prod_456', variantId: 'var_789' }, { tagId: 'TAG002', productId: 'prod_456', variantId: 'var_789' }, { tagId: 'TAG003', productId: 'prod_456', batchId: 'batch_100' } ] }) console.log(`Created: ${result.summary.created}, Failed: ${result.summary.failed}`) ```
|
|
3491
|
+
|
|
3492
|
+
**update**(collectionId: string,
|
|
3493
|
+
tagId: string,
|
|
3494
|
+
data: UpdateTagRequest) → `Promise<UpdateTagResponse>`
|
|
3495
|
+
Update an existing tag mapping. ```typescript const updated = await tags.update('coll_123', 'TAG001', { variantId: 'var_999', metadata: { notes: 'Updated variant' } }) ```
|
|
3496
|
+
|
|
3497
|
+
**remove**(collectionId: string,
|
|
3498
|
+
tagId: string) → `Promise<DeleteTagResponse>`
|
|
3499
|
+
Delete a tag mapping. ```typescript await tags.remove('coll_123', 'TAG001') ```
|
|
3500
|
+
|
|
3501
|
+
**get**(collectionId: string,
|
|
3502
|
+
tagId: string) → `Promise<GetTagResponse>`
|
|
3503
|
+
Get a single tag mapping by tagId. ```typescript const tag = await tags.get('coll_123', 'TAG001') ```
|
|
3504
|
+
|
|
3505
|
+
**list**(collectionId: string,
|
|
3506
|
+
params?: ListTagsRequest) → `Promise<ListTagsResponse>`
|
|
3507
|
+
List all tags for a collection with optional filters and pagination. ```typescript // List all tags const all = await tags.list('coll_123') // List with filters const filtered = await tags.list('coll_123', { productId: 'prod_456', variantId: 'var_789', limit: 50, offset: 0 }) ```
|
|
3508
|
+
|
|
3509
|
+
**publicGet**(tagId: string,
|
|
3510
|
+
params?: PublicGetTagRequest) → `Promise<PublicGetTagResponse>`
|
|
3511
|
+
Public lookup of a single tag by tagId. Optionally embed related collection, product, or proof data. No authentication required. ```typescript // Simple lookup const result = await tags.publicGet('TAG001') // With embedded data const withData = await tags.publicGet('TAG001', { embed: 'collection,product,proof' }) console.log(withData.tag, withData.collection, withData.product, withData.proof) ```
|
|
3512
|
+
|
|
3513
|
+
**publicBatchLookup**(data: PublicBatchLookupRequest) → `Promise<PublicBatchLookupResponse>`
|
|
3514
|
+
Public batch lookup of multiple tags in a single request (POST). Optionally embed related data. Related data is deduplicated and batch-fetched. No authentication required. ```typescript const result = await tags.publicBatchLookup({ tagIds: ['TAG001', 'TAG002', 'TAG003'], embed: 'collection,product' }) // Access tags and deduplicated collections/products console.log(result.tags['TAG001']) console.log(result.collections) console.log(result.products) ```
|
|
3515
|
+
|
|
3516
|
+
**publicBatchLookupQuery**(params: PublicBatchLookupQueryRequest) → `Promise<PublicBatchLookupQueryResponse>`
|
|
3517
|
+
Public batch lookup of multiple tags using query parameters (GET). Alternative to publicBatchLookup for simple GET requests. No authentication required. ```typescript const result = await tags.publicBatchLookupQuery({ tagIds: 'TAG001,TAG002,TAG003', embed: 'collection' }) ```
|
|
3518
|
+
|
|
3153
3519
|
### template
|
|
3154
3520
|
|
|
3155
3521
|
**getAll**(collectionId: string) → `Promise<Template[]>`
|