SDK Reference
@proveanything/smartlinks
Namespaces
batch
Group products into batches; manage serial number ranges and lookups.
get
Get a single batch by ID for a collection and product (admin only).
get(collectionId: string,
productId: string,
batchId: string) → Promise<>list
List all batches for a collection and product (admin only).
list(collectionId: string,
productId: string) → Promise<[]>create
Create a new batch for a collection and product (admin only).
create(collectionId: string,
productId: string,
data: ) → Promise<>update
Update a batch for a collection and product (admin only).
update(collectionId: string,
productId: string,
batchId: string,
data: ) → Promise<>remove
Delete a batch for a collection and product (admin only).
remove(collectionId: string,
productId: string,
batchId: string) → Promise<void>getPublic
Get a single batch by ID for a collection and product (public endpoint).
getPublic(collectionId: string,
productId: string,
batchId: string) → Promise<>getSN
Get serial numbers for a batch (admin only).
getSN(collectionId: string,
productId: string,
batchId: string,
startIndex: number = 0,
count: number = 10) → Promise<any>lookupSN
Look up a serial number by code for a batch (admin only).
lookupSN(collectionId: string,
productId: string,
batchId: string,
codeId: string) → Promise<any>searchInCollection
Search for batches across all products in a collection. Allows searching by batch ID or name, with optional product filtering. typescript // Search for batches containing "2024" const batches = await batch.searchInCollection('coll_123', { search: 'BATCH-2024', limit: 50 }) // Filter batches for a specific product const productBatches = await batch.searchInCollection('coll_123', { productId: 'prod_abc', limit: 100 }) // Get all batches in collection const allBatches = await batch.searchInCollection('coll_123') // Check for expired batches batches.forEach(batch => { if (batch.expiryDate?.seconds) { const expiryDate = new Date(batch.expiryDate.seconds * 1000) if (expiryDate < new Date()) { console.log(`Batch ${batch.id} is expired`) } } })
searchInCollection(collectionId: string,
params?: ) → Promise<[]>findInCollection
Find a specific batch by ID across all products in a collection. Returns the batch along with the productId it belongs to. typescript // Find which product contains a specific batch const batch = await batch.findInCollection('coll_123', 'BATCH-2024-001') console.log(`Batch found in product: ${batch.productId}`) console.log(`Expires: ${batch.expiryDate}`)
findInCollection(collectionId: string,
batchId: string) → Promise<>getBatchTags
Get all tags/codes assigned to a specific batch. Shows which claim set codes have been assigned to this batch. typescript // Get all tags assigned to a batch const tags = await batch.getBatchTags('coll_123', 'BATCH-2024-001') console.log(`Batch has ${tags.length} tags assigned`) tags.forEach(tag => { console.log(`Code: ${tag.code}, ClaimSet: ${tag.claimSetId}, TagID: ${tag.tagId}`) }) // Get tags from a specific claim set const claimSetTags = await batch.getBatchTags('coll_123', 'BATCH-2024-001', '000001')
getBatchTags(collectionId: string,
batchId: string,
claimSetId?: string) → Promise<[]>