Skip to content

Commit 8cfa522

Browse files
authored
Merge pull request #57 from hyperledger/add-namespace-api-updated
Add namespace api
2 parents 10e1885 + 00e597b commit 8cfa522

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

lib/firefly.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ import {
7070
FireFlyVerifierResolveRequest,
7171
FireFlyVerifierResolveResponse,
7272
FireFlyTokenApprovalRequest,
73+
FireFlyNamespaceResponse,
7374
} from './interfaces';
7475
import { FireFlyWebSocket, FireFlyWebSocketCallback } from './websocket';
7576
import HttpBase, { mapConfig } from './http';
@@ -130,6 +131,17 @@ export default class FireFly extends HttpBase {
130131
);
131132
}
132133

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

lib/interfaces.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ 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+
6671
// Network
6772

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hyperledger/firefly-sdk",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "Client SDK for Hyperledger FireFly",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)