UNPKG

@tuanltntu/n8n-nodes-bitrix24

Version:

Comprehensive n8n community node for Bitrix24 API integration with CRM, Tasks, Chat, Telephony, and more

51 lines (50 loc) 2.29 kB
import { IExecuteFunctions, IDataObject, INodeExecutionData } from "n8n-workflow"; import { IResourceHandlerOptions } from "./ResourceHandlerFactory"; /** * Base class for all Bitrix24 resource handlers * Defines the common structure and methods for handling different Bitrix24 resources */ export declare abstract class ResourceHandlerBase { protected readonly executeFunctions: IExecuteFunctions; protected readonly returnData: INodeExecutionData[]; protected readonly items: INodeExecutionData[]; protected readonly options: IResourceHandlerOptions; protected isDebugMode: boolean; constructor(executeFunctions: IExecuteFunctions, returnData: INodeExecutionData[], options?: IResourceHandlerOptions); /** * Process the operations for this resource * Each resource handler should implement this method to handle its specific operations */ abstract process(): Promise<INodeExecutionData[]>; /** * Make a standardized API call to Bitrix24 * This encapsulates the standard way to call Bitrix24 API */ protected makeApiCall(endpoint: string, body?: IDataObject, queryParams?: IDataObject, itemIndex?: number, getAllItems?: boolean): Promise<any>; /** * Process and add API response to the return data */ protected addResponseToReturnData(responseData: any, itemIndex: number): void; /** * Add error details to return data for failed items */ protected addErrorToReturnData(error: Error, itemIndex: number): void; /** * Check if execution should continue on error */ protected continueOnFail(): boolean; /** * Get a parameter value for the current operation */ protected getNodeParameter(parameterName: string, itemIndex: number, fallback?: any): any; /** * Get options with access token handling * This provides a consistent way to get options that might include an accessToken * Handles multiple option fields (options, taskOptions, instanceOptions, etc.) */ protected getOptionsWithAccessToken(itemIndex: number, defaultOptions?: IDataObject): IDataObject; /** * Parse JSON parameters safely */ protected parseJsonParameter(json: string, errorMessage: string, itemIndex: number): IDataObject; }