R/CSVDatatypeError.r

# OpenSilex API
#
# No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
#
# OpenAPI spec version: 1.0.0-rc+2
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' CSVDatatypeError Class
#'
#' @field rowIndex 
#' @field colIndex 
#' @field header 
#' @field value 
#' @field datatype 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
CSVDatatypeError <- R6::R6Class(
  'CSVDatatypeError',
  public = list(
    `rowIndex` = NULL,
    `colIndex` = NULL,
    `header` = NULL,
    `value` = NULL,
    `datatype` = NULL,
    initialize = function(`rowIndex`, `colIndex`, `header`, `value`, `datatype`){
      if (!missing(`rowIndex`)) {
        stopifnot(is.numeric(`rowIndex`), length(`rowIndex`) == 1)
        self$`rowIndex` <- `rowIndex`
      }
      if (!missing(`colIndex`)) {
        stopifnot(is.numeric(`colIndex`), length(`colIndex`) == 1)
        self$`colIndex` <- `colIndex`
      }
      if (!missing(`header`)) {
        stopifnot(is.character(`header`), length(`header`) == 1)
        self$`header` <- `header`
      }
      if (!missing(`value`)) {
        stopifnot(is.character(`value`), length(`value`) == 1)
        self$`value` <- `value`
      }
      if (!missing(`datatype`)) {
        stopifnot(is.character(`datatype`), length(`datatype`) == 1)
        self$`datatype` <- `datatype`
      }
    },
    toJSON = function() {
      CSVDatatypeErrorObject <- list()
      if (!is.null(self$`rowIndex`)) {
        CSVDatatypeErrorObject[['rowIndex']] <- self$`rowIndex`
      }
      if (!is.null(self$`colIndex`)) {
        CSVDatatypeErrorObject[['colIndex']] <- self$`colIndex`
      }
      if (!is.null(self$`header`)) {
        CSVDatatypeErrorObject[['header']] <- self$`header`
      }
      if (!is.null(self$`value`)) {
        CSVDatatypeErrorObject[['value']] <- self$`value`
      }
      if (!is.null(self$`datatype`)) {
        CSVDatatypeErrorObject[['datatype']] <- self$`datatype`
      }

      CSVDatatypeErrorObject
    },
    fromJSON = function(CSVDatatypeErrorJson) {
      CSVDatatypeErrorObject <- jsonlite::fromJSON(CSVDatatypeErrorJson)
      if (!is.null(CSVDatatypeErrorObject$`rowIndex`)) {
        self$`rowIndex` <- CSVDatatypeErrorObject$`rowIndex`
      }
      if (!is.null(CSVDatatypeErrorObject$`colIndex`)) {
        self$`colIndex` <- CSVDatatypeErrorObject$`colIndex`
      }
      if (!is.null(CSVDatatypeErrorObject$`header`)) {
        self$`header` <- CSVDatatypeErrorObject$`header`
      }
      if (!is.null(CSVDatatypeErrorObject$`value`)) {
        self$`value` <- CSVDatatypeErrorObject$`value`
      }
      if (!is.null(CSVDatatypeErrorObject$`datatype`)) {
        self$`datatype` <- CSVDatatypeErrorObject$`datatype`
      }
    },
    fromJSONObject = function(CSVDatatypeErrorObject) {
      if (!is.null(CSVDatatypeErrorObject$`rowIndex`)) {
        self$`rowIndex` <- CSVDatatypeErrorObject$`rowIndex`
      }
      if (!is.null(CSVDatatypeErrorObject$`colIndex`)) {
        self$`colIndex` <- CSVDatatypeErrorObject$`colIndex`
      }
      if (!is.null(CSVDatatypeErrorObject$`header`)) {
        self$`header` <- CSVDatatypeErrorObject$`header`
      }
      if (!is.null(CSVDatatypeErrorObject$`value`)) {
        self$`value` <- CSVDatatypeErrorObject$`value`
      }
      if (!is.null(CSVDatatypeErrorObject$`datatype`)) {
        self$`datatype` <- CSVDatatypeErrorObject$`datatype`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "rowIndex": %s,
           "colIndex": %s,
           "header": %s,
           "value": %s,
           "datatype": %s
        }',
        ifelse(is.null(self$`rowIndex`), "null",as.numeric(jsonlite::toJSON(self$`rowIndex`,auto_unbox=TRUE, null = "null"))),
        ifelse(is.null(self$`colIndex`), "null",as.numeric(jsonlite::toJSON(self$`colIndex`,auto_unbox=TRUE, null = "null"))),
        ifelse(is.null(self$`header`), "null",jsonlite::toJSON(self$`header`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`value`), "null",jsonlite::toJSON(self$`value`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`datatype`), "null",jsonlite::toJSON(self$`datatype`,auto_unbox=TRUE, null = "null"))
      )
    },
    fromJSONString = function(CSVDatatypeErrorJson) {
      CSVDatatypeErrorObject <- jsonlite::fromJSON(CSVDatatypeErrorJson)
      self$`rowIndex` <- CSVDatatypeErrorObject$`rowIndex`
      self$`colIndex` <- CSVDatatypeErrorObject$`colIndex`
      self$`header` <- CSVDatatypeErrorObject$`header`
      self$`value` <- CSVDatatypeErrorObject$`value`
      self$`datatype` <- CSVDatatypeErrorObject$`datatype`
    }
  )
)
OpenSILEX/opensilexClientToolsR documentation built on Jan. 28, 2022, 5:03 a.m.