generated from coulomb/repo-seed
Add convenience helpers and improve documentation
- Add isInProduction() helper for checking status 3 or 4 - Add getErrorSummary() helper for extracting error messages - Add fetchAllPages() pagination helper for auto-pagination - Add comprehensive JSDoc to ListResponse interface - Create ADR-001 documenting decision not to add listAll() method Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
25
src/types.ts
25
src/types.ts
@@ -313,12 +313,35 @@ export interface Document {
|
||||
}
|
||||
|
||||
/**
|
||||
* List response wrapper
|
||||
* Response structure for paginated list operations.
|
||||
*
|
||||
* @remarks
|
||||
* The actual data is in the `items` array, not `data` or `results`.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const response = await client.documents.list();
|
||||
*
|
||||
* // Access the documents array via `items`
|
||||
* for (const doc of response.items) {
|
||||
* console.log(doc.filename, doc.status.text);
|
||||
* }
|
||||
*
|
||||
* // Pagination information
|
||||
* console.log(`Showing ${response.items.length} of ${response.total} documents`);
|
||||
*
|
||||
* // Check if more pages exist
|
||||
* const hasMore = response.offset + response.items.length < response.total;
|
||||
* ```
|
||||
*/
|
||||
export interface ListResponse<T> {
|
||||
/** Array of items returned by the query */
|
||||
items: T[];
|
||||
/** Total number of items matching the query (across all pages) */
|
||||
total: number;
|
||||
/** Maximum number of items per page */
|
||||
limit: number;
|
||||
/** Number of items skipped (for pagination) */
|
||||
offset: number;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user