-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathapi.ts
More file actions
59 lines (50 loc) · 1.93 KB
/
api.ts
File metadata and controls
59 lines (50 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import type { HttpClient } from '../http.js';
import type {
ApplicationMetadata,
ApplicationMetadataActions,
ApplicationMetadataEntities,
EntityMetadata,
NavigationTree,
ViewDescriptor,
ViewDescriptorMetadata,
} from './types.js';
/**
* Provides access to application metadata endpoints.
* Base path: /api/app/metadata
*/
export class MetadataApi {
private readonly http: HttpClient;
constructor(http: HttpClient) {
this.http = http;
}
/** GET /api/app/metadata — Application-level metadata */
getApp(): Promise<ApplicationMetadata> {
return this.http.get('/api/app/metadata');
}
/** GET /api/app/metadata/navigation — Full navigation tree */
getNavigation(): Promise<NavigationTree> {
return this.http.get('/api/app/metadata/navigation');
}
/** GET /api/app/metadata/actions — All global actions */
getGlobalActions(): Promise<ApplicationMetadataActions> {
return this.http.get('/api/app/metadata/actions');
}
/** GET /api/app/metadata/entities — All entity metadata */
getEntities(): Promise<ApplicationMetadataEntities> {
return this.http.get('/api/app/metadata/entities');
}
/** GET /api/app/metadata/entities/{className} — Single entity metadata */
getEntity(className: string): Promise<EntityMetadata> {
return this.http.get(`/api/app/metadata/entities/${encodeURIComponent(className)}`);
}
/** GET /api/app/metadata/entities/{className}/views — All view descriptors for an entity */
getEntityViews(className: string): Promise<ViewDescriptorMetadata[]> {
return this.http.get(`/api/app/metadata/entities/${encodeURIComponent(className)}/views`);
}
/** GET /api/app/metadata/entities/{className}/views/{view} — Specific view descriptor */
getEntityView(className: string, view: string): Promise<ViewDescriptor> {
return this.http.get(
`/api/app/metadata/entities/${encodeURIComponent(className)}/views/${encodeURIComponent(view)}`,
);
}
}