UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

37 lines (36 loc) 1.4 kB
import { IObjectMetadata } from '@decentralized-identity/hub-common-js'; import HubCommitQueryRequest from '../hubSession/requests/HubCommitQueryRequest'; import HubSession from '../hubSession/HubSession'; /** * Class that represents an object in a hub. */ export default class HubObject { /** * The actual payload of the object. */ payload: any | undefined; /** * Object Metadata that can be used to query for the actual object in the hub. */ readonly objectMetadata: IObjectMetadata; /** * Create an instance for Hub Object using hub object's metadata. * @param objectMetadata object metadata that represents an object in a hub. */ constructor(objectMetadata: IObjectMetadata); /** * If payload is not defined, get the payload from hub session using metadata. * @param hubSession the hub session that will be used to query object * @param commitQueryRequest the commit query requests for getting all commits for certain object. */ hydrate(hubSession: HubSession, commitQueryRequest: HubCommitQueryRequest): Promise<any>; /** * Get the Payload of the Hub Object if object is hydrated. * Throws an Error if object is not hydrated. */ getPayload(): any; /** * Get The Metadata of the Hub Object. */ getMetadata(): IObjectMetadata; }