@playbookmedia/backend-client-sdk
v1.26.2-patch-3
Published
Vector Backend SDK for interacting with the Vector API
Maintainers
Readme
Vector TypeScript Client SDK
Official TypeScript SDK for Vector's Backend Services
Overview
This package provides a modern, type-safe TypeScript client for interacting with Vector's backend services. Built with TypeScript and following best practices, it offers a seamless integration experience with comprehensive type definitions and Promise-based APIs.
Features
- 🔒 Type Safety: Full TypeScript support with comprehensive type definitions
- 🚀 Modern Architecture: Promise-based API with async/await support
- 🛡️ Error Handling: Built-in error handling and retry mechanisms
- 📦 Zero Dependencies: Minimal production dependencies
- 🔄 Automatic Retries: Smart retry logic for failed requests
- 📚 Rich Documentation: Extensive documentation and examples
- ✨ IDE Support: Great IDE integration with TypeScript
Installation
# Using npm
npm install @playbookmedia/backend-typescript-sdk
# Using yarn
yarn add @playbookmedia/backend-typescript-sdk
# Using pnpm
pnpm add @playbookmedia/backend-typescript-sdkQuick Start
import { VectorClient } from '@playbookmedia/backend-typescript-sdk';
// Initialize the client
const client = new VectorClient({
apiKey: 'your-api-key',
environment: 'production' // or 'staging'
});
// Example: Using the client
async function example() {
try {
// Make API calls
const response = await client.someEndpoint({
// request parameters
});
console.log('Response:', response);
} catch (error) {
if (error instanceof VectorAPIError) {
console.error('API Error:', error.message);
console.error('Status:', error.status);
console.error('Code:', error.code);
} else {
console.error('Unexpected error:', error);
}
}
}API Reference
Client Configuration
interface VectorClientConfig {
apiKey: string;
environment?: 'production' | 'staging';
timeout?: number;
retryConfig?: {
maxRetries: number;
initialDelayMs: number;
};
}Available Methods
client.method1(): Description of method 1client.method2(): Description of method 2- More methods documented in our API Reference
Development
Prerequisites
- Node.js >= 12.0
- npm or yarn
Setup
Clone the repository:
git clone https://github.com/VectorEngineering/thinkthank-backend.git cd thinkthank-backend/sdk/client/client-typescript-sdkInstall dependencies:
npm install
Available Scripts
npm run build- Builds the package using TypeScriptnpm run clean- Removes build artifactsnpm run test- Runs tests with Jestnpm run lint- Lints code using ESLintnpm run format- Formats code using Prettiernpm run typecheck- Runs TypeScript type checkingnpm run semantic-release- Handles semantic versioning and releases
Testing
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverageContributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
npm run cm(uses Commitizen) - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
Support
- 📧 Email: [email protected]
- 📚 Documentation: docs.vector.engineering
- 🐛 Issue Tracker: GitHub Issues
License
MIT © [Vector Engineering]
