From 0728bc4371350621346fe8198bb5931f77777881 Mon Sep 17 00:00:00 2001 From: Dmitry Fesenko Date: Thu, 20 May 2021 11:07:30 +0300 Subject: [PATCH] feat: get claims by subjects --- src/cacheServerClient/ICacheServerClient.ts | 1 + src/cacheServerClient/cacheServerClient.ts | 6 ++++++ src/iam.ts | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/cacheServerClient/ICacheServerClient.ts b/src/cacheServerClient/ICacheServerClient.ts index b5544cb2..b78c1b43 100644 --- a/src/cacheServerClient/ICacheServerClient.ts +++ b/src/cacheServerClient/ICacheServerClient.ts @@ -48,6 +48,7 @@ export interface ICacheServerClient { search: string; }) => Promise<(IOrganization | IApp | IRole)[]>; getRolesByOwner: ({ owner }: { owner: string }) => Promise; + getClaimsBySubjects: (subjects: string[]) => Promise; getClaimsByIssuer: ({ did, isAccepted, diff --git a/src/cacheServerClient/cacheServerClient.ts b/src/cacheServerClient/cacheServerClient.ts index ca411810..7542c1fc 100644 --- a/src/cacheServerClient/cacheServerClient.ts +++ b/src/cacheServerClient/cacheServerClient.ts @@ -220,6 +220,12 @@ export class CacheServerClient implements ICacheServerClient { return data; } + async getClaimsBySubjects(subjects: string[]): Promise { + const { data } = await this.httpClient.get('/claim/by/subjects', { params: { subjects: subjects.join(',') } }); + return data; + } + + async getClaimsByIssuer({ did, isAccepted, diff --git a/src/iam.ts b/src/iam.ts index 5704da4d..17943a05 100644 --- a/src/iam.ts +++ b/src/iam.ts @@ -1454,6 +1454,10 @@ export class IAM extends IAMBase { // CLAIMS + async getClaimsBySubjects(subjects: string[]) { + return this._cacheClient.getClaimsBySubjects(subjects); + } + /** * @description - Returns claims for given requester. Allows filtering by status and parent namespace */