R/directions_matching.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 DirectionsMatching
#' @description DirectionsMatching Class
#' @format An \code{R6Class} generator object
#' @field code  character [optional]
#'
#' @field tracepoints  list( object ) [optional]
#'
#' @field matchings  list( object ) [optional]
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
DirectionsMatching <- R6::R6Class(
  'DirectionsMatching',
  public = list(
    `code` = NULL,
    `tracepoints` = NULL,
    `matchings` = NULL,
    initialize = function(`code`=NULL, `tracepoints`=NULL, `matchings`=NULL, ...){
      local.optional.var <- list(...)
      if (!is.null(`code`)) {
        stopifnot(is.character(`code`), length(`code`) == 1)
        self$`code` <- `code`
      }
      if (!is.null(`tracepoints`)) {
        stopifnot(is.vector(`tracepoints`), length(`tracepoints`) != 0)
        sapply(`tracepoints`, function(x) stopifnot(is.character(x)))
        self$`tracepoints` <- `tracepoints`
      }
      if (!is.null(`matchings`)) {
        stopifnot(is.vector(`matchings`), length(`matchings`) != 0)
        sapply(`matchings`, function(x) stopifnot(is.character(x)))
        self$`matchings` <- `matchings`
      }
    },
    toJSON = function() {
      DirectionsMatchingObject <- list()
      if (!is.null(self$`code`)) {
        DirectionsMatchingObject[['code']] <-
          self$`code`
      }
      if (!is.null(self$`tracepoints`)) {
        DirectionsMatchingObject[['tracepoints']] <-
          self$`tracepoints`
      }
      if (!is.null(self$`matchings`)) {
        DirectionsMatchingObject[['matchings']] <-
          self$`matchings`
      }

      DirectionsMatchingObject
    },
    fromJSON = function(DirectionsMatchingJson) {
      DirectionsMatchingObject <- jsonlite::fromJSON(DirectionsMatchingJson)
      if (!is.null(DirectionsMatchingObject$`code`)) {
        self$`code` <- DirectionsMatchingObject$`code`
      }
      if (!is.null(DirectionsMatchingObject$`tracepoints`)) {
        self$`tracepoints` <- ApiClient$new()$deserializeObj(DirectionsMatchingObject$`tracepoints`, "array[object]", loadNamespace("locationiq"))
      }
      if (!is.null(DirectionsMatchingObject$`matchings`)) {
        self$`matchings` <- ApiClient$new()$deserializeObj(DirectionsMatchingObject$`matchings`, "array[object]", loadNamespace("locationiq"))
      }
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`code`)) {
        sprintf(
        '"code":
          "%s"
                ',
        self$`code`
        )},
        if (!is.null(self$`tracepoints`)) {
        sprintf(
        '"tracepoints":
           [%s]
        ',
        paste(unlist(lapply(self$`tracepoints`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`matchings`)) {
        sprintf(
        '"matchings":
           [%s]
        ',
        paste(unlist(lapply(self$`matchings`, function(x) paste0('"', x, '"'))), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(DirectionsMatchingJson) {
      DirectionsMatchingObject <- jsonlite::fromJSON(DirectionsMatchingJson)
      self$`code` <- DirectionsMatchingObject$`code`
      self$`tracepoints` <- ApiClient$new()$deserializeObj(DirectionsMatchingObject$`tracepoints`, "array[object]", loadNamespace("locationiq"))
      self$`matchings` <- ApiClient$new()$deserializeObj(DirectionsMatchingObject$`matchings`, "array[object]", loadNamespace("locationiq"))
      self
    }
  )
)
location-iq/locationiq-r-client documentation built on Feb. 28, 2020, 9:42 p.m.