R/romanized_name_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 RomanizedNameOut
#' @description RomanizedNameOut Class
#' @format An \code{R6Class} generator object
#' @field id  character [optional]
#'
#' @field latinName  character [optional]
#'
#' @field originalName  character [optional]
#'
#' @field sourceLanguage  character [optional]
#'
#' @field targetLanguage  character [optional]
#'
#' @field sourceScript  character [optional]
#'
#' @field targetScript  character [optional]
#'
#' @field score  numeric [optional]
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
RomanizedNameOut <- R6::R6Class(
  'RomanizedNameOut',
  public = list(
    `id` = NULL,
    `latinName` = NULL,
    `originalName` = NULL,
    `sourceLanguage` = NULL,
    `targetLanguage` = NULL,
    `sourceScript` = NULL,
    `targetScript` = NULL,
    `score` = NULL,
    initialize = function(`id`=NULL, `latinName`=NULL, `originalName`=NULL, `sourceLanguage`=NULL, `targetLanguage`=NULL, `sourceScript`=NULL, `targetScript`=NULL, `score`=NULL, ...){
      local.optional.var <- list(...)
      if (!is.null(`id`)) {
        stopifnot(is.character(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!is.null(`latinName`)) {
        stopifnot(is.character(`latinName`), length(`latinName`) == 1)
        self$`latinName` <- `latinName`
      }
      if (!is.null(`originalName`)) {
        stopifnot(is.character(`originalName`), length(`originalName`) == 1)
        self$`originalName` <- `originalName`
      }
      if (!is.null(`sourceLanguage`)) {
        stopifnot(is.character(`sourceLanguage`), length(`sourceLanguage`) == 1)
        self$`sourceLanguage` <- `sourceLanguage`
      }
      if (!is.null(`targetLanguage`)) {
        stopifnot(is.character(`targetLanguage`), length(`targetLanguage`) == 1)
        self$`targetLanguage` <- `targetLanguage`
      }
      if (!is.null(`sourceScript`)) {
        stopifnot(is.character(`sourceScript`), length(`sourceScript`) == 1)
        self$`sourceScript` <- `sourceScript`
      }
      if (!is.null(`targetScript`)) {
        stopifnot(is.character(`targetScript`), length(`targetScript`) == 1)
        self$`targetScript` <- `targetScript`
      }
      if (!is.null(`score`)) {
        stopifnot(is.numeric(`score`), length(`score`) == 1)
        self$`score` <- `score`
      }
    },
    toJSON = function() {
      RomanizedNameOutObject <- list()
      if (!is.null(self$`id`)) {
        RomanizedNameOutObject[['id']] <-
          self$`id`
      }
      if (!is.null(self$`latinName`)) {
        RomanizedNameOutObject[['latinName']] <-
          self$`latinName`
      }
      if (!is.null(self$`originalName`)) {
        RomanizedNameOutObject[['originalName']] <-
          self$`originalName`
      }
      if (!is.null(self$`sourceLanguage`)) {
        RomanizedNameOutObject[['sourceLanguage']] <-
          self$`sourceLanguage`
      }
      if (!is.null(self$`targetLanguage`)) {
        RomanizedNameOutObject[['targetLanguage']] <-
          self$`targetLanguage`
      }
      if (!is.null(self$`sourceScript`)) {
        RomanizedNameOutObject[['sourceScript']] <-
          self$`sourceScript`
      }
      if (!is.null(self$`targetScript`)) {
        RomanizedNameOutObject[['targetScript']] <-
          self$`targetScript`
      }
      if (!is.null(self$`score`)) {
        RomanizedNameOutObject[['score']] <-
          self$`score`
      }

      RomanizedNameOutObject
    },
    fromJSON = function(RomanizedNameOutJson) {
      RomanizedNameOutObject <- jsonlite::fromJSON(RomanizedNameOutJson)
      if (!is.null(RomanizedNameOutObject$`id`)) {
        self$`id` <- RomanizedNameOutObject$`id`
      }
      if (!is.null(RomanizedNameOutObject$`latinName`)) {
        self$`latinName` <- RomanizedNameOutObject$`latinName`
      }
      if (!is.null(RomanizedNameOutObject$`originalName`)) {
        self$`originalName` <- RomanizedNameOutObject$`originalName`
      }
      if (!is.null(RomanizedNameOutObject$`sourceLanguage`)) {
        self$`sourceLanguage` <- RomanizedNameOutObject$`sourceLanguage`
      }
      if (!is.null(RomanizedNameOutObject$`targetLanguage`)) {
        self$`targetLanguage` <- RomanizedNameOutObject$`targetLanguage`
      }
      if (!is.null(RomanizedNameOutObject$`sourceScript`)) {
        self$`sourceScript` <- RomanizedNameOutObject$`sourceScript`
      }
      if (!is.null(RomanizedNameOutObject$`targetScript`)) {
        self$`targetScript` <- RomanizedNameOutObject$`targetScript`
      }
      if (!is.null(RomanizedNameOutObject$`score`)) {
        self$`score` <- RomanizedNameOutObject$`score`
      }
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`id`)) {
        sprintf(
        '"id":
          "%s"
                ',
        self$`id`
        )},
        if (!is.null(self$`latinName`)) {
        sprintf(
        '"latinName":
          "%s"
                ',
        self$`latinName`
        )},
        if (!is.null(self$`originalName`)) {
        sprintf(
        '"originalName":
          "%s"
                ',
        self$`originalName`
        )},
        if (!is.null(self$`sourceLanguage`)) {
        sprintf(
        '"sourceLanguage":
          "%s"
                ',
        self$`sourceLanguage`
        )},
        if (!is.null(self$`targetLanguage`)) {
        sprintf(
        '"targetLanguage":
          "%s"
                ',
        self$`targetLanguage`
        )},
        if (!is.null(self$`sourceScript`)) {
        sprintf(
        '"sourceScript":
          "%s"
                ',
        self$`sourceScript`
        )},
        if (!is.null(self$`targetScript`)) {
        sprintf(
        '"targetScript":
          "%s"
                ',
        self$`targetScript`
        )},
        if (!is.null(self$`score`)) {
        sprintf(
        '"score":
          %d
                ',
        self$`score`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(RomanizedNameOutJson) {
      RomanizedNameOutObject <- jsonlite::fromJSON(RomanizedNameOutJson)
      self$`id` <- RomanizedNameOutObject$`id`
      self$`latinName` <- RomanizedNameOutObject$`latinName`
      self$`originalName` <- RomanizedNameOutObject$`originalName`
      self$`sourceLanguage` <- RomanizedNameOutObject$`sourceLanguage`
      self$`targetLanguage` <- RomanizedNameOutObject$`targetLanguage`
      self$`sourceScript` <- RomanizedNameOutObject$`sourceScript`
      self$`targetScript` <- RomanizedNameOutObject$`targetScript`
      self$`score` <- RomanizedNameOutObject$`score`
      self
    }
  )
)
namsor/namsor-r-sdk2 documentation built on March 15, 2021, 7:12 p.m.