R/query.R

# Influx OSS API Service
#
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
#
# The version of the OpenAPI document: 2.0.0
#
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title Query
#'
#' @description Query Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field extern  \link{File} [optional]
#'
#' @field query  character 
#'
#' @field type  character [optional]
#'
#' @field dialect  \link{Dialect} [optional]
#'
#' @field now  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Query <- R6::R6Class(
  'Query',
  public = list(
    `extern` = NULL,
    `query` = NULL,
    `type` = NULL,
    `dialect` = NULL,
    `now` = NULL,
    initialize = function(
        `query`, `extern`=NULL, `type`=NULL, `dialect`=NULL, `now`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`query`)) {
        stopifnot(is.character(`query`), length(`query`) == 1)
        self$`query` <- `query`
      }
      if (!is.null(`extern`)) {
        stopifnot(R6::is.R6(`extern`))
        self$`extern` <- `extern`
      }
      if (!is.null(`type`)) {
        stopifnot(is.character(`type`), length(`type`) == 1)
        self$`type` <- `type`
      }
      if (!is.null(`dialect`)) {
        stopifnot(R6::is.R6(`dialect`))
        self$`dialect` <- `dialect`
      }
      if (!is.null(`now`)) {
        stopifnot(is.character(`now`), length(`now`) == 1)
        self$`now` <- `now`
      }
    },
    toJSON = function() {
      QueryObject <- list()
      if (!is.null(self$`extern`)) {
        QueryObject[['extern']] <-
          self$`extern`$toJSON()
      }
      if (!is.null(self$`query`)) {
        QueryObject[['query']] <-
          self$`query`
      }
      if (!is.null(self$`type`)) {
        QueryObject[['type']] <-
          self$`type`
      }
      if (!is.null(self$`dialect`)) {
        QueryObject[['dialect']] <-
          self$`dialect`$toJSON()
      }
      if (!is.null(self$`now`)) {
        QueryObject[['now']] <-
          self$`now`
      }

      QueryObject
    },
    fromJSON = function(QueryJson) {
      QueryObject <- jsonlite::fromJSON(QueryJson)
      if (!is.null(QueryObject$`extern`)) {
        externObject <- File$new()
        externObject$fromJSON(jsonlite::toJSON(QueryObject$extern, auto_unbox = TRUE, digits = NA))
        self$`extern` <- externObject
      }
      if (!is.null(QueryObject$`query`)) {
        self$`query` <- QueryObject$`query`
      }
      if (!is.null(QueryObject$`type`)) {
        self$`type` <- QueryObject$`type`
      }
      if (!is.null(QueryObject$`dialect`)) {
        dialectObject <- Dialect$new()
        dialectObject$fromJSON(jsonlite::toJSON(QueryObject$dialect, auto_unbox = TRUE, digits = NA))
        self$`dialect` <- dialectObject
      }
      if (!is.null(QueryObject$`now`)) {
        self$`now` <- QueryObject$`now`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`extern`)) {
        sprintf(
        '"extern":
        %s
        ',
        jsonlite::toJSON(self$`extern`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`query`)) {
        sprintf(
        '"query":
          "%s"
                ',
        self$`query`
        )},
        if (!is.null(self$`type`)) {
        sprintf(
        '"type":
          "%s"
                ',
        self$`type`
        )},
        if (!is.null(self$`dialect`)) {
        sprintf(
        '"dialect":
        %s
        ',
        jsonlite::toJSON(self$`dialect`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`now`)) {
        sprintf(
        '"now":
          "%s"
                ',
        self$`now`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(QueryJson) {
      QueryObject <- jsonlite::fromJSON(QueryJson)
      self$`extern` <- File$new()$fromJSON(jsonlite::toJSON(QueryObject$extern, auto_unbox = TRUE, digits = NA))
      self$`query` <- QueryObject$`query`
      self$`type` <- QueryObject$`type`
      self$`dialect` <- Dialect$new()$fromJSON(jsonlite::toJSON(QueryObject$dialect, auto_unbox = TRUE, digits = NA))
      self$`now` <- QueryObject$`now`
      self
    }
  )
)

Try the influxdbclient package in your browser

Any scripts or data that you put into this service are public.

influxdbclient documentation built on Sept. 1, 2022, 5:07 p.m.