R6 Class representing a resource for managing collections. Wrapper for Seven Bridges pageable resources. Among the actual collection items it contains information regarding the total number of entries available on the server and resource API request URL (href).
Public fields
href
API request URL.
items
Items returned in API response.
links
List of links (hrefs) for next and/or previous page resources.
total
Total number of items available on the server.
response
Raw API response.
auth
Seven Bridges Authentication object.
Methods
Method new()
Create a new Collection object.
Usage
Collection$new(
href = NA,
items = NA,
links = NA,
total = NA,
response = NA,
auth = NA
)
Method print()
Print method for Collection class.
Method next_page()
Return next page of results.
Arguments
...
Other arguments that can be passed to core
api()
function like 'advanced_access', 'fields', etc.
Method prev_page()
Return previous page of results.
Arguments
...
Other arguments that can be passed to core
api()
function like 'advanced_access', 'fields', etc.
Method all()
Fetches all available items by iterating through all pages. Please be aware of the API rate limit for your request.
Arguments
...
Other arguments that can be passed to core
api()
function like 'advanced_access', 'fields', etc.
Examples
## ------------------------------------------------
## Method `Collection$print`
## ------------------------------------------------
if (FALSE) {
# x is API response when collection object is requested
collection_object <- Collection$new(
href = x$href,
items = x$items,
links = x$links,
total = x$total,
auth = auth,
response = attr(x, "response")
)
# Print collection object
collection_object$print()
}
## ------------------------------------------------
## Method `Collection$next_page`
## ------------------------------------------------
if (FALSE) {
# x is API response when collection object is requested
collection_object <- Collection$new(
href = x$href,
items = x$items,
links = x$links,
total = x$total,
auth = auth,
response = attr(x, "response")
)
# Get next page of collection results
collection_object$next_page()
}
## ------------------------------------------------
## Method `Collection$prev_page`
## ------------------------------------------------
if (FALSE) {
# x is API response when collection object is requested
collection_object <- Collection$new(
href = x$href,
items = x$items,
links = x$links,
total = x$total,
auth = auth,
response = attr(x, "response")
)
# Get previous page of collection results
collection_object$prev_page()
}
## ------------------------------------------------
## Method `Collection$all`
## ------------------------------------------------
if (FALSE) {
# x is API response when collection object is requested
collection_object <- Collection$new(
href = x$href,
items = x$items,
links = x$links,
total = x$total,
auth = auth,
response = attr(x, "response")
)
# Get all results of collection
collection_object$all()
}