R/QueryRequest.r

# 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


#' QueryRequest Class
#'
#' @field sql 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
QueryRequest <- R6::R6Class(
  'QueryRequest',
  public = list(
    `sql` = NULL,
    initialize = function(`sql`){
      if (!missing(`sql`)) {
        stopifnot(R6::is.R6(`sql`))
        self$`sql` <- `sql`
      }
    },
    toJSON = function() {
      QueryRequestObject <- list()
      if (!is.null(self$`sql`)) {
        QueryRequestObject[['sql']] <- self$`sql`$toJSON()
      }

      QueryRequestObject
    },
    fromJSON = function(QueryRequestJson) {
      QueryRequestObject <- jsonlite::fromJSON(QueryRequestJson)
      if (!is.null(QueryRequestObject$`sql`)) {
        sqlObject <- QueryRequestSql$new()
        sqlObject$fromJSON(jsonlite::toJSON(QueryRequestObject$sql, auto_unbox = TRUE))
        self$`sql` <- sqlObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "sql": %s
        }',
        self$`sql`$toJSONString()
      )
    },
    fromJSONString = function(QueryRequestJson) {
      QueryRequestObject <- jsonlite::fromJSON(QueryRequestJson)
      QueryRequestSqlObject <- QueryRequestSql$new()
      self$`sql` <- QueryRequestSqlObject$fromJSON(jsonlite::toJSON(QueryRequestObject$sql, auto_unbox = TRUE))
    }
  )
)
rockset/RRockset documentation built on June 20, 2019, 2:51 p.m.