# 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 Location
#' @description Location Class
#' @format An \code{R6Class} generator object
#' @field distance numeric [optional]
#'
#' @field place_id character [optional]
#'
#' @field licence character [optional]
#'
#' @field osm_type character [optional]
#'
#' @field osm_id character [optional]
#'
#' @field boundingbox list( character ) [optional]
#'
#' @field lat character [optional]
#'
#' @field lon character [optional]
#'
#' @field display_name character [optional]
#'
#' @field class character [optional]
#'
#' @field type character [optional]
#'
#' @field importance numeric [optional]
#'
#' @field address \link{Address} [optional]
#'
#' @field namedetails \link{Namedetails} [optional]
#'
#' @field matchquality \link{Matchquality} [optional]
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Location <- R6::R6Class(
'Location',
public = list(
`distance` = NULL,
`place_id` = NULL,
`licence` = NULL,
`osm_type` = NULL,
`osm_id` = NULL,
`boundingbox` = NULL,
`lat` = NULL,
`lon` = NULL,
`display_name` = NULL,
`class` = NULL,
`type` = NULL,
`importance` = NULL,
`address` = NULL,
`namedetails` = NULL,
`matchquality` = NULL,
initialize = function(`distance`=NULL, `place_id`=NULL, `licence`=NULL, `osm_type`=NULL, `osm_id`=NULL, `boundingbox`=NULL, `lat`=NULL, `lon`=NULL, `display_name`=NULL, `class`=NULL, `type`=NULL, `importance`=NULL, `address`=NULL, `namedetails`=NULL, `matchquality`=NULL, ...){
local.optional.var <- list(...)
if (!is.null(`distance`)) {
self$`distance` <- `distance`
}
if (!is.null(`place_id`)) {
stopifnot(is.character(`place_id`), length(`place_id`) == 1)
self$`place_id` <- `place_id`
}
if (!is.null(`licence`)) {
stopifnot(is.character(`licence`), length(`licence`) == 1)
self$`licence` <- `licence`
}
if (!is.null(`osm_type`)) {
stopifnot(is.character(`osm_type`), length(`osm_type`) == 1)
self$`osm_type` <- `osm_type`
}
if (!is.null(`osm_id`)) {
stopifnot(is.character(`osm_id`), length(`osm_id`) == 1)
self$`osm_id` <- `osm_id`
}
if (!is.null(`boundingbox`)) {
stopifnot(is.vector(`boundingbox`), length(`boundingbox`) != 0)
sapply(`boundingbox`, function(x) stopifnot(is.character(x)))
self$`boundingbox` <- `boundingbox`
}
if (!is.null(`lat`)) {
stopifnot(is.character(`lat`), length(`lat`) == 1)
self$`lat` <- `lat`
}
if (!is.null(`lon`)) {
stopifnot(is.character(`lon`), length(`lon`) == 1)
self$`lon` <- `lon`
}
if (!is.null(`display_name`)) {
stopifnot(is.character(`display_name`), length(`display_name`) == 1)
self$`display_name` <- `display_name`
}
if (!is.null(`class`)) {
stopifnot(is.character(`class`), length(`class`) == 1)
self$`class` <- `class`
}
if (!is.null(`type`)) {
stopifnot(is.character(`type`), length(`type`) == 1)
self$`type` <- `type`
}
if (!is.null(`importance`)) {
self$`importance` <- `importance`
}
if (!is.null(`address`)) {
stopifnot(R6::is.R6(`address`))
self$`address` <- `address`
}
if (!is.null(`namedetails`)) {
stopifnot(R6::is.R6(`namedetails`))
self$`namedetails` <- `namedetails`
}
if (!is.null(`matchquality`)) {
stopifnot(R6::is.R6(`matchquality`))
self$`matchquality` <- `matchquality`
}
},
toJSON = function() {
LocationObject <- list()
if (!is.null(self$`distance`)) {
LocationObject[['distance']] <-
self$`distance`
}
if (!is.null(self$`place_id`)) {
LocationObject[['place_id']] <-
self$`place_id`
}
if (!is.null(self$`licence`)) {
LocationObject[['licence']] <-
self$`licence`
}
if (!is.null(self$`osm_type`)) {
LocationObject[['osm_type']] <-
self$`osm_type`
}
if (!is.null(self$`osm_id`)) {
LocationObject[['osm_id']] <-
self$`osm_id`
}
if (!is.null(self$`boundingbox`)) {
LocationObject[['boundingbox']] <-
self$`boundingbox`
}
if (!is.null(self$`lat`)) {
LocationObject[['lat']] <-
self$`lat`
}
if (!is.null(self$`lon`)) {
LocationObject[['lon']] <-
self$`lon`
}
if (!is.null(self$`display_name`)) {
LocationObject[['display_name']] <-
self$`display_name`
}
if (!is.null(self$`class`)) {
LocationObject[['class']] <-
self$`class`
}
if (!is.null(self$`type`)) {
LocationObject[['type']] <-
self$`type`
}
if (!is.null(self$`importance`)) {
LocationObject[['importance']] <-
self$`importance`
}
if (!is.null(self$`address`)) {
LocationObject[['address']] <-
self$`address`$toJSON()
}
if (!is.null(self$`namedetails`)) {
LocationObject[['namedetails']] <-
self$`namedetails`$toJSON()
}
if (!is.null(self$`matchquality`)) {
LocationObject[['matchquality']] <-
self$`matchquality`$toJSON()
}
LocationObject
},
fromJSON = function(LocationJson) {
LocationObject <- jsonlite::fromJSON(LocationJson)
if (!is.null(LocationObject$`distance`)) {
self$`distance` <- LocationObject$`distance`
}
if (!is.null(LocationObject$`place_id`)) {
self$`place_id` <- LocationObject$`place_id`
}
if (!is.null(LocationObject$`licence`)) {
self$`licence` <- LocationObject$`licence`
}
if (!is.null(LocationObject$`osm_type`)) {
self$`osm_type` <- LocationObject$`osm_type`
}
if (!is.null(LocationObject$`osm_id`)) {
self$`osm_id` <- LocationObject$`osm_id`
}
if (!is.null(LocationObject$`boundingbox`)) {
self$`boundingbox` <- ApiClient$new()$deserializeObj(LocationObject$`boundingbox`, "array[character]", loadNamespace("locationiq"))
}
if (!is.null(LocationObject$`lat`)) {
self$`lat` <- LocationObject$`lat`
}
if (!is.null(LocationObject$`lon`)) {
self$`lon` <- LocationObject$`lon`
}
if (!is.null(LocationObject$`display_name`)) {
self$`display_name` <- LocationObject$`display_name`
}
if (!is.null(LocationObject$`class`)) {
self$`class` <- LocationObject$`class`
}
if (!is.null(LocationObject$`type`)) {
self$`type` <- LocationObject$`type`
}
if (!is.null(LocationObject$`importance`)) {
self$`importance` <- LocationObject$`importance`
}
if (!is.null(LocationObject$`address`)) {
addressObject <- Address$new()
addressObject$fromJSON(jsonlite::toJSON(LocationObject$address, auto_unbox = TRUE, digits = NA))
self$`address` <- addressObject
}
if (!is.null(LocationObject$`namedetails`)) {
namedetailsObject <- Namedetails$new()
namedetailsObject$fromJSON(jsonlite::toJSON(LocationObject$namedetails, auto_unbox = TRUE, digits = NA))
self$`namedetails` <- namedetailsObject
}
if (!is.null(LocationObject$`matchquality`)) {
matchqualityObject <- Matchquality$new()
matchqualityObject$fromJSON(jsonlite::toJSON(LocationObject$matchquality, auto_unbox = TRUE, digits = NA))
self$`matchquality` <- matchqualityObject
}
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`distance`)) {
sprintf(
'"distance":
%d
',
self$`distance`
)},
if (!is.null(self$`place_id`)) {
sprintf(
'"place_id":
"%s"
',
self$`place_id`
)},
if (!is.null(self$`licence`)) {
sprintf(
'"licence":
"%s"
',
self$`licence`
)},
if (!is.null(self$`osm_type`)) {
sprintf(
'"osm_type":
"%s"
',
self$`osm_type`
)},
if (!is.null(self$`osm_id`)) {
sprintf(
'"osm_id":
"%s"
',
self$`osm_id`
)},
if (!is.null(self$`boundingbox`)) {
sprintf(
'"boundingbox":
[%s]
',
paste(unlist(lapply(self$`boundingbox`, function(x) paste0('"', x, '"'))), collapse=",")
)},
if (!is.null(self$`lat`)) {
sprintf(
'"lat":
"%s"
',
self$`lat`
)},
if (!is.null(self$`lon`)) {
sprintf(
'"lon":
"%s"
',
self$`lon`
)},
if (!is.null(self$`display_name`)) {
sprintf(
'"display_name":
"%s"
',
self$`display_name`
)},
if (!is.null(self$`class`)) {
sprintf(
'"class":
"%s"
',
self$`class`
)},
if (!is.null(self$`type`)) {
sprintf(
'"type":
"%s"
',
self$`type`
)},
if (!is.null(self$`importance`)) {
sprintf(
'"importance":
%d
',
self$`importance`
)},
if (!is.null(self$`address`)) {
sprintf(
'"address":
%s
',
jsonlite::toJSON(self$`address`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`namedetails`)) {
sprintf(
'"namedetails":
%s
',
jsonlite::toJSON(self$`namedetails`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`matchquality`)) {
sprintf(
'"matchquality":
%s
',
jsonlite::toJSON(self$`matchquality`$toJSON(), auto_unbox=TRUE, digits = NA)
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(LocationJson) {
LocationObject <- jsonlite::fromJSON(LocationJson)
self$`distance` <- LocationObject$`distance`
self$`place_id` <- LocationObject$`place_id`
self$`licence` <- LocationObject$`licence`
self$`osm_type` <- LocationObject$`osm_type`
self$`osm_id` <- LocationObject$`osm_id`
self$`boundingbox` <- ApiClient$new()$deserializeObj(LocationObject$`boundingbox`, "array[character]", loadNamespace("locationiq"))
self$`lat` <- LocationObject$`lat`
self$`lon` <- LocationObject$`lon`
self$`display_name` <- LocationObject$`display_name`
self$`class` <- LocationObject$`class`
self$`type` <- LocationObject$`type`
self$`importance` <- LocationObject$`importance`
self$`address` <- Address$new()$fromJSON(jsonlite::toJSON(LocationObject$address, auto_unbox = TRUE, digits = NA))
self$`namedetails` <- Namedetails$new()$fromJSON(jsonlite::toJSON(LocationObject$namedetails, auto_unbox = TRUE, digits = NA))
self$`matchquality` <- Matchquality$new()$fromJSON(jsonlite::toJSON(LocationObject$matchquality, auto_unbox = TRUE, digits = NA))
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.