UNPKG

@startbutton/node-sdk

Version:
89 lines 2.39 kB
import { SDKConfig, RequestOptions, ApiResponse } from './types'; /** * Custom error classes for the SDK */ export declare class StartButtonError extends Error { status?: number; code?: string; errors?: string[]; constructor(message: string, status?: number, code?: string, errors?: string[]); } export declare class AuthenticationError extends StartButtonError { constructor(message?: string); } export declare class ValidationError extends StartButtonError { constructor(message: string, errors?: string[]); } export declare class RateLimitError extends StartButtonError { constructor(message?: string); } export declare class ServerError extends StartButtonError { constructor(message?: string); } /** * HTTP Client for the StartButton SDK */ export declare class HttpClient { private config; private axiosInstance; private retryAttempts; private retryDelay; constructor(config: SDKConfig); /** * Create and configure the Axios instance */ private createAxiosInstance; /** * Get default headers including SDK identification */ private getDefaultHeaders; /** * Setup request and response interceptors */ private setupInterceptors; /** * Generate a unique request ID */ private generateRequestId; /** * Handle response errors and convert to SDK errors */ private handleResponseError; /** * Make an HTTP request with retry logic */ request<T>(options: RequestOptions): Promise<ApiResponse<T>>; /** * Build headers with optional public key override */ private buildHeaders; /** * Execute request with retry logic */ private executeWithRetry; /** * Determine if request should be retried */ private shouldRetry; /** * Calculate retry delay with exponential backoff */ private getRetryDelay; /** * Delay execution for retry */ private delay; /** * Format the API response */ private formatResponse; /** * Set retry configuration */ setRetryConfig(attempts: number, delay: number): void; /** * Get the current configuration */ getConfig(): SDKConfig; } //# sourceMappingURL=http-client.d.ts.map