From 9362522bc648477bfe00e7697563c2bb19f70971 Mon Sep 17 00:00:00 2001 From: Chengxuan Xing Date: Thu, 5 Jan 2023 21:16:21 +0000 Subject: [PATCH] add back namespace APIs Signed-off-by: Chengxuan Xing --- lib/firefly.ts | 13 +++++++++++++ lib/interfaces.ts | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/lib/firefly.ts b/lib/firefly.ts index 130b009..eb94f2f 100644 --- a/lib/firefly.ts +++ b/lib/firefly.ts @@ -70,6 +70,8 @@ import { FireFlyVerifierResolveRequest, FireFlyVerifierResolveResponse, FireFlyTokenApprovalRequest, + FireFlyNamespaceResponse, + FireFlyNamespacesResponse, } from './interfaces'; import { FireFlyWebSocket, FireFlyWebSocketCallback } from './websocket'; import HttpBase, { mapConfig } from './http'; @@ -130,6 +132,17 @@ export default class FireFly extends HttpBase { ); } + getNamespace( + name: string, + options?: FireFlyGetOptions, + ): Promise { + return this.getOne(`/namespaces/${name}`, undefined, options, true); + } + + getNamespaces(options?: FireFlyGetOptions): Promise { + return this.getMany('/namespaces', undefined, options, true); + } + getDatatypes( filter?: FireFlyDatatypeFilter, options?: FireFlyGetOptions, diff --git a/lib/interfaces.ts b/lib/interfaces.ts index 207b6e8..83ebc30 100644 --- a/lib/interfaces.ts +++ b/lib/interfaces.ts @@ -63,6 +63,14 @@ export interface FireFlyWebSocketOptions { heartbeatInterval: number; } +// Namespace +export type FireFlyNamespaceResponse = Required< + operations['getNamespace']['responses']['200']['content']['application/json'] +>; + +export type FireFlyNamespacesResponse = Required< +operations['getNamespaces']['responses']['200']['content']['application/json'] +>; // Network export type FireFlyIdentityFilter = operations['getIdentities']['parameters']['query'];