Collection | R Documentation |
R6 Class representing a resource for managing collections. A 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).
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.
new()
Create a new Collection object.
Collection$new( href = NA, items = NA, links = NA, total = NA, response = NA, auth = NA )
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.
print()
Print method for Collection class.
Collection$print(n = 10)
n
Number of items to print in console.
\dontrun{ # 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() }
next_page()
Returns the next page of results.
Collection$next_page(...)
...
Other arguments that can be passed to core api()
function
like 'advanced_access', 'fields', etc.
\dontrun{ # 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() }
prev_page()
Returns the previous page of results.
Collection$prev_page(...)
...
Other arguments that can be passed to core api()
function
like 'advanced_access', 'fields', etc.
\dontrun{ # 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() }
all()
Fetches all available items by iterating through all pages. Please be aware of the API rate limit for your request.
Collection$all(...)
...
Other arguments that can be passed to core api()
function
like 'advanced_access', 'fields', etc.
\dontrun{ # 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() }
clone()
The objects of this class are cloneable with this method.
Collection$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------
## Method `Collection$print`
## ------------------------------------------------
## Not run:
# 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()
## End(Not run)
## ------------------------------------------------
## Method `Collection$next_page`
## ------------------------------------------------
## Not run:
# 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()
## End(Not run)
## ------------------------------------------------
## Method `Collection$prev_page`
## ------------------------------------------------
## Not run:
# 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()
## End(Not run)
## ------------------------------------------------
## Method `Collection$all`
## ------------------------------------------------
## Not run:
# 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()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.