R/batch_parsed_full_name_in.R

# NamSor API v2
#
# NamSor API v2 : enpoints to process personal names (gender, cultural origin or ethnicity) in all alphabets or languages. Use GET methods for small tests, but prefer POST methods for higher throughput (batch processing of up to 100 names at a time). Need something you can't find here? We have many more features coming soon. Let us know, we'll do our best to add it! 
#
# The version of the OpenAPI document: 2.0.10
# Contact: contact@namsor.com
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title BatchParsedFullNameIn
#' @description BatchParsedFullNameIn Class
#' @format An \code{R6Class} generator object
#' @field personalNames  list( \link{ParsedFullNameIn} ) [optional]
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
BatchParsedFullNameIn <- R6::R6Class(
  'BatchParsedFullNameIn',
  public = list(
    `personalNames` = NULL,
    initialize = function(`personalNames`=NULL, ...){
      local.optional.var <- list(...)
      if (!is.null(`personalNames`)) {
        stopifnot(is.vector(`personalNames`), length(`personalNames`) != 0)
        sapply(`personalNames`, function(x) stopifnot(R6::is.R6(x)))
        self$`personalNames` <- `personalNames`
      }
    },
    toJSON = function() {
      BatchParsedFullNameInObject <- list()
      if (!is.null(self$`personalNames`)) {
        BatchParsedFullNameInObject[['personalNames']] <-
          lapply(self$`personalNames`, function(x) x$toJSON())
      }

      BatchParsedFullNameInObject
    },
    fromJSON = function(BatchParsedFullNameInJson) {
      BatchParsedFullNameInObject <- jsonlite::fromJSON(BatchParsedFullNameInJson)
      if (!is.null(BatchParsedFullNameInObject$`personalNames`)) {
        self$`personalNames` <- ApiClient$new()$deserializeObj(BatchParsedFullNameInObject$`personalNames`, "array[ParsedFullNameIn]", loadNamespace("namsor"))
      }
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`personalNames`)) {
        sprintf(
        '"personalNames":
        [%s]
',
        paste(sapply(self$`personalNames`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(BatchParsedFullNameInJson) {
      BatchParsedFullNameInObject <- jsonlite::fromJSON(BatchParsedFullNameInJson)
      self$`personalNames` <- ApiClient$new()$deserializeObj(BatchParsedFullNameInObject$`personalNames`, "array[ParsedFullNameIn]", loadNamespace("namsor"))
      self
    }
  )
)
namsor/namsor-r-sdk2 documentation built on March 15, 2021, 7:12 p.m.