Skip to content

Commit 326caaa

Browse files
committed
Add queries for identities
Signed-off-by: Andrew Richardson <[email protected]>
1 parent 91b0643 commit 326caaa

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

lib/firefly.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ import {
5757
FireFlyContractInvokeRequest,
5858
FireFlyContractQueryRequest,
5959
FireFlyDataRequest,
60+
FireFlyIdentityFilter,
61+
FireFlyIdentityResponse,
62+
FireFlyIdentitiesResponse,
6063
} from './interfaces';
6164
import { FireFlyWebSocket, FireFlyWebSocketCallback } from './websocket';
6265
import HttpBase, { mapConfig } from './http';
@@ -69,23 +72,32 @@ export default class FireFly extends HttpBase {
6972
return response.data;
7073
}
7174

75+
async getIdentities(
76+
filter?: FireFlyIdentityFilter,
77+
options?: FireFlyGetOptions,
78+
): Promise<FireFlyIdentitiesResponse> {
79+
return this.getMany<FireFlyIdentitiesResponse>('/identities', filter, options);
80+
}
81+
82+
async getIdentity(
83+
nameOrId: string,
84+
options?: FireFlyGetOptions,
85+
): Promise<FireFlyIdentityResponse | undefined> {
86+
return this.getOne<FireFlyIdentityResponse>(`/identities/${nameOrId}`, options);
87+
}
88+
7289
async getOrganizations(
7390
filter?: FireFlyOrganizationFilter,
7491
options?: FireFlyGetOptions,
7592
): Promise<FireFlyOrganizationResponse[]> {
76-
return this.getMany<FireFlyOrganizationResponse[]>(
77-
'/network/organizations',
78-
filter,
79-
options,
80-
true,
81-
);
93+
return this.getMany<FireFlyOrganizationResponse[]>('/network/organizations', filter, options);
8294
}
8395

8496
async getNodes(
8597
filter?: FireFlyNodeFilter,
8698
options?: FireFlyGetOptions,
8799
): Promise<FireFlyNodeResponse[]> {
88-
return this.getMany<FireFlyNodeResponse[]>('/network/nodes', filter, options, true);
100+
return this.getMany<FireFlyNodeResponse[]>('/network/nodes', filter, options);
89101
}
90102

91103
async getVerifiers(
@@ -98,7 +110,6 @@ export default class FireFly extends HttpBase {
98110
`/namespaces/${namespace}/verifiers`,
99111
filter,
100112
options,
101-
true,
102113
);
103114
}
104115

lib/interfaces.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,17 @@ export interface FireFlyWebSocketOptions {
6161

6262
// Network
6363

64+
export type FireFlyIdentityFilter = operations['getIdentities']['parameters']['query'];
6465
export type FireFlyOrganizationFilter = operations['getNetworkOrgs']['parameters']['query'];
6566
export type FireFlyNodeFilter = operations['getNetworkNodes']['parameters']['query'];
6667
export type FireFlyVerifierFilter = operations['getVerifiers']['parameters']['query'];
6768

6869
export type FireFlyIdentityResponse = Required<
6970
operations['getIdentityByID']['responses']['200']['content']['application/json']
7071
>;
72+
export type FireFlyIdentitiesResponse = Required<
73+
operations['getIdentities']['responses']['200']['content']['application/json']
74+
>;
7175
export type FireFlyOrganizationResponse = Required<
7276
operations['getNetworkOrg']['responses']['200']['content']['application/json']
7377
>;

0 commit comments

Comments
 (0)