Skip to content

Commit

Permalink
feat: get claims by subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed May 27, 2021
1 parent 6069076 commit 0728bc4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cacheServerClient/ICacheServerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export interface ICacheServerClient {
search: string;
}) => Promise<(IOrganization | IApp | IRole)[]>;
getRolesByOwner: ({ owner }: { owner: string }) => Promise<IRole[]>;
getClaimsBySubjects: (subjects: string[]) => Promise<Claim[]>;
getClaimsByIssuer: ({
did,
isAccepted,
Expand Down
6 changes: 6 additions & 0 deletions src/cacheServerClient/cacheServerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ export class CacheServerClient implements ICacheServerClient {
return data;
}

async getClaimsBySubjects(subjects: string[]): Promise<Claim[]> {
const { data } = await this.httpClient.get<Claim[]>('/claim/by/subjects', { params: { subjects: subjects.join(',') } });
return data;
}


async getClaimsByIssuer({
did,
isAccepted,
Expand Down
4 changes: 4 additions & 0 deletions src/iam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 0728bc4

Please sign in to comment.