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

    Class Resource

    This class repesents an in-memory instance of a HAL resource.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • obj: Object

        the object used to assign the properties

      Returns Resource

    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

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

      Returns Observable<Resource>

      an observable of the refreshed resource instance

    • Persit the resource. Uses PUT request to send the new resource state.

      Returns Observable<Accessor>

      an observable of resource accessor