# 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 APIUsageAggregatedOut
#' @description APIUsageAggregatedOut Class
#' @format An \code{R6Class} generator object
#' @field timeUnit character [optional]
#'
#' @field periodStart integer [optional]
#'
#' @field periodEnd integer [optional]
#'
#' @field totalUsage integer [optional]
#'
#' @field historyTruncated character [optional]
#'
#' @field data list( \link{array[integer]} ) [optional]
#'
#' @field colHeaders list( character ) [optional]
#'
#' @field rowHeaders list( character ) [optional]
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
APIUsageAggregatedOut <- R6::R6Class(
'APIUsageAggregatedOut',
public = list(
`timeUnit` = NULL,
`periodStart` = NULL,
`periodEnd` = NULL,
`totalUsage` = NULL,
`historyTruncated` = NULL,
`data` = NULL,
`colHeaders` = NULL,
`rowHeaders` = NULL,
initialize = function(`timeUnit`=NULL, `periodStart`=NULL, `periodEnd`=NULL, `totalUsage`=NULL, `historyTruncated`=NULL, `data`=NULL, `colHeaders`=NULL, `rowHeaders`=NULL, ...){
local.optional.var <- list(...)
if (!is.null(`timeUnit`)) {
stopifnot(is.character(`timeUnit`), length(`timeUnit`) == 1)
self$`timeUnit` <- `timeUnit`
}
if (!is.null(`periodStart`)) {
stopifnot(is.numeric(`periodStart`), length(`periodStart`) == 1)
self$`periodStart` <- `periodStart`
}
if (!is.null(`periodEnd`)) {
stopifnot(is.numeric(`periodEnd`), length(`periodEnd`) == 1)
self$`periodEnd` <- `periodEnd`
}
if (!is.null(`totalUsage`)) {
stopifnot(is.numeric(`totalUsage`), length(`totalUsage`) == 1)
self$`totalUsage` <- `totalUsage`
}
if (!is.null(`historyTruncated`)) {
self$`historyTruncated` <- `historyTruncated`
}
if (!is.null(`data`)) {
stopifnot(is.vector(`data`), length(`data`) != 0)
sapply(`data`, function(x) stopifnot(R6::is.R6(x)))
self$`data` <- `data`
}
if (!is.null(`colHeaders`)) {
stopifnot(is.vector(`colHeaders`), length(`colHeaders`) != 0)
sapply(`colHeaders`, function(x) stopifnot(is.character(x)))
self$`colHeaders` <- `colHeaders`
}
if (!is.null(`rowHeaders`)) {
stopifnot(is.vector(`rowHeaders`), length(`rowHeaders`) != 0)
sapply(`rowHeaders`, function(x) stopifnot(is.character(x)))
self$`rowHeaders` <- `rowHeaders`
}
},
toJSON = function() {
APIUsageAggregatedOutObject <- list()
if (!is.null(self$`timeUnit`)) {
APIUsageAggregatedOutObject[['timeUnit']] <-
self$`timeUnit`
}
if (!is.null(self$`periodStart`)) {
APIUsageAggregatedOutObject[['periodStart']] <-
self$`periodStart`
}
if (!is.null(self$`periodEnd`)) {
APIUsageAggregatedOutObject[['periodEnd']] <-
self$`periodEnd`
}
if (!is.null(self$`totalUsage`)) {
APIUsageAggregatedOutObject[['totalUsage']] <-
self$`totalUsage`
}
if (!is.null(self$`historyTruncated`)) {
APIUsageAggregatedOutObject[['historyTruncated']] <-
self$`historyTruncated`
}
if (!is.null(self$`data`)) {
APIUsageAggregatedOutObject[['data']] <-
lapply(self$`data`, function(x) x$toJSON())
}
if (!is.null(self$`colHeaders`)) {
APIUsageAggregatedOutObject[['colHeaders']] <-
self$`colHeaders`
}
if (!is.null(self$`rowHeaders`)) {
APIUsageAggregatedOutObject[['rowHeaders']] <-
self$`rowHeaders`
}
APIUsageAggregatedOutObject
},
fromJSON = function(APIUsageAggregatedOutJson) {
APIUsageAggregatedOutObject <- jsonlite::fromJSON(APIUsageAggregatedOutJson)
if (!is.null(APIUsageAggregatedOutObject$`timeUnit`)) {
self$`timeUnit` <- APIUsageAggregatedOutObject$`timeUnit`
}
if (!is.null(APIUsageAggregatedOutObject$`periodStart`)) {
self$`periodStart` <- APIUsageAggregatedOutObject$`periodStart`
}
if (!is.null(APIUsageAggregatedOutObject$`periodEnd`)) {
self$`periodEnd` <- APIUsageAggregatedOutObject$`periodEnd`
}
if (!is.null(APIUsageAggregatedOutObject$`totalUsage`)) {
self$`totalUsage` <- APIUsageAggregatedOutObject$`totalUsage`
}
if (!is.null(APIUsageAggregatedOutObject$`historyTruncated`)) {
self$`historyTruncated` <- APIUsageAggregatedOutObject$`historyTruncated`
}
if (!is.null(APIUsageAggregatedOutObject$`data`)) {
self$`data` <- ApiClient$new()$deserializeObj(APIUsageAggregatedOutObject$`data`, "array[array[integer]]", loadNamespace("namsor"))
}
if (!is.null(APIUsageAggregatedOutObject$`colHeaders`)) {
self$`colHeaders` <- ApiClient$new()$deserializeObj(APIUsageAggregatedOutObject$`colHeaders`, "array[character]", loadNamespace("namsor"))
}
if (!is.null(APIUsageAggregatedOutObject$`rowHeaders`)) {
self$`rowHeaders` <- ApiClient$new()$deserializeObj(APIUsageAggregatedOutObject$`rowHeaders`, "array[character]", loadNamespace("namsor"))
}
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`timeUnit`)) {
sprintf(
'"timeUnit":
"%s"
',
self$`timeUnit`
)},
if (!is.null(self$`periodStart`)) {
sprintf(
'"periodStart":
%d
',
self$`periodStart`
)},
if (!is.null(self$`periodEnd`)) {
sprintf(
'"periodEnd":
%d
',
self$`periodEnd`
)},
if (!is.null(self$`totalUsage`)) {
sprintf(
'"totalUsage":
%d
',
self$`totalUsage`
)},
if (!is.null(self$`historyTruncated`)) {
sprintf(
'"historyTruncated":
"%s"
',
self$`historyTruncated`
)},
if (!is.null(self$`data`)) {
sprintf(
'"data":
[%s]
',
paste(sapply(self$`data`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
)},
if (!is.null(self$`colHeaders`)) {
sprintf(
'"colHeaders":
[%s]
',
paste(unlist(lapply(self$`colHeaders`, function(x) paste0('"', x, '"'))), collapse=",")
)},
if (!is.null(self$`rowHeaders`)) {
sprintf(
'"rowHeaders":
[%s]
',
paste(unlist(lapply(self$`rowHeaders`, function(x) paste0('"', x, '"'))), collapse=",")
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(APIUsageAggregatedOutJson) {
APIUsageAggregatedOutObject <- jsonlite::fromJSON(APIUsageAggregatedOutJson)
self$`timeUnit` <- APIUsageAggregatedOutObject$`timeUnit`
self$`periodStart` <- APIUsageAggregatedOutObject$`periodStart`
self$`periodEnd` <- APIUsageAggregatedOutObject$`periodEnd`
self$`totalUsage` <- APIUsageAggregatedOutObject$`totalUsage`
self$`historyTruncated` <- APIUsageAggregatedOutObject$`historyTruncated`
self$`data` <- ApiClient$new()$deserializeObj(APIUsageAggregatedOutObject$`data`, "array[array[integer]]", loadNamespace("namsor"))
self$`colHeaders` <- ApiClient$new()$deserializeObj(APIUsageAggregatedOutObject$`colHeaders`, "array[character]", loadNamespace("namsor"))
self$`rowHeaders` <- ApiClient$new()$deserializeObj(APIUsageAggregatedOutObject$`rowHeaders`, "array[character]", loadNamespace("namsor"))
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.