R/StatusException.r

# sunagriAPI
#
# An instance of OpenSILEX WebService
#
# OpenAPI spec version: 3.3.0
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


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

      StatusExceptionObject
    },
    fromJSON = function(StatusExceptionJson) {
      StatusExceptionObject <- jsonlite::fromJSON(StatusExceptionJson)
      if (!is.null(StatusExceptionObject$`type`)) {
        self$`type` <- StatusExceptionObject$`type`
      }
      if (!is.null(StatusExceptionObject$`href`)) {
        self$`href` <- StatusExceptionObject$`href`
      }
      if (!is.null(StatusExceptionObject$`details`)) {
        self$`details` <- StatusExceptionObject$`details`
      }
    },
    fromJSONObject = function(StatusExceptionObject) {
      if (!is.null(StatusExceptionObject$`type`)) {
        self$`type` <- StatusExceptionObject$`type`
      }
      if (!is.null(StatusExceptionObject$`href`)) {
        self$`href` <- StatusExceptionObject$`href`
      }
      if (!is.null(StatusExceptionObject$`details`)) {
        self$`details` <- StatusExceptionObject$`details`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "type": %s,
           "href": %s,
           "details": %s
        }',
        jsonlite::toJSON(self$`type`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`href`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`details`,auto_unbox=TRUE, null = "null")
      )
    },
    fromJSONString = function(StatusExceptionJson) {
      StatusExceptionObject <- jsonlite::fromJSON(StatusExceptionJson)
      self$`type` <- StatusExceptionObject$`type`
      self$`href` <- StatusExceptionObject$`href`
      self$`details` <- StatusExceptionObject$`details`
    }
  )
)
OpenSILEX/phis-ws-client-r-tool documentation built on Sept. 10, 2020, 8:42 a.m.