# 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 1000 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!
#
# OpenAPI spec version: 2.0.2-beta
# Contact: contact@namsor.com
# Generated by: https://openapi-generator.tech
#' BatchFirstLastNameGenderIn Class
#'
#' @field personalNames
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
BatchFirstLastNameGenderIn <- R6::R6Class(
'BatchFirstLastNameGenderIn',
public = list(
`personalNames` = NULL,
initialize = function(`personalNames`){
if (!missing(`personalNames`)) {
stopifnot(is.vector(`personalNames`), length(`personalNames`) != 0)
sapply(`personalNames`, function(x) stopifnot(R6::is.R6(x)))
self$`personalNames` <- `personalNames`
}
},
toJSON = function() {
BatchFirstLastNameGenderInObject <- list()
if (!is.null(self$`personalNames`)) {
BatchFirstLastNameGenderInObject[['personalNames']] <-
sapply(self$`personalNames`, function(x) x$toJSON())
}
BatchFirstLastNameGenderInObject
},
fromJSON = function(BatchFirstLastNameGenderInJson) {
BatchFirstLastNameGenderInObject <- jsonlite::fromJSON(BatchFirstLastNameGenderInJson)
if (!is.null(BatchFirstLastNameGenderInObject$`personalNames`)) {
self$`personalNames` <- sapply(BatchFirstLastNameGenderInObject$`personalNames`, function(x) {
personalNamesObject <- FirstLastNameGenderIn$new()
personalNamesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
personalNamesObject
})
}
},
toJSONString = function() {
sprintf(
'{
"personalNames":
[%s]
}',
paste(unlist(lapply(self$`personalNames`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE))), collapse=",")
)
},
fromJSONString = function(BatchFirstLastNameGenderInJson) {
BatchFirstLastNameGenderInObject <- jsonlite::fromJSON(BatchFirstLastNameGenderInJson)
data.frame <- BatchFirstLastNameGenderInObject$`personalNames`
self$`personalNames` <- vector("list", length = nrow(data.frame))
for (row in 1:nrow(data.frame)) {
personalNames.node <- FirstLastNameGenderIn$new()
personalNames.node$fromJSON(jsonlite::toJSON(data.frame[row,,drop = TRUE], auto_unbox = TRUE))
self$`personalNames`[[row]] <- personalNames.node
}
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.