JSPM

  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q69956F
  • License MIT

Vector Backend SDK for interacting with the Vector API

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@playbookmedia/backend-client-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Vector TypeScript Client SDK

    npm package Build Status Downloads Issues Code Coverage Semantic Release

    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-sdk

    Quick 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 1
    • client.method2(): Description of method 2
    • More methods documented in our API Reference

    Development

    Prerequisites

    • Node.js >= 12.0
    • npm or yarn

    Setup

    1. Clone the repository:

      git clone https://github.com/VectorEngineering/quills-protobuf-definitions.git
      cd quills-protobuf-definitions/sdk/client/client-typescript-sdk
    2. Install dependencies:

      npm install

    Available Scripts

    • npm run build - Builds the package using TypeScript
    • npm run clean - Removes build artifacts
    • npm run test - Runs tests with Jest
    • npm run lint - Lints code using ESLint
    • npm run format - Formats code using Prettier
    • npm run typecheck - Runs TypeScript type checking
    • npm 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:coverage

    Contributing

    We welcome contributions! Please follow these steps:

    1. Fork the repository
    2. Create your feature branch: git checkout -b feature/amazing-feature
    3. Commit your changes: npm run cm (uses Commitizen)
    4. Push to the branch: git push origin feature/amazing-feature
    5. Open a Pull Request

    Support

    License

    MIT © [Vector Engineering]