-
Notifications
You must be signed in to change notification settings - Fork 7
/
ICacheClient.ts
48 lines (43 loc) · 2.86 KB
/
ICacheClient.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { IAppDefinition, IOrganizationDefinition, IRoleDefinition } from "@energyweb/iam-contracts";
import { IDIDDocument } from "@ew-did-registry/did-resolver-interface";
import { IClaimIssuance, IClaimRejection, IClaimRequest } from "../claims/claims.types";
import { IPubKeyAndIdentityToken } from "../signer/signer.types";
import { AssetsFilter, ClaimsFilter } from "./cacheClient.types";
import { Asset, AssetHistory } from "../assets/assets.types";
import { IApp, IOrganization, IRole } from "../domains/domains.types";
import { Claim } from "../claims/claims.types";
import { SearchType } from ".";
export interface ICacheClient {
pubKeyAndIdentityToken: IPubKeyAndIdentityToken | undefined;
login: () => Promise<void>;
isAuthEnabled: () => boolean;
getRoleDefinition: (namespace: string) => Promise<IRoleDefinition>;
getRolesDefinition: (namespace: string[]) => Promise<Record<string, IRoleDefinition>>;
getOrgDefinition: (namespace: string) => Promise<IOrganizationDefinition>;
getAppDefinition: (namespace: string) => Promise<IAppDefinition>;
getApplicationRoles: (namespace: string) => Promise<IRole[]>;
getOrganizationRoles: (namespace: string) => Promise<IRole[]>;
getOrganizationsByOwner: (owner: string, excludeSubOrgs?: boolean) => Promise<IOrganization[]>;
getApplicationsByOwner: (owner: string) => Promise<IApp[]>;
getApplicationsByOrganization: (namespace: string) => Promise<IApp[]>;
getSubOrganizationsByOrganization: (namespace: string) => Promise<IOrganization[]>;
getOrgHierarchy: (namespace: string) => Promise<IOrganization>;
getNamespaceBySearchPhrase: (phrase: string, types?: SearchType[]) => Promise<(IOrganization | IApp | IRole)[]>;
getRolesByOwner: (owner: string) => Promise<IRole[]>;
getDIDsForRole: (namespace: string) => Promise<string[]>;
getClaimsBySubjects: (subjects: string[]) => Promise<Claim[]>;
getClaimsByIssuer: (issuer: string, filter?: ClaimsFilter) => Promise<Claim[]>;
getClaimsByRequester: (requester: string, filter?: ClaimsFilter) => Promise<Claim[]>;
getClaimsBySubject: (subject: string, filter?: ClaimsFilter) => Promise<Claim[]>;
requestClaim: (requester: string, message: IClaimRequest) => Promise<void>;
issueClaim: (issuer: string, message: IClaimIssuance) => Promise<void>;
rejectClaim: (issuer: string, message: IClaimRejection) => Promise<void>;
deleteClaim: (claimId: string) => Promise<void>;
getDidDocument: (did: string, includeClaims?: boolean) => Promise<IDIDDocument>;
addDIDToWatchList: (did: string) => Promise<void>;
getOwnedAssets: (owner: string) => Promise<Asset[]>;
getOfferedAssets: (offeredTo: string) => Promise<Asset[]>;
getAssetById: (id: string) => Promise<Asset>;
getPreviouslyOwnedAssets: (owner: string) => Promise<Asset[]>;
getAssetHistory: (id: string, filter?: AssetsFilter) => Promise<AssetHistory[]>;
}