Item
, Collection
and Response
objects Conceptually there are two response types exposed by BaseSpace, an
individual response and a collection response. The former, modeled by
the Item
S4 class, is used when querying an individual
item/instance within a resource. The later is used for listing the
items/instances available for a given resource and is modeled by the
Collection
S4 class.
Item
class models a simple unordered set of key/value
pairs. There is a core set of keys, for which access methods are
defined and which are inherited by any child class. In the following x
is an Item
object. $
:$
operator can be used to access the
Item elements. When x
is an Item object this is equivalet
to @
. But one can think at it as user level operator.
Unlike @
the replace method is not implemented for $
.
Id(x)
:Name(x)
:Href(x)
:DateCreated(x)
:Date
instace by as.Date(DateCreated(x))
.
UserOwnedBy(x)
:list
object, but it might be replace with
an object at a future point.
Status(x)
:HrefBaseSpaceUI(x)
:Collection
class models an ordered set of Item
objects and a set of predefined attributes. The interface
provided by the Item
class is implemented by this class.
However, since we deal with an ordered set of objects, the methods
and the access methods, return a vector of the same length as the
size of the collection. In the following x
is a Collection
object. All accesor implemented by the item class are implemented by
Collection class. However here the return value is a vector. If
x
has 2 elements, then Id(x)
will be a vector with 2
elements. The same stands for the general accessor $
. length(x)
:x
.
Items(x)
:Item
objects.
TotalCount(x)
:Offset(x)
:Limit(x)
:SortDir(x)
:SortBy(x)
:length(x)
:x
.show(x)
:as.list(x)
:list
representation of the object.showClass("Item") showClass("Collection") showClass("Response")