# REST API
#
# Rockset's REST API allows for creating and managing all resources in Rockset. Each supported endpoint is documented below. All requests must be authorized with a Rockset API key, which can be created in the [Rockset console](https://console.rockset.com). The API key must be provided as `ApiKey <api_key>` in the `Authorization` request header. For example: ``` Authorization: ApiKey aB35kDjg93J5nsf4GjwMeErAVd832F7ad4vhsW1S02kfZiab42sTsfW5Sxt25asT ``` All endpoints are only accessible via https. Build something awesome!
#
# OpenAPI spec version: v1
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' QueryResponse Class
#'
#' @field results
#' @field fields
#' @field stats
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
QueryResponse <- R6::R6Class(
'QueryResponse',
public = list(
`results` = NULL,
`fields` = NULL,
`stats` = NULL,
initialize = function(`results`, `fields`, `stats`){
if (!missing(`results`)) {
stopifnot(is.list(`results`), length(`results`) != 0)
lapply(`results`, function(x) stopifnot(R6::is.R6(x)))
self$`results` <- `results`
}
if (!missing(`fields`)) {
stopifnot(is.list(`fields`), length(`fields`) != 0)
lapply(`fields`, function(x) stopifnot(R6::is.R6(x)))
self$`fields` <- `fields`
}
if (!missing(`stats`)) {
stopifnot(R6::is.R6(`stats`))
self$`stats` <- `stats`
}
},
toJSON = function() {
QueryResponseObject <- list()
if (!is.null(self$`results`)) {
QueryResponseObject[['results']] <- lapply(self$`results`, function(x) x$toJSON())
}
if (!is.null(self$`fields`)) {
QueryResponseObject[['fields']] <- lapply(self$`fields`, function(x) x$toJSON())
}
if (!is.null(self$`stats`)) {
QueryResponseObject[['stats']] <- self$`stats`$toJSON()
}
QueryResponseObject
},
fromJSON = function(QueryResponseJson) {
QueryResponseObject <- jsonlite::fromJSON(QueryResponseJson)
if (!is.null(QueryResponseObject$`results`)) {
self$`results` <- QueryResponseObject$`results`
}
if (!is.null(QueryResponseObject$`fields`)) {
self$`fields` <- lapply(QueryResponseObject$`fields`, function(x) {
fieldsObject <- QueryFieldType$new()
fieldsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
fieldsObject
})
}
if (!is.null(QueryResponseObject$`stats`)) {
statsObject <- QueryResponseStats$new()
statsObject$fromJSON(jsonlite::toJSON(QueryResponseObject$stats, auto_unbox = TRUE))
self$`stats` <- statsObject
}
},
toJSONString = function() {
sprintf(
'{
"results": [%s],
"fields": [%s],
"stats": %s
}',
lapply(self$`results`, function(x) paste(x$toJSON(), sep=",")),
lapply(self$`fields`, function(x) paste(x$toJSON(), sep=",")),
self$`stats`$toJSON()
)
},
fromJSONString = function(QueryResponseJson) {
QueryResponseObject <- jsonlite::fromJSON(QueryResponseJson)
print(QueryResponseObject)
self$`results` <- QueryResponseObject$`results`
self$`fields` <- lapply(QueryResponseObject$`fields`, function(x) QueryFieldType$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
QueryResponseStatsObject <- QueryResponseStats$new()
self$`stats` <- QueryResponseStatsObject$fromJSON(jsonlite::toJSON(QueryResponseObject$stats, auto_unbox = TRUE))
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.