@proveanything/smartlinks
Version:
Official JavaScript/TypeScript SDK for the Smartlinks API
79 lines (78 loc) • 4.17 kB
TypeScript
import { BatchResponse, BatchCreateRequest, BatchUpdateRequest } from "../types/batch";
export declare namespace batch {
/**
* Get a single batch by ID for a collection and product (admin only).
* @param collectionId - Identifier of the parent collection
* @param productId - Identifier of the parent product
* @param batchId - Identifier of the batch
* @returns Promise resolving to a BatchResponse object
* @throws ErrorResponse if the request fails
*/
function get(collectionId: string, productId: string, batchId: string): Promise<BatchResponse>;
/**
* List all batches for a collection and product (admin only).
* @param collectionId - Identifier of the parent collection
* @param productId - Identifier of the parent product
* @returns Promise resolving to an array of BatchResponse objects
* @throws ErrorResponse if the request fails
*/
function list(collectionId: string, productId: string): Promise<BatchResponse[]>;
/**
* Create a new batch for a collection and product (admin only).
* @param collectionId - Identifier of the parent collection
* @param productId - Identifier of the parent product
* @param data - Batch creation data
* @returns Promise resolving to a BatchResponse object
* @throws ErrorResponse if the request fails
*/
function create(collectionId: string, productId: string, data: BatchCreateRequest): Promise<BatchResponse>;
/**
* Update a batch for a collection and product (admin only).
* @param collectionId - Identifier of the parent collection
* @param productId - Identifier of the parent product
* @param batchId - Identifier of the batch
* @param data - Batch update data
* @returns Promise resolving to a BatchResponse object
* @throws ErrorResponse if the request fails
*/
function update(collectionId: string, productId: string, batchId: string, data: BatchUpdateRequest): Promise<BatchResponse>;
/**
* Delete a batch for a collection and product (admin only).
* @param collectionId - Identifier of the parent collection
* @param productId - Identifier of the parent product
* @param batchId - Identifier of the batch
* @returns Promise resolving to void
* @throws ErrorResponse if the request fails
*/
function remove(collectionId: string, productId: string, batchId: string): Promise<void>;
/**
* Get a single batch by ID for a collection and product (public endpoint).
* @param collectionId - Identifier of the parent collection
* @param productId - Identifier of the parent product
* @param batchId - Identifier of the batch
* @returns Promise resolving to a BatchResponse object
* @throws ErrorResponse if the request fails
*/
function getPublic(collectionId: string, productId: string, batchId: string): Promise<BatchResponse>;
/**
* Get serial numbers for a batch (admin only).
* @param collectionId - Identifier of the parent collection
* @param productId - Identifier of the parent product
* @param batchId - Identifier of the batch
* @param startIndex - Starting index for pagination (default: 0)
* @param count - Number of serial numbers to retrieve (default: 10)
* @returns Promise resolving to serial number data
* @throws ErrorResponse if the request fails
*/
function getSN(collectionId: string, productId: string, batchId: string, startIndex?: number, count?: number): Promise<any>;
/**
* Look up a serial number by code for a batch (admin only).
* @param collectionId - Identifier of the parent collection
* @param productId - Identifier of the parent product
* @param batchId - Identifier of the batch
* @param codeId - The serial number code to look up
* @returns Promise resolving to serial number lookup data
* @throws ErrorResponse if the request fails
*/
function lookupSN(collectionId: string, productId: string, batchId: string, codeId: string): Promise<any>;
}