Angular HAL Client - v1.0.0-dev.7
    Preparing search index...

    Class Collection<T>

    This class represents an in-memory collection of resources.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    start: number

    Zero-based offset of the first element of the values array in the collection.

    values: T[]

    A page of values of the collection starting with start offset.

    Accessors

    • get canCreate(): boolean

      This property is true when either methods array does not exist in the self link or the array exists and contains POST string. It is false otherwise.

      Returns boolean

    • get canDelete(): boolean

      This property is true when either methods array does not exist in the self link or the array exists and contains DELETE string. It is false otherwise.

      Returns boolean

    • get canRead(): boolean

      This property is true when either methods array does not exist in the self link or the array exists and contains GET string. It is false otherwise.

      Returns boolean

    • get canUpdate(): boolean

      This property is true when either methods array does not exist in the self link or the array exists and contains PUT string. It is false otherwise.

      Returns boolean

    • get self(): string

      The URI of self link.

      Returns string

    Methods

    • Create a new resource in the collection identified by self link. It makes a POST call to the URI in self link and returns an observable for the call. The observable normally emits an accessor for the newly created resource or undefined if Location header was not returned by the call.

      Parameters

      • obj: any

        the payload for the POST method call

      Returns Observable<Accessor | undefined>

      an observable of the resource's accessor

    • Delete the resource identified by self link.

      Returns Observable<void>

      an observable that emits next signal on successful delete

    • Follow the relation link. Returns an accessor for the resource or undefined if no such relation exists.

      Parameters

      • rel: string

        the name of the relation link

      • params: Params = {}

        parameters for a templated link

      Returns Accessor | undefined

      an accessor for the linked resource or undefined

    • Returns a single embedded resource or undefined if no such embedded exists. If the named resource is an array it returns the first element.

      Type Parameters

      Parameters

      • type: Type<T>

        the resource type

      • rel: string

        the name of the embedded resource

      Returns T | undefined

      the resource or undefined

    • Returns an embedded array of resources or undefined if the named embedded does not exist. If the named resource is not an array it wraps the resource in an array.

      Type Parameters

      Parameters

      • type: Type<T>

        the element resource type

      • rel: string

        the name of the embedded resource array

      Returns T[] | undefined

      the resource array or undefined

    • Follow next link if it exists and can be read.

      Returns Accessor | undefined

      the accessor for the link or undefined

    • Follow prev link if it exists and can be read.

      Returns Accessor | undefined

      the accessor for the link or undefined

    • Refresh the resource collection. In other words, read the resource collection identified by self link.

      Returns Observable<Collection<T>>

      an observable of the refreshed resource collection instance