@hydra-cg/heracles.ts > HypermediaContainer
Provides a default implementation of the IHypermediaContainer interface.
class:
↳ ResourceFilterableCollection<IResource>
↳ HypermediaContainer
⊕ new HypermediaContainer(headers: IHeaders, rootResource: IResource, hypermedia: Iterable
<IResource>): HypermediaContainer
Overrides ResourceFilterableCollection.constructor
Defined in DataModel/HypermediaContainer.ts:63
Initializes a new instance of the HypermediaContainer class.
Parameters:
Name | Type | Description |
---|---|---|
headers | IHeaders | |
rootResource | IResource | Main resource associated with the requested Url. |
hypermedia | Iterable <IResource> |
Hypermedia controls to be stored within this container. |
Returns: HypermediaContainer
● collections: ResourceFilterableCollection<ICollection>
Implementation of IHypermediaContainer.collections
Defined in DataModel/HypermediaContainer.ts:57
Gets discovered collections.
● headers: IHeaders
Implementation of IHypermediaContainer.headers
Defined in DataModel/HypermediaContainer.ts:42
Gets response headers.
● iri: string
Implementation of IHypermediaContainer.iri
Defined in DataModel/HypermediaContainer.ts:45
Gets an Iri of a resource.
readonly:
returns:
● links: LinksCollection
Implementation of IHypermediaContainer.links
Defined in DataModel/HypermediaContainer.ts:63
Gets a collection of links.
<Optional>
members● members: ResourceFilterableCollection<IResource>
Implementation of IHypermediaContainer.members
Defined in DataModel/HypermediaContainer.ts:54
Gets a collection members. This may be null if the resource owning this container is not a hydra:Collection.
● operations: OperationsCollection
Implementation of IHypermediaContainer.operations
Defined in DataModel/HypermediaContainer.ts:60
Gets possible operations.
● type: TypesCollection
Implementation of IHypermediaContainer.type
Defined in DataModel/HypermediaContainer.ts:48
Gets classes a given resource is of.
readonly:
returns:
<Optional>
view● view: IHydraResource
Implementation of IHypermediaContainer.view
Defined in DataModel/HypermediaContainer.ts:51
Gets a partial collection view. This may be null if the resource owning this container is not a hydra:Collection with hydra:view.
get length(): number
Inherited from FilterableCollection.length
Defined in DataModel/Collections/FilterableCollection.ts:38
Gets the number of items in this collection.
readonly:
Returns: number
▸ __@iterator(): Iterator
<IResource>
Implementation of IHypermediaContainer.[@iterator](/Heracles.ts/interfaces/ihypermediacontainer.html#_iterator)
Inherited from FilterableCollection.[@iterator](/Heracles.ts/classes/filterablecollection.html#_iterator)
Defined in DataModel/Collections/FilterableCollection.ts:111
inheritdoc:
Returns: Iterator
<IResource>
▸ any(): boolean
Implementation of IHypermediaContainer.any
Inherited from FilterableCollection.any
Defined in DataModel/Collections/FilterableCollection.ts:52
Checks whether this collection has any items fitlered.
Returns: boolean
<Protected>
createInstance▸ createInstance(items: Iterable
<IResource>): ResourceFilterableCollection<IResource>
Implementation of IHypermediaContainer.createInstance
Inherited from ResourceFilterableCollection.createInstance
Overrides FilterableCollection.createInstance
Defined in DataModel/Collections/ResourceFilterableCollection.ts:54
Parameters:
Name | Type |
---|---|
items | Iterable <IResource> |
Returns: ResourceFilterableCollection<IResource>
▸ first(): IResource
Implementation of IHypermediaContainer.first
Inherited from FilterableCollection.first
Defined in DataModel/Collections/FilterableCollection.ts:60
Gets the first item of the collection or null if there are no items matching the criteria.
Returns: IResource
<Optional>
getIterator▸ getIterator(): IPartialCollectionIterator
Implementation of IHypermediaContainer.getIterator
Defined in DataModel/HypermediaContainer.ts:87
Gets a part iterator associated with the collection. This may be null if the resource owning this container is not a hydra:Collection with hydra:view.
Returns: IPartialCollectionIterator
▸ last(): IResource
Implementation of IHypermediaContainer.last
Inherited from FilterableCollection.last
Defined in DataModel/Collections/FilterableCollection.ts:69
Gets the last item of the collection or null if there are no items matching the criteria.
Returns: IResource
<Protected>
narrowFiltersWith▸ narrowFiltersWith<TValue
>(predicate: string
, matchEvaluator: function
): FilterableCollection<IResource>
▸ narrowFiltersWith(predicate: string
, value: string
| RegExp
): FilterableCollection<IResource>
Inherited from FilterableCollection.narrowFiltersWith
Defined in DataModel/Collections/FilterableCollection.ts:129
Creates a new instance of the FilterableCollection with filter made narrower with given predicate.
Type parameters:
Parameters:
Name | Type | Description |
---|---|---|
predicate | string |
Predicate of the filter. |
matchEvaluator | function |
Match evaluator of the predicate to filter. |
Returns: FilterableCollection<IResource>
Implementation of IHypermediaContainer.narrowFiltersWith
Inherited from FilterableCollection.narrowFiltersWith
Defined in DataModel/Collections/FilterableCollection.ts:140
Creates a new instance of the FilterableCollection with filter made narrower with given predicate.
Parameters:
Name | Type | Description |
---|---|---|
predicate | string |
Predicate of the filter. |
value | string | RegExp |
Either value or regular expression to match the value of the predicate to filter. |
Returns: FilterableCollection<IResource>
▸ nonBlank(): ResourceFilterableCollection<IResource>
Implementation of IHypermediaContainer.nonBlank
Inherited from ResourceFilterableCollection.nonBlank
Defined in DataModel/Collections/ResourceFilterableCollection.ts:50
Obtains a collection of resources being non blank nodes;
Returns: ResourceFilterableCollection<IResource>
▸ ofIri(iri: string
): ResourceFilterableCollection<IResource>
Implementation of IHypermediaContainer.ofIri
Inherited from ResourceFilterableCollection.ofIri
Defined in DataModel/Collections/ResourceFilterableCollection.ts:37
Obtains a collection of resources of a given Iri;
Parameters:
Name | Type | Description |
---|---|---|
iri | string |
Iri of the resources. |
Returns: ResourceFilterableCollection<IResource>
▸ ofType(iri: string
): ResourceFilterableCollection<IResource>
Implementation of IHypermediaContainer.ofType
Inherited from ResourceFilterableCollection.ofType
Defined in DataModel/Collections/ResourceFilterableCollection.ts:23
Obtains a collection of resources of a given type;
Parameters:
Name | Type | Description |
---|---|---|
iri | string |
Type of the resources. |
Returns: ResourceFilterableCollection<IResource>
▸ toArray(): IResource[]
Implementation of IHypermediaContainer.toArray
Inherited from FilterableCollection.toArray
Defined in DataModel/Collections/FilterableCollection.ts:101
Flattens this collection to a standard array.
Returns: IResource[]
▸ where(matchEvaluator: function
): FilterableCollection<IResource>
Inherited from FilterableCollection.where
Defined in DataModel/Collections/FilterableCollection.ts:83
Filters the collection with a generic match evaluator.
Parameters:
Name | Type | Description |
---|---|---|
matchEvaluator | function |
Match evaluation delegate. |
Returns: FilterableCollection<IResource>