Skip to content

Commit 9362522

Browse files
committed
add back namespace APIs
Signed-off-by: Chengxuan Xing <[email protected]>
1 parent 10e1885 commit 9362522

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/firefly.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ import {
7070
FireFlyVerifierResolveRequest,
7171
FireFlyVerifierResolveResponse,
7272
FireFlyTokenApprovalRequest,
73+
FireFlyNamespaceResponse,
74+
FireFlyNamespacesResponse,
7375
} from './interfaces';
7476
import { FireFlyWebSocket, FireFlyWebSocketCallback } from './websocket';
7577
import HttpBase, { mapConfig } from './http';
@@ -130,6 +132,17 @@ export default class FireFly extends HttpBase {
130132
);
131133
}
132134

135+
getNamespace(
136+
name: string,
137+
options?: FireFlyGetOptions,
138+
): Promise<FireFlyNamespaceResponse | undefined> {
139+
return this.getOne<FireFlyNamespaceResponse>(`/namespaces/${name}`, undefined, options, true);
140+
}
141+
142+
getNamespaces(options?: FireFlyGetOptions): Promise<FireFlyNamespacesResponse[]> {
143+
return this.getMany<FireFlyNamespacesResponse[]>('/namespaces', undefined, options, true);
144+
}
145+
133146
getDatatypes(
134147
filter?: FireFlyDatatypeFilter,
135148
options?: FireFlyGetOptions,

lib/interfaces.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ export interface FireFlyWebSocketOptions {
6363
heartbeatInterval: number;
6464
}
6565

66+
// Namespace
67+
export type FireFlyNamespaceResponse = Required<
68+
operations['getNamespace']['responses']['200']['content']['application/json']
69+
>;
70+
71+
export type FireFlyNamespacesResponse = Required<
72+
operations['getNamespaces']['responses']['200']['content']['application/json']
73+
>;
6674
// Network
6775

6876
export type FireFlyIdentityFilter = operations['getIdentities']['parameters']['query'];

0 commit comments

Comments
 (0)