UNPKG

@gsb-core/core

Version:

GSB core services and classes for platform-independent web applications

62 lines (61 loc) 1.6 kB
/** * GSB API Service */ import { HttpCallRequest } from '../types/requests'; export declare class GsbApiService { private pendingBulkCalls; private bulkCallCounter; constructor(); /** * Get the singleton instance of the service */ static getInstance(): GsbApiService; private getBaseUrl; /** * Extract tenant code from a JWT token * @param token The JWT token * @returns The tenant code or undefined */ private extractTenantCode; /** * Generate a unique request ID for bulk operations */ private generateReqId; /** * Get the bulk batch key for grouping requests */ private getBulkBatchKey; /** * Ensure request has a unique ID for bulk operations */ private ensureRequestId; /** * Execute a bulk batch */ private executeBulkBatch; /** * Add a call to the bulk batch */ private addToBulkBatch; /** * Make an HTTP call */ httpCall(dto: any, callback?: (response: any) => void, errorCallback?: (error: any) => void): Promise<any>; /** * Execute HTTP call asynchronously */ httpCallAsync(dto: any): Promise<any>; /** * Convert request parameters to fetch request data */ convertToRequestData(requestParameters: any): { url: string; init: RequestInit; }; /** * Call the API with the appropriate token and tenant code */ callApi(req: HttpCallRequest & { useBulk?: boolean; }, endPoint: string, token?: string, tenantCode?: string): Promise<any>; }