@gooddata/gooddata-js
Version:
GoodData JavaScript SDK
69 lines (68 loc) • 2.2 kB
TypeScript
import { ApiResponse } from "./xhr";
/**
* Utility methods. Mostly private
*
* @module util
* @class util
*
*/
/**
* Gooddata-js package signature
* @private
*/
export declare const thisPackage: {
name: string;
version: string;
};
/**
* Create getter function for accessing nested objects
*
* @param {String} path Target path to nested object
* @method getIn
* @private
*/
export declare const getIn: (path: string) => (object: any) => any;
export interface IPollingOptions {
attempts?: number;
maxAttempts?: number;
pollStep?: number;
}
/**
* Helper for polling
*
* @param xhrRequest xhr module
* @param {String} uri
* @param {Function} isPollingDone
* @param {Object} options for polling (maxAttempts, pollStep)
* @private
*/
export declare const handlePolling: (xhrRequest: any, uri: string, isPollingDone: (response: any) => boolean, options?: IPollingOptions) => any;
/**
* Helper for polling with header status
*
* @param xhrRequest xhr module
* @param {String} uri
* @param {Function} isPollingDone
* @param {Object} options for polling (maxAttempts, pollStep)
* @private
*/
export declare const handleHeadPolling: (xhrRequest: any, uri: string, isPollingDone: (responseHeaders: Response, response: ApiResponse) => boolean, options?: IPollingOptions) => any;
/**
* Builds query string from plain object
* (Refactored from admin/routes.js)
*
* @param {Object} query parameters possibly including arrays inside
* @returns {string} querystring
*/
export declare function queryString(query: any): string;
/**
* Get all results from paged api by traversing all resulting pages
* This is usable for apis which support offset and limit (i.e. not those with next paging links)
*
* @param xhrGet xhr module
* @param {string} uri uri to be fetched, will append offset and limit for next pages
* @param {string} itemKey key under which to look for results (differs for different apis)
* @param {number} optional offset starting offset, default 0
* @param pagesData optional data to be pre-filled
*/
export declare function getAllPagesByOffsetLimit(xhr: any, uri: string, itemKey: string, offset?: number, pagesData?: any[]): Promise<{}>;