spreadapi-wrapper
v0.0.1
Published
A wrapper for the Spread API
Maintainers
Readme
spreadapi-wrapper
A lightweight TypeScript/JavaScript wrapper for the Spread API, designed to simplify integration with Google Sheets or similar spreadsheet APIs.
Features
- Type-safe batch requests for reading and writing rows
- Simple configuration and usage
- Supports custom ordering, pagination, and limits
Installation
npm install spreadapi-wrapperUsage
import { SpreadClient } from 'spreadapi-wrapper';
const client = new SpreadClient({
sheetUrl: 'https://api.spreadapi.com/sheet-url',
sheetName: 'Sheet1',
accessKey: 'your-access-key',
});
// Insert rows
await client.insertRows([
{ name: 'Alice', age: 30 },
{ name: 'Bob', age: 25 },
]);
// Get a single row by ID
const row = await client.getRow(1);
// Get multiple rows with options
const rows = await client.getRows({
order: 'DESC',
start_id: 10,
limit: 5,
});API
SpreadClient(config)
sheetUrl: string – The API endpoint URL for your sheetsheetName: string – The name of the sheet to operate onaccessKey: string – Your Spread API access key
Methods
insertRows<T>(payloads: T[]): Promise<SpreadApiBatchResponse<T>>– Insert multiple rowsgetRow<T>(id: number): Promise<SpreadApiBatchResponse<T>>– Get a single row by IDgetRows<T>(options?): Promise<SpreadApiBatchResponse<T>>– Get multiple rows with optionalorder,start_id, andlimit
Development
- Build:
npm run build - Test:
npm test
License
MIT
