R/address.R

# LocationIQ
#
# LocationIQ provides flexible enterprise-grade location based solutions. We work with developers, startups and enterprises worldwide serving billions of requests everyday. This page provides an overview of the technical aspects of our API and will help you get started.
#
# The version of the OpenAPI document: 1.1.0
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title Address
#' @description Address Class
#' @format An \code{R6Class} generator object
#' @field house_number  character [optional]
#'
#' @field road  character [optional]
#'
#' @field residential  character [optional]
#'
#' @field borough  character [optional]
#'
#' @field neighbourhood  character [optional]
#'
#' @field quarter  character [optional]
#'
#' @field hamlet  character [optional]
#'
#' @field suburb  character [optional]
#'
#' @field island  character [optional]
#'
#' @field village  character [optional]
#'
#' @field town  character [optional]
#'
#' @field city  character [optional]
#'
#' @field city_district  character [optional]
#'
#' @field county  character [optional]
#'
#' @field state  character [optional]
#'
#' @field state_district  character [optional]
#'
#' @field postcode  character [optional]
#'
#' @field country  character [optional]
#'
#' @field country_code  character [optional]
#'
#' @field state_code  character [optional]
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Address <- R6::R6Class(
  'Address',
  public = list(
    `house_number` = NULL,
    `road` = NULL,
    `residential` = NULL,
    `borough` = NULL,
    `neighbourhood` = NULL,
    `quarter` = NULL,
    `hamlet` = NULL,
    `suburb` = NULL,
    `island` = NULL,
    `village` = NULL,
    `town` = NULL,
    `city` = NULL,
    `city_district` = NULL,
    `county` = NULL,
    `state` = NULL,
    `state_district` = NULL,
    `postcode` = NULL,
    `country` = NULL,
    `country_code` = NULL,
    `state_code` = NULL,
    initialize = function(`house_number`=NULL, `road`=NULL, `residential`=NULL, `borough`=NULL, `neighbourhood`=NULL, `quarter`=NULL, `hamlet`=NULL, `suburb`=NULL, `island`=NULL, `village`=NULL, `town`=NULL, `city`=NULL, `city_district`=NULL, `county`=NULL, `state`=NULL, `state_district`=NULL, `postcode`=NULL, `country`=NULL, `country_code`=NULL, `state_code`=NULL, ...){
      local.optional.var <- list(...)
      if (!is.null(`house_number`)) {
        stopifnot(is.character(`house_number`), length(`house_number`) == 1)
        self$`house_number` <- `house_number`
      }
      if (!is.null(`road`)) {
        stopifnot(is.character(`road`), length(`road`) == 1)
        self$`road` <- `road`
      }
      if (!is.null(`residential`)) {
        stopifnot(is.character(`residential`), length(`residential`) == 1)
        self$`residential` <- `residential`
      }
      if (!is.null(`borough`)) {
        stopifnot(is.character(`borough`), length(`borough`) == 1)
        self$`borough` <- `borough`
      }
      if (!is.null(`neighbourhood`)) {
        stopifnot(is.character(`neighbourhood`), length(`neighbourhood`) == 1)
        self$`neighbourhood` <- `neighbourhood`
      }
      if (!is.null(`quarter`)) {
        stopifnot(is.character(`quarter`), length(`quarter`) == 1)
        self$`quarter` <- `quarter`
      }
      if (!is.null(`hamlet`)) {
        stopifnot(is.character(`hamlet`), length(`hamlet`) == 1)
        self$`hamlet` <- `hamlet`
      }
      if (!is.null(`suburb`)) {
        stopifnot(is.character(`suburb`), length(`suburb`) == 1)
        self$`suburb` <- `suburb`
      }
      if (!is.null(`island`)) {
        stopifnot(is.character(`island`), length(`island`) == 1)
        self$`island` <- `island`
      }
      if (!is.null(`village`)) {
        stopifnot(is.character(`village`), length(`village`) == 1)
        self$`village` <- `village`
      }
      if (!is.null(`town`)) {
        stopifnot(is.character(`town`), length(`town`) == 1)
        self$`town` <- `town`
      }
      if (!is.null(`city`)) {
        stopifnot(is.character(`city`), length(`city`) == 1)
        self$`city` <- `city`
      }
      if (!is.null(`city_district`)) {
        stopifnot(is.character(`city_district`), length(`city_district`) == 1)
        self$`city_district` <- `city_district`
      }
      if (!is.null(`county`)) {
        stopifnot(is.character(`county`), length(`county`) == 1)
        self$`county` <- `county`
      }
      if (!is.null(`state`)) {
        stopifnot(is.character(`state`), length(`state`) == 1)
        self$`state` <- `state`
      }
      if (!is.null(`state_district`)) {
        stopifnot(is.character(`state_district`), length(`state_district`) == 1)
        self$`state_district` <- `state_district`
      }
      if (!is.null(`postcode`)) {
        stopifnot(is.character(`postcode`), length(`postcode`) == 1)
        self$`postcode` <- `postcode`
      }
      if (!is.null(`country`)) {
        stopifnot(is.character(`country`), length(`country`) == 1)
        self$`country` <- `country`
      }
      if (!is.null(`country_code`)) {
        stopifnot(is.character(`country_code`), length(`country_code`) == 1)
        self$`country_code` <- `country_code`
      }
      if (!is.null(`state_code`)) {
        stopifnot(is.character(`state_code`), length(`state_code`) == 1)
        self$`state_code` <- `state_code`
      }
    },
    toJSON = function() {
      AddressObject <- list()
      if (!is.null(self$`house_number`)) {
        AddressObject[['house_number']] <-
          self$`house_number`
      }
      if (!is.null(self$`road`)) {
        AddressObject[['road']] <-
          self$`road`
      }
      if (!is.null(self$`residential`)) {
        AddressObject[['residential']] <-
          self$`residential`
      }
      if (!is.null(self$`borough`)) {
        AddressObject[['borough']] <-
          self$`borough`
      }
      if (!is.null(self$`neighbourhood`)) {
        AddressObject[['neighbourhood']] <-
          self$`neighbourhood`
      }
      if (!is.null(self$`quarter`)) {
        AddressObject[['quarter']] <-
          self$`quarter`
      }
      if (!is.null(self$`hamlet`)) {
        AddressObject[['hamlet']] <-
          self$`hamlet`
      }
      if (!is.null(self$`suburb`)) {
        AddressObject[['suburb']] <-
          self$`suburb`
      }
      if (!is.null(self$`island`)) {
        AddressObject[['island']] <-
          self$`island`
      }
      if (!is.null(self$`village`)) {
        AddressObject[['village']] <-
          self$`village`
      }
      if (!is.null(self$`town`)) {
        AddressObject[['town']] <-
          self$`town`
      }
      if (!is.null(self$`city`)) {
        AddressObject[['city']] <-
          self$`city`
      }
      if (!is.null(self$`city_district`)) {
        AddressObject[['city_district']] <-
          self$`city_district`
      }
      if (!is.null(self$`county`)) {
        AddressObject[['county']] <-
          self$`county`
      }
      if (!is.null(self$`state`)) {
        AddressObject[['state']] <-
          self$`state`
      }
      if (!is.null(self$`state_district`)) {
        AddressObject[['state_district']] <-
          self$`state_district`
      }
      if (!is.null(self$`postcode`)) {
        AddressObject[['postcode']] <-
          self$`postcode`
      }
      if (!is.null(self$`country`)) {
        AddressObject[['country']] <-
          self$`country`
      }
      if (!is.null(self$`country_code`)) {
        AddressObject[['country_code']] <-
          self$`country_code`
      }
      if (!is.null(self$`state_code`)) {
        AddressObject[['state_code']] <-
          self$`state_code`
      }

      AddressObject
    },
    fromJSON = function(AddressJson) {
      AddressObject <- jsonlite::fromJSON(AddressJson)
      if (!is.null(AddressObject$`house_number`)) {
        self$`house_number` <- AddressObject$`house_number`
      }
      if (!is.null(AddressObject$`road`)) {
        self$`road` <- AddressObject$`road`
      }
      if (!is.null(AddressObject$`residential`)) {
        self$`residential` <- AddressObject$`residential`
      }
      if (!is.null(AddressObject$`borough`)) {
        self$`borough` <- AddressObject$`borough`
      }
      if (!is.null(AddressObject$`neighbourhood`)) {
        self$`neighbourhood` <- AddressObject$`neighbourhood`
      }
      if (!is.null(AddressObject$`quarter`)) {
        self$`quarter` <- AddressObject$`quarter`
      }
      if (!is.null(AddressObject$`hamlet`)) {
        self$`hamlet` <- AddressObject$`hamlet`
      }
      if (!is.null(AddressObject$`suburb`)) {
        self$`suburb` <- AddressObject$`suburb`
      }
      if (!is.null(AddressObject$`island`)) {
        self$`island` <- AddressObject$`island`
      }
      if (!is.null(AddressObject$`village`)) {
        self$`village` <- AddressObject$`village`
      }
      if (!is.null(AddressObject$`town`)) {
        self$`town` <- AddressObject$`town`
      }
      if (!is.null(AddressObject$`city`)) {
        self$`city` <- AddressObject$`city`
      }
      if (!is.null(AddressObject$`city_district`)) {
        self$`city_district` <- AddressObject$`city_district`
      }
      if (!is.null(AddressObject$`county`)) {
        self$`county` <- AddressObject$`county`
      }
      if (!is.null(AddressObject$`state`)) {
        self$`state` <- AddressObject$`state`
      }
      if (!is.null(AddressObject$`state_district`)) {
        self$`state_district` <- AddressObject$`state_district`
      }
      if (!is.null(AddressObject$`postcode`)) {
        self$`postcode` <- AddressObject$`postcode`
      }
      if (!is.null(AddressObject$`country`)) {
        self$`country` <- AddressObject$`country`
      }
      if (!is.null(AddressObject$`country_code`)) {
        self$`country_code` <- AddressObject$`country_code`
      }
      if (!is.null(AddressObject$`state_code`)) {
        self$`state_code` <- AddressObject$`state_code`
      }
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`house_number`)) {
        sprintf(
        '"house_number":
          "%s"
                ',
        self$`house_number`
        )},
        if (!is.null(self$`road`)) {
        sprintf(
        '"road":
          "%s"
                ',
        self$`road`
        )},
        if (!is.null(self$`residential`)) {
        sprintf(
        '"residential":
          "%s"
                ',
        self$`residential`
        )},
        if (!is.null(self$`borough`)) {
        sprintf(
        '"borough":
          "%s"
                ',
        self$`borough`
        )},
        if (!is.null(self$`neighbourhood`)) {
        sprintf(
        '"neighbourhood":
          "%s"
                ',
        self$`neighbourhood`
        )},
        if (!is.null(self$`quarter`)) {
        sprintf(
        '"quarter":
          "%s"
                ',
        self$`quarter`
        )},
        if (!is.null(self$`hamlet`)) {
        sprintf(
        '"hamlet":
          "%s"
                ',
        self$`hamlet`
        )},
        if (!is.null(self$`suburb`)) {
        sprintf(
        '"suburb":
          "%s"
                ',
        self$`suburb`
        )},
        if (!is.null(self$`island`)) {
        sprintf(
        '"island":
          "%s"
                ',
        self$`island`
        )},
        if (!is.null(self$`village`)) {
        sprintf(
        '"village":
          "%s"
                ',
        self$`village`
        )},
        if (!is.null(self$`town`)) {
        sprintf(
        '"town":
          "%s"
                ',
        self$`town`
        )},
        if (!is.null(self$`city`)) {
        sprintf(
        '"city":
          "%s"
                ',
        self$`city`
        )},
        if (!is.null(self$`city_district`)) {
        sprintf(
        '"city_district":
          "%s"
                ',
        self$`city_district`
        )},
        if (!is.null(self$`county`)) {
        sprintf(
        '"county":
          "%s"
                ',
        self$`county`
        )},
        if (!is.null(self$`state`)) {
        sprintf(
        '"state":
          "%s"
                ',
        self$`state`
        )},
        if (!is.null(self$`state_district`)) {
        sprintf(
        '"state_district":
          "%s"
                ',
        self$`state_district`
        )},
        if (!is.null(self$`postcode`)) {
        sprintf(
        '"postcode":
          "%s"
                ',
        self$`postcode`
        )},
        if (!is.null(self$`country`)) {
        sprintf(
        '"country":
          "%s"
                ',
        self$`country`
        )},
        if (!is.null(self$`country_code`)) {
        sprintf(
        '"country_code":
          "%s"
                ',
        self$`country_code`
        )},
        if (!is.null(self$`state_code`)) {
        sprintf(
        '"state_code":
          "%s"
                ',
        self$`state_code`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(AddressJson) {
      AddressObject <- jsonlite::fromJSON(AddressJson)
      self$`house_number` <- AddressObject$`house_number`
      self$`road` <- AddressObject$`road`
      self$`residential` <- AddressObject$`residential`
      self$`borough` <- AddressObject$`borough`
      self$`neighbourhood` <- AddressObject$`neighbourhood`
      self$`quarter` <- AddressObject$`quarter`
      self$`hamlet` <- AddressObject$`hamlet`
      self$`suburb` <- AddressObject$`suburb`
      self$`island` <- AddressObject$`island`
      self$`village` <- AddressObject$`village`
      self$`town` <- AddressObject$`town`
      self$`city` <- AddressObject$`city`
      self$`city_district` <- AddressObject$`city_district`
      self$`county` <- AddressObject$`county`
      self$`state` <- AddressObject$`state`
      self$`state_district` <- AddressObject$`state_district`
      self$`postcode` <- AddressObject$`postcode`
      self$`country` <- AddressObject$`country`
      self$`country_code` <- AddressObject$`country_code`
      self$`state_code` <- AddressObject$`state_code`
      self
    }
  )
)
location-iq/locationiq-r-client documentation built on Feb. 28, 2020, 9:42 p.m.