@lexriver/yandex-pay
Version:
A TypeScript client for Yandex Pay API to integrate payment processing in your Node.js applications
52 lines (51 loc) • 1.34 kB
TypeScript
/**
* Base service class for making API requests
*/
export declare abstract class BaseService {
/**
* Base URL for API requests
*/
protected readonly baseUrl: string;
/**
* API key for authentication
*/
protected readonly apiKey: string;
/**
* Creates a new BaseService instance
*
* @param baseUrl Base URL for API requests
* @param apiKey API key for authentication
*/
constructor(baseUrl: string, apiKey: string);
/**
* Makes a GET request to the API
*
* @param path API path
* @param params Query parameters
* @returns Response data
*/
protected get<T>(path: string, params?: Record<string, string>): Promise<T>;
/**
* Makes a POST request to the API
*
* @param path API path
* @param data Request body
* @returns Response data
*/
protected post<T>(path: string, data: Record<string, any>): Promise<T>;
/**
* Gets the headers for API requests
*/
protected getHeaders(): Record<string, string>;
/**
* Generates a request ID
*/
protected generateRequestId(): string;
/**
* Handles the API response
*
* @param response Fetch Response
* @returns Response data
*/
protected handleResponse<T>(response: Response): Promise<T>;
}