R/dialect.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 Dialect
#'
#' @description Dialect Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field header  character [optional]
#'
#' @field delimiter  character [optional]
#'
#' @field annotations  list( character ) [optional]
#'
#' @field commentPrefix  character [optional]
#'
#' @field dateTimeFormat  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Dialect <- R6::R6Class(
  'Dialect',
  public = list(
    `header` = NULL,
    `delimiter` = NULL,
    `annotations` = NULL,
    `commentPrefix` = NULL,
    `dateTimeFormat` = NULL,
    initialize = function(
        `header`=TRUE, `delimiter`=',', `annotations`=NULL, `commentPrefix`='#', `dateTimeFormat`='RFC3339', ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`header`)) {
        self$`header` <- `header`
      }
      if (!is.null(`delimiter`)) {
        stopifnot(is.character(`delimiter`), length(`delimiter`) == 1)
        self$`delimiter` <- `delimiter`
      }
      if (!is.null(`annotations`)) {
        stopifnot(is.vector(`annotations`), length(`annotations`) != 0)
        sapply(`annotations`, function(x) stopifnot(is.character(x)))
        self$`annotations` <- `annotations`
      }
      if (!is.null(`commentPrefix`)) {
        stopifnot(is.character(`commentPrefix`), length(`commentPrefix`) == 1)
        self$`commentPrefix` <- `commentPrefix`
      }
      if (!is.null(`dateTimeFormat`)) {
        stopifnot(is.character(`dateTimeFormat`), length(`dateTimeFormat`) == 1)
        self$`dateTimeFormat` <- `dateTimeFormat`
      }
    },
    toJSON = function() {
      DialectObject <- list()
      if (!is.null(self$`header`)) {
        DialectObject[['header']] <-
          self$`header`
      }
      if (!is.null(self$`delimiter`)) {
        DialectObject[['delimiter']] <-
          self$`delimiter`
      }
      if (!is.null(self$`annotations`)) {
        DialectObject[['annotations']] <-
          self$`annotations`
      }
      if (!is.null(self$`commentPrefix`)) {
        DialectObject[['commentPrefix']] <-
          self$`commentPrefix`
      }
      if (!is.null(self$`dateTimeFormat`)) {
        DialectObject[['dateTimeFormat']] <-
          self$`dateTimeFormat`
      }

      DialectObject
    },
    fromJSON = function(DialectJson) {
      DialectObject <- jsonlite::fromJSON(DialectJson)
      if (!is.null(DialectObject$`header`)) {
        self$`header` <- DialectObject$`header`
      }
      if (!is.null(DialectObject$`delimiter`)) {
        self$`delimiter` <- DialectObject$`delimiter`
      }
      if (!is.null(DialectObject$`annotations`)) {
        self$`annotations` <- ApiClient$new()$deserializeObj(DialectObject$`annotations`, "set[character]", loadNamespace("influxdbclient"))
      }
      if (!is.null(DialectObject$`commentPrefix`)) {
        self$`commentPrefix` <- DialectObject$`commentPrefix`
      }
      if (!is.null(DialectObject$`dateTimeFormat`)) {
        self$`dateTimeFormat` <- DialectObject$`dateTimeFormat`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`header`)) {
        sprintf(
        '"header":
          "%s"
                ',
        self$`header`
        )},
        if (!is.null(self$`delimiter`)) {
        sprintf(
        '"delimiter":
          "%s"
                ',
        self$`delimiter`
        )},
        if (!is.null(self$`annotations`)) {
        sprintf(
        '"annotations":
           [%s]
        ',
        paste(unlist(lapply(self$`annotations`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`commentPrefix`)) {
        sprintf(
        '"commentPrefix":
          "%s"
                ',
        self$`commentPrefix`
        )},
        if (!is.null(self$`dateTimeFormat`)) {
        sprintf(
        '"dateTimeFormat":
          "%s"
                ',
        self$`dateTimeFormat`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(DialectJson) {
      DialectObject <- jsonlite::fromJSON(DialectJson)
      self$`header` <- DialectObject$`header`
      self$`delimiter` <- DialectObject$`delimiter`
      self$`annotations` <- ApiClient$new()$deserializeObj(DialectObject$`annotations`, "set[character]", loadNamespace("influxdbclient"))
      self$`commentPrefix` <- DialectObject$`commentPrefix`
      self$`dateTimeFormat` <- DialectObject$`dateTimeFormat`
      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.