@gooddata/gooddata-js
Version:
GoodData JavaScript SDK
143 lines (142 loc) • 5.08 kB
TypeScript
import { ITimezone, IColor, IColorPalette, IFeatureFlags } from "./interfaces";
import { XhrModule, ApiResponse } from "./xhr";
export interface IProjectConfigSettingItem {
settingItem: {
key: string;
links: {
self: string;
};
source: string;
value: string;
};
}
export interface IProjectConfigResponse {
settings: {
items: IProjectConfigSettingItem[];
};
}
export declare const parseSettingItemValue: (value: string) => string | number | boolean;
/**
* Functions for working with projects
*
* @class project
* @module project
*/
export declare class ProjectModule {
private xhr;
constructor(xhr: XhrModule);
/**
* Get current project id
*
* @method getCurrentProjectId
* @return {String} current project identifier
*/
getCurrentProjectId(): Promise<string | null>;
/**
* Return current project id in bootstrap
* @method getCurrentProjectIdInBootstrap
* @param bootstrapData - data was got from bootstrap resource
*/
getCurrentProjectIdInBootstrap(bootstrapData: any): string | null;
/**
* Fetches projects available for the user represented by the given profileId
*
* @method getProjects
* @param {String} profileId - User profile identifier
* @return {Array} An Array of projects
*/
getProjects(profileId: string): Promise<any>;
/**
* Fetches all datasets for the given project
*
* @method getDatasets
* @param {String} projectId - GD project identifier
* @return {Array} An array of objects containing datasets metadata
*/
getDatasets(projectId: string): Promise<any>;
/**
* Fetches a chart color palette for a project represented by the given
* projectId parameter.
*
* @method getColorPalette
* @param {String} projectId - A project identifier
* @return {Array} An array of objects with r, g, b fields representing a project's
* color palette
*/
getColorPalette(projectId: string): Promise<any>;
/**
* Fetches a chart color palette for a project represented by the given
* projectId parameter.
*
* @method getColorPaletteWithGuids
* @param {String} projectId - A project identifier
* @return {Array} An array of objects representing a project's
* color palette with color guid or undefined
*/
getColorPaletteWithGuids(projectId: string): Promise<IColorPalette | undefined>;
/**
* Sets given colors as a color palette for a given project.
*
* @method setColorPalette
* @param {String} projectId - GD project identifier
* @param {Array} colors - An array of colors that we want to use within the project.
* Each color should be an object with r, g, b fields. // TODO really object?
*/
setColorPalette(projectId: string, colors: IColor[]): Promise<ApiResponse>;
/**
* Gets current timezone and its offset. Example output:
*
* {
* id: 'Europe/Prague',
* displayName: 'Central European Time',
* currentOffsetMs: 3600000
* }
*
* @method getTimezone
* @param {String} projectId - GD project identifier
*/
getTimezone(projectId: string): Promise<ITimezone>;
setTimezone(projectId: string, timezone: ITimezone): Promise<any>;
/**
* Create project
* Note: returns a promise which is resolved when the project creation is finished
*
* @experimental
* @method createProject
* @param {String} title
* @param {String} authorizationToken
* @param {Object} options for project creation (summary, projectTemplate, ...)
* @return {Object} created project object
*/
createProject(title: string, authorizationToken: string, options?: any): Promise<any>;
/**
* Delete project
*
* @method deleteProject
* @param {String} projectId
*/
deleteProject(projectId: string): Promise<ApiResponse>;
/**
* Gets aggregated feature flags for given project and current user
*
* @method getFeatureFlags
* @param {String} projectId - A project identifier
* @return {IFeatureFlags} Hash table of feature flags and theirs values where feature flag is as key
*/
getFeatureFlags(projectId: string): Promise<IFeatureFlags>;
/**
* Gets project config including project specific feature flags
*
* @param {String} projectId - A project identifier
* @return {IProjectConfigSettingItem[]} An array of project config setting items
*/
getConfig(projectId: string): Promise<IProjectConfigSettingItem[]>;
/**
* Gets project specific feature flags
*
* @param {String} projectId - A project identifier
* @param {String} source - optional filter settingItems with specific source
* @return {IFeatureFlags} Hash table of feature flags and theirs values where feature flag is as key
*/
getProjectFeatureFlags(projectId: string, source?: string): Promise<IFeatureFlags>;
}