R/FacilityAddressDTO.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


#' FacilityAddressDTO Class
#'
#' @field countryName 
#' @field locality 
#' @field postalCode 
#' @field region 
#' @field streetAddress 
#' @field readableAddress 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
FacilityAddressDTO <- R6::R6Class(
  'FacilityAddressDTO',
  public = list(
    `countryName` = NULL,
    `locality` = NULL,
    `postalCode` = NULL,
    `region` = NULL,
    `streetAddress` = NULL,
    `readableAddress` = NULL,
    initialize = function(`countryName`, `locality`, `postalCode`, `region`, `streetAddress`, `readableAddress`){
      if (!missing(`countryName`)) {
        stopifnot(is.character(`countryName`), length(`countryName`) == 1)
        self$`countryName` <- `countryName`
      }
      if (!missing(`locality`)) {
        stopifnot(is.character(`locality`), length(`locality`) == 1)
        self$`locality` <- `locality`
      }
      if (!missing(`postalCode`)) {
        stopifnot(is.character(`postalCode`), length(`postalCode`) == 1)
        self$`postalCode` <- `postalCode`
      }
      if (!missing(`region`)) {
        stopifnot(is.character(`region`), length(`region`) == 1)
        self$`region` <- `region`
      }
      if (!missing(`streetAddress`)) {
        stopifnot(is.character(`streetAddress`), length(`streetAddress`) == 1)
        self$`streetAddress` <- `streetAddress`
      }
      if (!missing(`readableAddress`)) {
        stopifnot(is.character(`readableAddress`), length(`readableAddress`) == 1)
        self$`readableAddress` <- `readableAddress`
      }
    },
    toJSON = function() {
      FacilityAddressDTOObject <- list()
      if (!is.null(self$`countryName`)) {
        FacilityAddressDTOObject[['countryName']] <- self$`countryName`
      }
      if (!is.null(self$`locality`)) {
        FacilityAddressDTOObject[['locality']] <- self$`locality`
      }
      if (!is.null(self$`postalCode`)) {
        FacilityAddressDTOObject[['postalCode']] <- self$`postalCode`
      }
      if (!is.null(self$`region`)) {
        FacilityAddressDTOObject[['region']] <- self$`region`
      }
      if (!is.null(self$`streetAddress`)) {
        FacilityAddressDTOObject[['streetAddress']] <- self$`streetAddress`
      }
      if (!is.null(self$`readableAddress`)) {
        FacilityAddressDTOObject[['readableAddress']] <- self$`readableAddress`
      }

      FacilityAddressDTOObject
    },
    fromJSON = function(FacilityAddressDTOJson) {
      FacilityAddressDTOObject <- jsonlite::fromJSON(FacilityAddressDTOJson)
      if (!is.null(FacilityAddressDTOObject$`countryName`)) {
        self$`countryName` <- FacilityAddressDTOObject$`countryName`
      }
      if (!is.null(FacilityAddressDTOObject$`locality`)) {
        self$`locality` <- FacilityAddressDTOObject$`locality`
      }
      if (!is.null(FacilityAddressDTOObject$`postalCode`)) {
        self$`postalCode` <- FacilityAddressDTOObject$`postalCode`
      }
      if (!is.null(FacilityAddressDTOObject$`region`)) {
        self$`region` <- FacilityAddressDTOObject$`region`
      }
      if (!is.null(FacilityAddressDTOObject$`streetAddress`)) {
        self$`streetAddress` <- FacilityAddressDTOObject$`streetAddress`
      }
      if (!is.null(FacilityAddressDTOObject$`readableAddress`)) {
        self$`readableAddress` <- FacilityAddressDTOObject$`readableAddress`
      }
    },
    fromJSONObject = function(FacilityAddressDTOObject) {
      if (!is.null(FacilityAddressDTOObject$`countryName`)) {
        self$`countryName` <- FacilityAddressDTOObject$`countryName`
      }
      if (!is.null(FacilityAddressDTOObject$`locality`)) {
        self$`locality` <- FacilityAddressDTOObject$`locality`
      }
      if (!is.null(FacilityAddressDTOObject$`postalCode`)) {
        self$`postalCode` <- FacilityAddressDTOObject$`postalCode`
      }
      if (!is.null(FacilityAddressDTOObject$`region`)) {
        self$`region` <- FacilityAddressDTOObject$`region`
      }
      if (!is.null(FacilityAddressDTOObject$`streetAddress`)) {
        self$`streetAddress` <- FacilityAddressDTOObject$`streetAddress`
      }
      if (!is.null(FacilityAddressDTOObject$`readableAddress`)) {
        self$`readableAddress` <- FacilityAddressDTOObject$`readableAddress`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "countryName": %s,
           "locality": %s,
           "postalCode": %s,
           "region": %s,
           "streetAddress": %s,
           "readableAddress": %s
        }',
        ifelse(is.null(self$`countryName`), "null",jsonlite::toJSON(self$`countryName`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`locality`), "null",jsonlite::toJSON(self$`locality`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`postalCode`), "null",jsonlite::toJSON(self$`postalCode`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`region`), "null",jsonlite::toJSON(self$`region`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`streetAddress`), "null",jsonlite::toJSON(self$`streetAddress`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`readableAddress`), "null",jsonlite::toJSON(self$`readableAddress`,auto_unbox=TRUE, null = "null"))
      )
    },
    fromJSONString = function(FacilityAddressDTOJson) {
      FacilityAddressDTOObject <- jsonlite::fromJSON(FacilityAddressDTOJson)
      self$`countryName` <- FacilityAddressDTOObject$`countryName`
      self$`locality` <- FacilityAddressDTOObject$`locality`
      self$`postalCode` <- FacilityAddressDTOObject$`postalCode`
      self$`region` <- FacilityAddressDTOObject$`region`
      self$`streetAddress` <- FacilityAddressDTOObject$`streetAddress`
      self$`readableAddress` <- FacilityAddressDTOObject$`readableAddress`
    }
  )
)
OpenSILEX/opensilexClientToolsR documentation built on Jan. 28, 2022, 5:03 a.m.