R/first_last_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 FirstLastNameOut
#' @description FirstLastNameOut Class
#' @format An \code{R6Class} generator object
#' @field id  character [optional]
#'
#' @field firstName  character [optional]
#'
#' @field lastName  character [optional]
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
FirstLastNameOut <- R6::R6Class(
  'FirstLastNameOut',
  public = list(
    `id` = NULL,
    `firstName` = NULL,
    `lastName` = NULL,
    initialize = function(`id`=NULL, `firstName`=NULL, `lastName`=NULL, ...){
      local.optional.var <- list(...)
      if (!is.null(`id`)) {
        stopifnot(is.character(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!is.null(`firstName`)) {
        stopifnot(is.character(`firstName`), length(`firstName`) == 1)
        self$`firstName` <- `firstName`
      }
      if (!is.null(`lastName`)) {
        stopifnot(is.character(`lastName`), length(`lastName`) == 1)
        self$`lastName` <- `lastName`
      }
    },
    toJSON = function() {
      FirstLastNameOutObject <- list()
      if (!is.null(self$`id`)) {
        FirstLastNameOutObject[['id']] <-
          self$`id`
      }
      if (!is.null(self$`firstName`)) {
        FirstLastNameOutObject[['firstName']] <-
          self$`firstName`
      }
      if (!is.null(self$`lastName`)) {
        FirstLastNameOutObject[['lastName']] <-
          self$`lastName`
      }

      FirstLastNameOutObject
    },
    fromJSON = function(FirstLastNameOutJson) {
      FirstLastNameOutObject <- jsonlite::fromJSON(FirstLastNameOutJson)
      if (!is.null(FirstLastNameOutObject$`id`)) {
        self$`id` <- FirstLastNameOutObject$`id`
      }
      if (!is.null(FirstLastNameOutObject$`firstName`)) {
        self$`firstName` <- FirstLastNameOutObject$`firstName`
      }
      if (!is.null(FirstLastNameOutObject$`lastName`)) {
        self$`lastName` <- FirstLastNameOutObject$`lastName`
      }
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`id`)) {
        sprintf(
        '"id":
          "%s"
                ',
        self$`id`
        )},
        if (!is.null(self$`firstName`)) {
        sprintf(
        '"firstName":
          "%s"
                ',
        self$`firstName`
        )},
        if (!is.null(self$`lastName`)) {
        sprintf(
        '"lastName":
          "%s"
                ',
        self$`lastName`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(FirstLastNameOutJson) {
      FirstLastNameOutObject <- jsonlite::fromJSON(FirstLastNameOutJson)
      self$`id` <- FirstLastNameOutObject$`id`
      self$`firstName` <- FirstLastNameOutObject$`firstName`
      self$`lastName` <- FirstLastNameOutObject$`lastName`
      self
    }
  )
)
namsor/namsor-r-sdk2 documentation built on March 15, 2021, 7:12 p.m.