kohin-js
Version:
The Kohin JS is a comprehensive developer toolkit designed to integrate Kohin's decentralized insurance system seamlessly into your applications. It enables efficient interaction with Kohin smart contracts and backend APIs, facilitating management and ana
40 lines (39 loc) • 1.78 kB
TypeScript
import { ResponseData } from "../config/commonResponse";
import { BaseApi } from "./BaseApi";
export declare class ApiCall extends BaseApi {
private responseFunction;
/**
* GET method to fetch data from an API endpoint.
* @param endpoint - API endpoint to make the request.
* @param params - Query parameters to include in the request (optional).
* @returns A promise resolving to the API response.
*/
getData<T>(endpoint: string, params?: Record<string, any>): Promise<ResponseData<T>>;
/**
* POST method to send data to an API endpoint.
* @param endpoint - API endpoint to make the request.
* @param data - Payload to send in the request body (optional).
* @param params - Query parameters to include in the request (optional).
* @returns A promise resolving to the API response.
*/
postData<T>(endpoint: string, data?: Record<string, any>, params?: Record<string, any>): Promise<ResponseData<T>>;
/**
* PUT method to update data on an API endpoint.
* @param endpoint - API endpoint to make the request.
* @param data - Payload to send in the request body (optional).
* @returns A promise resolving to the API response.
*/
putData<T>(endpoint: string, data?: Record<string, any>): Promise<ResponseData<T>>;
/**
* DELETE method to remove data from an API endpoint.
* @param endpoint - API endpoint to make the request.
* @returns A promise resolving to the API response.
*/
deleteData<T>(endpoint: string): Promise<ResponseData<T>>;
/**
* Custom error handling method to format errors.
* @param error - Axios error object containing details of the error.
* @returns A formatted error object.
*/
private handleError;
}