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

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