@gooddata/gooddata-js
Version:
GoodData JavaScript SDK
115 lines (114 loc) • 5.51 kB
TypeScript
import { Execution, AFM } from "@gooddata/typings";
import { XhrModule, ApiResponseError } from "../xhr";
export declare const DEFAULT_LIMIT = 1000;
/**
* This interface represents input for executeVisualization API endpoint.
*
* NOTE: all functionality related to executeVisualization is experimental and subject to possible breaking changes
* in the future; location and shape of this interface WILL change when the functionality is made GA.
*
* @private
* @internal
*/
export interface IVisualizationExecution {
visualizationExecution: {
reference: string;
resultSpec?: AFM.IResultSpec;
filters?: AFM.CompatibilityFilter[];
};
}
/**
* This interface represents error caused during second part of api execution (data fetching)
* and contains information about first execution part if that part was successful.
*/
export declare class ApiExecutionResponseError extends ApiResponseError {
executionResponse: any;
constructor(error: ApiResponseError, executionResponse: any);
}
export declare class ExecuteAfmModule {
private xhr;
constructor(xhr: XhrModule);
/**
* Execute AFM and fetch all data results
*
* @method executeAfm
* @param {String} projectId - GD project identifier
* @param {AFM.IExecution} execution - See https://github.com/gooddata/gooddata-typings/blob/v2.1.0/src/AFM.ts#L2
*
* @returns {Promise<Execution.IExecutionResponses>} Structure with `executionResponse` and `executionResult` -
* See https://github.com/gooddata/gooddata-typings/blob/v2.1.0/src/Execution.ts#L113
*/
executeAfm(projectId: string, execution: AFM.IExecution): Promise<Execution.IExecutionResponses>;
/**
* Execute AFM and return execution's response; the response describes dimensionality of the results and
* includes link to poll for the results.
*
* @method getExecutionResponse
* @param {string} projectId - GD project identifier
* @param {AFM.IExecution} execution - See https://github.com/gooddata/gooddata-typings/blob/v2.1.0/src/AFM.ts#L2
*
* @returns {Promise<Execution.IExecutionResponse>} Promise with `executionResponse`
* See https://github.com/gooddata/gooddata-typings/blob/v2.1.0/src/Execution.ts#L69
*/
getExecutionResponse(projectId: string, execution: AFM.IExecution): Promise<Execution.IExecutionResponse>;
/**
* Execute saved visualization and get all data.
*
* NOTE: all functionality related to executeVisualization is experimental and subject to possible breaking changes
* in the future; location and shape of this interface WILL change when the functionality is made GA.
*
* @param {string} projectId - GD project identifier
* @param {IVisualizationExecution} visExecution - execution payload
*
* @private
* @internal
*/
_executeVisualization(projectId: string, visExecution: IVisualizationExecution): Promise<Execution.IExecutionResponses>;
/**
*
* Execute visualization and return the response; the response describes dimensionality of the results and
* includes link to poll for the results.
*
* NOTE: all functionality related to executeVisualization is experimental and subject to possible breaking changes
* in the future; location and shape of this interface WILL change when the functionality is made GA.
*
* @param {string} projectId - GD project identifier
* @param {IVisualizationExecution} visExecution - execution payload
*
* @private
* @internal
*/
_getVisExecutionResponse(projectId: string, visExecution: IVisualizationExecution): Promise<Execution.IExecutionResponse>;
/**
* Get one page of Result from Execution (with requested limit and offset)
*
* @method getPartialExecutionResult
* @param {string} executionResultUri
* @param {number[]} limit - limit for each dimension
* @param {number[]} offset - offset for each dimension
*
* @returns {Promise<Execution.IExecutionResult | null>}
* Promise with `executionResult` or `null` (null means empty response - HTTP 204)
* See https://github.com/gooddata/gooddata-typings/blob/v2.1.0/src/Execution.ts#L88
*/
getPartialExecutionResult(executionResultUri: string, limit: number[], offset: number[]): Promise<Execution.IExecutionResult | null>;
/**
* Get whole ExecutionResult
*
* @method getExecutionResult
* @param {string} executionResultUri
*
* @returns {Promise<Execution.IExecutionResult | null>}
* Promise with `executionResult` or `null` (null means empty response - HTTP 204)
* See https://github.com/gooddata/gooddata-typings/blob/v2.1.0/src/Execution.ts#L88
*/
getExecutionResult(executionResultUri: string): Promise<Execution.IExecutionResult | null>;
private getPage;
private getAllPages;
private fetchExecutionResult;
}
export declare function replaceLimitAndOffsetInUri(oldUri: string, limit: number[], offset: number[]): string;
export declare function getNextOffset(limit: number[], offset: number[], total: number[]): number[];
export declare function getNextLimit(limit: number[], nextOffset: number[], total: number[]): number[];
export declare function nextPageExists(nextOffset: number[], total: number[]): boolean;
export declare function mergePage(prevExecutionResult: Execution.IExecutionResult, executionResult: Execution.IExecutionResult): Execution.IExecutionResult;