# 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
#' SourceDetailedMetricsOut Class
#'
#' @field classifierName
#' @field source
#' @field aiEstimateTotal
#' @field aiEstimatePrecision
#' @field aiEstimateRecall
#' @field metricTimeStamp
#' @field aiStartTime
#' @field aiLearnTotal
#' @field snapshotDate
#' @field expectedClassMetrics
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
SourceDetailedMetricsOut <- R6::R6Class(
'SourceDetailedMetricsOut',
public = list(
`classifierName` = NULL,
`source` = NULL,
`aiEstimateTotal` = NULL,
`aiEstimatePrecision` = NULL,
`aiEstimateRecall` = NULL,
`metricTimeStamp` = NULL,
`aiStartTime` = NULL,
`aiLearnTotal` = NULL,
`snapshotDate` = NULL,
`expectedClassMetrics` = NULL,
initialize = function(`classifierName`, `source`, `aiEstimateTotal`, `aiEstimatePrecision`, `aiEstimateRecall`, `metricTimeStamp`, `aiStartTime`, `aiLearnTotal`, `snapshotDate`, `expectedClassMetrics`){
if (!missing(`classifierName`)) {
stopifnot(is.character(`classifierName`), length(`classifierName`) == 1)
self$`classifierName` <- `classifierName`
}
if (!missing(`source`)) {
stopifnot(R6::is.R6(`source`))
self$`source` <- `source`
}
if (!missing(`aiEstimateTotal`)) {
stopifnot(is.numeric(`aiEstimateTotal`), length(`aiEstimateTotal`) == 1)
self$`aiEstimateTotal` <- `aiEstimateTotal`
}
if (!missing(`aiEstimatePrecision`)) {
stopifnot(is.numeric(`aiEstimatePrecision`), length(`aiEstimatePrecision`) == 1)
self$`aiEstimatePrecision` <- `aiEstimatePrecision`
}
if (!missing(`aiEstimateRecall`)) {
stopifnot(is.numeric(`aiEstimateRecall`), length(`aiEstimateRecall`) == 1)
self$`aiEstimateRecall` <- `aiEstimateRecall`
}
if (!missing(`metricTimeStamp`)) {
stopifnot(is.numeric(`metricTimeStamp`), length(`metricTimeStamp`) == 1)
self$`metricTimeStamp` <- `metricTimeStamp`
}
if (!missing(`aiStartTime`)) {
stopifnot(is.numeric(`aiStartTime`), length(`aiStartTime`) == 1)
self$`aiStartTime` <- `aiStartTime`
}
if (!missing(`aiLearnTotal`)) {
stopifnot(is.numeric(`aiLearnTotal`), length(`aiLearnTotal`) == 1)
self$`aiLearnTotal` <- `aiLearnTotal`
}
if (!missing(`snapshotDate`)) {
stopifnot(is.numeric(`snapshotDate`), length(`snapshotDate`) == 1)
self$`snapshotDate` <- `snapshotDate`
}
if (!missing(`expectedClassMetrics`)) {
stopifnot(is.vector(`expectedClassMetrics`), length(`expectedClassMetrics`) != 0)
sapply(`expectedClassMetrics`, function(x) stopifnot(R6::is.R6(x)))
self$`expectedClassMetrics` <- `expectedClassMetrics`
}
},
toJSON = function() {
SourceDetailedMetricsOutObject <- list()
if (!is.null(self$`classifierName`)) {
SourceDetailedMetricsOutObject[['classifierName']] <-
self$`classifierName`
}
if (!is.null(self$`source`)) {
SourceDetailedMetricsOutObject[['source']] <-
self$`source`$toJSON()
}
if (!is.null(self$`aiEstimateTotal`)) {
SourceDetailedMetricsOutObject[['aiEstimateTotal']] <-
self$`aiEstimateTotal`
}
if (!is.null(self$`aiEstimatePrecision`)) {
SourceDetailedMetricsOutObject[['aiEstimatePrecision']] <-
self$`aiEstimatePrecision`
}
if (!is.null(self$`aiEstimateRecall`)) {
SourceDetailedMetricsOutObject[['aiEstimateRecall']] <-
self$`aiEstimateRecall`
}
if (!is.null(self$`metricTimeStamp`)) {
SourceDetailedMetricsOutObject[['metricTimeStamp']] <-
self$`metricTimeStamp`
}
if (!is.null(self$`aiStartTime`)) {
SourceDetailedMetricsOutObject[['aiStartTime']] <-
self$`aiStartTime`
}
if (!is.null(self$`aiLearnTotal`)) {
SourceDetailedMetricsOutObject[['aiLearnTotal']] <-
self$`aiLearnTotal`
}
if (!is.null(self$`snapshotDate`)) {
SourceDetailedMetricsOutObject[['snapshotDate']] <-
self$`snapshotDate`
}
if (!is.null(self$`expectedClassMetrics`)) {
SourceDetailedMetricsOutObject[['expectedClassMetrics']] <-
sapply(self$`expectedClassMetrics`, function(x) x$toJSON())
}
SourceDetailedMetricsOutObject
},
fromJSON = function(SourceDetailedMetricsOutJson) {
SourceDetailedMetricsOutObject <- jsonlite::fromJSON(SourceDetailedMetricsOutJson)
if (!is.null(SourceDetailedMetricsOutObject$`classifierName`)) {
self$`classifierName` <- SourceDetailedMetricsOutObject$`classifierName`
}
if (!is.null(SourceDetailedMetricsOutObject$`source`)) {
sourceObject <- APIKeyOut$new()
sourceObject$fromJSON(jsonlite::toJSON(SourceDetailedMetricsOutObject$source, auto_unbox = TRUE))
self$`source` <- sourceObject
}
if (!is.null(SourceDetailedMetricsOutObject$`aiEstimateTotal`)) {
self$`aiEstimateTotal` <- SourceDetailedMetricsOutObject$`aiEstimateTotal`
}
if (!is.null(SourceDetailedMetricsOutObject$`aiEstimatePrecision`)) {
self$`aiEstimatePrecision` <- SourceDetailedMetricsOutObject$`aiEstimatePrecision`
}
if (!is.null(SourceDetailedMetricsOutObject$`aiEstimateRecall`)) {
self$`aiEstimateRecall` <- SourceDetailedMetricsOutObject$`aiEstimateRecall`
}
if (!is.null(SourceDetailedMetricsOutObject$`metricTimeStamp`)) {
self$`metricTimeStamp` <- SourceDetailedMetricsOutObject$`metricTimeStamp`
}
if (!is.null(SourceDetailedMetricsOutObject$`aiStartTime`)) {
self$`aiStartTime` <- SourceDetailedMetricsOutObject$`aiStartTime`
}
if (!is.null(SourceDetailedMetricsOutObject$`aiLearnTotal`)) {
self$`aiLearnTotal` <- SourceDetailedMetricsOutObject$`aiLearnTotal`
}
if (!is.null(SourceDetailedMetricsOutObject$`snapshotDate`)) {
self$`snapshotDate` <- SourceDetailedMetricsOutObject$`snapshotDate`
}
if (!is.null(SourceDetailedMetricsOutObject$`expectedClassMetrics`)) {
self$`expectedClassMetrics` <- sapply(SourceDetailedMetricsOutObject$`expectedClassMetrics`, function(x) {
expectedClassMetricsObject <- ExpectedClassMetricsOut$new()
expectedClassMetricsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
expectedClassMetricsObject
})
}
},
toJSONString = function() {
sprintf(
'{
"classifierName":
"%s",
"source":
%s,
"aiEstimateTotal":
%d,
"aiEstimatePrecision":
%d,
"aiEstimateRecall":
%d,
"metricTimeStamp":
%d,
"aiStartTime":
%d,
"aiLearnTotal":
%d,
"snapshotDate":
%d,
"expectedClassMetrics":
[%s]
}',
self$`classifierName`,
jsonlite::toJSON(self$`source`$toJSON(), auto_unbox=TRUE),
self$`aiEstimateTotal`,
self$`aiEstimatePrecision`,
self$`aiEstimateRecall`,
self$`metricTimeStamp`,
self$`aiStartTime`,
self$`aiLearnTotal`,
self$`snapshotDate`,
paste(unlist(lapply(self$`expectedClassMetrics`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE))), collapse=",")
)
},
fromJSONString = function(SourceDetailedMetricsOutJson) {
SourceDetailedMetricsOutObject <- jsonlite::fromJSON(SourceDetailedMetricsOutJson)
self$`classifierName` <- SourceDetailedMetricsOutObject$`classifierName`
self$`source` <- APIKeyOut$new()$fromJSON(jsonlite::toJSON(SourceDetailedMetricsOutObject$source, auto_unbox = TRUE))
self$`aiEstimateTotal` <- SourceDetailedMetricsOutObject$`aiEstimateTotal`
self$`aiEstimatePrecision` <- SourceDetailedMetricsOutObject$`aiEstimatePrecision`
self$`aiEstimateRecall` <- SourceDetailedMetricsOutObject$`aiEstimateRecall`
self$`metricTimeStamp` <- SourceDetailedMetricsOutObject$`metricTimeStamp`
self$`aiStartTime` <- SourceDetailedMetricsOutObject$`aiStartTime`
self$`aiLearnTotal` <- SourceDetailedMetricsOutObject$`aiLearnTotal`
self$`snapshotDate` <- SourceDetailedMetricsOutObject$`snapshotDate`
data.frame <- SourceDetailedMetricsOutObject$`expectedClassMetrics`
self$`expectedClassMetrics` <- vector("list", length = nrow(data.frame))
for (row in 1:nrow(data.frame)) {
expectedClassMetrics.node <- ExpectedClassMetricsOut$new()
expectedClassMetrics.node$fromJSON(jsonlite::toJSON(data.frame[row,,drop = TRUE], auto_unbox = TRUE))
self$`expectedClassMetrics`[[row]] <- expectedClassMetrics.node
}
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.