R/chinese_api.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 Chinese operations
#' @description namsor.Chinese
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ ChineseNameCandidates } \emph{ Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming }
#' 
#'
#' \itemize{
#' \item \emph{ @param } chinese.surname.latin character
#' \item \emph{ @param } chinese.given.name.latin character
#' \item \emph{ @returnType } \link{RomanizedNameOut} \cr
#'
#'
#' \item status code : 200 | A romanized name.
#'
#' \item return type : RomanizedNameOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ChineseNameCandidatesBatch } \emph{ Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming }
#' 
#'
#' \itemize{
#' \item \emph{ @param } batch.first.last.name.in \link{BatchFirstLastNameIn}
#' \item \emph{ @returnType } \link{BatchNameMatchCandidatesOut} \cr
#'
#'
#' \item status code : 200 | A list of genderized names.
#'
#' \item return type : BatchNameMatchCandidatesOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ChineseNameCandidatesGenderBatch } \emph{ Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname) ex. Wang Xiaoming. }
#' 
#'
#' \itemize{
#' \item \emph{ @param } batch.first.last.name.in \link{BatchFirstLastNameIn}
#' \item \emph{ @returnType } \link{BatchNameMatchCandidatesOut} \cr
#'
#'
#' \item status code : 200 | A list of genderized names.
#'
#' \item return type : BatchNameMatchCandidatesOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ChineseNameGenderCandidates } \emph{ Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming - having a known gender ('male' or 'female') }
#' 
#'
#' \itemize{
#' \item \emph{ @param } chinese.surname.latin character
#' \item \emph{ @param } chinese.given.name.latin character
#' \item \emph{ @param } known.gender character
#' \item \emph{ @returnType } \link{RomanizedNameOut} \cr
#'
#'
#' \item status code : 200 | A romanized name.
#'
#' \item return type : RomanizedNameOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ChineseNameMatch } \emph{ Return a score for matching Chinese name ex. 王晓明 with a romanized name ex. Wang Xiaoming }
#' 
#'
#' \itemize{
#' \item \emph{ @param } chinese.surname.latin character
#' \item \emph{ @param } chinese.given.name.latin character
#' \item \emph{ @param } chinese.name character
#' \item \emph{ @returnType } \link{RomanizedNameOut} \cr
#'
#'
#' \item status code : 200 | A romanized name.
#'
#' \item return type : RomanizedNameOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ChineseNameMatchBatch } \emph{ Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming }
#' 
#'
#' \itemize{
#' \item \emph{ @param } batch.first.last.name.in \link{BatchFirstLastNameIn}
#' \item \emph{ @returnType } \link{BatchNameMatchCandidatesOut} \cr
#'
#'
#' \item status code : 200 | A list of genderized names.
#'
#' \item return type : BatchNameMatchCandidatesOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GenderChineseName } \emph{ Infer the likely gender of a Chinese full name ex. 王晓明 }
#' 
#'
#' \itemize{
#' \item \emph{ @param } chinese.name character
#' \item \emph{ @returnType } \link{PersonalNameGenderedOut} \cr
#'
#'
#' \item status code : 200 | A genderized name.
#'
#' \item return type : PersonalNameGenderedOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GenderChineseNameBatch } \emph{ Infer the likely gender of up to 100 full names ex. 王晓明 }
#' 
#'
#' \itemize{
#' \item \emph{ @param } batch.personal.name.in \link{BatchPersonalNameIn}
#' \item \emph{ @returnType } \link{BatchPersonalNameGenderedOut} \cr
#'
#'
#' \item status code : 200 | A list of genderized names.
#'
#' \item return type : BatchPersonalNameGenderedOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GenderChineseNamePinyin } \emph{ Infer the likely gender of a Chinese name in LATIN (Pinyin). }
#' 
#'
#' \itemize{
#' \item \emph{ @param } chinese.surname.latin character
#' \item \emph{ @param } chinese.given.name.latin character
#' \item \emph{ @returnType } \link{FirstLastNameGenderedOut} \cr
#'
#'
#' \item status code : 200 | A genderized name.
#'
#' \item return type : FirstLastNameGenderedOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GenderChineseNamePinyinBatch } \emph{ Infer the likely gender of up to 100 Chinese names in LATIN (Pinyin). }
#' 
#'
#' \itemize{
#' \item \emph{ @param } batch.first.last.name.in \link{BatchFirstLastNameIn}
#' \item \emph{ @returnType } \link{BatchFirstLastNameGenderedOut} \cr
#'
#'
#' \item status code : 200 | A list of genderized names.
#'
#' \item return type : BatchFirstLastNameGenderedOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ParseChineseName } \emph{ Infer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name) }
#' 
#'
#' \itemize{
#' \item \emph{ @param } chinese.name character
#' \item \emph{ @returnType } \link{PersonalNameParsedOut} \cr
#'
#'
#' \item status code : 200 | A origined name.
#'
#' \item return type : PersonalNameParsedOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ParseChineseNameBatch } \emph{ Infer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name). }
#' 
#'
#' \itemize{
#' \item \emph{ @param } batch.personal.name.in \link{BatchPersonalNameIn}
#' \item \emph{ @returnType } \link{BatchPersonalNameParsedOut} \cr
#'
#'
#' \item status code : 200 | A list of parsed names.
#'
#' \item return type : BatchPersonalNameParsedOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PinyinChineseName } \emph{ Romanize the Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name) }
#' 
#'
#' \itemize{
#' \item \emph{ @param } chinese.name character
#' \item \emph{ @returnType } \link{PersonalNameParsedOut} \cr
#'
#'
#' \item status code : 200 | A pinyin name.
#'
#' \item return type : PersonalNameParsedOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PinyinChineseNameBatch } \emph{ Romanize a list of Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name). }
#' 
#'
#' \itemize{
#' \item \emph{ @param } batch.personal.name.in \link{BatchPersonalNameIn}
#' \item \emph{ @returnType } \link{BatchPersonalNameParsedOut} \cr
#'
#'
#' \item status code : 200 | A list of Pinyin names.
#'
#' \item return type : BatchPersonalNameParsedOut 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Missing or incorrect API Key
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | API Limit Reached or API Key Disabled
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  ChineseNameCandidates  ####################
#'
#' library(namsor)
#' var.chinese.surname.latin <- 'chinese.surname.latin_example' # character | 
#' var.chinese.given.name.latin <- 'chinese.given.name.latin_example' # character | 
#'
#' #Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$ChineseNameCandidates(var.chinese.surname.latin, var.chinese.given.name.latin)
#'
#'
#' ####################  ChineseNameCandidatesBatch  ####################
#'
#' library(namsor)
#' var.batch.first.last.name.in <- BatchFirstLastNameIn$new() # BatchFirstLastNameIn | A list of personal Chinese names in LATIN, firstName = chineseGivenName; lastName=chineseSurname
#'
#' #Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$ChineseNameCandidatesBatch(batch.first.last.name.in=var.batch.first.last.name.in)
#'
#'
#' ####################  ChineseNameCandidatesGenderBatch  ####################
#'
#' library(namsor)
#' var.batch.first.last.name.in <- BatchFirstLastNameIn$new() # BatchFirstLastNameIn | A list of personal Chinese names in LATIN, firstName = chineseGivenName; lastName=chineseSurname
#'
#' #Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname) ex. Wang Xiaoming.
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$ChineseNameCandidatesGenderBatch(batch.first.last.name.in=var.batch.first.last.name.in)
#'
#'
#' ####################  ChineseNameGenderCandidates  ####################
#'
#' library(namsor)
#' var.chinese.surname.latin <- 'chinese.surname.latin_example' # character | 
#' var.chinese.given.name.latin <- 'chinese.given.name.latin_example' # character | 
#' var.known.gender <- 'known.gender_example' # character | 
#'
#' #Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming - having a known gender ('male' or 'female')
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$ChineseNameGenderCandidates(var.chinese.surname.latin, var.chinese.given.name.latin, var.known.gender)
#'
#'
#' ####################  ChineseNameMatch  ####################
#'
#' library(namsor)
#' var.chinese.surname.latin <- 'chinese.surname.latin_example' # character | 
#' var.chinese.given.name.latin <- 'chinese.given.name.latin_example' # character | 
#' var.chinese.name <- 'chinese.name_example' # character | 
#'
#' #Return a score for matching Chinese name ex. 王晓明 with a romanized name ex. Wang Xiaoming
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$ChineseNameMatch(var.chinese.surname.latin, var.chinese.given.name.latin, var.chinese.name)
#'
#'
#' ####################  ChineseNameMatchBatch  ####################
#'
#' library(namsor)
#' var.batch.first.last.name.in <- BatchFirstLastNameIn$new() # BatchFirstLastNameIn | A list of personal Chinese names in LATIN, firstName = chineseGivenName; lastName=chineseSurname
#'
#' #Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$ChineseNameMatchBatch(batch.first.last.name.in=var.batch.first.last.name.in)
#'
#'
#' ####################  GenderChineseName  ####################
#'
#' library(namsor)
#' var.chinese.name <- 'chinese.name_example' # character | 
#'
#' #Infer the likely gender of a Chinese full name ex. 王晓明
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$GenderChineseName(var.chinese.name)
#'
#'
#' ####################  GenderChineseNameBatch  ####################
#'
#' library(namsor)
#' var.batch.personal.name.in <- BatchPersonalNameIn$new() # BatchPersonalNameIn | A list of personal names, with a country ISO2 code
#'
#' #Infer the likely gender of up to 100 full names ex. 王晓明
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$GenderChineseNameBatch(batch.personal.name.in=var.batch.personal.name.in)
#'
#'
#' ####################  GenderChineseNamePinyin  ####################
#'
#' library(namsor)
#' var.chinese.surname.latin <- 'chinese.surname.latin_example' # character | 
#' var.chinese.given.name.latin <- 'chinese.given.name.latin_example' # character | 
#'
#' #Infer the likely gender of a Chinese name in LATIN (Pinyin).
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$GenderChineseNamePinyin(var.chinese.surname.latin, var.chinese.given.name.latin)
#'
#'
#' ####################  GenderChineseNamePinyinBatch  ####################
#'
#' library(namsor)
#' var.batch.first.last.name.in <- BatchFirstLastNameIn$new() # BatchFirstLastNameIn | A list of names, with country code.
#'
#' #Infer the likely gender of up to 100 Chinese names in LATIN (Pinyin).
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$GenderChineseNamePinyinBatch(batch.first.last.name.in=var.batch.first.last.name.in)
#'
#'
#' ####################  ParseChineseName  ####################
#'
#' library(namsor)
#' var.chinese.name <- 'chinese.name_example' # character | 
#'
#' #Infer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name)
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$ParseChineseName(var.chinese.name)
#'
#'
#' ####################  ParseChineseNameBatch  ####################
#'
#' library(namsor)
#' var.batch.personal.name.in <- BatchPersonalNameIn$new() # BatchPersonalNameIn | A list of personal names
#'
#' #Infer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name).
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$ParseChineseNameBatch(batch.personal.name.in=var.batch.personal.name.in)
#'
#'
#' ####################  PinyinChineseName  ####################
#'
#' library(namsor)
#' var.chinese.name <- 'chinese.name_example' # character | 
#'
#' #Romanize the Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name)
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$PinyinChineseName(var.chinese.name)
#'
#'
#' ####################  PinyinChineseNameBatch  ####################
#'
#' library(namsor)
#' var.batch.personal.name.in <- BatchPersonalNameIn$new() # BatchPersonalNameIn | A list of Chinese names
#'
#' #Romanize a list of Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name).
#' api.instance <- ChineseApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['X-API-KEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$PinyinChineseNameBatch(batch.personal.name.in=var.batch.personal.name.in)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
ChineseApi <- R6::R6Class(
  'ChineseApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    ChineseNameCandidates = function(chinese.surname.latin, chinese.given.name.latin, ...){
      apiResponse <- self$ChineseNameCandidatesWithHttpInfo(chinese.surname.latin, chinese.given.name.latin, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ChineseNameCandidatesWithHttpInfo = function(chinese.surname.latin, chinese.given.name.latin, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`chinese.surname.latin`)) {
        stop("Missing required parameter `chinese.surname.latin`.")
      }

      if (missing(`chinese.given.name.latin`)) {
        stop("Missing required parameter `chinese.given.name.latin`.")
      }

      urlPath <- "/api2/json/chineseNameCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin}"
      if (!missing(`chinese.surname.latin`)) {
        urlPath <- gsub(paste0("\\{", "chineseSurnameLatin", "\\}"), URLencode(as.character(`chinese.surname.latin`), reserved = TRUE), urlPath)
      }

      if (!missing(`chinese.given.name.latin`)) {
        urlPath <- gsub(paste0("\\{", "chineseGivenNameLatin", "\\}"), URLencode(as.character(`chinese.given.name.latin`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "RomanizedNameOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ChineseNameCandidatesBatch = function(batch.first.last.name.in=NULL, ...){
      apiResponse <- self$ChineseNameCandidatesBatchWithHttpInfo(batch.first.last.name.in, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ChineseNameCandidatesBatchWithHttpInfo = function(batch.first.last.name.in=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (!missing(`batch.first.last.name.in`)) {
        body <- `batch.first.last.name.in`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api2/json/chineseNameCandidatesBatch"
      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "BatchNameMatchCandidatesOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ChineseNameCandidatesGenderBatch = function(batch.first.last.name.in=NULL, ...){
      apiResponse <- self$ChineseNameCandidatesGenderBatchWithHttpInfo(batch.first.last.name.in, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ChineseNameCandidatesGenderBatchWithHttpInfo = function(batch.first.last.name.in=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (!missing(`batch.first.last.name.in`)) {
        body <- `batch.first.last.name.in`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api2/json/chineseNameCandidatesGenderBatch"
      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "BatchNameMatchCandidatesOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ChineseNameGenderCandidates = function(chinese.surname.latin, chinese.given.name.latin, known.gender, ...){
      apiResponse <- self$ChineseNameGenderCandidatesWithHttpInfo(chinese.surname.latin, chinese.given.name.latin, known.gender, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ChineseNameGenderCandidatesWithHttpInfo = function(chinese.surname.latin, chinese.given.name.latin, known.gender, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`chinese.surname.latin`)) {
        stop("Missing required parameter `chinese.surname.latin`.")
      }

      if (missing(`chinese.given.name.latin`)) {
        stop("Missing required parameter `chinese.given.name.latin`.")
      }

      if (missing(`known.gender`)) {
        stop("Missing required parameter `known.gender`.")
      }

      urlPath <- "/api2/json/chineseNameGenderCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin}/{knownGender}"
      if (!missing(`chinese.surname.latin`)) {
        urlPath <- gsub(paste0("\\{", "chineseSurnameLatin", "\\}"), URLencode(as.character(`chinese.surname.latin`), reserved = TRUE), urlPath)
      }

      if (!missing(`chinese.given.name.latin`)) {
        urlPath <- gsub(paste0("\\{", "chineseGivenNameLatin", "\\}"), URLencode(as.character(`chinese.given.name.latin`), reserved = TRUE), urlPath)
      }

      if (!missing(`known.gender`)) {
        urlPath <- gsub(paste0("\\{", "knownGender", "\\}"), URLencode(as.character(`known.gender`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "RomanizedNameOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ChineseNameMatch = function(chinese.surname.latin, chinese.given.name.latin, chinese.name, ...){
      apiResponse <- self$ChineseNameMatchWithHttpInfo(chinese.surname.latin, chinese.given.name.latin, chinese.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ChineseNameMatchWithHttpInfo = function(chinese.surname.latin, chinese.given.name.latin, chinese.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`chinese.surname.latin`)) {
        stop("Missing required parameter `chinese.surname.latin`.")
      }

      if (missing(`chinese.given.name.latin`)) {
        stop("Missing required parameter `chinese.given.name.latin`.")
      }

      if (missing(`chinese.name`)) {
        stop("Missing required parameter `chinese.name`.")
      }

      urlPath <- "/api2/json/chineseNameMatch/{chineseSurnameLatin}/{chineseGivenNameLatin}/{chineseName}"
      if (!missing(`chinese.surname.latin`)) {
        urlPath <- gsub(paste0("\\{", "chineseSurnameLatin", "\\}"), URLencode(as.character(`chinese.surname.latin`), reserved = TRUE), urlPath)
      }

      if (!missing(`chinese.given.name.latin`)) {
        urlPath <- gsub(paste0("\\{", "chineseGivenNameLatin", "\\}"), URLencode(as.character(`chinese.given.name.latin`), reserved = TRUE), urlPath)
      }

      if (!missing(`chinese.name`)) {
        urlPath <- gsub(paste0("\\{", "chineseName", "\\}"), URLencode(as.character(`chinese.name`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "RomanizedNameOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ChineseNameMatchBatch = function(batch.first.last.name.in=NULL, ...){
      apiResponse <- self$ChineseNameMatchBatchWithHttpInfo(batch.first.last.name.in, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ChineseNameMatchBatchWithHttpInfo = function(batch.first.last.name.in=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (!missing(`batch.first.last.name.in`)) {
        body <- `batch.first.last.name.in`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api2/json/chineseNameMatchBatch"
      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "BatchNameMatchCandidatesOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    GenderChineseName = function(chinese.name, ...){
      apiResponse <- self$GenderChineseNameWithHttpInfo(chinese.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GenderChineseNameWithHttpInfo = function(chinese.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`chinese.name`)) {
        stop("Missing required parameter `chinese.name`.")
      }

      urlPath <- "/api2/json/genderChineseName/{chineseName}"
      if (!missing(`chinese.name`)) {
        urlPath <- gsub(paste0("\\{", "chineseName", "\\}"), URLencode(as.character(`chinese.name`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "PersonalNameGenderedOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    GenderChineseNameBatch = function(batch.personal.name.in=NULL, ...){
      apiResponse <- self$GenderChineseNameBatchWithHttpInfo(batch.personal.name.in, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GenderChineseNameBatchWithHttpInfo = function(batch.personal.name.in=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (!missing(`batch.personal.name.in`)) {
        body <- `batch.personal.name.in`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api2/json/genderChineseNameBatch"
      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "BatchPersonalNameGenderedOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    GenderChineseNamePinyin = function(chinese.surname.latin, chinese.given.name.latin, ...){
      apiResponse <- self$GenderChineseNamePinyinWithHttpInfo(chinese.surname.latin, chinese.given.name.latin, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GenderChineseNamePinyinWithHttpInfo = function(chinese.surname.latin, chinese.given.name.latin, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`chinese.surname.latin`)) {
        stop("Missing required parameter `chinese.surname.latin`.")
      }

      if (missing(`chinese.given.name.latin`)) {
        stop("Missing required parameter `chinese.given.name.latin`.")
      }

      urlPath <- "/api2/json/genderChineseNamePinyin/{chineseSurnameLatin}/{chineseGivenNameLatin}"
      if (!missing(`chinese.surname.latin`)) {
        urlPath <- gsub(paste0("\\{", "chineseSurnameLatin", "\\}"), URLencode(as.character(`chinese.surname.latin`), reserved = TRUE), urlPath)
      }

      if (!missing(`chinese.given.name.latin`)) {
        urlPath <- gsub(paste0("\\{", "chineseGivenNameLatin", "\\}"), URLencode(as.character(`chinese.given.name.latin`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "FirstLastNameGenderedOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    GenderChineseNamePinyinBatch = function(batch.first.last.name.in=NULL, ...){
      apiResponse <- self$GenderChineseNamePinyinBatchWithHttpInfo(batch.first.last.name.in, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GenderChineseNamePinyinBatchWithHttpInfo = function(batch.first.last.name.in=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (!missing(`batch.first.last.name.in`)) {
        body <- `batch.first.last.name.in`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api2/json/genderChineseNamePinyinBatch"
      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "BatchFirstLastNameGenderedOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ParseChineseName = function(chinese.name, ...){
      apiResponse <- self$ParseChineseNameWithHttpInfo(chinese.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ParseChineseNameWithHttpInfo = function(chinese.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`chinese.name`)) {
        stop("Missing required parameter `chinese.name`.")
      }

      urlPath <- "/api2/json/parseChineseName/{chineseName}"
      if (!missing(`chinese.name`)) {
        urlPath <- gsub(paste0("\\{", "chineseName", "\\}"), URLencode(as.character(`chinese.name`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "PersonalNameParsedOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ParseChineseNameBatch = function(batch.personal.name.in=NULL, ...){
      apiResponse <- self$ParseChineseNameBatchWithHttpInfo(batch.personal.name.in, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ParseChineseNameBatchWithHttpInfo = function(batch.personal.name.in=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (!missing(`batch.personal.name.in`)) {
        body <- `batch.personal.name.in`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api2/json/parseChineseNameBatch"
      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "BatchPersonalNameParsedOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    PinyinChineseName = function(chinese.name, ...){
      apiResponse <- self$PinyinChineseNameWithHttpInfo(chinese.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    PinyinChineseNameWithHttpInfo = function(chinese.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`chinese.name`)) {
        stop("Missing required parameter `chinese.name`.")
      }

      urlPath <- "/api2/json/pinyinChineseName/{chineseName}"
      if (!missing(`chinese.name`)) {
        urlPath <- gsub(paste0("\\{", "chineseName", "\\}"), URLencode(as.character(`chinese.name`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "PersonalNameParsedOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    PinyinChineseNameBatch = function(batch.personal.name.in=NULL, ...){
      apiResponse <- self$PinyinChineseNameBatchWithHttpInfo(batch.personal.name.in, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    PinyinChineseNameBatchWithHttpInfo = function(batch.personal.name.in=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (!missing(`batch.personal.name.in`)) {
        body <- `batch.personal.name.in`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api2/json/pinyinChineseNameBatch"
      # API key authentication
      if ("X-API-KEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-API-KEY"]) > 0) {
        headerParams['X-API-KEY'] <- paste(unlist(self$apiClient$apiKeys["X-API-KEY"]), collapse='')
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "BatchPersonalNameParsedOut", loadNamespace("namsor")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    }
  )
)
namsor/namsor-r-sdk2 documentation built on March 15, 2021, 7:12 p.m.