fmp-node-api
Version:
A comprehensive Node.js wrapper for Financial Modeling Prep API
89 lines (86 loc) • 2.98 kB
TypeScript
import { A as APIResponse } from '../common-COsxpVBY.js';
/**
* Validation utilities for FMP API parameters and responses
*/
declare class FMPValidation {
/**
* Validate stock symbol format
* @param symbol - The symbol to validate
* @returns True if the symbol format is valid
*/
static isValidSymbol(symbol: string): boolean;
/**
* Validate crypto symbol format
* @param symbol - The crypto symbol to validate
* @returns True if the crypto symbol format is valid
*/
static isValidCryptoSymbol(symbol: string): boolean;
/**
* Validate forex pair format
* @param symbol - The forex pair to validate
* @returns True if the forex pair format is valid
*/
static isValidForexPair(symbol: string): boolean;
/**
* Validate date format (YYYY-MM-DD)
* @param date - The date string to validate
* @returns True if the date format is valid
*/
static isValidDate(date: string): boolean;
/**
* Validate date range
* @param from - Start date
* @param to - End date
* @returns True if the date range is valid
*/
static isValidDateRange(from: string, to: string): boolean;
/**
* Validate API response structure
* @param response - The response to validate
* @returns True if the response has the expected structure
*/
static isValidResponse(response: any): response is APIResponse<any>;
/**
* Validate API key format
* @param apiKey - The API key to validate
* @returns True if the API key format is valid
*/
static isValidApiKey(apiKey: string): boolean;
/**
* Validate period parameter
* @param period - The period to validate
* @returns True if the period is valid
*/
static isValidPeriod(period: string): boolean;
/**
* Validate limit parameter
* @param limit - The limit to validate
* @returns True if the limit is valid
*/
static isValidLimit(limit: number): boolean;
/**
* Get validation errors for quote parameters
* @param params - The parameters to validate
* @returns Array of validation error messages
*/
static validateQuoteParams(params: any): string[];
/**
* Get validation errors for financial statement parameters
* @param params - The parameters to validate
* @returns Array of validation error messages
*/
static validateFinancialParams(params: any): string[];
/**
* Get validation errors for date range parameters
* @param params - The parameters to validate
* @returns Array of validation error messages
*/
static validateDateRangeParams(params: any): string[];
/**
* Validate and throw error if validation fails
* @param errors - Array of validation errors
* @param context - Context for the error message
*/
static throwIfInvalid(errors: string[], context?: string): void;
}
export { FMPValidation };