bc-node-sdk
Version:
BetterCommerce's NodeJS SDK encapsulates the base framework for all the Next.js applications.
15 lines (14 loc) • 771 B
TypeScript
import IApiParams from "./IApiParams";
/**
* Interface {@link IApiRequestHandler} encapsulates the abstract behavior for handling API requests.
*/
export default interface IApiRequestHandler {
/**
* Handles API requests by delegating them to the appropriate HTTP method handler.
*
* @param {IApiParams} request - The IApiParams object containing request details such as endpoint, data, params, headers, and cookies.
* @param {string} method - The HTTP request method as a string (e.g., GET, POST, PUT, DELETE, PATCH).
* @returns {Promise<any>} A Promise that resolves to the result of the API call or a JSON response indicating the method is not allowed.
*/
handleRequest(request: IApiParams, method: string): any;
}