UNPKG

@siren-js/client

Version:
47 lines (46 loc) 1.53 kB
import { SirenElementVisitor } from '../visitor/siren-element-visitor'; import { Action } from './action'; import { Link } from './link'; import { SirenElement } from './siren-element'; import { SubEntity } from './sub-entity'; /** * Represents a URI-addressable resource * @typeParam T Type of the `properties` property */ export declare class Entity<T extends object = object> implements SirenElement { /** * Available behavior exposed by the `Entity` */ actions: Action[]; /** * List of strings describing the nature of the `Entity` based on the current representation. Possible values are * implementation-dependent and should be documented. */ class: string[]; /** * Related entities represented as embedded links or representations */ entities: SubEntity[]; /** * Navigation links that communicate ways to navigate outside the entity graph */ links: Link[]; /** * Key-value pairs describing the state of the `Entity` */ properties: T; /** * Descriptive text about the `Entity` */ title?: string; [extension: string]: unknown; /** * Visits this entity's {@linkcode actions}, {@linkcode entities}, and * {@linkcode links}, followed by the entity itself. */ accept(visitor: SirenElementVisitor): Promise<void>; /** * Returns the `Action` in `actions` with the given `name`, if it exists. Otherwise, returns `undefined`. */ getAction(name: string): Action | undefined; }