R/ApiError.r

# Dkube api server
#
# No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
#
# OpenAPI spec version: 2.2.1.11
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' ApiError Class
#'
#' @field code 
#' @field message 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ApiError <- R6::R6Class(
  'ApiError',
  public = list(
    `code` = NULL,
    `message` = NULL,
    initialize = function(`code`, `message`){
      if (!missing(`code`)) {
        stopifnot(is.numeric(`code`), length(`code`) == 1)
        self$`code` <- `code`
      }
      if (!missing(`message`)) {
        stopifnot(is.character(`message`), length(`message`) == 1)
        self$`message` <- `message`
      }
    },
    toJSON = function() {
      ApiErrorObject <- list()
      if (!is.null(self$`code`)) {
        ApiErrorObject[['code']] <- self$`code`
      }
      if (!is.null(self$`message`)) {
        ApiErrorObject[['message']] <- self$`message`
      }

      ApiErrorObject
    },
    fromJSON = function(ApiErrorJson) {
      ApiErrorObject <- jsonlite::fromJSON(ApiErrorJson)
      if (!is.null(ApiErrorObject$`code`)) {
        self$`code` <- ApiErrorObject$`code`
      }
      if (!is.null(ApiErrorObject$`message`)) {
        self$`message` <- ApiErrorObject$`message`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "code": %d,
           "message": %s
        }',
        self$`code`,
        self$`message`
      )
    },
    fromJSONString = function(ApiErrorJson) {
      ApiErrorObject <- jsonlite::fromJSON(ApiErrorJson)
      self$`code` <- ApiErrorObject$`code`
      self$`message` <- ApiErrorObject$`message`
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.