1 | import { AFM, VisualizationObject } from "@gooddata/typings";
|
2 | import { ApiResponse, XhrModule } from "./xhr";
|
3 | import { IGetObjectsByQueryOptions, IGetObjectUsingOptions, SortDirection } from "./interfaces";
|
4 | export interface IValidElementsOptions {
|
5 | limit?: number;
|
6 | offset?: number;
|
7 | order?: SortDirection;
|
8 | filter?: string;
|
9 | prompt?: string;
|
10 | uris?: string[];
|
11 | complement?: boolean;
|
12 | includeTotalCountWithoutFilters?: boolean;
|
13 | restrictiveDefinition?: string;
|
14 | restrictiveDefinitionContent?: object;
|
15 | afm?: AFM.IAfm;
|
16 | }
|
17 | /**
|
18 | * Functions for working with metadata objects
|
19 | *
|
20 | * @class metadata
|
21 | * @module metadata
|
22 | */
|
23 | export declare class MetadataModule {
|
24 | private xhr;
|
25 | constructor(xhr: XhrModule);
|
26 | /**
|
27 | * Load all objects with given uris
|
28 | * (use bulk loading instead of getting objects one by one)
|
29 | *
|
30 | * @method getObjects
|
31 | * @param {String} projectId id of the project
|
32 | * Array} objectUris array of uris for objects to be loaded
{ |
33 | * Array} array of loaded elements
{ |
34 | */
|
35 | getObjects(projectId: string, objectUris: string[]): any;
|
36 | /**
|
37 | * Loads all objects by query (fetches all pages, one by one)
|
38 | *
|
39 | * @method getObjectsByQuery
|
40 | * @param {String} projectId id of the project
|
41 | * @param {Object} options (see https://developer.gooddata.com/api endpoint: /gdc/md/{project_id}/objects/query)
|
42 | * - category {String} for example 'dataSets' or 'projectDashboard'
|
43 | * - mode {String} 'enriched' or 'raw'
|
44 | * - author {String} the URI of the author of the metadata objects
|
45 | * - limit {number} default is 50 (also maximum)
|
46 | * - deprecated {boolean} show also deprecated objects
|
47 | * @return {Promise<Array>} array of returned objects
|
48 | */
|
49 | getObjectsByQuery(projectId: string, options: IGetObjectsByQueryOptions): Promise<any[]>;
|
50 | /**
|
51 | * Get MD objects from using2 resource. Include only objects of given types
|
52 | * and take care about fetching only nearest objects if requested.
|
53 | *
|
54 | * @method getObjectUsing
|
55 | * @param {String} projectId id of the project
|
56 | * @param {String} uri uri of the object for which dependencies are to be found
|
57 | * @param {Object} options objects with options:
|
58 | * - types {Array} array of strings with object types to be included
|
59 | * - nearest {Boolean} whether to include only nearest dependencies
|
60 | * @return {jQuery promise} promise promise once resolved returns an array of
|
61 | * entries returned by using2 resource
|
62 | */
|
63 | getObjectUsing(projectId: string, uri: string, options?: IGetObjectUsingOptions): Promise<any>;
|
64 | /**
|
65 | * Get MD objects from using2 resource. Include only objects of given types
|
66 | * and take care about fetching only nearest objects if requested.
|
67 | *
|
68 | * @method getObjectUsingMany
|
69 | * @param {String} projectId id of the project
|
70 | * @param {Array} uris uris of objects for which dependencies are to be found
|
71 | * @param {Object} options objects with options:
|
72 | * - types {Array} array of strings with object types to be included
|
73 | * - nearest {Boolean} whether to include only nearest dependencies
|
74 | * @return {jQuery promise} promise promise once resolved returns an array of
|
75 | * entries returned by using2 resource
|
76 | */
|
77 | getObjectUsingMany(projectId: string, uris: string[], options?: IGetObjectUsingOptions): Promise<any>;
|
78 | /**
|
79 | * Returns all visualizationObjects metadata in a project specified by projectId param
|
80 | *
|
81 | * @method getVisualizations
|
82 | * @param {string} projectId Project identifier
|
83 | * @return {Array} An array of visualization objects metadata
|
84 | */
|
85 | getVisualizations(projectId: string): Promise<any>;
|
86 | /**
|
87 | * Returns all attributes in a project specified by projectId param
|
88 | *
|
89 | * @method getAttributes
|
90 | * @param {string} projectId Project identifier
|
91 | * @return {Array} An array of attribute objects
|
92 | */
|
93 | getAttributes(projectId: string): Promise<any>;
|
94 | /**
|
95 | * Returns all dimensions in a project specified by projectId param
|
96 | *
|
97 | * @method getDimensions
|
98 | * @param {string} projectId Project identifier
|
99 | * @return {Array} An array of dimension objects
|
100 | * @see getFolders
|
101 | */
|
102 | getDimensions(projectId: string): Promise<any>;
|
103 | /**
|
104 | * Returns project folders. Folders can be of specific types and you can specify
|
105 | * the type you need by passing and optional `type` parameter
|
106 | *
|
107 | * @method getFolders
|
108 | * @param {String} projectId - Project identifier
|
109 | * @param {String} type - Optional, possible values are `metric`, `fact`, `attribute`
|
110 | * @return {Array} An array of dimension objects
|
111 | */
|
112 | getFolders(projectId: string, type: string): Promise<any>;
|
113 | /**
|
114 | * Returns all facts in a project specified by the given projectId
|
115 | *
|
116 | * @method getFacts
|
117 | * @param {string} projectId Project identifier
|
118 | * @return {Array} An array of fact objects
|
119 | */
|
120 | getFacts(projectId: string): Promise<any>;
|
121 | /**
|
122 | * Returns all metrics in a project specified by the given projectId
|
123 | *
|
124 | * @method getMetrics
|
125 | * @param {string} projectId Project identifier
|
126 | * @return {Array} An array of metric objects
|
127 | */
|
128 | getMetrics(projectId: string): Promise<any>;
|
129 | /**
|
130 | * Returns all metrics that are reachable (with respect to ldm of the project
|
131 | * specified by the given projectId) for given attributes
|
132 | *
|
133 | * @method getAvailableMetrics
|
134 | * @param {String} projectId - Project identifier
|
135 | * @param {Array} attrs - An array of attribute uris for which we want to get
|
136 | * available metrics
|
137 | * @return {Array} An array of reachable metrics for the given attrs
|
138 | * @see getAvailableAttributes
|
139 | * @see getAvailableFacts
|
140 | */
|
141 | getAvailableMetrics(projectId: string, attrs?: string[]): Promise<any>;
|
142 | /**
|
143 | * Returns all attributes that are reachable (with respect to ldm of the project
|
144 | * specified by the given projectId) for given metrics (also called as drillCrossPath)
|
145 | *
|
146 | * @method getAvailableAttributes
|
147 | * @param {String} projectId - Project identifier
|
148 | * @param {Array} metrics - An array of metric uris for which we want to get
|
149 | * available attributes
|
150 | * @return {Array} An array of reachable attributes for the given metrics
|
151 | * @see getAvailableMetrics
|
152 | * @see getAvailableFacts
|
153 | */
|
154 | getAvailableAttributes(projectId: string, metrics?: string[]): Promise<any>;
|
155 | /**
|
156 | * Returns all attributes that are reachable (with respect to ldm of the project
|
157 | * specified by the given projectId) for given metrics (also called as drillCrossPath)
|
158 | *
|
159 | * @method getAvailableFacts
|
160 | * @param {String} projectId - Project identifier
|
161 | * @param {Array} items - An array of metric or attribute uris for which we want to get
|
162 | * available facts
|
163 | * @return {Array} An array of reachable facts for the given items
|
164 | * @see getAvailableAttributes
|
165 | * @see getAvailableMetrics
|
166 | */
|
167 | getAvailableFacts(projectId: string, items?: string[]): Promise<any>;
|
168 | /**
|
169 | * Get details of a metadata object specified by its uri
|
170 | *
|
171 | * @method getObjectDetails
|
172 | * @param uri uri of the metadata object for which details are to be retrieved
|
173 | * @return {Object} object details
|
174 | */
|
175 | getObjectDetails(uri: string): Promise<any>;
|
176 | /**
|
177 | * Get folders with items.
|
178 | * Returns array of folders, each having a title and items property which is an array of
|
179 | * corresponding items. Each item is either a metric or attribute, keeping its original
|
180 | * verbose structure.
|
181 | *
|
182 | * @method getFoldersWithItems
|
183 | * @param {String} type type of folders to return
|
184 | * @return {Array} Array of folder object, each containing title and
|
185 | * corresponding items.
|
186 | */
|
187 | getFoldersWithItems(projectId: string, type: string): Promise<{
|
188 | title: any;
|
189 | items: any;
|
190 | }[]>;
|
191 | /**
|
192 | * Get identifier of a metadata object identified by its uri
|
193 | *
|
194 | * @method getObjectIdentifier
|
195 | * @param uri uri of the metadata object for which the identifier is to be retrieved
|
196 | * @return {String} object identifier
|
197 | */
|
198 | getObjectIdentifier(uri: string): Promise<any>;
|
199 | /**
|
200 | * Get uri of an metadata object, specified by its identifier and project id it belongs to
|
201 | *
|
202 | * @method getObjectUri
|
203 | * @param {string} projectId id of the project
|
204 | * @param identifier identifier of the metadata object
|
205 | * @return {String} uri of the metadata object
|
206 | */
|
207 | getObjectUri(projectId: string, identifier: string): Promise<any>;
|
208 | /**
|
209 | * Get uris specified by identifiers
|
210 | *
|
211 | * @method getUrisFromIdentifiers
|
212 | * @param {String} projectId id of the project
|
213 | * @param {Array} identifiers identifiers of the metadata objects
|
214 | * @return {Array} array of identifier + uri pairs
|
215 | */
|
216 | getUrisFromIdentifiers(projectId: string, identifiers: string[]): Promise<any>;
|
217 | /**
|
218 | * Get identifiers specified by uris
|
219 | *
|
220 | * @method getIdentifiersFromUris
|
221 | * @param {String} projectId id of the project
|
222 | * @param {Array} uris of the metadata objects
|
223 | * @return {Array} array of identifier + uri pairs
|
224 | */
|
225 | getIdentifiersFromUris(projectId: string, uris: string[]): Promise<any>;
|
226 | /**
|
227 | * Get attribute elements with their labels and uris.
|
228 | *
|
229 | * @param {String} projectId id of the project
|
230 | * @param {String} labelUri uri of the label (display form)
|
231 | * @param {Array<String>} patterns elements labels/titles (for EXACT mode), or patterns (for WILD mode)
|
232 | * @param {('EXACT'|'WILD')} mode match mode, currently only EXACT supported
|
233 | * @return {Array} array of elementLabelUri objects
|
234 | */
|
235 | translateElementLabelsToUris(projectId: string, labelUri: string, patterns: string[], mode?: string): Promise<any>;
|
236 | /**
|
237 | * Get valid elements of an attribute, specified by its identifier and project id it belongs to
|
238 | *
|
239 | * @method getValidElements
|
240 | * @param {string} projectId id of the project
|
241 | * @param id display form id of the metadata object
|
242 | * @param {Object} options objects with options:
|
243 | * - limit {Number}
|
244 | * - offset {Number}
|
245 | * - order {String} 'asc' or 'desc'
|
246 | * - filter {String}
|
247 | * - prompt {String}
|
248 | * - uris {Array}
|
249 | * - complement {Boolean}
|
250 | * - includeTotalCountWithoutFilters {Boolean}
|
251 | * - restrictiveDefinition {String}
|
252 | * - afm {Object}
|
253 | * @return {Object} ValidElements response with:
|
254 | * - items {Array} elements
|
255 | * - paging {Object}
|
256 | * - elementsMeta {Object}
|
257 | */
|
258 | getValidElements(projectId: string, id: string, options?: IValidElementsOptions): Promise<any>;
|
259 | /**
|
260 | * Get visualization by Uri and process data
|
261 | *
|
262 | * @method getVisualization
|
263 | * @param {String} visualizationUri
|
264 | */
|
265 | getVisualization(uri: string): Promise<VisualizationObject.IVisualization>;
|
266 | /**
|
267 | * Save visualization
|
268 | *
|
269 | * @method saveVisualization
|
270 | * @param {String} visualizationUri
|
271 | */
|
272 | saveVisualization(projectId: string, visualization: VisualizationObject.IVisualization): Promise<any>;
|
273 | /**
|
274 | * Update visualization
|
275 | *
|
276 | * @method updateVisualization
|
277 | * @param {String} visualizationUri
|
278 | */
|
279 | updateVisualization(projectId: string, visualizationUri: string, visualization: VisualizationObject.IVisualization): Promise<any>;
|
280 | /**
|
281 | * Delete visualization
|
282 | *
|
283 | * @method deleteVisualization
|
284 | * @param {String} visualizationUri
|
285 | */
|
286 | deleteVisualization(visualizationUri: string): Promise<ApiResponse>;
|
287 | /**
|
288 | * Delete object
|
289 | *
|
290 | * @experimental
|
291 | * @method deleteObject
|
292 | * @param {String} uri of the object to be deleted
|
293 | */
|
294 | deleteObject(uri: string): Promise<ApiResponse>;
|
295 | /**
|
296 | * Create object
|
297 | *
|
298 | * @experimental
|
299 | * @method createObject
|
300 | * @param {String} projectId
|
301 | * @param {String} obj object definition
|
302 | */
|
303 | createObject(projectId: string, obj: any): Promise<any>;
|
304 | /**
|
305 | * Update object
|
306 | *
|
307 | * @experimental
|
308 | * @method updateObject
|
309 | * @param {String} projectId
|
310 | * @param {String} visualizationUri
|
311 | * @param {String} obj object definition
|
312 | */
|
313 | updateObject(projectId: string, visualizationUri: string, obj: any): Promise<any>;
|
314 | /**
|
315 | * LDM manage
|
316 | *
|
317 | * @experimental
|
318 | * @method ldmManage
|
319 | * @param {String} projectId
|
320 | * @param {String} maql
|
321 | * @param {Object} options for polling (maxAttempts, pollStep)
|
322 | */
|
323 | ldmManage(projectId: string, maql: string, options?: {}): Promise<any>;
|
324 | /**
|
325 | * ETL pull
|
326 | *
|
327 | * @experimental
|
328 | * @method etlPull
|
329 | * @param {String} projectId
|
330 | * @param {String} uploadsDir
|
331 | * @param {Object} options for polling (maxAttempts, pollStep)
|
332 | */
|
333 | etlPull(projectId: string, uploadsDir: string, options?: {}): Promise<any>;
|
334 | private isTaskFinished;
|
335 | private checkStatusForError;
|
336 | }
|