RestContainer-class function

RestContainer

RestContainer

The RestContainer object wraps a collection of resources with a list-like interface. Values are stored and retrieved using familiar accessors like [[ and [[<-. Coercion between external media and objects is based on the Media framework. class

Data access

The RestContainer object maps familiar R list accessors to CRUD operations on RestUri.

  • x[] \<- value: Creates resources for the objects in value at x. This is the create/POST operation. Unlike an R list, the resources are added to the collection without removing any existing resources. This inconsistency is unfortunate, so we might change this behavior in the future.

  • x$name, x[[i]]: Reads the named element. This is the read/GET operation.

  • x[i]: Reads the named elements, which are returned in a list. This is the vectorized read/GET

    operation. Unlike an R list, this is not an endomorphism, in that the return value is dropped to a list and is no longer attached to the REST interface.

  • x$name \<- value, x[[i]] \<- value: Updates the named resource with value. This is the update/PUT operation.

  • x[i] \<- value: Updates resources at x with the objects in value, a list. This is the vectorized update/PUT operation.

  • x$name \<- NULL, x[[i]] \<- NULL: Deletes the named resource. This is the delete/DELETE operation.

Constructor

  • RestContainer(...): Constructs an instance based on RestUri(...).

Examples

apache <- RestContainer("http://wiki.apache.org") apache$solr

See Also

RestUri, which is a lower-level but perhaps more sensible interface.

Author(s)

Michael Lawrence

  • Maintainer: Michael Lawrence
  • License: Artistic-2.0
  • Last published: 2022-06-16

Useful links