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

      ErrorObject
    },
    fromJSON = function(ErrorJson) {
      ErrorObject <- jsonlite::fromJSON(ErrorJson)
      if (!is.null(ErrorObject$`error`)) {
        self$`error` <- ErrorObject$`error`
      }
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`error`)) {
        sprintf(
        '"error":
          "%s"
                ',
        self$`error`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ErrorJson) {
      ErrorObject <- jsonlite::fromJSON(ErrorJson)
      self$`error` <- ErrorObject$`error`
      self
    }
  )
)
location-iq/locationiq-r-client documentation built on Feb. 28, 2020, 9:42 p.m.